0021338: EDF 1926 SMESH: New controls and filters

Call myPredicate->SetMesh( GetMesh() ) in order to let him update
   his data according to a changed mesh
This commit is contained in:
eap 2012-01-26 15:32:57 +00:00
parent 1ffe72da8d
commit 2d179048e3

View File

@ -149,6 +149,7 @@ void SMESHDS_GroupOnFilter::update() const
me->myElements.clear(); me->myElements.clear();
if ( myPredicate ) if ( myPredicate )
{ {
myPredicate->SetMesh( GetMesh() ); // hope myPredicate updates self here if necessary
me->myElements.reserve( GetMesh()->GetMeshInfo().NbElements(GetType())); me->myElements.reserve( GetMesh()->GetMeshInfo().NbElements(GetType()));
SMDS_ElemIteratorPtr elIt = GetMesh()->elementsIterator(GetType()); SMDS_ElemIteratorPtr elIt = GetMesh()->elementsIterator(GetType());
while ( elIt->more() ) while ( elIt->more() )
@ -157,7 +158,8 @@ void SMESHDS_GroupOnFilter::update() const
if ( myPredicate->IsSatisfy( e->GetID() )) if ( myPredicate->IsSatisfy( e->GetID() ))
me->myElements.push_back( e ); me->myElements.push_back( e );
} }
me->myElements.resize( myElements.size() ); vector< const SMDS_MeshElement*> elems( me->myElements.begin(), me->myElements.end() );
me->myElements.swap( elems );
} }
me->setChanged( false ); me->setChanged( false );
} }