diff --git a/src/SMESH/SMESH_Gen.cxx b/src/SMESH/SMESH_Gen.cxx index db4fe2136..06c47d8c0 100644 --- a/src/SMESH/SMESH_Gen.cxx +++ b/src/SMESH/SMESH_Gen.cxx @@ -39,11 +39,12 @@ #include "SMESH_MesherHelper.hxx" #include "SMESH_subMesh.hxx" -#include "utilities.h" -#include "Utils_ExceptHandlers.hxx" +#include +#include -#include +#include #include +#include #include "memoire.h" @@ -331,6 +332,32 @@ 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 // ====================================================== @@ -374,9 +401,11 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, SMESH_subMesh* smToCompute = smIt->next(); const TopoDS_Shape& aSubShape = smToCompute->GetSubShape(); - const int aShapeDim = GetShapeDim( aSubShape ); + 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 ) @@ -1222,6 +1251,26 @@ int SMESH_Gen::GetShapeDim(const TopAbs_ShapeEnum & aShapeType) return dim[ aShapeType ]; } +//================================================================================ +/*! + * \brief Return shape dimension by exploding compounds + */ +//================================================================================ + +int SMESH_Gen::GetFlatShapeDim(const TopoDS_Shape &aShape) +{ + int aShapeDim; + if ( aShape.ShapeType() == TopAbs_COMPOUND || + aShape.ShapeType() == TopAbs_COMPSOLID ) + { + TopoDS_Iterator it( aShape ); + aShapeDim = GetFlatShapeDim( it.Value() ); + } + else + aShapeDim = GetShapeDim( aShape ); + return aShapeDim; +} + //============================================================================= /*! * Generate a new id unique within this Gen diff --git a/src/SMESH/SMESH_Gen.hxx b/src/SMESH/SMESH_Gen.hxx index d2dd8271c..5c05f3bfa 100644 --- a/src/SMESH/SMESH_Gen.hxx +++ b/src/SMESH/SMESH_Gen.hxx @@ -154,6 +154,7 @@ public: static int GetShapeDim(const TopAbs_ShapeEnum & aShapeType); static int GetShapeDim(const TopoDS_Shape & aShape) { return GetShapeDim( aShape.ShapeType() ); } + static int GetFlatShapeDim(const TopoDS_Shape &aShape); SMESH_Algo* GetAlgo(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, TopoDS_Shape* assignedTo=0); SMESH_Algo* GetAlgo(SMESH_subMesh * aSubMesh, TopoDS_Shape* assignedTo=0);