+ // 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 )
+ {
+ // find max dimension of an assigned algo
+ TopAbs_ShapeEnum algoShape = TopAbs_SHAPE;
+ const std::list <const SMESHDS_Hypothesis * >& hyps = aMesh->GetHypothesisList( aShape );
+ std::list <const SMESHDS_Hypothesis * >::const_iterator hypIt = hyps.begin();
+ for ( ; hypIt != hyps.end(); ++hypIt )
+ if ( const SMESH_Algo* algo = dynamic_cast< const SMESH_Algo* >( *hypIt ))
+ switch ( algo->GetDim() ) {
+ case 1: algoShape = TopAbs_EDGE; break;
+ case 2: algoShape = TopAbs_FACE; break;
+ case 3: algoShape = TopAbs_SOLID; break;
+ case 0: algoShape = TopAbs_VERTEX; break;
+ }
+ if ( algoShape != TopAbs_SHAPE )
+ {
+ // return all sub-meshes on this dimension
+ SMESH_subMeshIteratorPtr smIt = theSubMesh->getDependsOnIterator(/*includeSelf=*/false);
+ 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 )))