mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-28 09:30:34 +05:00
52457: Addition of hypotheses is 8 time longer than meshing.
More optimization
This commit is contained in:
parent
80a2161a03
commit
f1013bf724
File diff suppressed because it is too large
Load Diff
@ -774,7 +774,7 @@ protected:
|
|||||||
bool registerElement(int ID, SMDS_MeshElement * element);
|
bool registerElement(int ID, SMDS_MeshElement * element);
|
||||||
|
|
||||||
void addChildrenWithNodes(std::set<const SMDS_MeshElement*>& setOfChildren,
|
void addChildrenWithNodes(std::set<const SMDS_MeshElement*>& setOfChildren,
|
||||||
const SMDS_MeshElement * element,
|
const SMDS_MeshElement * element,
|
||||||
std::set<const SMDS_MeshElement*>& nodes);
|
std::set<const SMDS_MeshElement*>& nodes);
|
||||||
|
|
||||||
inline void adjustmyCellsCapacity(int ID)
|
inline void adjustmyCellsCapacity(int ID)
|
||||||
@ -818,8 +818,8 @@ protected:
|
|||||||
//! SMDS_MeshCells refer to vtk cells (vtk id != index in myCells),store reference to this mesh, and sub-shape
|
//! SMDS_MeshCells refer to vtk cells (vtk id != index in myCells),store reference to this mesh, and sub-shape
|
||||||
SetOfCells myCells;
|
SetOfCells myCells;
|
||||||
|
|
||||||
//! for cells only: index = ID for SMDS users, value = ID in vtkUnstructuredGrid
|
//! a buffer to speed up elements addition by excluding some memory allocation
|
||||||
//std::vector<int> myCellIdSmdsToVtk;
|
std::vector<vtkIdType> myNodeIds;
|
||||||
|
|
||||||
//! for cells only: index = ID in vtkUnstructuredGrid, value = ID for SMDS users
|
//! for cells only: index = ID in vtkUnstructuredGrid, value = ID for SMDS users
|
||||||
std::vector<int> myCellIdVtkToSmds;
|
std::vector<int> myCellIdVtkToSmds;
|
||||||
|
@ -232,7 +232,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
|
|||||||
if ( aShapesId && aShapeDim > (int)aDim )
|
if ( aShapesId && aShapeDim > (int)aDim )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SMESH_Algo* algo = GetAlgo( aMesh, aSubShape, &algoShape );
|
SMESH_Algo* algo = GetAlgo( smToCompute, &algoShape );
|
||||||
if ( algo && !algo->NeedDiscreteBoundary() )
|
if ( algo && !algo->NeedDiscreteBoundary() )
|
||||||
{
|
{
|
||||||
if ( algo->SupportSubmeshes() )
|
if ( algo->SupportSubmeshes() )
|
||||||
@ -308,7 +308,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
|
|||||||
sm = smVec[i];
|
sm = smVec[i];
|
||||||
|
|
||||||
// get a shape the algo is assigned to
|
// get a shape the algo is assigned to
|
||||||
if ( !GetAlgo( aMesh, sm->GetSubShape(), & algoShape ))
|
if ( !GetAlgo( sm, & algoShape ))
|
||||||
continue; // strange...
|
continue; // strange...
|
||||||
|
|
||||||
// look for more local algos
|
// look for more local algos
|
||||||
@ -331,7 +331,8 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
|
|||||||
.And( SMESH_HypoFilter::IsApplicableTo( aSubShape ))
|
.And( SMESH_HypoFilter::IsApplicableTo( aSubShape ))
|
||||||
.And( SMESH_HypoFilter::IsMoreLocalThan( algoShape, aMesh ));
|
.And( SMESH_HypoFilter::IsMoreLocalThan( algoShape, aMesh ));
|
||||||
|
|
||||||
if ( SMESH_Algo* subAlgo = (SMESH_Algo*) aMesh.GetHypothesis( aSubShape, filter, true )) {
|
if ( SMESH_Algo* subAlgo = (SMESH_Algo*) aMesh.GetHypothesis( smToCompute, filter, true))
|
||||||
|
{
|
||||||
if ( ! subAlgo->NeedDiscreteBoundary() ) continue;
|
if ( ! subAlgo->NeedDiscreteBoundary() ) continue;
|
||||||
SMESH_Hypothesis::Hypothesis_Status status;
|
SMESH_Hypothesis::Hypothesis_Status status;
|
||||||
if ( subAlgo->CheckHypothesis( aMesh, aSubShape, status ))
|
if ( subAlgo->CheckHypothesis( aMesh, aSubShape, status ))
|
||||||
@ -477,7 +478,7 @@ bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh,
|
|||||||
const int aShapeDim = GetShapeDim( aSubShape );
|
const int aShapeDim = GetShapeDim( aSubShape );
|
||||||
if ( aShapeDim < 1 ) break;
|
if ( aShapeDim < 1 ) break;
|
||||||
|
|
||||||
SMESH_Algo* algo = GetAlgo( aMesh, aSubShape );
|
SMESH_Algo* algo = GetAlgo( smToCompute );
|
||||||
if ( algo && !algo->NeedDiscreteBoundary() ) {
|
if ( algo && !algo->NeedDiscreteBoundary() ) {
|
||||||
if ( algo->SupportSubmeshes() ) {
|
if ( algo->SupportSubmeshes() ) {
|
||||||
smWithAlgoSupportingSubmeshes.push_front( smToCompute );
|
smWithAlgoSupportingSubmeshes.push_front( smToCompute );
|
||||||
@ -508,7 +509,7 @@ bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh,
|
|||||||
|
|
||||||
// get a shape the algo is assigned to
|
// get a shape the algo is assigned to
|
||||||
TopoDS_Shape algoShape;
|
TopoDS_Shape algoShape;
|
||||||
if ( !GetAlgo( aMesh, sm->GetSubShape(), & algoShape ))
|
if ( !GetAlgo( sm, & algoShape ))
|
||||||
continue; // strange...
|
continue; // strange...
|
||||||
|
|
||||||
// look for more local algos
|
// look for more local algos
|
||||||
@ -525,7 +526,8 @@ bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh,
|
|||||||
.And( SMESH_HypoFilter::IsApplicableTo( aSubShape ))
|
.And( SMESH_HypoFilter::IsApplicableTo( aSubShape ))
|
||||||
.And( SMESH_HypoFilter::IsMoreLocalThan( algoShape, aMesh ));
|
.And( SMESH_HypoFilter::IsMoreLocalThan( algoShape, aMesh ));
|
||||||
|
|
||||||
if ( SMESH_Algo* subAlgo = (SMESH_Algo*) aMesh.GetHypothesis( aSubShape, filter, true )) {
|
if ( SMESH_Algo* subAlgo = (SMESH_Algo*) aMesh.GetHypothesis( smToCompute, filter, true ))
|
||||||
|
{
|
||||||
if ( ! subAlgo->NeedDiscreteBoundary() ) continue;
|
if ( ! subAlgo->NeedDiscreteBoundary() ) continue;
|
||||||
SMESH_Hypothesis::Hypothesis_Status status;
|
SMESH_Hypothesis::Hypothesis_Status status;
|
||||||
if ( subAlgo->CheckHypothesis( aMesh, aSubShape, status ))
|
if ( subAlgo->CheckHypothesis( aMesh, aSubShape, status ))
|
||||||
@ -1013,6 +1015,23 @@ SMESH_Algo *SMESH_Gen::GetAlgo(SMESH_Mesh & aMesh,
|
|||||||
const TopoDS_Shape & aShape,
|
const TopoDS_Shape & aShape,
|
||||||
TopoDS_Shape* assignedTo)
|
TopoDS_Shape* assignedTo)
|
||||||
{
|
{
|
||||||
|
return GetAlgo( aMesh.GetSubMesh( aShape ), assignedTo );
|
||||||
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* Finds algo to mesh a sub-mesh. Optionally returns a shape the found algo is bound to
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
|
||||||
|
SMESH_Algo *SMESH_Gen::GetAlgo(SMESH_subMesh * aSubMesh,
|
||||||
|
TopoDS_Shape* assignedTo)
|
||||||
|
{
|
||||||
|
if ( !aSubMesh ) return 0;
|
||||||
|
|
||||||
|
const TopoDS_Shape & aShape = aSubMesh->GetSubShape();
|
||||||
|
SMESH_Mesh& aMesh = *aSubMesh->GetFather();
|
||||||
|
|
||||||
SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
|
SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
|
||||||
filter.And( filter.IsApplicableTo( aShape ));
|
filter.And( filter.IsApplicableTo( aShape ));
|
||||||
|
|
||||||
@ -1020,7 +1039,7 @@ SMESH_Algo *SMESH_Gen::GetAlgo(SMESH_Mesh & aMesh,
|
|||||||
|
|
||||||
TopoDS_Shape assignedToShape;
|
TopoDS_Shape assignedToShape;
|
||||||
SMESH_Algo* algo =
|
SMESH_Algo* algo =
|
||||||
(SMESH_Algo*) aMesh.GetHypothesis( aShape, filter, true, &assignedToShape );
|
(SMESH_Algo*) aMesh.GetHypothesis( aSubMesh, filter, true, &assignedToShape );
|
||||||
|
|
||||||
if ( algo &&
|
if ( algo &&
|
||||||
aShape.ShapeType() == TopAbs_FACE &&
|
aShape.ShapeType() == TopAbs_FACE &&
|
||||||
@ -1035,7 +1054,7 @@ SMESH_Algo *SMESH_Gen::GetAlgo(SMESH_Mesh & aMesh,
|
|||||||
filter.AndNot( filter.Is( algo ));
|
filter.AndNot( filter.Is( algo ));
|
||||||
TopoDS_Shape assignedToShape2;
|
TopoDS_Shape assignedToShape2;
|
||||||
SMESH_Algo* algo2 =
|
SMESH_Algo* algo2 =
|
||||||
(SMESH_Algo*) aMesh.GetHypothesis( aShape, filter, true, &assignedToShape2 );
|
(SMESH_Algo*) aMesh.GetHypothesis( aSubMesh, filter, true, &assignedToShape2 );
|
||||||
if ( algo2 && // algo found
|
if ( algo2 && // algo found
|
||||||
!assignedToShape2.IsSame( aMesh.GetShapeToMesh() ) && // algo is local
|
!assignedToShape2.IsSame( aMesh.GetShapeToMesh() ) && // algo is local
|
||||||
( SMESH_MesherHelper::GetGroupType( assignedToShape2 ) == // algo of the same level
|
( SMESH_MesherHelper::GetGroupType( assignedToShape2 ) == // algo of the same level
|
||||||
|
@ -147,6 +147,7 @@ public:
|
|||||||
{ return GetShapeDim( aShape.ShapeType() ); }
|
{ return GetShapeDim( aShape.ShapeType() ); }
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
static bool IsGlobalHypothesis(const SMESH_Hypothesis* theHyp, SMESH_Mesh& aMesh);
|
static bool IsGlobalHypothesis(const SMESH_Hypothesis* theHyp, SMESH_Mesh& aMesh);
|
||||||
|
|
||||||
|
@ -773,7 +773,30 @@ const SMESH_Hypothesis * SMESH_Mesh::GetHypothesis(const TopoDS_Shape & aSubS
|
|||||||
const bool andAncestors,
|
const bool andAncestors,
|
||||||
TopoDS_Shape* assignedTo) const
|
TopoDS_Shape* assignedTo) const
|
||||||
{
|
{
|
||||||
|
return GetHypothesis( const_cast< SMESH_Mesh* >(this)->GetSubMesh( aSubShape ),
|
||||||
|
aFilter, andAncestors, assignedTo );
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Return the hypothesis assigned to the shape of a sub-mesh
|
||||||
|
* \param aSubMesh - the sub-mesh to check
|
||||||
|
* \param aFilter - the hypothesis filter
|
||||||
|
* \param andAncestors - flag to check hypos assigned to ancestors of the shape
|
||||||
|
* \param assignedTo - to return the shape the found hypo is assigned to
|
||||||
|
* \retval SMESH_Hypothesis* - the first hypo passed through aFilter
|
||||||
|
*/
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
const SMESH_Hypothesis * SMESH_Mesh::GetHypothesis(const SMESH_subMesh * aSubMesh,
|
||||||
|
const SMESH_HypoFilter& aFilter,
|
||||||
|
const bool andAncestors,
|
||||||
|
TopoDS_Shape* assignedTo) const
|
||||||
|
{
|
||||||
|
if ( !aSubMesh ) return 0;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
const TopoDS_Shape & aSubShape = aSubMesh->GetSubShape();
|
||||||
const list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(aSubShape);
|
const list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(aSubShape);
|
||||||
list<const SMESHDS_Hypothesis*>::const_iterator hyp = hypList.begin();
|
list<const SMESHDS_Hypothesis*>::const_iterator hyp = hypList.begin();
|
||||||
for ( ; hyp != hypList.end(); hyp++ ) {
|
for ( ; hyp != hypList.end(); hyp++ ) {
|
||||||
@ -787,9 +810,12 @@ const SMESH_Hypothesis * SMESH_Mesh::GetHypothesis(const TopoDS_Shape & aSubS
|
|||||||
if ( andAncestors )
|
if ( andAncestors )
|
||||||
{
|
{
|
||||||
// user sorted submeshes of ancestors, according to stored submesh priority
|
// user sorted submeshes of ancestors, according to stored submesh priority
|
||||||
getAncestorsSubMeshes( aSubShape, _ancestorSubMeshes );
|
std::vector< SMESH_subMesh * > & ancestors =
|
||||||
vector<SMESH_subMesh*>::const_iterator smIt = _ancestorSubMeshes.begin();
|
const_cast< std::vector< SMESH_subMesh * > & > ( aSubMesh->GetAncestors() );
|
||||||
for ( ; smIt != _ancestorSubMeshes.end(); smIt++ )
|
SortByMeshOrder( ancestors );
|
||||||
|
|
||||||
|
vector<SMESH_subMesh*>::const_iterator smIt = ancestors.begin();
|
||||||
|
for ( ; smIt != ancestors.end(); smIt++ )
|
||||||
{
|
{
|
||||||
const TopoDS_Shape& curSh = (*smIt)->GetSubShape();
|
const TopoDS_Shape& curSh = (*smIt)->GetSubShape();
|
||||||
const list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(curSh);
|
const list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(curSh);
|
||||||
@ -808,7 +834,7 @@ const SMESH_Hypothesis * SMESH_Mesh::GetHypothesis(const TopoDS_Shape & aSubS
|
|||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Return hypothesis assigned to the shape
|
* \brief Return hypotheses assigned to the shape
|
||||||
* \param aSubShape - the shape to check
|
* \param aSubShape - the shape to check
|
||||||
* \param aFilter - the hypothesis filter
|
* \param aFilter - the hypothesis filter
|
||||||
* \param aHypList - the list of the found hypotheses
|
* \param aHypList - the list of the found hypotheses
|
||||||
@ -823,6 +849,29 @@ int SMESH_Mesh::GetHypotheses(const TopoDS_Shape & aSubShape,
|
|||||||
const bool andAncestors,
|
const bool andAncestors,
|
||||||
list< TopoDS_Shape > * assignedTo/*=0*/) const
|
list< TopoDS_Shape > * assignedTo/*=0*/) const
|
||||||
{
|
{
|
||||||
|
return GetHypotheses( const_cast< SMESH_Mesh* >(this)->GetSubMesh( aSubShape ),
|
||||||
|
aFilter, aHypList, andAncestors, assignedTo );
|
||||||
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Return hypotheses assigned to the shape of a sub-mesh
|
||||||
|
* \param aSubShape - the sub-mesh to check
|
||||||
|
* \param aFilter - the hypothesis filter
|
||||||
|
* \param aHypList - the list of the found hypotheses
|
||||||
|
* \param andAncestors - flag to check hypos assigned to ancestors of the shape
|
||||||
|
* \retval int - number of unique hypos in aHypList
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
int SMESH_Mesh::GetHypotheses(const SMESH_subMesh * aSubMesh,
|
||||||
|
const SMESH_HypoFilter& aFilter,
|
||||||
|
list <const SMESHDS_Hypothesis * >& aHypList,
|
||||||
|
const bool andAncestors,
|
||||||
|
list< TopoDS_Shape > * assignedTo/*=0*/) const
|
||||||
|
{
|
||||||
|
if ( !aSubMesh ) return 0;
|
||||||
|
|
||||||
set<string> hypTypes; // to exclude same type hypos from the result list
|
set<string> hypTypes; // to exclude same type hypos from the result list
|
||||||
int nbHyps = 0;
|
int nbHyps = 0;
|
||||||
|
|
||||||
@ -840,6 +889,7 @@ int SMESH_Mesh::GetHypotheses(const TopoDS_Shape & aSubShape,
|
|||||||
|
|
||||||
// get hypos from aSubShape
|
// get hypos from aSubShape
|
||||||
{
|
{
|
||||||
|
const TopoDS_Shape & aSubShape = aSubMesh->GetSubShape();
|
||||||
const list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(aSubShape);
|
const list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(aSubShape);
|
||||||
for ( hyp = hypList.begin(); hyp != hypList.end(); hyp++ )
|
for ( hyp = hypList.begin(); hyp != hypList.end(); hyp++ )
|
||||||
if ( aFilter.IsOk (cSMESH_Hyp( *hyp ), aSubShape) &&
|
if ( aFilter.IsOk (cSMESH_Hyp( *hyp ), aSubShape) &&
|
||||||
@ -857,16 +907,15 @@ int SMESH_Mesh::GetHypotheses(const TopoDS_Shape & aSubShape,
|
|||||||
// get hypos from ancestors of aSubShape
|
// get hypos from ancestors of aSubShape
|
||||||
if ( andAncestors )
|
if ( andAncestors )
|
||||||
{
|
{
|
||||||
TopTools_MapOfShape map;
|
|
||||||
|
|
||||||
// user sorted submeshes of ancestors, according to stored submesh priority
|
// user sorted submeshes of ancestors, according to stored submesh priority
|
||||||
getAncestorsSubMeshes( aSubShape, _ancestorSubMeshes );
|
std::vector< SMESH_subMesh * > & ancestors =
|
||||||
vector<SMESH_subMesh*>::const_iterator smIt = _ancestorSubMeshes.begin();
|
const_cast< std::vector< SMESH_subMesh * > & > ( aSubMesh->GetAncestors() );
|
||||||
for ( ; smIt != _ancestorSubMeshes.end(); smIt++ )
|
SortByMeshOrder( ancestors );
|
||||||
|
|
||||||
|
vector<SMESH_subMesh*>::const_iterator smIt = ancestors.begin();
|
||||||
|
for ( ; smIt != ancestors.end(); smIt++ )
|
||||||
{
|
{
|
||||||
const TopoDS_Shape& curSh = (*smIt)->GetSubShape();
|
const TopoDS_Shape& curSh = (*smIt)->GetSubShape();
|
||||||
if ( !map.Add( curSh ))
|
|
||||||
continue;
|
|
||||||
const list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(curSh);
|
const list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(curSh);
|
||||||
for ( hyp = hypList.begin(); hyp != hypList.end(); hyp++ )
|
for ( hyp = hypList.begin(); hyp != hypList.end(); hyp++ )
|
||||||
if (( aFilter.IsOk( cSMESH_Hyp( *hyp ), curSh )) &&
|
if (( aFilter.IsOk( cSMESH_Hyp( *hyp ), curSh )) &&
|
||||||
@ -1047,9 +1096,7 @@ bool SMESH_Mesh::IsUsedHypothesis(SMESHDS_Hypothesis * anHyp,
|
|||||||
if ( !aSubMesh || !aSubMesh->IsApplicableHypotesis( hyp ))
|
if ( !aSubMesh || !aSubMesh->IsApplicableHypotesis( hyp ))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const TopoDS_Shape & aSubShape = const_cast<SMESH_subMesh*>( aSubMesh )->GetSubShape();
|
SMESH_Algo *algo = aSubMesh->GetAlgo();
|
||||||
|
|
||||||
SMESH_Algo *algo = _gen->GetAlgo(*this, aSubShape );
|
|
||||||
|
|
||||||
// algorithm
|
// algorithm
|
||||||
if (anHyp->GetType() > SMESHDS_Hypothesis::PARAM_ALGO)
|
if (anHyp->GetType() > SMESHDS_Hypothesis::PARAM_ALGO)
|
||||||
@ -1062,7 +1109,7 @@ bool SMESH_Mesh::IsUsedHypothesis(SMESHDS_Hypothesis * anHyp,
|
|||||||
const SMESH_HypoFilter* hypoKind;
|
const SMESH_HypoFilter* hypoKind;
|
||||||
if (( hypoKind = algo->GetCompatibleHypoFilter( !hyp->IsAuxiliary() ))) {
|
if (( hypoKind = algo->GetCompatibleHypoFilter( !hyp->IsAuxiliary() ))) {
|
||||||
list <const SMESHDS_Hypothesis * > usedHyps;
|
list <const SMESHDS_Hypothesis * > usedHyps;
|
||||||
if ( GetHypotheses( aSubShape, *hypoKind, usedHyps, true ))
|
if ( GetHypotheses( aSubMesh, *hypoKind, usedHyps, true ))
|
||||||
return ( find( usedHyps.begin(), usedHyps.end(), anHyp ) != usedHyps.end() );
|
return ( find( usedHyps.begin(), usedHyps.end(), anHyp ) != usedHyps.end() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1134,7 +1181,7 @@ void SMESH_Mesh::NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* h
|
|||||||
{
|
{
|
||||||
// check if hyp is used by algo
|
// check if hyp is used by algo
|
||||||
usedHyps.clear();
|
usedHyps.clear();
|
||||||
if ( GetHypotheses( aSubShape, *compatibleHypoKind, usedHyps, true ) &&
|
if ( GetHypotheses( aSubMesh, *compatibleHypoKind, usedHyps, true ) &&
|
||||||
find( usedHyps.begin(), usedHyps.end(), hyp ) != usedHyps.end() )
|
find( usedHyps.begin(), usedHyps.end(), hyp ) != usedHyps.end() )
|
||||||
{
|
{
|
||||||
aSubMesh->AlgoStateEngine(SMESH_subMesh::MODIF_HYP,
|
aSubMesh->AlgoStateEngine(SMESH_subMesh::MODIF_HYP,
|
||||||
@ -2138,7 +2185,10 @@ void SMESH_Mesh::fillAncestorsMap(const TopoDS_Shape& theShape)
|
|||||||
while ( ancIt.More() && ancIt.Value().ShapeType() >= memberType )
|
while ( ancIt.More() && ancIt.Value().ShapeType() >= memberType )
|
||||||
ancIt.Next();
|
ancIt.Next();
|
||||||
if ( ancIt.More() )
|
if ( ancIt.More() )
|
||||||
|
{
|
||||||
ancList.InsertBefore( theShape, ancIt );
|
ancList.InsertBefore( theShape, ancIt );
|
||||||
|
GetSubMesh( des.Current() )->ClearAncestors(); // to re-fill _ancestors
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@ -148,6 +148,17 @@ public:
|
|||||||
const bool andAncestors,
|
const bool andAncestors,
|
||||||
std::list< TopoDS_Shape > * assignedTo=0) const;
|
std::list< TopoDS_Shape > * assignedTo=0) const;
|
||||||
|
|
||||||
|
const SMESH_Hypothesis * GetHypothesis(const SMESH_subMesh * aSubMesh,
|
||||||
|
const SMESH_HypoFilter& aFilter,
|
||||||
|
const bool andAncestors,
|
||||||
|
TopoDS_Shape* assignedTo=0) const;
|
||||||
|
|
||||||
|
int GetHypotheses(const SMESH_subMesh * aSubMesh,
|
||||||
|
const SMESH_HypoFilter& aFilter,
|
||||||
|
std::list< const SMESHDS_Hypothesis * >& aHypList,
|
||||||
|
const bool andAncestors,
|
||||||
|
std::list< TopoDS_Shape > * assignedTo=0) const;
|
||||||
|
|
||||||
SMESH_Hypothesis * GetHypothesis(const int aHypID) const;
|
SMESH_Hypothesis * GetHypothesis(const int aHypID) const;
|
||||||
|
|
||||||
const std::list<SMESHDS_Command*> & GetLog() throw(SALOME_Exception);
|
const std::list<SMESHDS_Command*> & GetLog() throw(SALOME_Exception);
|
||||||
|
@ -47,13 +47,14 @@
|
|||||||
#include <BRep_Builder.hxx>
|
#include <BRep_Builder.hxx>
|
||||||
#include <BRep_Tool.hxx>
|
#include <BRep_Tool.hxx>
|
||||||
#include <TopExp.hxx>
|
#include <TopExp.hxx>
|
||||||
|
#include <TopExp_Explorer.hxx>
|
||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
#include <TopTools_IndexedMapOfShape.hxx>
|
||||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||||
|
#include <TopTools_ListOfShape.hxx>
|
||||||
#include <TopoDS.hxx>
|
#include <TopoDS.hxx>
|
||||||
#include <TopoDS_Compound.hxx>
|
#include <TopoDS_Compound.hxx>
|
||||||
#include <gp_Pnt.hxx>
|
|
||||||
#include <TopExp_Explorer.hxx>
|
|
||||||
#include <TopoDS_Iterator.hxx>
|
#include <TopoDS_Iterator.hxx>
|
||||||
|
#include <gp_Pnt.hxx>
|
||||||
|
|
||||||
#include <Standard_OutOfMemory.hxx>
|
#include <Standard_OutOfMemory.hxx>
|
||||||
#include <Standard_ErrorHandler.hxx>
|
#include <Standard_ErrorHandler.hxx>
|
||||||
@ -195,7 +196,10 @@ SMESH_subMesh *SMESH_subMesh::GetFirstToCompute()
|
|||||||
SMESH_Algo* SMESH_subMesh::GetAlgo() const
|
SMESH_Algo* SMESH_subMesh::GetAlgo() const
|
||||||
{
|
{
|
||||||
if ( !_algo )
|
if ( !_algo )
|
||||||
((SMESH_subMesh*)this)->_algo = _father->GetGen()->GetAlgo(*_father, _subShape);
|
{
|
||||||
|
SMESH_subMesh* me = const_cast< SMESH_subMesh* >( this );
|
||||||
|
me->_algo = _father->GetGen()->GetAlgo( me );
|
||||||
|
}
|
||||||
return _algo;
|
return _algo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -735,7 +739,7 @@ SMESH_Hypothesis::Hypothesis_Status
|
|||||||
SMESH_HypoFilter filter( SMESH_HypoFilter::HasType( algo->GetType() ));
|
SMESH_HypoFilter filter( SMESH_HypoFilter::HasType( algo->GetType() ));
|
||||||
filter.Or( SMESH_HypoFilter::HasType( algo->GetType()+1 ));
|
filter.Or( SMESH_HypoFilter::HasType( algo->GetType()+1 ));
|
||||||
filter.Or( SMESH_HypoFilter::HasType( algo->GetType()+2 ));
|
filter.Or( SMESH_HypoFilter::HasType( algo->GetType()+2 ));
|
||||||
if ( SMESH_Algo * curAlgo = (SMESH_Algo*)_father->GetHypothesis(_subShape, filter, true ))
|
if ( SMESH_Algo * curAlgo = (SMESH_Algo*)_father->GetHypothesis( this, filter, true ))
|
||||||
if ( !curAlgo->NeedDiscreteBoundary() )
|
if ( !curAlgo->NeedDiscreteBoundary() )
|
||||||
algoRequiringCleaning = curAlgo;
|
algoRequiringCleaning = curAlgo;
|
||||||
}
|
}
|
||||||
@ -964,7 +968,7 @@ SMESH_Hypothesis::Hypothesis_Status
|
|||||||
f.Init( SMESH_HypoFilter::IsAlgo() );
|
f.Init( SMESH_HypoFilter::IsAlgo() );
|
||||||
f.And( SMESH_HypoFilter::IsApplicableTo( _subShape ));
|
f.And( SMESH_HypoFilter::IsApplicableTo( _subShape ));
|
||||||
f.AndNot( SMESH_HypoFilter::Is( algo ));
|
f.AndNot( SMESH_HypoFilter::Is( algo ));
|
||||||
const SMESH_Hypothesis * prevAlgo = _father->GetHypothesis( _subShape, f, true );
|
const SMESH_Hypothesis * prevAlgo = _father->GetHypothesis( this, f, true );
|
||||||
if (prevAlgo &&
|
if (prevAlgo &&
|
||||||
string(algo->GetName()) != string(prevAlgo->GetName()) )
|
string(algo->GetName()) != string(prevAlgo->GetName()) )
|
||||||
modifiedHyp = true;
|
modifiedHyp = true;
|
||||||
@ -1023,7 +1027,7 @@ SMESH_Hypothesis::Hypothesis_Status
|
|||||||
f.Init( SMESH_HypoFilter::IsAlgo() );
|
f.Init( SMESH_HypoFilter::IsAlgo() );
|
||||||
f.And( SMESH_HypoFilter::IsApplicableTo( _subShape ));
|
f.And( SMESH_HypoFilter::IsApplicableTo( _subShape ));
|
||||||
f.AndNot( SMESH_HypoFilter::Is( algo ));
|
f.AndNot( SMESH_HypoFilter::Is( algo ));
|
||||||
const SMESH_Hypothesis* prevAlgo = _father->GetHypothesis( _subShape, f, true );
|
const SMESH_Hypothesis* prevAlgo = _father->GetHypothesis( this, f, true );
|
||||||
if (prevAlgo &&
|
if (prevAlgo &&
|
||||||
string(algo->GetName()) != string(prevAlgo->GetName()) )
|
string(algo->GetName()) != string(prevAlgo->GetName()) )
|
||||||
modifiedHyp = true;
|
modifiedHyp = true;
|
||||||
@ -1089,21 +1093,22 @@ SMESH_Hypothesis::Hypothesis_Status
|
|||||||
{
|
{
|
||||||
// is algo hidden?
|
// is algo hidden?
|
||||||
SMESH_Gen* gen = _father->GetGen();
|
SMESH_Gen* gen = _father->GetGen();
|
||||||
TopTools_ListIteratorOfListOfShape it( _father->GetAncestors( _subShape ));
|
const std::vector< SMESH_subMesh * > & ancestors = GetAncestors();
|
||||||
for ( ; ( ret == SMESH_Hypothesis::HYP_OK && it.More()); it.Next() ) {
|
for ( size_t iA = 0; ( ret == SMESH_Hypothesis::HYP_OK && iA < ancestors.size()); ++iA ) {
|
||||||
if ( SMESH_Algo* upperAlgo = gen->GetAlgo( *_father, it.Value() ))
|
if ( SMESH_Algo* upperAlgo = ancestors[ iA ]->GetAlgo() )
|
||||||
if ( !upperAlgo->NeedDiscreteBoundary() && !upperAlgo->SupportSubmeshes())
|
if ( !upperAlgo->NeedDiscreteBoundary() && !upperAlgo->SupportSubmeshes())
|
||||||
ret = SMESH_Hypothesis::HYP_HIDDEN_ALGO;
|
ret = SMESH_Hypothesis::HYP_HIDDEN_ALGO;
|
||||||
}
|
}
|
||||||
// is algo hiding?
|
// is algo hiding?
|
||||||
if ( ret == SMESH_Hypothesis::HYP_OK &&
|
if ( ret == SMESH_Hypothesis::HYP_OK &&
|
||||||
!algo->NeedDiscreteBoundary() &&
|
!algo->NeedDiscreteBoundary() &&
|
||||||
!algo->SupportSubmeshes()) {
|
!algo->SupportSubmeshes())
|
||||||
|
{
|
||||||
TopoDS_Shape algoAssignedTo, otherAssignedTo;
|
TopoDS_Shape algoAssignedTo, otherAssignedTo;
|
||||||
gen->GetAlgo( *_father, _subShape, &algoAssignedTo );
|
gen->GetAlgo( this, &algoAssignedTo );
|
||||||
map<int, SMESH_subMesh*>::reverse_iterator i_sm = _mapDepend.rbegin();
|
map<int, SMESH_subMesh*>::reverse_iterator i_sm = _mapDepend.rbegin();
|
||||||
for ( ; ( ret == SMESH_Hypothesis::HYP_OK && i_sm != _mapDepend.rend()) ; ++i_sm )
|
for ( ; ( ret == SMESH_Hypothesis::HYP_OK && i_sm != _mapDepend.rend()) ; ++i_sm )
|
||||||
if ( gen->GetAlgo( *_father, i_sm->second->_subShape, &otherAssignedTo ) &&
|
if ( gen->GetAlgo( i_sm->second, &otherAssignedTo ) &&
|
||||||
SMESH_MesherHelper::IsSubShape( /*sub=*/otherAssignedTo, /*main=*/algoAssignedTo ))
|
SMESH_MesherHelper::IsSubShape( /*sub=*/otherAssignedTo, /*main=*/algoAssignedTo ))
|
||||||
ret = SMESH_Hypothesis::HYP_HIDING_ALGO;
|
ret = SMESH_Hypothesis::HYP_HIDING_ALGO;
|
||||||
}
|
}
|
||||||
@ -1177,16 +1182,16 @@ bool SMESH_subMesh::IsConform(const SMESH_Algo* theAlgo)
|
|||||||
for (; itsub.More(); itsub.Next())
|
for (; itsub.More(); itsub.Next())
|
||||||
{
|
{
|
||||||
// loop on adjacent subShapes
|
// loop on adjacent subShapes
|
||||||
TopTools_ListIteratorOfListOfShape it( _father->GetAncestors( itsub.Value() ));
|
const std::vector< SMESH_subMesh * > & ancestors = GetAncestors();
|
||||||
for (; it.More(); it.Next())
|
for ( size_t iA = 0; iA < ancestors.size(); ++iA )
|
||||||
{
|
{
|
||||||
const TopoDS_Shape& adjacent = it.Value();
|
const TopoDS_Shape& adjacent = ancestors[ iA ]->GetSubShape();
|
||||||
if ( _subShape.IsSame( adjacent )) continue;
|
if ( _subShape.IsSame( adjacent )) continue;
|
||||||
if ( adjacent.ShapeType() != _subShape.ShapeType())
|
if ( adjacent.ShapeType() != _subShape.ShapeType())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// check algo attached to smAdjacent
|
// check algo attached to smAdjacent
|
||||||
SMESH_Algo * algo = gen->GetAlgo((*_father), adjacent);
|
SMESH_Algo * algo = ancestors[ iA ]->GetAlgo();
|
||||||
if (algo &&
|
if (algo &&
|
||||||
!algo->NeedDiscreteBoundary() &&
|
!algo->NeedDiscreteBoundary() &&
|
||||||
algo->OnlyUnaryInput())
|
algo->OnlyUnaryInput())
|
||||||
@ -2035,12 +2040,10 @@ void SMESH_subMesh::ComputeSubMeshStateEngine(int event, const bool includeSelf)
|
|||||||
|
|
||||||
void SMESH_subMesh::updateDependantsState(const compute_event theEvent)
|
void SMESH_subMesh::updateDependantsState(const compute_event theEvent)
|
||||||
{
|
{
|
||||||
TopTools_ListIteratorOfListOfShape it( _father->GetAncestors( _subShape ));
|
const std::vector< SMESH_subMesh * > & ancestors = GetAncestors();
|
||||||
for (; it.More(); it.Next())
|
for ( size_t iA = 0; iA < ancestors.size(); ++iA )
|
||||||
{
|
{
|
||||||
const TopoDS_Shape& ancestor = it.Value();
|
ancestors[ iA ]->ComputeStateEngine( theEvent );
|
||||||
if ( SMESH_subMesh *aSubMesh = _father->GetSubMeshContaining(ancestor))
|
|
||||||
aSubMesh->ComputeStateEngine( theEvent );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2054,19 +2057,17 @@ void SMESH_subMesh::cleanDependants()
|
|||||||
{
|
{
|
||||||
int dimToClean = SMESH_Gen::GetShapeDim( _subShape ) + 1;
|
int dimToClean = SMESH_Gen::GetShapeDim( _subShape ) + 1;
|
||||||
|
|
||||||
TopTools_ListIteratorOfListOfShape it( _father->GetAncestors( _subShape ));
|
const std::vector< SMESH_subMesh * > & ancestors = GetAncestors();
|
||||||
for (; it.More(); it.Next())
|
for ( size_t iA = 0; iA < ancestors.size(); ++iA )
|
||||||
{
|
{
|
||||||
const TopoDS_Shape& ancestor = it.Value();
|
const TopoDS_Shape& ancestor = ancestors[ iA ]->GetSubShape();
|
||||||
if ( SMESH_Gen::GetShapeDim( ancestor ) == dimToClean ) {
|
if ( SMESH_Gen::GetShapeDim( ancestor ) == dimToClean )
|
||||||
|
{
|
||||||
// PAL8021. do not go upper than SOLID, else ComputeStateEngine(CLEAN)
|
// PAL8021. do not go upper than SOLID, else ComputeStateEngine(CLEAN)
|
||||||
// will erase mesh on other shapes in a compound
|
// will erase mesh on other shapes in a compound
|
||||||
if ( ancestor.ShapeType() >= TopAbs_SOLID ) {
|
if ( ancestor.ShapeType() >= TopAbs_SOLID &&
|
||||||
SMESH_subMesh *aSubMesh = _father->GetSubMeshContaining(ancestor);
|
!ancestors[ iA ]->IsEmpty() ) // prevent infinite CLEAN via event lesteners
|
||||||
if (aSubMesh &&
|
ancestors[ iA ]->ComputeStateEngine(CLEAN);
|
||||||
!aSubMesh->IsEmpty() ) // prevent infinite CLEAN via event lesteners
|
|
||||||
aSubMesh->ComputeStateEngine(CLEAN);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2142,7 +2143,7 @@ TopoDS_Shape SMESH_subMesh::getCollection(SMESH_Gen * theGen,
|
|||||||
}
|
}
|
||||||
else if ( subMesh->GetComputeState() == READY_TO_COMPUTE )
|
else if ( subMesh->GetComputeState() == READY_TO_COMPUTE )
|
||||||
{
|
{
|
||||||
SMESH_Algo* anAlgo = theGen->GetAlgo( *_father, S );
|
SMESH_Algo* anAlgo = theGen->GetAlgo( subMesh );
|
||||||
if (strcmp( anAlgo->GetName(), theAlgo->GetName()) == 0 && // same algo
|
if (strcmp( anAlgo->GetName(), theAlgo->GetName()) == 0 && // same algo
|
||||||
anAlgo->GetUsedHypothesis( *_father, S, ignoreAuxiliaryHyps ) == aUsedHyp) // same hyps
|
anAlgo->GetUsedHypothesis( *_father, S, ignoreAuxiliaryHyps ) == aUsedHyp) // same hyps
|
||||||
aBuilder.Add( aCompound, S );
|
aBuilder.Add( aCompound, S );
|
||||||
@ -2576,6 +2577,44 @@ SMESH_subMeshIteratorPtr SMESH_subMesh::getDependsOnIterator(const bool includeS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Returns ancestor sub-meshes. Finds them if not yet found.
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
const std::vector< SMESH_subMesh * > & SMESH_subMesh::GetAncestors() const
|
||||||
|
{
|
||||||
|
if ( _ancestors.empty() &&
|
||||||
|
!_subShape.IsSame( _father->GetShapeToMesh() ))
|
||||||
|
{
|
||||||
|
const TopTools_ListOfShape& ancShapes = _father->GetAncestors( _subShape );
|
||||||
|
|
||||||
|
SMESH_subMesh* me = const_cast< SMESH_subMesh* >( this );
|
||||||
|
me->_ancestors.reserve( ancShapes.Extent() );
|
||||||
|
|
||||||
|
TopTools_MapOfShape map;
|
||||||
|
|
||||||
|
for ( TopTools_ListIteratorOfListOfShape it( ancShapes ); it.More(); it.Next() )
|
||||||
|
if ( SMESH_subMesh* sm = _father->GetSubMeshContaining( it.Value() ))
|
||||||
|
if ( map.Add( it.Value() ))
|
||||||
|
me->_ancestors.push_back( sm );
|
||||||
|
}
|
||||||
|
|
||||||
|
return _ancestors;
|
||||||
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Clears the vector of ancestor sub-meshes
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
void SMESH_subMesh::ClearAncestors()
|
||||||
|
{
|
||||||
|
_ancestors.clear();
|
||||||
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Find common submeshes (based on shared sub-shapes with other
|
* \brief Find common submeshes (based on shared sub-shapes with other
|
||||||
|
@ -88,6 +88,9 @@ class SMESH_EXPORT SMESH_subMesh
|
|||||||
SMESH_subMeshIteratorPtr getDependsOnIterator(const bool includeSelf,
|
SMESH_subMeshIteratorPtr getDependsOnIterator(const bool includeSelf,
|
||||||
const bool complexShapeFirst=false) const;
|
const bool complexShapeFirst=false) const;
|
||||||
|
|
||||||
|
const std::vector< SMESH_subMesh * > & GetAncestors() const;
|
||||||
|
void ClearAncestors();
|
||||||
|
|
||||||
const TopoDS_Shape & GetSubShape() const;
|
const TopoDS_Shape & GetSubShape() const;
|
||||||
|
|
||||||
enum compute_state
|
enum compute_state
|
||||||
@ -325,6 +328,7 @@ protected:
|
|||||||
|
|
||||||
std::map < int, SMESH_subMesh * >_mapDepend;
|
std::map < int, SMESH_subMesh * >_mapDepend;
|
||||||
bool _dependenceAnalysed;
|
bool _dependenceAnalysed;
|
||||||
|
std::vector< SMESH_subMesh * > _ancestors;
|
||||||
|
|
||||||
SMESH_Algo * _algo; // the algorithm found by last *StateEngine() call
|
SMESH_Algo * _algo; // the algorithm found by last *StateEngine() call
|
||||||
algo_state _algoState;
|
algo_state _algoState;
|
||||||
|
@ -209,23 +209,22 @@ namespace {
|
|||||||
/*!
|
/*!
|
||||||
* \brief Returns a local 1D hypothesis used for theEdge
|
* \brief Returns a local 1D hypothesis used for theEdge
|
||||||
*/
|
*/
|
||||||
const SMESH_Hypothesis* getLocal1DHyp (SMESH_Mesh& theMesh,
|
const SMESH_Hypothesis* getLocal1DHyp (SMESH_subMesh* theSubMesh,
|
||||||
const TopoDS_Shape& theEdge,
|
//const TopoDS_Shape& theEdge,
|
||||||
TopoDS_Shape* theSssignedTo=0)
|
TopoDS_Shape* theSssignedTo=0)
|
||||||
{
|
{
|
||||||
static SMESH_HypoFilter hypo;
|
static SMESH_HypoFilter hypo;
|
||||||
hypo.Init( hypo.HasDim( 1 )).
|
hypo.Init( hypo.HasDim( 1 )).
|
||||||
AndNot ( hypo.IsAlgo() ).
|
AndNot ( hypo.IsAlgo() ).
|
||||||
AndNot ( hypo.IsAssignedTo( theMesh.GetShapeToMesh() ));
|
AndNot ( hypo.IsAssignedTo( theSubMesh->GetFather()->GetShapeToMesh() ));
|
||||||
|
|
||||||
return theMesh.GetHypothesis( theEdge, hypo, true, theSssignedTo );
|
return theSubMesh->GetFather()->GetHypothesis( theSubMesh, hypo, true, theSssignedTo );
|
||||||
}
|
}
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Returns a propagation hypothesis assigned to theEdge
|
* \brief Returns a propagation hypothesis assigned to theEdge
|
||||||
*/
|
*/
|
||||||
const SMESH_Hypothesis* getProagationHyp (SMESH_Mesh& theMesh,
|
const SMESH_Hypothesis* getProagationHyp (SMESH_subMesh* theSubMesh)
|
||||||
const TopoDS_Shape& theEdge)
|
|
||||||
{
|
{
|
||||||
static SMESH_HypoFilter propagHypFilter;
|
static SMESH_HypoFilter propagHypFilter;
|
||||||
if ( propagHypFilter.IsEmpty() )
|
if ( propagHypFilter.IsEmpty() )
|
||||||
@ -234,7 +233,7 @@ namespace {
|
|||||||
Init( SMESH_HypoFilter::HasName( StdMeshers_Propagation::GetName ())).
|
Init( SMESH_HypoFilter::HasName( StdMeshers_Propagation::GetName ())).
|
||||||
Or ( SMESH_HypoFilter::HasName( StdMeshers_PropagOfDistribution::GetName ()));
|
Or ( SMESH_HypoFilter::HasName( StdMeshers_PropagOfDistribution::GetName ()));
|
||||||
}
|
}
|
||||||
return theMesh.GetHypothesis( theEdge, propagHypFilter, true );
|
return theSubMesh->GetFather()->GetHypothesis( theSubMesh, propagHypFilter, true );
|
||||||
}
|
}
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
@ -261,13 +260,13 @@ namespace {
|
|||||||
SMESH_Mesh* mesh = theMainSubMesh->GetFather();
|
SMESH_Mesh* mesh = theMainSubMesh->GetFather();
|
||||||
|
|
||||||
TopoDS_Shape shapeOfHyp1D; // shape to which an hyp being propagated is assigned
|
TopoDS_Shape shapeOfHyp1D; // shape to which an hyp being propagated is assigned
|
||||||
const SMESH_Hypothesis* hyp1D = getLocal1DHyp( *mesh, theMainEdge, &shapeOfHyp1D );
|
const SMESH_Hypothesis* hyp1D = getLocal1DHyp( theMainSubMesh, &shapeOfHyp1D );
|
||||||
SMESH_HypoFilter moreLocalCheck( SMESH_HypoFilter::IsMoreLocalThan( shapeOfHyp1D, *mesh ));
|
SMESH_HypoFilter moreLocalCheck( SMESH_HypoFilter::IsMoreLocalThan( shapeOfHyp1D, *mesh ));
|
||||||
|
|
||||||
PropagationMgrData* chainData = getData( theMainSubMesh );
|
PropagationMgrData* chainData = getData( theMainSubMesh );
|
||||||
chainData->SetState( HAS_PROPAG_HYP );
|
chainData->SetState( HAS_PROPAG_HYP );
|
||||||
|
|
||||||
if ( const SMESH_Hypothesis * propagHyp = getProagationHyp( *mesh, theMainEdge ))
|
if ( const SMESH_Hypothesis * propagHyp = getProagationHyp( theMainSubMesh ))
|
||||||
chainData->myIsPropagOfDistribution =
|
chainData->myIsPropagOfDistribution =
|
||||||
( StdMeshers_PropagOfDistribution::GetName() == propagHyp->GetName() );
|
( StdMeshers_PropagOfDistribution::GetName() == propagHyp->GetName() );
|
||||||
|
|
||||||
@ -279,6 +278,8 @@ namespace {
|
|||||||
TopTools_MapOfShape checkedShapes;
|
TopTools_MapOfShape checkedShapes;
|
||||||
checkedShapes.Add( theMainEdge );
|
checkedShapes.Add( theMainEdge );
|
||||||
|
|
||||||
|
vector<TopoDS_Edge> edges;
|
||||||
|
|
||||||
list<SMESH_subMesh*>::iterator smIt = chain.begin();
|
list<SMESH_subMesh*>::iterator smIt = chain.begin();
|
||||||
for ( ; smIt != chain.end(); ++smIt )
|
for ( ; smIt != chain.end(); ++smIt )
|
||||||
{
|
{
|
||||||
@ -295,9 +296,8 @@ namespace {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Get ordered edges and find index of anE in a sequence
|
// Get ordered edges and find index of anE in a sequence
|
||||||
|
edges.clear();
|
||||||
BRepTools_WireExplorer aWE (TopoDS::Wire(itA.Value()));
|
BRepTools_WireExplorer aWE (TopoDS::Wire(itA.Value()));
|
||||||
vector<TopoDS_Edge> edges;
|
|
||||||
edges.reserve(4);
|
|
||||||
int edgeIndex = 0;
|
int edgeIndex = 0;
|
||||||
for (; aWE.More(); aWE.Next()) {
|
for (; aWE.More(); aWE.Next()) {
|
||||||
TopoDS_Edge edge = aWE.Current();
|
TopoDS_Edge edge = aWE.Current();
|
||||||
@ -361,7 +361,7 @@ namespace {
|
|||||||
if ( oppData->State() == WAIT_PROPAG_HYP ) // ... anOppE is not in any chain
|
if ( oppData->State() == WAIT_PROPAG_HYP ) // ... anOppE is not in any chain
|
||||||
{
|
{
|
||||||
oppData->SetSource( theMainSubMesh );
|
oppData->SetSource( theMainSubMesh );
|
||||||
if ( ! (hyp1D = getLocal1DHyp( *mesh, anOppE, &shapeOfHyp1D )) || //...no 1d hyp on anOppE
|
if ( ! (hyp1D = getLocal1DHyp( oppSM, &shapeOfHyp1D )) || //...no 1d hyp on anOppE
|
||||||
! (moreLocalCheck.IsOk( hyp1D, shapeOfHyp1D ))) // ... or hyp1D is "more global"
|
! (moreLocalCheck.IsOk( hyp1D, shapeOfHyp1D ))) // ... or hyp1D is "more global"
|
||||||
{
|
{
|
||||||
oppData->myForward = data->myForward;
|
oppData->myForward = data->myForward;
|
||||||
@ -373,8 +373,8 @@ namespace {
|
|||||||
DBGMSG( "set IN_CHAIN on " << oppSM->GetId() );
|
DBGMSG( "set IN_CHAIN on " << oppSM->GetId() );
|
||||||
if ( oppSM->GetAlgoState() != SMESH_subMesh::HYP_OK )
|
if ( oppSM->GetAlgoState() != SMESH_subMesh::HYP_OK )
|
||||||
// make oppSM check algo state
|
// make oppSM check algo state
|
||||||
if ( SMESH_Algo* algo = mesh->GetGen()->GetAlgo( *mesh, anOppE ))
|
if ( SMESH_Algo* algo = oppSM->GetAlgo() )
|
||||||
oppSM->AlgoStateEngine(SMESH_subMesh::ADD_FATHER_ALGO,algo);
|
oppSM->AlgoStateEngine(SMESH_subMesh::ADD_FATHER_ALGO, algo);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
oppData->SetState( LAST_IN_CHAIN );
|
oppData->SetState( LAST_IN_CHAIN );
|
||||||
@ -490,7 +490,7 @@ namespace {
|
|||||||
submesh->SetEventListener( getListener(), data, submesh );
|
submesh->SetEventListener( getListener(), data, submesh );
|
||||||
|
|
||||||
const SMESH_Hypothesis * propagHyp =
|
const SMESH_Hypothesis * propagHyp =
|
||||||
getProagationHyp( *submesh->GetFather(), submesh->GetSubShape() );
|
getProagationHyp( submesh );
|
||||||
if ( propagHyp )
|
if ( propagHyp )
|
||||||
{
|
{
|
||||||
data->myIsPropagOfDistribution =
|
data->myIsPropagOfDistribution =
|
||||||
@ -556,11 +556,10 @@ namespace {
|
|||||||
|
|
||||||
case WAIT_PROPAG_HYP: { // propagation hyp or local 1D hyp is missing
|
case WAIT_PROPAG_HYP: { // propagation hyp or local 1D hyp is missing
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
bool hasPropagHyp = ( isPropagHyp ||
|
bool hasPropagHyp = ( isPropagHyp || getProagationHyp( subMesh ));
|
||||||
getProagationHyp( *subMesh->GetFather(), subMesh->GetSubShape()) );
|
|
||||||
if ( !hasPropagHyp )
|
if ( !hasPropagHyp )
|
||||||
return;
|
return;
|
||||||
bool hasLocal1DHyp = getLocal1DHyp( *subMesh->GetFather(), subMesh->GetSubShape());
|
bool hasLocal1DHyp = getLocal1DHyp( subMesh );
|
||||||
if ( !hasLocal1DHyp )
|
if ( !hasLocal1DHyp )
|
||||||
return;
|
return;
|
||||||
if ( event == SMESH_subMesh::ADD_HYP ||
|
if ( event == SMESH_subMesh::ADD_HYP ||
|
||||||
@ -577,7 +576,7 @@ namespace {
|
|||||||
switch ( event ) {
|
switch ( event ) {
|
||||||
case SMESH_subMesh::REMOVE_HYP:
|
case SMESH_subMesh::REMOVE_HYP:
|
||||||
case SMESH_subMesh::REMOVE_FATHER_HYP: // remove propagation hyp
|
case SMESH_subMesh::REMOVE_FATHER_HYP: // remove propagation hyp
|
||||||
if ( isPropagHyp && !getProagationHyp( *subMesh->GetFather(), subMesh->GetSubShape()) )
|
if ( isPropagHyp && !getProagationHyp( subMesh ))
|
||||||
{
|
{
|
||||||
DBGMSG( "REMOVE_HYP propagation from HAS_PROPAG_HYP " << subMesh->GetId() );
|
DBGMSG( "REMOVE_HYP propagation from HAS_PROPAG_HYP " << subMesh->GetId() );
|
||||||
// clear propagation chain
|
// clear propagation chain
|
||||||
|
Loading…
Reference in New Issue
Block a user