-// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// ================================================================
// 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
// ================================================================
const TopoDS_Shape& aSubShape = smToCompute->GetSubShape();
aShapeDim = GetShapeDim( aSubShape );
if ( aShapeDim < 1 ) break;
-
+
// check for preview dimension limitations
if ( aShapesId && aShapeDim > (int)aDim )
continue;
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
// ======================================================
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
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 );
+ }
}
}
// --------------------------------