]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
bos #29143 [CEA] Compute takes too much time in polyhedron per solid use case V9_9_0a1
authoreap <eap@opencascade.com>
Mon, 28 Feb 2022 11:38:20 +0000 (14:38 +0300)
committereap <eap@opencascade.com>
Mon, 28 Feb 2022 11:38:20 +0000 (14:38 +0300)
more optimization: don't try to find more local algos if uniDimAlgoShapes is empty

src/SMESH/SMESH_Gen.cxx
src/SMESH/SMESH_Homard.hxx

index db001028789710aff4f59f4f8eef3f4a804ef951..02d5a217e18a283ddb9f9bf81b933d8768f3655f 100644 (file)
@@ -248,7 +248,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh &                aMesh,
     // ================================================================
     // Apply algos that do NOT require discreteized boundaries
     // ("all-dimensional") and do NOT support sub-meshes, starting from
-    // the most complex shapes and collect sub-meshes with algos that 
+    // the most complex shapes and collect sub-meshes with algos that
     // DO support sub-meshes
     // ================================================================
 
@@ -273,7 +273,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh &                aMesh,
       const TopoDS_Shape& aSubShape = smToCompute->GetSubShape();
       aShapeDim = GetShapeDim( aSubShape );
       if ( aShapeDim < 1 ) break;
-      
+
       // check for preview dimension limitations
       if ( aShapesId && aShapeDim > (int)aDim )
         continue;
@@ -390,47 +390,50 @@ bool SMESH_Gen::Compute(SMESH_Mesh &                aMesh,
 
         const TopAbs_ShapeEnum shapeType = sm->GetSubShape().ShapeType();
 
-        // get a shape the algo is assigned to
-        if ( !GetAlgo( sm, & algoShape ))
-          continue; // strange...
+        if ( !uniDimAlgoShapes.IsEmpty() )
+        {
+          // get a shape the algo is assigned to
+          if ( !GetAlgo( sm, & algoShape ))
+            continue; // strange...
 
-        // look for more local algos
-        if ( SMESH_subMesh* algoSM = aMesh.GetSubMesh( algoShape ))
-          smIt = algoSM->getDependsOnIterator(!includeSelf, !complexShapeFirst);
-        else
-          smIt = sm->getDependsOnIterator(!includeSelf, !complexShapeFirst);
+          // look for more local algos
+          if ( SMESH_subMesh* algoSM = aMesh.GetSubMesh( algoShape ))
+            smIt = algoSM->getDependsOnIterator(!includeSelf, !complexShapeFirst);
+          else
+            smIt = sm->getDependsOnIterator(!includeSelf, !complexShapeFirst);
 
-        while ( smIt->more() )
-        {
-          SMESH_subMesh* smToCompute = smIt->next();
+          while ( smIt->more() )
+          {
+            SMESH_subMesh* smToCompute = smIt->next();
 
-          const TopoDS_Shape& aSubShape = smToCompute->GetSubShape();
-          const           int aShapeDim = GetShapeDim( aSubShape );
-          if ( aShapeDim < 1 || aSubShape.ShapeType() <= shapeType )
-            continue;
-          if ( !uniDimAlgoShapes.Contains( aSubShape ))
-            continue; // [bos #29143] aMesh.GetHypothesis() is too long
+            const TopoDS_Shape& aSubShape = smToCompute->GetSubShape();
+            const           int aShapeDim = GetShapeDim( aSubShape );
+            if ( aShapeDim < 1 || aSubShape.ShapeType() <= shapeType )
+              continue;
+            if ( !uniDimAlgoShapes.Contains( aSubShape ))
+              continue; // [bos #29143] aMesh.GetHypothesis() is too long
 
-          // check for preview dimension limitations
-          if ( aShapesId && GetShapeDim( aSubShape.ShapeType() ) > (int)aDim )
-            continue;
+            // check for preview dimension limitations
+            if ( aShapesId && GetShapeDim( aSubShape.ShapeType() ) > (int)aDim )
+              continue;
 
-          SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
-          filter
-            .And( SMESH_HypoFilter::IsApplicableTo( aSubShape ))
-            .And( SMESH_HypoFilter::IsMoreLocalThan( algoShape, aMesh ));
+            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( smToCompute, filter, true))
-          {
-            if ( ! subAlgo->NeedDiscreteBoundary() ) continue;
-            TopTools_IndexedMapOfShape* localAllowed = allowedSubShapes;
-            if ( localAllowed && localAllowed->IsEmpty() )
-              localAllowed = 0; // prevent fillAllowed() with  aSubShape
-
-            SMESH_Hypothesis::Hypothesis_Status status;
-            if ( subAlgo->CheckHypothesis( aMesh, aSubShape, status ))
-              // mesh a lower smToCompute starting from vertices
-              Compute( aMesh, aSubShape, aFlags | SHAPE_ONLY_UPWARD, aDim, aShapesId, localAllowed );
+            if ( SMESH_Algo* subAlgo = (SMESH_Algo*) aMesh.GetHypothesis( smToCompute, filter, true))
+            {
+              if ( ! subAlgo->NeedDiscreteBoundary() ) continue;
+              TopTools_IndexedMapOfShape* localAllowed = allowedSubShapes;
+              if ( localAllowed && localAllowed->IsEmpty() )
+                localAllowed = 0; // prevent fillAllowed() with  aSubShape
+
+              SMESH_Hypothesis::Hypothesis_Status status;
+              if ( subAlgo->CheckHypothesis( aMesh, aSubShape, status ))
+                // mesh a lower smToCompute starting from vertices
+                Compute( aMesh, aSubShape, aFlags | SHAPE_ONLY_UPWARD, aDim, aShapesId, localAllowed );
+            }
           }
         }
         // --------------------------------
index 9d2b7dc0783afeac255333371113d3643d8d7acd..5fce29bb8ec09a9ead57949beb0404d3e5507ce8 100644 (file)
@@ -237,6 +237,6 @@ private:
   int                           _MessInfo;
 };
 
-}; // namespace SMESHHOMARDImpl
+} // namespace SMESHHOMARDImpl
 
 #endif