X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH%2FSMESH_Gen.cxx;h=02d5a217e18a283ddb9f9bf81b933d8768f3655f;hb=a9219e5f12182c6fa74f609710408281585f4ef1;hp=06c47d8c0fca9b6bea14a4eff85ba4aa9df4865e;hpb=4a9dc0d21027467f5b6331017afd45504b293207;p=modules%2Fsmesh.git diff --git a/src/SMESH/SMESH_Gen.cxx b/src/SMESH/SMESH_Gen.cxx index 06c47d8c0..02d5a217e 100644 --- a/src/SMESH/SMESH_Gen.cxx +++ b/src/SMESH/SMESH_Gen.cxx @@ -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; @@ -332,32 +332,6 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, else smWithAlgoSupportingSubmeshes[0].push_front( shDim2smIt->second ); - // gather sub-shapes with local uni-dimensional algos (bos #29143) - // ---------------------------------------------------------------- - TopTools_MapOfShape uniDimAlgoShapes; - ShapeToHypothesis::Iterator s2hyps( aMesh.GetMeshDS()->GetHypotheses() ); - for ( ; s2hyps.More(); s2hyps.Next() ) - { - const TopoDS_Shape& s = s2hyps.Key(); - if ( s.IsSame( aMesh.GetShapeToMesh() )) - continue; - for ( auto & hyp : s2hyps.Value() ) - { - if ( const SMESH_Algo* algo = dynamic_cast< const SMESH_Algo*>( hyp )) - if ( algo->NeedDiscreteBoundary() ) - { - TopAbs_ShapeEnum sType; - switch ( algo->GetDim() ) { - case 3: sType = TopAbs_SOLID; break; - case 2: sType = TopAbs_FACE; break; - default: sType = TopAbs_EDGE; break; - } - for ( TopExp_Explorer ex( s2hyps.Key(), sType ); ex.More(); ex.Next() ) - uniDimAlgoShapes.Add( ex.Current() ); - } - } - } - // ====================================================== // Apply all-dimensional algorithms supporing sub-meshes // ====================================================== @@ -367,6 +341,36 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, smVec.insert( smVec.end(), smWithAlgoSupportingSubmeshes[aShapeDim].begin(), smWithAlgoSupportingSubmeshes[aShapeDim].end() ); + + // gather sub-shapes with local uni-dimensional algos (bos #29143) + // ---------------------------------------------------------------- + TopTools_MapOfShape uniDimAlgoShapes; + if ( !smVec.empty() ) + { + ShapeToHypothesis::Iterator s2hyps( aMesh.GetMeshDS()->GetHypotheses() ); + for ( ; s2hyps.More(); s2hyps.Next() ) + { + const TopoDS_Shape& s = s2hyps.Key(); + if ( s.IsSame( aMesh.GetShapeToMesh() )) + continue; + for ( auto & hyp : s2hyps.Value() ) + { + if ( const SMESH_Algo* algo = dynamic_cast< const SMESH_Algo*>( hyp )) + if ( algo->NeedDiscreteBoundary() ) + { + TopAbs_ShapeEnum sType; + switch ( algo->GetDim() ) { + case 3: sType = TopAbs_SOLID; break; + case 2: sType = TopAbs_FACE; break; + default: sType = TopAbs_EDGE; break; + } + for ( TopExp_Explorer ex( s2hyps.Key(), sType ); ex.More(); ex.Next() ) + uniDimAlgoShapes.Add( ex.Current() ); + } + } + } + } + { // ------------------------------------------------ // sort list of sub-meshes according to mesh order @@ -386,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 ); + } } } // --------------------------------