+ // ------------------------------------------------------------
+ // sort list of meshes according to mesh order
+ // ------------------------------------------------------------
+ aMesh.SortByMeshOrder( smWithAlgoSupportingSubmeshes );
+
+ // ------------------------------------------------------------
+ // compute submeshes under shapes with algos that DO NOT require
+ // Discreteized boundaries and DO support submeshes
+ // ------------------------------------------------------------
+ list< SMESH_subMesh* >::iterator subIt, subEnd;
+ subIt = smWithAlgoSupportingSubmeshes.begin();
+ subEnd = smWithAlgoSupportingSubmeshes.end();
+ // start from lower shapes
+ for ( ; subIt != subEnd; ++subIt ) {
+ sm = *subIt;
+
+ // get a shape the algo is assigned to
+ TopoDS_Shape algoShape;
+ if ( !GetAlgo( aMesh, sm->GetSubShape(), & algoShape ))
+ continue; // strange...
+
+ // look for more local algos
+ smIt = sm->getDependsOnIterator(!includeSelf, !complexShapeFirst);
+ while ( smIt->more() ) {
+ SMESH_subMesh* smToCompute = smIt->next();
+
+ const TopoDS_Shape& aSubShape = smToCompute->GetSubShape();
+ const int aShapeDim = GetShapeDim( aSubShape );
+ if ( aShapeDim < 1 ) continue;
+
+ //const TopAbs_ShapeEnum aShType = smToCompute->GetSubShape().ShapeType();
+
+ SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
+ filter
+ .And( SMESH_HypoFilter::IsApplicableTo( aSubShape ))
+ .And( SMESH_HypoFilter::IsMoreLocalThan( algoShape, aMesh ));
+
+ if ( SMESH_Algo* subAlgo = (SMESH_Algo*) aMesh.GetHypothesis( aSubShape, filter, true )) {
+ SMESH_Hypothesis::Hypothesis_Status status;
+ if ( subAlgo->CheckHypothesis( aMesh, aSubShape, status ))
+ // mesh a lower smToCompute starting from vertices
+ Evaluate( aMesh, aSubShape, aResMap, /*anUpward=*/true, aShapesId );
+ }
+ }
+ }
+ // ----------------------------------------------------------
+ // apply the algos that do not require Discreteized boundaries
+ // ----------------------------------------------------------
+ for ( subIt = smWithAlgoSupportingSubmeshes.begin(); subIt != subEnd; ++subIt )
+ {
+ sm = *subIt;
+ sm->Evaluate(aResMap);
+ if ( aShapesId )
+ aShapesId->insert( sm->GetId() );
+ }
+
+ // -----------------------------------------------
+ // mesh the rest sub-shapes starting from vertices
+ // -----------------------------------------------
+ ret = Evaluate( aMesh, aShape, aResMap, /*anUpward=*/true, aShapesId );
+ }
+
+ MESSAGE( "VSR - SMESH_Gen::Evaluate() finished, OK = " << ret);