This commit is contained in:
rnv 2022-03-11 12:33:57 +03:00
commit 8385b9256f
3 changed files with 97 additions and 40 deletions

View File

@ -39,11 +39,12 @@
#include "SMESH_MesherHelper.hxx" #include "SMESH_MesherHelper.hxx"
#include "SMESH_subMesh.hxx" #include "SMESH_subMesh.hxx"
#include "utilities.h" #include <utilities.h>
#include "Utils_ExceptHandlers.hxx" #include <Utils_ExceptHandlers.hxx>
#include <TopoDS_Iterator.hxx> #include <TopExp_Explorer.hxx>
#include <TopoDS.hxx> #include <TopoDS.hxx>
#include <TopoDS_Iterator.hxx>
#include "memoire.h" #include "memoire.h"
@ -340,6 +341,36 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
smVec.insert( smVec.end(), smVec.insert( smVec.end(),
smWithAlgoSupportingSubmeshes[aShapeDim].begin(), smWithAlgoSupportingSubmeshes[aShapeDim].begin(),
smWithAlgoSupportingSubmeshes[aShapeDim].end() ); 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 // sort list of sub-meshes according to mesh order
@ -359,6 +390,8 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
const TopAbs_ShapeEnum shapeType = sm->GetSubShape().ShapeType(); const TopAbs_ShapeEnum shapeType = sm->GetSubShape().ShapeType();
if ( !uniDimAlgoShapes.IsEmpty() )
{
// get a shape the algo is assigned to // get a shape the algo is assigned to
if ( !GetAlgo( sm, & algoShape )) if ( !GetAlgo( sm, & algoShape ))
continue; // strange... continue; // strange...
@ -377,6 +410,8 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
const int aShapeDim = GetShapeDim( aSubShape ); const int aShapeDim = GetShapeDim( aSubShape );
if ( aShapeDim < 1 || aSubShape.ShapeType() <= shapeType ) if ( aShapeDim < 1 || aSubShape.ShapeType() <= shapeType )
continue; continue;
if ( !uniDimAlgoShapes.Contains( aSubShape ))
continue; // [bos #29143] aMesh.GetHypothesis() is too long
// check for preview dimension limitations // check for preview dimension limitations
if ( aShapesId && GetShapeDim( aSubShape.ShapeType() ) > (int)aDim ) if ( aShapesId && GetShapeDim( aSubShape.ShapeType() ) > (int)aDim )
@ -400,6 +435,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
Compute( aMesh, aSubShape, aFlags | SHAPE_ONLY_UPWARD, aDim, aShapesId, localAllowed ); Compute( aMesh, aSubShape, aFlags | SHAPE_ONLY_UPWARD, aDim, aShapesId, localAllowed );
} }
} }
}
// -------------------------------- // --------------------------------
// apply the all-dimensional algo // apply the all-dimensional algo
// -------------------------------- // --------------------------------
@ -1222,6 +1258,26 @@ int SMESH_Gen::GetShapeDim(const TopAbs_ShapeEnum & aShapeType)
return dim[ 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 * Generate a new id unique within this Gen

View File

@ -154,6 +154,7 @@ public:
static int GetShapeDim(const TopAbs_ShapeEnum & aShapeType); static int GetShapeDim(const TopAbs_ShapeEnum & aShapeType);
static int GetShapeDim(const TopoDS_Shape & aShape) static int GetShapeDim(const TopoDS_Shape & aShape)
{ return GetShapeDim( aShape.ShapeType() ); } { 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_Mesh & aMesh, const TopoDS_Shape & aShape, TopoDS_Shape* assignedTo=0);
SMESH_Algo* GetAlgo(SMESH_subMesh * aSubMesh, TopoDS_Shape* assignedTo=0); SMESH_Algo* GetAlgo(SMESH_subMesh * aSubMesh, TopoDS_Shape* assignedTo=0);

View File

@ -237,6 +237,6 @@ private:
int _MessInfo; int _MessInfo;
}; };
}; // namespace SMESHHOMARDImpl } // namespace SMESHHOMARDImpl
#endif #endif