+ // on father sub-meshes, check presence of an algo which will mesh this sub-mesh
+ // even if no algo is assigned to this sub-mesh
+ bool topAlgoPresent = false;
+ TopTools_ListIteratorOfListOfShape ancestors( aMesh->GetAncestors( aShape ));
+ for ( ; ancestors.More() && !topAlgoPresent; ancestors.Next() )
+ if (( sm = aMesh->GetSubMeshContaining( ancestors.Value() )))
+ topAlgoPresent = ( sm->GetAlgo() && !sm->GetAlgo()->NeedDiscreteBoundary() );
+
+ if ( !topAlgoPresent )
+ {
+ // look for a sub-mesh with an algo
+ SMESH_subMeshIteratorPtr smIt =
+ theSubMesh->getDependsOnIterator(/*includeSelf=*/false, /*complexShapeFirst=*/true);
+ TopAbs_ShapeEnum algoShape = TopAbs_SHAPE;
+ while ( smIt->more() && algoShape == TopAbs_SHAPE )
+ {
+ sm = smIt->next();
+ if ( sm->GetAlgo() )
+ algoShape = sm->GetSubShape().ShapeType();
+ }
+ if ( algoShape != TopAbs_SHAPE )
+ {
+ // return all sub-meshes on this shape type
+ smIt = theSubMesh->getDependsOnIterator(/*includeSelf=*/false, /*complexShapeFirst=*/true);
+ while ( smIt->more() )
+ {
+ sm = smIt->next();
+ if ( sm->GetSubShape().ShapeType() == algoShape && sm->GetSubMeshDS() )
+ theSubMeshList.push_back( sm->GetSubMeshDS() );
+ }
+ return size < theSubMeshList.size();
+ }
+ }
+ }
+
+ switch ( aShapeType )
+ {
+ case TopAbs_SOLID:
+ {
+ // add sub-mesh of solid itself
+ if (( aSubMeshDS = aMeshDS->MeshElements( aShape )))