+ if ( _father->NbNodes() == 0 ) return;
+
+ SMESH_subMeshIteratorPtr smIt = getDependsOnIterator(false,
+ /*complexShapeFirst=*/true);
+ if ( !keepSupportedsubMeshes )
+ {
+ while ( smIt->more() )
+ smIt->next()->ComputeStateEngine(CLEAN);
+ }
+ else
+ {
+ // find sub-meshes to keep elements on
+ set< SMESH_subMesh* > smToKeep;
+ SMESHDS_Mesh* meshDS = _father->GetMeshDS();
+ while ( smIt->more() )
+ {
+ SMESH_subMesh* sm = smIt->next();
+ if ( sm->IsEmpty() ) continue;
+
+ // look for an algo assigned to sm
+ bool algoFound = false;
+ const list<const SMESHDS_Hypothesis*>& hyps = meshDS->GetHypothesis( sm->_subShape );
+ list<const SMESHDS_Hypothesis*>::const_iterator h = hyps.begin();
+ for ( ; ( !algoFound && h != hyps.end() ); ++h )
+ algoFound = ((*h)->GetType() != SMESHDS_Hypothesis::PARAM_ALGO );
+
+ // remember all sub-meshes of sm
+ if ( algoFound )
+ {
+ SMESH_subMeshIteratorPtr smIt2 = getDependsOnIterator(false,true);
+ while ( smIt2->more() )
+ smToKeep.insert( smIt2->next() );
+ }
+ }
+ // remove elements
+ SMESH_subMeshIteratorPtr smIt = getDependsOnIterator(false,true);
+ while ( smIt->more() )
+ {
+ SMESH_subMesh* sm = smIt->next();
+ if ( !smToKeep.count( sm ))
+ sm->ComputeStateEngine(CLEAN);
+ }
+ }