mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-05 06:10:33 +05:00
In IsMoreLocalThanPredicate, take priority of sub-mehses into account
This commit is contained in:
parent
690b5f67ff
commit
1cae83f943
@ -304,7 +304,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
|
||||
SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
|
||||
filter
|
||||
.And( SMESH_HypoFilter::IsApplicableTo( aSubShape ))
|
||||
.And( SMESH_HypoFilter::IsMoreLocalThan( algoShape, aMesh.GetShapeToMesh() ));
|
||||
.And( SMESH_HypoFilter::IsMoreLocalThan( algoShape, aMesh ));
|
||||
|
||||
if ( SMESH_Algo* subAlgo = (SMESH_Algo*) aMesh.GetHypothesis( aSubShape, filter, true )) {
|
||||
SMESH_Hypothesis::Hypothesis_Status status;
|
||||
@ -516,7 +516,7 @@ bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh,
|
||||
SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
|
||||
filter
|
||||
.And( SMESH_HypoFilter::IsApplicableTo( aSubShape ))
|
||||
.And( SMESH_HypoFilter::IsMoreLocalThan( algoShape, aMesh.GetShapeToMesh() ));
|
||||
.And( SMESH_HypoFilter::IsMoreLocalThan( algoShape, aMesh ));
|
||||
|
||||
if ( SMESH_Algo* subAlgo = (SMESH_Algo*) aMesh.GetHypothesis( aSubShape, filter, true )) {
|
||||
SMESH_Hypothesis::Hypothesis_Status status;
|
||||
|
@ -121,6 +121,34 @@ bool SMESH_HypoFilter::IsAssignedToPredicate::IsOk(const SMESH_Hypothesis* aHyp,
|
||||
return ( !_mainShape.IsNull() && !aShape.IsNull() && _mainShape.IsSame( aShape ));
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Finds shapes preferable over _shape due to sub-mesh order
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
void SMESH_HypoFilter::IsMoreLocalThanPredicate::findPreferable()
|
||||
{
|
||||
const int shapeID = _mesh.GetMeshDS()->ShapeToIndex( _shape );
|
||||
const TListOfListOfInt& listOfShapeIDList = _mesh.GetMeshOrder();
|
||||
TListOfListOfInt::const_iterator listsIt = listOfShapeIDList.begin();
|
||||
for ( ; listsIt != listOfShapeIDList.end(); ++listsIt )
|
||||
{
|
||||
const TListOfInt& idList = *listsIt;
|
||||
TListOfInt::const_iterator idIt =
|
||||
std::find( idList.begin(), idList.end(), shapeID );
|
||||
if ( idIt != idList.end() && *idIt != idList.front() )
|
||||
{
|
||||
for ( ; idIt != idList.end(); --idIt )
|
||||
{
|
||||
const TopoDS_Shape& shape = _mesh.GetMeshDS()->IndexToShape( *idIt );
|
||||
if ( !shape.IsNull())
|
||||
_preferableShapes.Add( shape );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsMoreLocalThanPredicate::IsOk
|
||||
//purpose :
|
||||
@ -129,7 +157,7 @@ bool SMESH_HypoFilter::IsAssignedToPredicate::IsOk(const SMESH_Hypothesis* aHyp,
|
||||
bool SMESH_HypoFilter::IsMoreLocalThanPredicate::IsOk(const SMESH_Hypothesis* aHyp,
|
||||
const TopoDS_Shape& aShape) const
|
||||
{
|
||||
if ( aShape.IsSame( _shapeToMesh ))
|
||||
if ( aShape.IsSame( _mesh.GetShapeToMesh() ))
|
||||
return false; // aHyp is global
|
||||
|
||||
if ( SMESH_MesherHelper::IsSubShape( aShape, /*mainShape=*/_shape ))
|
||||
@ -144,6 +172,10 @@ bool SMESH_HypoFilter::IsMoreLocalThanPredicate::IsOk(const SMESH_Hypothesis* aH
|
||||
if ( SMESH_MesherHelper::IsSubShape( exp.Current(), /*mainShape=*/_shape ))
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( _preferableShapes.Contains( aShape ))
|
||||
return true; // issue 21559, Mesh_6
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -297,9 +329,9 @@ SMESH_HypoPredicate* SMESH_HypoFilter::IsApplicableTo(const TopoDS_Shape& theSha
|
||||
//=======================================================================
|
||||
|
||||
SMESH_HypoPredicate* SMESH_HypoFilter::IsMoreLocalThan(const TopoDS_Shape& theShape,
|
||||
const TopoDS_Shape& theShapeToMesh)
|
||||
const SMESH_Mesh& theMesh)
|
||||
{
|
||||
return new IsMoreLocalThanPredicate( theShape, theShapeToMesh);
|
||||
return new IsMoreLocalThanPredicate( theShape, theMesh );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@ -36,9 +36,11 @@
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
|
||||
class SMESH_HypoFilter;
|
||||
class SMESH_Hypothesis;
|
||||
class SMESH_Mesh;
|
||||
|
||||
class SMESH_EXPORT SMESH_HypoPredicate {
|
||||
public:
|
||||
@ -73,7 +75,7 @@ class SMESH_EXPORT SMESH_HypoFilter: public SMESH_HypoPredicate
|
||||
static SMESH_HypoPredicate* Is(const SMESH_Hypothesis* theHypo);
|
||||
static SMESH_HypoPredicate* IsGlobal(const TopoDS_Shape& theMainShape);
|
||||
static SMESH_HypoPredicate* IsMoreLocalThan(const TopoDS_Shape& theShape,
|
||||
const TopoDS_Shape& theShapeToMesh);
|
||||
const SMESH_Mesh& theMesh);
|
||||
static SMESH_HypoPredicate* HasName(const std::string & theName);
|
||||
static SMESH_HypoPredicate* HasDim(const int theDim);
|
||||
static SMESH_HypoPredicate* HasType(const int theHypType);
|
||||
@ -170,12 +172,15 @@ class SMESH_EXPORT SMESH_HypoFilter: public SMESH_HypoPredicate
|
||||
};
|
||||
|
||||
struct IsMoreLocalThanPredicate : public SMESH_HypoPredicate {
|
||||
TopoDS_Shape _shape, _shapeToMesh;
|
||||
TopoDS_Shape _shape;
|
||||
const SMESH_Mesh& _mesh;
|
||||
TopTools_MapOfShape _preferableShapes;
|
||||
IsMoreLocalThanPredicate( const TopoDS_Shape& shape,
|
||||
const TopoDS_Shape& shapeToMesh )
|
||||
:_shape(shape),_shapeToMesh(shapeToMesh){}
|
||||
const SMESH_Mesh& mesh )
|
||||
:_shape(shape),_mesh(mesh) { findPreferable(); }
|
||||
bool IsOk(const SMESH_Hypothesis* aHyp,
|
||||
const TopoDS_Shape& aShape) const;
|
||||
void findPreferable();
|
||||
};
|
||||
|
||||
struct IsAuxiliaryPredicate : public SMESH_HypoPredicate {
|
||||
|
Loading…
Reference in New Issue
Block a user