mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-14 02:30:33 +05:00
52457: Addition of hypotheses is 8 time longer than meshing.
This commit is contained in:
parent
9bfa6616ba
commit
a3ee66b037
@ -145,7 +145,7 @@ DriverMED_Family
|
|||||||
//=============================================================================
|
//=============================================================================
|
||||||
DriverMED_FamilyPtrList
|
DriverMED_FamilyPtrList
|
||||||
DriverMED_Family
|
DriverMED_Family
|
||||||
::MakeFamilies(const SMESHDS_SubMeshPtrMap& theSubMeshes,
|
::MakeFamilies(SMESHDS_SubMeshIteratorPtr theSubMeshes,
|
||||||
const SMESHDS_GroupBasePtrList& theGroups,
|
const SMESHDS_GroupBasePtrList& theGroups,
|
||||||
const bool doGroupOfNodes,
|
const bool doGroupOfNodes,
|
||||||
const bool doGroupOfEdges,
|
const bool doGroupOfEdges,
|
||||||
@ -170,11 +170,10 @@ DriverMED_Family
|
|||||||
int aElemFamId = FIRST_ELEM_FAMILY;
|
int aElemFamId = FIRST_ELEM_FAMILY;
|
||||||
|
|
||||||
// Process sub-meshes
|
// Process sub-meshes
|
||||||
SMESHDS_SubMeshPtrMap::const_iterator aSMIter = theSubMeshes.begin();
|
while ( theSubMeshes->more() )
|
||||||
for (; aSMIter != theSubMeshes.end(); aSMIter++)
|
|
||||||
{
|
{
|
||||||
const int anId = aSMIter->first;
|
SMESHDS_SubMesh* aSubMesh = const_cast< SMESHDS_SubMesh* >( theSubMeshes->next() );
|
||||||
SMESHDS_SubMesh* aSubMesh = aSMIter->second;
|
const int anId = aSubMesh->GetID();
|
||||||
if ( aSubMesh->IsComplexSubmesh() )
|
if ( aSubMesh->IsComplexSubmesh() )
|
||||||
continue; // submesh containing other submeshs
|
continue; // submesh containing other submeshs
|
||||||
DriverMED_FamilyPtrList aSMFams = SplitByType(aSubMesh,anId);
|
DriverMED_FamilyPtrList aSMFams = SplitByType(aSubMesh,anId);
|
||||||
|
@ -69,7 +69,7 @@ class MESHDRIVERMED_EXPORT DriverMED_Family
|
|||||||
*/
|
*/
|
||||||
static
|
static
|
||||||
DriverMED_FamilyPtrList
|
DriverMED_FamilyPtrList
|
||||||
MakeFamilies (const SMESHDS_SubMeshPtrMap& theSubMeshes,
|
MakeFamilies (SMESHDS_SubMeshIteratorPtr theSubMeshes,
|
||||||
const SMESHDS_GroupBasePtrList& theGroups,
|
const SMESHDS_GroupBasePtrList& theGroups,
|
||||||
const bool doGroupOfNodes,
|
const bool doGroupOfNodes,
|
||||||
const bool doGroupOfEdges,
|
const bool doGroupOfEdges,
|
||||||
|
@ -101,7 +101,7 @@ void DriverMED_W_SMESHDS_Mesh::AddAllSubMeshes()
|
|||||||
|
|
||||||
void DriverMED_W_SMESHDS_Mesh::AddSubMesh(SMESHDS_SubMesh* theSubMesh, int theID)
|
void DriverMED_W_SMESHDS_Mesh::AddSubMesh(SMESHDS_SubMesh* theSubMesh, int theID)
|
||||||
{
|
{
|
||||||
mySubMeshes[theID] = theSubMesh;
|
mySubMeshes.push_back( theSubMesh );
|
||||||
}
|
}
|
||||||
|
|
||||||
void DriverMED_W_SMESHDS_Mesh::AddGroupOfNodes()
|
void DriverMED_W_SMESHDS_Mesh::AddGroupOfNodes()
|
||||||
@ -292,6 +292,20 @@ namespace
|
|||||||
// return elem_famNum->second;
|
// return elem_famNum->second;
|
||||||
return aDefaultFamilyId;
|
return aDefaultFamilyId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Returns iterator on sub-meshes
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
SMESHDS_SubMeshIteratorPtr getIterator( std::vector<SMESHDS_SubMesh*>& mySubMeshes )
|
||||||
|
{
|
||||||
|
return SMESHDS_SubMeshIteratorPtr
|
||||||
|
( new SMDS_SetIterator
|
||||||
|
< const SMESHDS_SubMesh*, std::vector< SMESHDS_SubMesh* >::iterator >( mySubMeshes.begin(),
|
||||||
|
mySubMeshes.end() ));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
|
Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
|
||||||
@ -435,7 +449,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
|
|||||||
myDoGroupOfBalls && nbBalls);
|
myDoGroupOfBalls && nbBalls);
|
||||||
} else {
|
} else {
|
||||||
aFamilies = DriverMED_Family::MakeFamilies
|
aFamilies = DriverMED_Family::MakeFamilies
|
||||||
(mySubMeshes, myGroups,
|
(getIterator( mySubMeshes ), myGroups,
|
||||||
myDoGroupOfNodes && nbNodes,
|
myDoGroupOfNodes && nbNodes,
|
||||||
myDoGroupOfEdges && nbEdges,
|
myDoGroupOfEdges && nbEdges,
|
||||||
myDoGroupOfFaces && nbFaces,
|
myDoGroupOfFaces && nbFaces,
|
||||||
|
@ -79,7 +79,7 @@ class MESHDRIVERMED_EXPORT DriverMED_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
|
|||||||
MED::EVersion myMedVersion;
|
MED::EVersion myMedVersion;
|
||||||
std::list<SMESHDS_GroupBase*> myGroups;
|
std::list<SMESHDS_GroupBase*> myGroups;
|
||||||
bool myAllSubMeshes;
|
bool myAllSubMeshes;
|
||||||
std::map<int,SMESHDS_SubMesh*> mySubMeshes;
|
std::vector<SMESHDS_SubMesh*> mySubMeshes;
|
||||||
bool myDoGroupOfNodes;
|
bool myDoGroupOfNodes;
|
||||||
bool myDoGroupOfEdges;
|
bool myDoGroupOfEdges;
|
||||||
bool myDoGroupOfFaces;
|
bool myDoGroupOfFaces;
|
||||||
|
@ -178,6 +178,7 @@ const SMESH_Algo::Features& SMESH_Algo::GetFeatures( const std::string& algoType
|
|||||||
SMESH_Algo::SMESH_Algo (int hypId, int studyId, SMESH_Gen * gen)
|
SMESH_Algo::SMESH_Algo (int hypId, int studyId, SMESH_Gen * gen)
|
||||||
: SMESH_Hypothesis(hypId, studyId, gen)
|
: SMESH_Hypothesis(hypId, studyId, gen)
|
||||||
{
|
{
|
||||||
|
_compatibleAllHypFilter = _compatibleNoAuxHypFilter = NULL;
|
||||||
_onlyUnaryInput = _requireDiscreteBoundary = _requireShape = true;
|
_onlyUnaryInput = _requireDiscreteBoundary = _requireShape = true;
|
||||||
_quadraticMesh = _supportSubmeshes = false;
|
_quadraticMesh = _supportSubmeshes = false;
|
||||||
_error = COMPERR_OK;
|
_error = COMPERR_OK;
|
||||||
@ -193,6 +194,8 @@ SMESH_Algo::SMESH_Algo (int hypId, int studyId, SMESH_Gen * gen)
|
|||||||
|
|
||||||
SMESH_Algo::~SMESH_Algo()
|
SMESH_Algo::~SMESH_Algo()
|
||||||
{
|
{
|
||||||
|
delete _compatibleNoAuxHypFilter;
|
||||||
|
// delete _compatibleAllHypFilter; -- _compatibleNoAuxHypFilter does it!!!
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -263,10 +266,9 @@ SMESH_Algo::GetUsedHypothesis(SMESH_Mesh & aMesh,
|
|||||||
{
|
{
|
||||||
SMESH_Algo* me = const_cast< SMESH_Algo* >( this );
|
SMESH_Algo* me = const_cast< SMESH_Algo* >( this );
|
||||||
me->_usedHypList.clear();
|
me->_usedHypList.clear();
|
||||||
SMESH_HypoFilter filter;
|
if ( const SMESH_HypoFilter* filter = GetCompatibleHypoFilter( ignoreAuxiliary ))
|
||||||
if ( InitCompatibleHypoFilter( filter, ignoreAuxiliary ))
|
|
||||||
{
|
{
|
||||||
aMesh.GetHypotheses( aShape, filter, me->_usedHypList, true );
|
aMesh.GetHypotheses( aShape, *filter, me->_usedHypList, true );
|
||||||
if ( ignoreAuxiliary && _usedHypList.size() > 1 )
|
if ( ignoreAuxiliary && _usedHypList.size() > 1 )
|
||||||
me->_usedHypList.clear(); //only one compatible hypothesis allowed
|
me->_usedHypList.clear(); //only one compatible hypothesis allowed
|
||||||
}
|
}
|
||||||
@ -288,9 +290,8 @@ SMESH_Algo::GetAppliedHypothesis(SMESH_Mesh & aMesh,
|
|||||||
{
|
{
|
||||||
SMESH_Algo* me = const_cast< SMESH_Algo* >( this );
|
SMESH_Algo* me = const_cast< SMESH_Algo* >( this );
|
||||||
me->_appliedHypList.clear();
|
me->_appliedHypList.clear();
|
||||||
SMESH_HypoFilter filter;
|
if ( const SMESH_HypoFilter* filter = GetCompatibleHypoFilter( ignoreAuxiliary ))
|
||||||
if ( InitCompatibleHypoFilter( filter, ignoreAuxiliary ))
|
aMesh.GetHypotheses( aShape, *filter, me->_appliedHypList, false );
|
||||||
aMesh.GetHypotheses( aShape, filter, me->_appliedHypList, false );
|
|
||||||
|
|
||||||
return _appliedHypList;
|
return _appliedHypList;
|
||||||
}
|
}
|
||||||
@ -457,27 +458,35 @@ bool SMESH_Algo::GetSortedNodesOnEdge(const SMESHDS_Mesh* theM
|
|||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Make filter recognize only compatible hypotheses
|
* \brief Returns the filter recognizing only compatible hypotheses
|
||||||
* \param theFilter - the filter to initialize
|
* \param ignoreAuxiliary - make filter ignore auxiliary hypotheses
|
||||||
* \param ignoreAuxiliary - make filter ignore compatible auxiliary hypotheses
|
* \retval SMESH_HypoFilter* - the filter that can be NULL
|
||||||
*/
|
*/
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
||||||
bool SMESH_Algo::InitCompatibleHypoFilter( SMESH_HypoFilter & theFilter,
|
const SMESH_HypoFilter*
|
||||||
const bool ignoreAuxiliary) const
|
SMESH_Algo::GetCompatibleHypoFilter(const bool ignoreAuxiliary) const
|
||||||
{
|
{
|
||||||
if ( !_compatibleHypothesis.empty() )
|
if ( !_compatibleHypothesis.empty() )
|
||||||
{
|
{
|
||||||
theFilter.Init( theFilter.HasName( _compatibleHypothesis[0] ));
|
if ( !_compatibleAllHypFilter )
|
||||||
for ( int i = 1; i < _compatibleHypothesis.size(); ++i )
|
{
|
||||||
theFilter.Or( theFilter.HasName( _compatibleHypothesis[ i ] ));
|
SMESH_HypoFilter* filter = new SMESH_HypoFilter();
|
||||||
|
filter->Init( filter->HasName( _compatibleHypothesis[0] ));
|
||||||
|
for ( int i = 1; i < _compatibleHypothesis.size(); ++i )
|
||||||
|
filter->Or( filter->HasName( _compatibleHypothesis[ i ] ));
|
||||||
|
|
||||||
if ( ignoreAuxiliary )
|
SMESH_HypoFilter* filterNoAux = new SMESH_HypoFilter( filter );
|
||||||
theFilter.AndNot( theFilter.IsAuxiliary() );
|
filterNoAux->AndNot( filterNoAux->IsAuxiliary() );
|
||||||
|
|
||||||
return true;
|
// _compatibleNoAuxHypFilter will detele _compatibleAllHypFilter!!!
|
||||||
|
SMESH_Algo* me = const_cast< SMESH_Algo* >( this );
|
||||||
|
me->_compatibleAllHypFilter = filter;
|
||||||
|
me->_compatibleNoAuxHypFilter = filterNoAux;
|
||||||
|
}
|
||||||
|
return ignoreAuxiliary ? _compatibleNoAuxHypFilter : _compatibleAllHypFilter;
|
||||||
}
|
}
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
@ -218,13 +218,12 @@ class SMESH_EXPORT SMESH_Algo : public SMESH_Hypothesis
|
|||||||
const TopoDS_Shape & aShape,
|
const TopoDS_Shape & aShape,
|
||||||
const bool ignoreAuxiliary=true) const;
|
const bool ignoreAuxiliary=true) const;
|
||||||
/*!
|
/*!
|
||||||
* \brief Make the filter recognize only compatible hypotheses
|
* \brief Returns the filter recognizing only compatible hypotheses
|
||||||
* \param theFilter - the filter to initialize
|
* \param ignoreAuxiliary - make filter ignore compatible auxiliary hypotheses
|
||||||
* \param ignoreAuxiliary - make filter ignore compatible auxiliary hypotheses
|
* \retval SMESH_HypoFilter* - the filter that can be NULL
|
||||||
* \retval bool - true if the algo has compatible hypotheses
|
|
||||||
*/
|
*/
|
||||||
bool InitCompatibleHypoFilter( SMESH_HypoFilter & theFilter,
|
const SMESH_HypoFilter* GetCompatibleHypoFilter(const bool ignoreAuxiliary) const;
|
||||||
const bool ignoreAuxiliary) const;
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Just return false as the algorithm does not hold parameters values
|
* \brief Just return false as the algorithm does not hold parameters values
|
||||||
*/
|
*/
|
||||||
@ -408,9 +407,12 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
const SMESH_HypoFilter * _compatibleAllHypFilter;
|
||||||
|
const SMESH_HypoFilter * _compatibleNoAuxHypFilter;
|
||||||
std::vector<std::string> _compatibleHypothesis;
|
std::vector<std::string> _compatibleHypothesis;
|
||||||
std::list<const SMESHDS_Hypothesis *> _appliedHypList;
|
std::list<const SMESHDS_Hypothesis *> _appliedHypList;
|
||||||
std::list<const SMESHDS_Hypothesis *> _usedHypList;
|
std::list<const SMESHDS_Hypothesis *> _usedHypList;
|
||||||
|
|
||||||
|
|
||||||
// Algo features influencing which Compute() and how is called:
|
// Algo features influencing which Compute() and how is called:
|
||||||
// in what turn and with what input shape.
|
// in what turn and with what input shape.
|
||||||
|
@ -288,24 +288,24 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
|
|||||||
// Apply all-dimensional algorithms supporing sub-meshes
|
// Apply all-dimensional algorithms supporing sub-meshes
|
||||||
// ======================================================
|
// ======================================================
|
||||||
|
|
||||||
|
std::vector< SMESH_subMesh* > smVec;
|
||||||
for ( aShapeDim = 0; aShapeDim < 4; ++aShapeDim )
|
for ( aShapeDim = 0; aShapeDim < 4; ++aShapeDim )
|
||||||
{
|
{
|
||||||
// ------------------------------------------------
|
// ------------------------------------------------
|
||||||
// sort list of sub-meshes according to mesh order
|
// sort list of sub-meshes according to mesh order
|
||||||
// ------------------------------------------------
|
// ------------------------------------------------
|
||||||
aMesh.SortByMeshOrder( smWithAlgoSupportingSubmeshes[ aShapeDim ] );
|
smVec.assign( smWithAlgoSupportingSubmeshes[ aShapeDim ].begin(),
|
||||||
|
smWithAlgoSupportingSubmeshes[ aShapeDim ].end() );
|
||||||
|
aMesh.SortByMeshOrder( smVec );
|
||||||
|
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// compute sub-meshes with local uni-dimensional algos under
|
// compute sub-meshes with local uni-dimensional algos under
|
||||||
// sub-meshes with all-dimensional algos
|
// sub-meshes with all-dimensional algos
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
list< SMESH_subMesh* >::iterator subIt, subEnd;
|
|
||||||
subIt = smWithAlgoSupportingSubmeshes[ aShapeDim ].begin();
|
|
||||||
subEnd = smWithAlgoSupportingSubmeshes[ aShapeDim ].end();
|
|
||||||
// start from lower shapes
|
// start from lower shapes
|
||||||
for ( ; subIt != subEnd; ++subIt )
|
for ( size_t i = 0; i < smVec.size(); ++i )
|
||||||
{
|
{
|
||||||
sm = *subIt;
|
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( aMesh, sm->GetSubShape(), & algoShape ))
|
||||||
@ -343,10 +343,9 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
|
|||||||
// --------------------------------
|
// --------------------------------
|
||||||
// apply the all-dimensional algos
|
// apply the all-dimensional algos
|
||||||
// --------------------------------
|
// --------------------------------
|
||||||
subIt = smWithAlgoSupportingSubmeshes[ aShapeDim ].begin();
|
for ( size_t i = 0; i < smVec.size(); ++i )
|
||||||
for ( ; subIt != subEnd; ++subIt )
|
|
||||||
{
|
{
|
||||||
sm = *subIt;
|
sm = smVec[i];
|
||||||
if ( sm->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE)
|
if ( sm->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE)
|
||||||
{
|
{
|
||||||
const TopAbs_ShapeEnum shapeType = sm->GetSubShape().ShapeType();
|
const TopAbs_ShapeEnum shapeType = sm->GetSubShape().ShapeType();
|
||||||
@ -494,18 +493,18 @@ bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh,
|
|||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// sort list of meshes according to mesh order
|
// sort list of meshes according to mesh order
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
aMesh.SortByMeshOrder( smWithAlgoSupportingSubmeshes );
|
std::vector< SMESH_subMesh* > smVec( smWithAlgoSupportingSubmeshes.begin(),
|
||||||
|
smWithAlgoSupportingSubmeshes.end() );
|
||||||
|
aMesh.SortByMeshOrder( smVec );
|
||||||
|
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// compute sub-meshes under shapes with algos that DO NOT require
|
// compute sub-meshes under shapes with algos that DO NOT require
|
||||||
// Discreteized boundaries and DO support sub-meshes
|
// Discreteized boundaries and DO support sub-meshes
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
list< SMESH_subMesh* >::iterator subIt, subEnd;
|
|
||||||
subIt = smWithAlgoSupportingSubmeshes.begin();
|
|
||||||
subEnd = smWithAlgoSupportingSubmeshes.end();
|
|
||||||
// start from lower shapes
|
// start from lower shapes
|
||||||
for ( ; subIt != subEnd; ++subIt ) {
|
for ( size_t i = 0; i < smVec.size(); ++i )
|
||||||
sm = *subIt;
|
{
|
||||||
|
sm = smVec[i];
|
||||||
|
|
||||||
// get a shape the algo is assigned to
|
// get a shape the algo is assigned to
|
||||||
TopoDS_Shape algoShape;
|
TopoDS_Shape algoShape;
|
||||||
@ -538,9 +537,9 @@ bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh,
|
|||||||
// ----------------------------------------------------------
|
// ----------------------------------------------------------
|
||||||
// apply the algos that do not require Discreteized boundaries
|
// apply the algos that do not require Discreteized boundaries
|
||||||
// ----------------------------------------------------------
|
// ----------------------------------------------------------
|
||||||
for ( subIt = smWithAlgoSupportingSubmeshes.begin(); subIt != subEnd; ++subIt )
|
for ( size_t i = 0; i < smVec.size(); ++i )
|
||||||
{
|
{
|
||||||
sm = *subIt;
|
sm = smVec[i];
|
||||||
sm->Evaluate(aResMap);
|
sm->Evaluate(aResMap);
|
||||||
if ( aShapesId )
|
if ( aShapesId )
|
||||||
aShapesId->insert( sm->GetId() );
|
aShapesId->insert( sm->GetId() );
|
||||||
|
@ -185,6 +185,7 @@ bool SMESH_HypoFilter::IsMoreLocalThanPredicate::IsOk(const SMESH_Hypothesis* aH
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
SMESH_HypoFilter::SMESH_HypoFilter()
|
SMESH_HypoFilter::SMESH_HypoFilter()
|
||||||
|
: myNbPredicates(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,6 +195,7 @@ SMESH_HypoFilter::SMESH_HypoFilter()
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
SMESH_HypoFilter::SMESH_HypoFilter( SMESH_HypoPredicate* aPredicate, bool notNegate )
|
SMESH_HypoFilter::SMESH_HypoFilter( SMESH_HypoPredicate* aPredicate, bool notNegate )
|
||||||
|
: myNbPredicates(0)
|
||||||
{
|
{
|
||||||
add( notNegate ? AND : AND_NOT, aPredicate );
|
add( notNegate ? AND : AND_NOT, aPredicate );
|
||||||
}
|
}
|
||||||
@ -352,15 +354,14 @@ SMESH_HypoPredicate* SMESH_HypoFilter::HasType(const int theHypType)
|
|||||||
bool SMESH_HypoFilter::IsOk (const SMESH_Hypothesis* aHyp,
|
bool SMESH_HypoFilter::IsOk (const SMESH_Hypothesis* aHyp,
|
||||||
const TopoDS_Shape& aShape) const
|
const TopoDS_Shape& aShape) const
|
||||||
{
|
{
|
||||||
if ( myPredicates.empty() )
|
if ( IsEmpty() )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
bool ok = ( myPredicates.front()->_logical_op <= AND_NOT );
|
bool ok = ( myPredicates[0]->_logical_op <= AND_NOT );
|
||||||
list<SMESH_HypoPredicate*>::const_iterator pred = myPredicates.begin();
|
for ( int i = 0; i < myNbPredicates; ++i )
|
||||||
for ( ; pred != myPredicates.end(); ++pred )
|
|
||||||
{
|
{
|
||||||
bool ok2 = (*pred)->IsOk( aHyp, aShape );
|
bool ok2 = myPredicates[i]->IsOk( aHyp, aShape );
|
||||||
switch ( (*pred)->_logical_op ) {
|
switch ( myPredicates[i]->_logical_op ) {
|
||||||
case AND: ok = ok && ok2; break;
|
case AND: ok = ok && ok2; break;
|
||||||
case AND_NOT: ok = ok && !ok2; break;
|
case AND_NOT: ok = ok && !ok2; break;
|
||||||
case OR: ok = ok || ok2; break;
|
case OR: ok = ok || ok2; break;
|
||||||
@ -378,10 +379,11 @@ bool SMESH_HypoFilter::IsOk (const SMESH_Hypothesis* aHyp,
|
|||||||
|
|
||||||
SMESH_HypoFilter & SMESH_HypoFilter::Init ( SMESH_HypoPredicate* aPredicate, bool notNegate )
|
SMESH_HypoFilter & SMESH_HypoFilter::Init ( SMESH_HypoPredicate* aPredicate, bool notNegate )
|
||||||
{
|
{
|
||||||
list<SMESH_HypoPredicate*>::const_iterator pred = myPredicates.begin();
|
SMESH_HypoPredicate** pred = &myPredicates[0];
|
||||||
for ( ; pred != myPredicates.end(); ++pred )
|
SMESH_HypoPredicate** end = &myPredicates[myNbPredicates];
|
||||||
|
for ( ; pred != end; ++pred )
|
||||||
delete *pred;
|
delete *pred;
|
||||||
myPredicates.clear();
|
myNbPredicates = 0;
|
||||||
|
|
||||||
add( notNegate ? AND : AND_NOT, aPredicate );
|
add( notNegate ? AND : AND_NOT, aPredicate );
|
||||||
return *this;
|
return *this;
|
||||||
@ -395,7 +397,11 @@ SMESH_HypoFilter & SMESH_HypoFilter::Init ( SMESH_HypoPredicate* aPredicate, bo
|
|||||||
|
|
||||||
SMESH_HypoFilter::~SMESH_HypoFilter()
|
SMESH_HypoFilter::~SMESH_HypoFilter()
|
||||||
{
|
{
|
||||||
Init(0);
|
SMESH_HypoPredicate** pred = &myPredicates[0];
|
||||||
|
SMESH_HypoPredicate** end = &myPredicates[myNbPredicates];
|
||||||
|
for ( ; pred != end; ++pred )
|
||||||
|
delete *pred;
|
||||||
|
myNbPredicates = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ class SMESH_EXPORT SMESH_HypoFilter: public SMESH_HypoPredicate
|
|||||||
// Create and add predicates.
|
// Create and add predicates.
|
||||||
// Added predicates will be destroyed by filter when it dies
|
// Added predicates will be destroyed by filter when it dies
|
||||||
SMESH_HypoFilter();
|
SMESH_HypoFilter();
|
||||||
SMESH_HypoFilter( SMESH_HypoPredicate* aPredicate, bool notNegate = true );
|
explicit SMESH_HypoFilter( SMESH_HypoPredicate* aPredicate, bool notNegate = true );
|
||||||
// notNegate==false means !aPredicate->IsOk()
|
// notNegate==false means !aPredicate->IsOk()
|
||||||
SMESH_HypoFilter & Init ( SMESH_HypoPredicate* aPredicate, bool notNegate = true );
|
SMESH_HypoFilter & Init ( SMESH_HypoPredicate* aPredicate, bool notNegate = true );
|
||||||
SMESH_HypoFilter & And ( SMESH_HypoPredicate* aPredicate );
|
SMESH_HypoFilter & And ( SMESH_HypoPredicate* aPredicate );
|
||||||
@ -80,7 +80,7 @@ class SMESH_EXPORT SMESH_HypoFilter: public SMESH_HypoPredicate
|
|||||||
static SMESH_HypoPredicate* HasDim(const int theDim);
|
static SMESH_HypoPredicate* HasDim(const int theDim);
|
||||||
static SMESH_HypoPredicate* HasType(const int theHypType);
|
static SMESH_HypoPredicate* HasType(const int theHypType);
|
||||||
|
|
||||||
bool IsEmpty() const { return myPredicates.empty(); }
|
bool IsEmpty() const { return myNbPredicates == 0; }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief check aHyp or/and aShape it is assigned to
|
* \brief check aHyp or/and aShape it is assigned to
|
||||||
@ -90,7 +90,7 @@ class SMESH_EXPORT SMESH_HypoFilter: public SMESH_HypoPredicate
|
|||||||
/*!
|
/*!
|
||||||
* \brief return true if contains no predicates
|
* \brief return true if contains no predicates
|
||||||
*/
|
*/
|
||||||
bool IsAny() const { return myPredicates.empty(); }
|
bool IsAny() const { return myNbPredicates > 0; }
|
||||||
|
|
||||||
~SMESH_HypoFilter();
|
~SMESH_HypoFilter();
|
||||||
|
|
||||||
@ -98,7 +98,9 @@ class SMESH_EXPORT SMESH_HypoFilter: public SMESH_HypoPredicate
|
|||||||
protected:
|
protected:
|
||||||
// fields
|
// fields
|
||||||
|
|
||||||
std::list<SMESH_HypoPredicate*> myPredicates;
|
//std::list<SMESH_HypoPredicate*> myPredicates;
|
||||||
|
SMESH_HypoPredicate* myPredicates[100];
|
||||||
|
int myNbPredicates;
|
||||||
|
|
||||||
// private methods
|
// private methods
|
||||||
|
|
||||||
@ -111,7 +113,7 @@ class SMESH_EXPORT SMESH_HypoFilter: public SMESH_HypoPredicate
|
|||||||
{
|
{
|
||||||
if ( pred ) {
|
if ( pred ) {
|
||||||
pred->_logical_op = bool_op;
|
pred->_logical_op = bool_op;
|
||||||
myPredicates.push_back( pred );
|
myPredicates[ myNbPredicates++ ] = pred;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,17 +26,18 @@
|
|||||||
//
|
//
|
||||||
#include "SMESH_Mesh.hxx"
|
#include "SMESH_Mesh.hxx"
|
||||||
#include "SMESH_MesherHelper.hxx"
|
#include "SMESH_MesherHelper.hxx"
|
||||||
#include "SMESH_subMesh.hxx"
|
|
||||||
#include "SMESH_Gen.hxx"
|
|
||||||
#include "SMESH_Hypothesis.hxx"
|
|
||||||
#include "SMESH_Group.hxx"
|
|
||||||
#include "SMESH_HypoFilter.hxx"
|
|
||||||
#include "SMESHDS_Group.hxx"
|
|
||||||
#include "SMESHDS_Script.hxx"
|
|
||||||
#include "SMESHDS_GroupOnGeom.hxx"
|
|
||||||
#include "SMESHDS_Document.hxx"
|
|
||||||
#include "SMDS_MeshVolume.hxx"
|
#include "SMDS_MeshVolume.hxx"
|
||||||
#include "SMDS_SetIterator.hxx"
|
#include "SMDS_SetIterator.hxx"
|
||||||
|
#include "SMESHDS_Document.hxx"
|
||||||
|
#include "SMESHDS_Group.hxx"
|
||||||
|
#include "SMESHDS_GroupOnGeom.hxx"
|
||||||
|
#include "SMESHDS_Script.hxx"
|
||||||
|
#include "SMESHDS_TSubMeshHolder.hxx"
|
||||||
|
#include "SMESH_Gen.hxx"
|
||||||
|
#include "SMESH_Group.hxx"
|
||||||
|
#include "SMESH_HypoFilter.hxx"
|
||||||
|
#include "SMESH_Hypothesis.hxx"
|
||||||
|
#include "SMESH_subMesh.hxx"
|
||||||
|
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
|
||||||
@ -91,6 +92,10 @@ static int MYDEBUG = 0;
|
|||||||
|
|
||||||
typedef SMESH_HypoFilter THypType;
|
typedef SMESH_HypoFilter THypType;
|
||||||
|
|
||||||
|
class SMESH_Mesh::SubMeshHolder : public SMESHDS_TSubMeshHolder< SMESH_subMesh >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
*
|
*
|
||||||
@ -116,6 +121,7 @@ SMESH_Mesh::SMESH_Mesh(int theLocalId,
|
|||||||
_shapeDiagonal = 0.0;
|
_shapeDiagonal = 0.0;
|
||||||
_callUp = NULL;
|
_callUp = NULL;
|
||||||
_myMeshDS->ShapeToMesh( PseudoShape() );
|
_myMeshDS->ShapeToMesh( PseudoShape() );
|
||||||
|
_subMeshHolder = new SubMeshHolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
@ -138,6 +144,7 @@ SMESH_Mesh::SMESH_Mesh():
|
|||||||
_shapeDiagonal( 0.0 ),
|
_shapeDiagonal( 0.0 ),
|
||||||
_callUp( 0 )
|
_callUp( 0 )
|
||||||
{
|
{
|
||||||
|
_subMeshHolder = new SubMeshHolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@ -185,13 +192,7 @@ SMESH_Mesh::~SMESH_Mesh()
|
|||||||
_mapGroup.clear();
|
_mapGroup.clear();
|
||||||
|
|
||||||
// delete sub-meshes
|
// delete sub-meshes
|
||||||
map <int, SMESH_subMesh*>::iterator sm = _mapSubMesh.begin();
|
delete _subMeshHolder;
|
||||||
for ( ; sm != _mapSubMesh.end(); ++sm )
|
|
||||||
{
|
|
||||||
delete sm->second;
|
|
||||||
sm->second = 0;
|
|
||||||
}
|
|
||||||
_mapSubMesh.clear();
|
|
||||||
|
|
||||||
if ( _callUp) delete _callUp;
|
if ( _callUp) delete _callUp;
|
||||||
_callUp = 0;
|
_callUp = 0;
|
||||||
@ -248,10 +249,7 @@ void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape)
|
|||||||
{
|
{
|
||||||
// removal of a shape to mesh, delete objects referring to sub-shapes:
|
// removal of a shape to mesh, delete objects referring to sub-shapes:
|
||||||
// - sub-meshes
|
// - sub-meshes
|
||||||
map <int, SMESH_subMesh *>::iterator i_sm = _mapSubMesh.begin();
|
_subMeshHolder->DeleteAll();
|
||||||
for ( ; i_sm != _mapSubMesh.end(); ++i_sm )
|
|
||||||
delete i_sm->second;
|
|
||||||
_mapSubMesh.clear();
|
|
||||||
// - groups on geometry
|
// - groups on geometry
|
||||||
map <int, SMESH_Group *>::iterator i_gr = _mapGroup.begin();
|
map <int, SMESH_Group *>::iterator i_gr = _mapGroup.begin();
|
||||||
while ( i_gr != _mapGroup.end() ) {
|
while ( i_gr != _mapGroup.end() ) {
|
||||||
@ -756,7 +754,6 @@ const list<const SMESHDS_Hypothesis*>&
|
|||||||
SMESH_Mesh::GetHypothesisList(const TopoDS_Shape & aSubShape) const
|
SMESH_Mesh::GetHypothesisList(const TopoDS_Shape & aSubShape) const
|
||||||
throw(SALOME_Exception)
|
throw(SALOME_Exception)
|
||||||
{
|
{
|
||||||
Unexpect aCatch(SalomeException);
|
|
||||||
return _myMeshDS->GetHypothesis(aSubShape);
|
return _myMeshDS->GetHypothesis(aSubShape);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -790,9 +787,9 @@ 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
|
||||||
const list<SMESH_subMesh*> smList = getAncestorsSubMeshes( aSubShape );
|
getAncestorsSubMeshes( aSubShape, _ancestorSubMeshes );
|
||||||
list<SMESH_subMesh*>::const_iterator smIt = smList.begin();
|
vector<SMESH_subMesh*>::const_iterator smIt = _ancestorSubMeshes.begin();
|
||||||
for ( ; smIt != smList.end(); smIt++ )
|
for ( ; smIt != _ancestorSubMeshes.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);
|
||||||
@ -863,18 +860,18 @@ int SMESH_Mesh::GetHypotheses(const TopoDS_Shape & aSubShape,
|
|||||||
TopTools_MapOfShape map;
|
TopTools_MapOfShape map;
|
||||||
|
|
||||||
// user sorted submeshes of ancestors, according to stored submesh priority
|
// user sorted submeshes of ancestors, according to stored submesh priority
|
||||||
const list<SMESH_subMesh*> smList = getAncestorsSubMeshes( aSubShape );
|
getAncestorsSubMeshes( aSubShape, _ancestorSubMeshes );
|
||||||
list<SMESH_subMesh*>::const_iterator smIt = smList.begin();
|
vector<SMESH_subMesh*>::const_iterator smIt = _ancestorSubMeshes.begin();
|
||||||
for ( ; smIt != smList.end(); smIt++ )
|
for ( ; smIt != _ancestorSubMeshes.end(); smIt++ )
|
||||||
{
|
{
|
||||||
const TopoDS_Shape& curSh = (*smIt)->GetSubShape();
|
const TopoDS_Shape& curSh = (*smIt)->GetSubShape();
|
||||||
if ( !map.Add( curSh ))
|
if ( !map.Add( curSh ))
|
||||||
continue;
|
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 )) &&
|
||||||
( cSMESH_Hyp(*hyp)->IsAuxiliary() || !mainHypFound ) &&
|
( cSMESH_Hyp(*hyp)->IsAuxiliary() || !mainHypFound ) &&
|
||||||
hypTypes.insert( (*hyp)->GetName() ).second )
|
( hypTypes.insert( (*hyp)->GetName() ).second ))
|
||||||
{
|
{
|
||||||
aHypList.push_back( *hyp );
|
aHypList.push_back( *hyp );
|
||||||
nbHyps++;
|
nbHyps++;
|
||||||
@ -937,8 +934,6 @@ void SMESH_Mesh::ClearLog() throw(SALOME_Exception)
|
|||||||
SMESH_subMesh *SMESH_Mesh::GetSubMesh(const TopoDS_Shape & aSubShape)
|
SMESH_subMesh *SMESH_Mesh::GetSubMesh(const TopoDS_Shape & aSubShape)
|
||||||
throw(SALOME_Exception)
|
throw(SALOME_Exception)
|
||||||
{
|
{
|
||||||
Unexpect aCatch(SalomeException);
|
|
||||||
SMESH_subMesh *aSubMesh;
|
|
||||||
int index = _myMeshDS->ShapeToIndex(aSubShape);
|
int index = _myMeshDS->ShapeToIndex(aSubShape);
|
||||||
|
|
||||||
// for submeshes on GEOM Group
|
// for submeshes on GEOM Group
|
||||||
@ -955,15 +950,11 @@ SMESH_subMesh *SMESH_Mesh::GetSubMesh(const TopoDS_Shape & aSubShape)
|
|||||||
// if ( !index )
|
// if ( !index )
|
||||||
// return NULL; // neither sub-shape nor a group
|
// return NULL; // neither sub-shape nor a group
|
||||||
|
|
||||||
map <int, SMESH_subMesh *>::iterator i_sm = _mapSubMesh.find(index);
|
SMESH_subMesh* aSubMesh = _subMeshHolder->Get( index );
|
||||||
if ( i_sm != _mapSubMesh.end())
|
if ( !aSubMesh )
|
||||||
{
|
|
||||||
aSubMesh = i_sm->second;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
aSubMesh = new SMESH_subMesh(index, this, _myMeshDS, aSubShape);
|
aSubMesh = new SMESH_subMesh(index, this, _myMeshDS, aSubShape);
|
||||||
_mapSubMesh[index] = aSubMesh;
|
_subMeshHolder->Add( index, aSubMesh );
|
||||||
}
|
}
|
||||||
return aSubMesh;
|
return aSubMesh;
|
||||||
}
|
}
|
||||||
@ -978,17 +969,10 @@ SMESH_subMesh *SMESH_Mesh::GetSubMesh(const TopoDS_Shape & aSubShape)
|
|||||||
SMESH_subMesh *SMESH_Mesh::GetSubMeshContaining(const TopoDS_Shape & aSubShape) const
|
SMESH_subMesh *SMESH_Mesh::GetSubMeshContaining(const TopoDS_Shape & aSubShape) const
|
||||||
throw(SALOME_Exception)
|
throw(SALOME_Exception)
|
||||||
{
|
{
|
||||||
Unexpect aCatch(SalomeException);
|
|
||||||
SMESH_subMesh *aSubMesh = NULL;
|
|
||||||
|
|
||||||
int index = _myMeshDS->ShapeToIndex(aSubShape);
|
int index = _myMeshDS->ShapeToIndex(aSubShape);
|
||||||
|
return GetSubMeshContaining( index );
|
||||||
map <int, SMESH_subMesh *>::const_iterator i_sm = _mapSubMesh.find(index);
|
|
||||||
if ( i_sm != _mapSubMesh.end())
|
|
||||||
aSubMesh = i_sm->second;
|
|
||||||
|
|
||||||
return aSubMesh;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* Get the SMESH_subMesh object implementation. Dont create it, return null
|
* Get the SMESH_subMesh object implementation. Dont create it, return null
|
||||||
@ -999,13 +983,11 @@ SMESH_subMesh *SMESH_Mesh::GetSubMeshContaining(const TopoDS_Shape & aSubShape)
|
|||||||
SMESH_subMesh *SMESH_Mesh::GetSubMeshContaining(const int aShapeID) const
|
SMESH_subMesh *SMESH_Mesh::GetSubMeshContaining(const int aShapeID) const
|
||||||
throw(SALOME_Exception)
|
throw(SALOME_Exception)
|
||||||
{
|
{
|
||||||
Unexpect aCatch(SalomeException);
|
SMESH_subMesh *aSubMesh = _subMeshHolder->Get( aShapeID );
|
||||||
|
|
||||||
map <int, SMESH_subMesh *>::const_iterator i_sm = _mapSubMesh.find(aShapeID);
|
return aSubMesh;
|
||||||
if (i_sm == _mapSubMesh.end())
|
|
||||||
return NULL;
|
|
||||||
return i_sm->second;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Return submeshes of groups containing the given sub-shape
|
* \brief Return submeshes of groups containing the given sub-shape
|
||||||
@ -1016,7 +998,6 @@ list<SMESH_subMesh*>
|
|||||||
SMESH_Mesh::GetGroupSubMeshesContaining(const TopoDS_Shape & aSubShape) const
|
SMESH_Mesh::GetGroupSubMeshesContaining(const TopoDS_Shape & aSubShape) const
|
||||||
throw(SALOME_Exception)
|
throw(SALOME_Exception)
|
||||||
{
|
{
|
||||||
Unexpect aCatch(SalomeException);
|
|
||||||
list<SMESH_subMesh*> found;
|
list<SMESH_subMesh*> found;
|
||||||
|
|
||||||
SMESH_subMesh * subMesh = GetSubMeshContaining(aSubShape);
|
SMESH_subMesh * subMesh = GetSubMeshContaining(aSubShape);
|
||||||
@ -1024,13 +1005,14 @@ SMESH_Mesh::GetGroupSubMeshesContaining(const TopoDS_Shape & aSubShape) const
|
|||||||
return found;
|
return found;
|
||||||
|
|
||||||
// submeshes of groups have max IDs, so search from the map end
|
// submeshes of groups have max IDs, so search from the map end
|
||||||
map<int, SMESH_subMesh *>::const_reverse_iterator i_sm;
|
SMESH_subMeshIteratorPtr smIt( _subMeshHolder->GetIterator( /*reverse=*/true ) );
|
||||||
for ( i_sm = _mapSubMesh.rbegin(); i_sm != _mapSubMesh.rend(); ++i_sm) {
|
while ( smIt->more() ) {
|
||||||
SMESHDS_SubMesh * ds = i_sm->second->GetSubMeshDS();
|
SMESH_subMesh* sm = smIt->next();
|
||||||
|
SMESHDS_SubMesh * ds = sm->GetSubMeshDS();
|
||||||
if ( ds && ds->IsComplexSubmesh() ) {
|
if ( ds && ds->IsComplexSubmesh() ) {
|
||||||
if ( SMESH_MesherHelper::IsSubShape( aSubShape, i_sm->second->GetSubShape() ))
|
if ( SMESH_MesherHelper::IsSubShape( aSubShape, sm->GetSubShape() ))
|
||||||
{
|
{
|
||||||
found.push_back( i_sm->second );
|
found.push_back( sm );
|
||||||
//break;
|
//break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1040,7 +1022,7 @@ SMESH_Mesh::GetGroupSubMeshesContaining(const TopoDS_Shape & aSubShape) const
|
|||||||
|
|
||||||
if ( found.empty() ) // maybe the main shape is a COMPOUND (issue 0021530)
|
if ( found.empty() ) // maybe the main shape is a COMPOUND (issue 0021530)
|
||||||
{
|
{
|
||||||
if ( SMESH_subMesh * mainSM = GetSubMeshContaining(1))
|
if ( SMESH_subMesh * mainSM = GetSubMeshContaining(1) )
|
||||||
if ( mainSM->GetSubShape().ShapeType() == TopAbs_COMPOUND )
|
if ( mainSM->GetSubShape().ShapeType() == TopAbs_COMPOUND )
|
||||||
{
|
{
|
||||||
TopoDS_Iterator it( mainSM->GetSubShape() );
|
TopoDS_Iterator it( mainSM->GetSubShape() );
|
||||||
@ -1077,17 +1059,15 @@ bool SMESH_Mesh::IsUsedHypothesis(SMESHDS_Hypothesis * anHyp,
|
|||||||
if (algo)
|
if (algo)
|
||||||
{
|
{
|
||||||
// look trough hypotheses used by algo
|
// look trough hypotheses used by algo
|
||||||
SMESH_HypoFilter hypoKind;
|
const SMESH_HypoFilter* hypoKind;
|
||||||
if ( algo->InitCompatibleHypoFilter( hypoKind, !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( aSubShape, *hypoKind, usedHyps, true ))
|
||||||
return ( find( usedHyps.begin(), usedHyps.end(), anHyp ) != usedHyps.end() );
|
return ( find( usedHyps.begin(), usedHyps.end(), anHyp ) != usedHyps.end() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// look through all assigned hypotheses
|
return false;
|
||||||
//SMESH_HypoFilter filter( SMESH_HypoFilter::Is( hyp ));
|
|
||||||
return false; //GetHypothesis( aSubShape, filter, true );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -1096,22 +1076,20 @@ bool SMESH_Mesh::IsUsedHypothesis(SMESHDS_Hypothesis * anHyp,
|
|||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
const list < SMESH_subMesh * >&
|
// const list < SMESH_subMesh * >&
|
||||||
SMESH_Mesh::GetSubMeshUsingHypothesis(SMESHDS_Hypothesis * anHyp)
|
// SMESH_Mesh::GetSubMeshUsingHypothesis(SMESHDS_Hypothesis * anHyp)
|
||||||
throw(SALOME_Exception)
|
// throw(SALOME_Exception)
|
||||||
{
|
// {
|
||||||
Unexpect aCatch(SalomeException);
|
// _subMeshesUsingHypothesisList.clear();
|
||||||
if(MYDEBUG) MESSAGE("SMESH_Mesh::GetSubMeshUsingHypothesis");
|
// SMESH_subMeshIteratorPtr smIt( _subMeshHolder->GetIterator() );
|
||||||
map < int, SMESH_subMesh * >::iterator itsm;
|
// while ( smIt->more() )
|
||||||
_subMeshesUsingHypothesisList.clear();
|
// {
|
||||||
for (itsm = _mapSubMesh.begin(); itsm != _mapSubMesh.end(); itsm++)
|
// SMESH_subMesh* aSubMesh = smIt->next();
|
||||||
{
|
// if ( IsUsedHypothesis ( anHyp, aSubMesh ))
|
||||||
SMESH_subMesh *aSubMesh = (*itsm).second;
|
// _subMeshesUsingHypothesisList.push_back( aSubMesh );
|
||||||
if ( IsUsedHypothesis ( anHyp, aSubMesh ))
|
// }
|
||||||
_subMeshesUsingHypothesisList.push_back(aSubMesh);
|
// return _subMeshesUsingHypothesisList;
|
||||||
}
|
// }
|
||||||
return _subMeshesUsingHypothesisList;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : NotifySubMeshesHypothesisModification
|
//function : NotifySubMeshesHypothesisModification
|
||||||
@ -1128,45 +1106,39 @@ void SMESH_Mesh::NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* h
|
|||||||
if (_callUp)
|
if (_callUp)
|
||||||
_callUp->HypothesisModified();
|
_callUp->HypothesisModified();
|
||||||
|
|
||||||
const SMESH_Algo *foundAlgo = 0;
|
SMESH_Algo *algo;
|
||||||
SMESH_HypoFilter algoKind, compatibleHypoKind;
|
const SMESH_HypoFilter* compatibleHypoKind;
|
||||||
list <const SMESHDS_Hypothesis * > usedHyps;
|
list <const SMESHDS_Hypothesis * > usedHyps;
|
||||||
|
|
||||||
|
SMESH_subMeshIteratorPtr smIt( _subMeshHolder->GetIterator() );
|
||||||
map < int, SMESH_subMesh * >::iterator itsm;
|
while ( smIt->more() )
|
||||||
for (itsm = _mapSubMesh.begin(); itsm != _mapSubMesh.end(); itsm++)
|
|
||||||
{
|
{
|
||||||
SMESH_subMesh *aSubMesh = (*itsm).second;
|
SMESH_subMesh* aSubMesh = smIt->next();
|
||||||
if ( aSubMesh->IsApplicableHypotesis( hyp ))
|
|
||||||
|
// if aSubMesh meshing depends on hyp,
|
||||||
|
// we call aSubMesh->AlgoStateEngine( MODIF_HYP, hyp ) that causes either
|
||||||
|
// 1) clearing of already computed aSubMesh or
|
||||||
|
// 2) changing algo_state from MISSING_HYP to HYP_OK when parameters of hyp becomes valid,
|
||||||
|
// other possible changes are not interesting. (IPAL0052457 - assigning hyp performance pb)
|
||||||
|
if ( aSubMesh->GetComputeState() != SMESH_subMesh::COMPUTE_OK &&
|
||||||
|
aSubMesh->GetComputeState() != SMESH_subMesh::FAILED_TO_COMPUTE &&
|
||||||
|
aSubMesh->GetAlgoState() != SMESH_subMesh::MISSING_HYP )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const TopoDS_Shape & aSubShape = aSubMesh->GetSubShape();
|
||||||
|
|
||||||
|
if (( aSubMesh->IsApplicableHypotesis( hyp )) &&
|
||||||
|
( algo = aSubMesh->GetAlgo() ) &&
|
||||||
|
( compatibleHypoKind = algo->GetCompatibleHypoFilter( !hyp->IsAuxiliary() )) &&
|
||||||
|
( compatibleHypoKind->IsOk( hyp, aSubShape )))
|
||||||
{
|
{
|
||||||
const TopoDS_Shape & aSubShape = aSubMesh->GetSubShape();
|
// check if hyp is used by algo
|
||||||
|
usedHyps.clear();
|
||||||
if ( !foundAlgo ) // init filter for algo search
|
if ( GetHypotheses( aSubShape, *compatibleHypoKind, usedHyps, true ) &&
|
||||||
algoKind.Init( THypType::IsAlgo() ).And( THypType::IsApplicableTo( aSubShape ));
|
find( usedHyps.begin(), usedHyps.end(), hyp ) != usedHyps.end() )
|
||||||
|
|
||||||
const SMESH_Algo *algo = static_cast<const SMESH_Algo*>
|
|
||||||
( GetHypothesis( aSubShape, algoKind, true ));
|
|
||||||
|
|
||||||
if ( algo )
|
|
||||||
{
|
{
|
||||||
bool sameAlgo = ( algo == foundAlgo );
|
aSubMesh->AlgoStateEngine(SMESH_subMesh::MODIF_HYP,
|
||||||
if ( !sameAlgo && foundAlgo )
|
const_cast< SMESH_Hypothesis*>( hyp ));
|
||||||
sameAlgo = ( strcmp( algo->GetName(), foundAlgo->GetName() ) == 0);
|
|
||||||
|
|
||||||
if ( !sameAlgo ) { // init filter for used hypos search
|
|
||||||
if ( !algo->InitCompatibleHypoFilter( compatibleHypoKind, !hyp->IsAuxiliary() ))
|
|
||||||
continue; // algo does not use any hypothesis
|
|
||||||
foundAlgo = algo;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if hyp is used by algo
|
|
||||||
usedHyps.clear();
|
|
||||||
if ( GetHypotheses( aSubShape, compatibleHypoKind, usedHyps, true ) &&
|
|
||||||
find( usedHyps.begin(), usedHyps.end(), hyp ) != usedHyps.end() )
|
|
||||||
{
|
|
||||||
aSubMesh->AlgoStateEngine(SMESH_subMesh::MODIF_HYP,
|
|
||||||
const_cast< SMESH_Hypothesis*>( hyp ));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1221,21 +1193,23 @@ bool SMESH_Mesh::HasModificationsToDiscard() const
|
|||||||
// return true if the next Compute() will be partial and
|
// return true if the next Compute() will be partial and
|
||||||
// existing but changed elements may prevent successful re-compute
|
// existing but changed elements may prevent successful re-compute
|
||||||
bool hasComputed = false, hasNotComputed = false;
|
bool hasComputed = false, hasNotComputed = false;
|
||||||
map <int, SMESH_subMesh*>::const_iterator i_sm = _mapSubMesh.begin();
|
SMESH_subMeshIteratorPtr smIt( _subMeshHolder->GetIterator() );
|
||||||
for ( ; i_sm != _mapSubMesh.end() ; ++i_sm )
|
while ( smIt->more() )
|
||||||
switch ( i_sm->second->GetSubShape().ShapeType() )
|
{
|
||||||
|
const SMESH_subMesh* aSubMesh = smIt->next();
|
||||||
|
switch ( aSubMesh->GetSubShape().ShapeType() )
|
||||||
{
|
{
|
||||||
case TopAbs_EDGE:
|
case TopAbs_EDGE:
|
||||||
case TopAbs_FACE:
|
case TopAbs_FACE:
|
||||||
case TopAbs_SOLID:
|
case TopAbs_SOLID:
|
||||||
if ( i_sm->second->IsMeshComputed() )
|
if ( aSubMesh->IsMeshComputed() )
|
||||||
hasComputed = true;
|
hasComputed = true;
|
||||||
else
|
else
|
||||||
hasNotComputed = true;
|
hasNotComputed = true;
|
||||||
if ( hasComputed && hasNotComputed)
|
if ( hasComputed && hasNotComputed)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if ( NbNodes() < 1 )
|
if ( NbNodes() < 1 )
|
||||||
const_cast<SMESH_Mesh*>(this)->_isModified = false;
|
const_cast<SMESH_Mesh*>(this)->_isModified = false;
|
||||||
|
|
||||||
@ -2147,7 +2121,6 @@ const TListOfListOfInt& SMESH_Mesh::GetMeshOrder() const
|
|||||||
|
|
||||||
void SMESH_Mesh::fillAncestorsMap(const TopoDS_Shape& theShape)
|
void SMESH_Mesh::fillAncestorsMap(const TopoDS_Shape& theShape)
|
||||||
{
|
{
|
||||||
|
|
||||||
int desType, ancType;
|
int desType, ancType;
|
||||||
if ( !theShape.IsSame( GetShapeToMesh()) && theShape.ShapeType() == TopAbs_COMPOUND )
|
if ( !theShape.IsSame( GetShapeToMesh()) && theShape.ShapeType() == TopAbs_COMPOUND )
|
||||||
{
|
{
|
||||||
@ -2193,16 +2166,16 @@ void SMESH_Mesh::fillAncestorsMap(const TopoDS_Shape& theShape)
|
|||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
bool SMESH_Mesh::SortByMeshOrder(list<SMESH_subMesh*>& theListToSort) const
|
bool SMESH_Mesh::SortByMeshOrder(std::vector<SMESH_subMesh*>& theListToSort) const
|
||||||
{
|
{
|
||||||
if ( !_mySubMeshOrder.size() || theListToSort.size() < 2)
|
if ( !_mySubMeshOrder.size() || theListToSort.size() < 2)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
bool res = false;
|
bool res = false;
|
||||||
list<SMESH_subMesh*> onlyOrderedList;
|
vector<SMESH_subMesh*> onlyOrderedList;
|
||||||
// collect all ordered submeshes in one list as pointers
|
// collect all ordered submeshes in one list as pointers
|
||||||
// and get their positions within theListToSort
|
// and get their positions within theListToSort
|
||||||
typedef list<SMESH_subMesh*>::iterator TPosInList;
|
typedef vector<SMESH_subMesh*>::iterator TPosInList;
|
||||||
map< int, TPosInList > sortedPos;
|
map< int, TPosInList > sortedPos;
|
||||||
TPosInList smBeg = theListToSort.begin(), smEnd = theListToSort.end();
|
TPosInList smBeg = theListToSort.begin(), smEnd = theListToSort.end();
|
||||||
TListOfListOfInt::const_iterator listIdsIt = _mySubMeshOrder.begin();
|
TListOfListOfInt::const_iterator listIdsIt = _mySubMeshOrder.begin();
|
||||||
@ -2244,8 +2217,8 @@ bool SMESH_Mesh::SortByMeshOrder(list<SMESH_subMesh*>& theListToSort) const
|
|||||||
return res;
|
return res;
|
||||||
res = true;
|
res = true;
|
||||||
|
|
||||||
list<SMESH_subMesh*>::iterator onlyBIt = onlyOrderedList.begin();
|
vector<SMESH_subMesh*>::iterator onlyBIt = onlyOrderedList.begin();
|
||||||
list<SMESH_subMesh*>::iterator onlyEIt = onlyOrderedList.end();
|
vector<SMESH_subMesh*>::iterator onlyEIt = onlyOrderedList.end();
|
||||||
|
|
||||||
// iterate on ordered submeshes and insert them in detected positions
|
// iterate on ordered submeshes and insert them in detected positions
|
||||||
map< int, TPosInList >::iterator i_pos = sortedPos.begin();
|
map< int, TPosInList >::iterator i_pos = sortedPos.begin();
|
||||||
@ -2287,17 +2260,15 @@ bool SMESH_Mesh::IsOrderOK( const SMESH_subMesh* smBefore,
|
|||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
list<SMESH_subMesh*>
|
void SMESH_Mesh::getAncestorsSubMeshes (const TopoDS_Shape& theSubShape,
|
||||||
SMESH_Mesh::getAncestorsSubMeshes (const TopoDS_Shape& theSubShape) const
|
std::vector< SMESH_subMesh* >& theSubMeshes) const
|
||||||
{
|
{
|
||||||
list<SMESH_subMesh*> listOfSubMesh;
|
theSubMeshes.clear();
|
||||||
TopTools_ListIteratorOfListOfShape it( GetAncestors( theSubShape ));
|
TopTools_ListIteratorOfListOfShape it( GetAncestors( theSubShape ));
|
||||||
for (; it.More(); it.Next() )
|
for (; it.More(); it.Next() )
|
||||||
if ( SMESH_subMesh* sm = GetSubMeshContaining( it.Value() ))
|
if ( SMESH_subMesh* sm = GetSubMeshContaining( it.Value() ))
|
||||||
listOfSubMesh.push_back(sm);
|
theSubMeshes.push_back(sm);
|
||||||
|
|
||||||
// sort submeshes according to stored mesh order
|
// sort submeshes according to stored mesh order
|
||||||
SortByMeshOrder( listOfSubMesh );
|
SortByMeshOrder( theSubMeshes );
|
||||||
|
|
||||||
return listOfSubMesh;
|
|
||||||
}
|
}
|
||||||
|
@ -182,8 +182,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
void NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* theChangedHyp);
|
void NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* theChangedHyp);
|
||||||
|
|
||||||
const std::list < SMESH_subMesh * >&
|
// const std::list < SMESH_subMesh * >&
|
||||||
GetSubMeshUsingHypothesis(SMESHDS_Hypothesis * anHyp) throw(SALOME_Exception);
|
// GetSubMeshUsingHypothesis(SMESHDS_Hypothesis * anHyp) throw(SALOME_Exception);
|
||||||
/*!
|
/*!
|
||||||
* \brief Return True if anHyp is used to mesh aSubShape
|
* \brief Return True if anHyp is used to mesh aSubShape
|
||||||
*/
|
*/
|
||||||
@ -322,7 +322,7 @@ public:
|
|||||||
const TListOfListOfInt& GetMeshOrder() const;
|
const TListOfListOfInt& GetMeshOrder() const;
|
||||||
|
|
||||||
// sort submeshes according to stored mesh order
|
// sort submeshes according to stored mesh order
|
||||||
bool SortByMeshOrder(std::list<SMESH_subMesh*>& theListToSort) const;
|
bool SortByMeshOrder(std::vector<SMESH_subMesh*>& theListToSort) const;
|
||||||
|
|
||||||
// return true if given order of sub-meshes is OK
|
// return true if given order of sub-meshes is OK
|
||||||
bool IsOrderOK( const SMESH_subMesh* smBefore,
|
bool IsOrderOK( const SMESH_subMesh* smBefore,
|
||||||
@ -333,8 +333,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
void fillAncestorsMap(const TopoDS_Shape& theShape);
|
void fillAncestorsMap(const TopoDS_Shape& theShape);
|
||||||
std::list<SMESH_subMesh*> getAncestorsSubMeshes
|
void getAncestorsSubMeshes(const TopoDS_Shape& theSubShape,
|
||||||
(const TopoDS_Shape& theSubShape) const;
|
std::vector< SMESH_subMesh* >& theSubMeshes) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int _id; // id given by creator (unique within the creator instance)
|
int _id; // id given by creator (unique within the creator instance)
|
||||||
@ -342,12 +342,14 @@ protected:
|
|||||||
int _groupId; // id generator for group objects
|
int _groupId; // id generator for group objects
|
||||||
int _nbSubShapes; // initial nb of subshapes in the shape to mesh
|
int _nbSubShapes; // initial nb of subshapes in the shape to mesh
|
||||||
bool _isShapeToMesh;// set to true when a shape is given (only once)
|
bool _isShapeToMesh;// set to true when a shape is given (only once)
|
||||||
std::list <SMESH_subMesh*> _subMeshesUsingHypothesisList;
|
//std::list <SMESH_subMesh*> _subMeshesUsingHypothesisList;
|
||||||
SMESHDS_Document * _myDocument;
|
SMESHDS_Document * _myDocument;
|
||||||
SMESHDS_Mesh * _myMeshDS;
|
SMESHDS_Mesh * _myMeshDS;
|
||||||
SMESH_Gen * _gen;
|
SMESH_Gen * _gen;
|
||||||
std::map <int, SMESH_subMesh*> _mapSubMesh;
|
std::map <int, SMESH_Group*> _mapGroup;
|
||||||
std::map <int, SMESH_Group*> _mapGroup;
|
|
||||||
|
class SubMeshHolder;
|
||||||
|
SubMeshHolder* _subMeshHolder;
|
||||||
|
|
||||||
bool _isAutoColor;
|
bool _isAutoColor;
|
||||||
bool _isModified; //!< modified since last total re-compute, issue 0020693
|
bool _isModified; //!< modified since last total re-compute, issue 0020693
|
||||||
@ -356,11 +358,13 @@ protected:
|
|||||||
|
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape _mapAncestors;
|
TopTools_IndexedDataMapOfShapeListOfShape _mapAncestors;
|
||||||
|
|
||||||
|
mutable std::vector<SMESH_subMesh*> _ancestorSubMeshes; // to speed up GetHypothes[ei]s()
|
||||||
|
|
||||||
TListOfListOfInt _mySubMeshOrder;
|
TListOfListOfInt _mySubMeshOrder;
|
||||||
|
|
||||||
// Struct calling methods at CORBA API implementation level, used to
|
// Struct calling methods at CORBA API implementation level, used to
|
||||||
// 1) make an upper level be consistent with a lower one when group removal
|
// 1) make an upper level (SMESH_I) be consistent with a lower one (SMESH)
|
||||||
// is invoked by hyp modification (issue 0020918)
|
// when group removal is invoked by hyp modification (issue 0020918)
|
||||||
// 2) to forget not loaded mesh data at hyp modification
|
// 2) to forget not loaded mesh data at hyp modification
|
||||||
TCallUp* _callUp;
|
TCallUp* _callUp;
|
||||||
|
|
||||||
|
@ -518,14 +518,12 @@ int SMESH_MeshEditor::FindShape (const SMDS_MeshElement * theElem)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const map<int,SMESHDS_SubMesh*>& id2sm = GetMeshDS()->SubMeshes();
|
SMESHDS_SubMeshIteratorPtr smIt = GetMeshDS()->SubMeshes();
|
||||||
map<int,SMESHDS_SubMesh*>::const_iterator id_sm = id2sm.begin();
|
while ( const SMESHDS_SubMesh* sm = smIt->next() )
|
||||||
for ( ; id_sm != id2sm.end(); ++id_sm )
|
if ( sm->Contains( theElem ))
|
||||||
if ( id_sm->second->Contains( theElem ))
|
return sm->GetID();
|
||||||
return id_sm->first;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//MESSAGE ("::FindShape() - SHAPE NOT FOUND")
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,14 +27,15 @@
|
|||||||
//
|
//
|
||||||
#include "SMESHDS_Mesh.hxx"
|
#include "SMESHDS_Mesh.hxx"
|
||||||
|
|
||||||
#include "SMESHDS_Group.hxx"
|
#include "SMDS_Downward.hxx"
|
||||||
#include "SMDS_VertexPosition.hxx"
|
|
||||||
#include "SMDS_EdgePosition.hxx"
|
#include "SMDS_EdgePosition.hxx"
|
||||||
#include "SMDS_FacePosition.hxx"
|
#include "SMDS_FacePosition.hxx"
|
||||||
#include "SMDS_SpacePosition.hxx"
|
#include "SMDS_SpacePosition.hxx"
|
||||||
#include "SMDS_Downward.hxx"
|
#include "SMDS_VertexPosition.hxx"
|
||||||
|
#include "SMESHDS_Group.hxx"
|
||||||
#include "SMESHDS_GroupOnGeom.hxx"
|
#include "SMESHDS_GroupOnGeom.hxx"
|
||||||
#include "SMESHDS_Script.hxx"
|
#include "SMESHDS_Script.hxx"
|
||||||
|
#include "SMESHDS_TSubMeshHolder.hxx"
|
||||||
|
|
||||||
#include <Standard_ErrorHandler.hxx>
|
#include <Standard_ErrorHandler.hxx>
|
||||||
#include <Standard_OutOfRange.hxx>
|
#include <Standard_OutOfRange.hxx>
|
||||||
@ -51,17 +52,20 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
class SMESHDS_Mesh::SubMeshHolder : public SMESHDS_TSubMeshHolder< const SMESHDS_SubMesh >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Create
|
//function : Create
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
SMESHDS_Mesh::SMESHDS_Mesh(int theMeshID, bool theIsEmbeddedMode):
|
SMESHDS_Mesh::SMESHDS_Mesh(int theMeshID, bool theIsEmbeddedMode):
|
||||||
myMeshID(theMeshID),
|
myMeshID(theMeshID),
|
||||||
myIsEmbeddedMode(theIsEmbeddedMode),
|
mySubMeshHolder( new SubMeshHolder ),
|
||||||
myCurSubID(-1)
|
myIsEmbeddedMode(theIsEmbeddedMode)
|
||||||
{
|
{
|
||||||
myScript = new SMESHDS_Script(theIsEmbeddedMode);
|
myScript = new SMESHDS_Script(theIsEmbeddedMode);
|
||||||
myCurSubMesh = 0;
|
|
||||||
SetPersistentId(theMeshID);
|
SetPersistentId(theMeshID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,19 +111,17 @@ void SMESHDS_Mesh::ShapeToMesh(const TopoDS_Shape & S)
|
|||||||
// - hypotheses
|
// - hypotheses
|
||||||
myShapeToHypothesis.Clear();
|
myShapeToHypothesis.Clear();
|
||||||
// - shape indices in SMDS_Position of nodes
|
// - shape indices in SMDS_Position of nodes
|
||||||
map<int,SMESHDS_SubMesh*>::iterator i_sub = myShapeIndexToSubMesh.begin();
|
SMESHDS_SubMeshIteratorPtr smIt = SubMeshes();
|
||||||
for ( ; i_sub != myShapeIndexToSubMesh.end(); i_sub++ ) {
|
while ( SMESHDS_SubMesh* sm = const_cast< SMESHDS_SubMesh* >( smIt->next() )) {
|
||||||
if ( !i_sub->second->IsComplexSubmesh() ) {
|
if ( !sm->IsComplexSubmesh() ) {
|
||||||
SMDS_NodeIteratorPtr nIt = i_sub->second->GetNodes();
|
SMDS_NodeIteratorPtr nIt = sm->GetNodes();
|
||||||
while ( nIt->more() )
|
while ( nIt->more() )
|
||||||
i_sub->second->RemoveNode(nIt->next(), false);
|
sm->RemoveNode(nIt->next(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// - sub-meshes
|
// - sub-meshes
|
||||||
TShapeIndexToSubMesh::iterator i_sm = myShapeIndexToSubMesh.begin();
|
mySubMeshHolder->DeleteAll();
|
||||||
for ( ; i_sm != myShapeIndexToSubMesh.end(); ++i_sm )
|
|
||||||
delete i_sm->second;
|
|
||||||
myShapeIndexToSubMesh.clear();
|
|
||||||
myIndexToShape.Clear();
|
myIndexToShape.Clear();
|
||||||
// - groups on geometry
|
// - groups on geometry
|
||||||
set<SMESHDS_GroupBase*>::iterator gr = myGroups.begin();
|
set<SMESHDS_GroupBase*>::iterator gr = myGroups.begin();
|
||||||
@ -145,12 +147,12 @@ void SMESHDS_Mesh::ShapeToMesh(const TopoDS_Shape & S)
|
|||||||
bool SMESHDS_Mesh::AddHypothesis(const TopoDS_Shape & SS,
|
bool SMESHDS_Mesh::AddHypothesis(const TopoDS_Shape & SS,
|
||||||
const SMESHDS_Hypothesis * H)
|
const SMESHDS_Hypothesis * H)
|
||||||
{
|
{
|
||||||
if (!myShapeToHypothesis.IsBound(SS.Oriented(TopAbs_FORWARD))) {
|
if (!myShapeToHypothesis.IsBound(SS/*.Oriented(TopAbs_FORWARD)*/)) {
|
||||||
list<const SMESHDS_Hypothesis *> aList;
|
list<const SMESHDS_Hypothesis *> aList;
|
||||||
myShapeToHypothesis.Bind(SS.Oriented(TopAbs_FORWARD), aList);
|
myShapeToHypothesis.Bind(SS/*.Oriented(TopAbs_FORWARD)*/, aList);
|
||||||
}
|
}
|
||||||
list<const SMESHDS_Hypothesis *>& alist =
|
list<const SMESHDS_Hypothesis *>& alist =
|
||||||
myShapeToHypothesis(SS.Oriented(TopAbs_FORWARD)); // ignore orientation of SS
|
myShapeToHypothesis(SS/*.Oriented(TopAbs_FORWARD)*/); // ignore orientation of SS
|
||||||
|
|
||||||
//Check if the Hypothesis is still present
|
//Check if the Hypothesis is still present
|
||||||
list<const SMESHDS_Hypothesis*>::iterator ith = find(alist.begin(),alist.end(), H );
|
list<const SMESHDS_Hypothesis*>::iterator ith = find(alist.begin(),alist.end(), H );
|
||||||
@ -169,9 +171,9 @@ bool SMESHDS_Mesh::AddHypothesis(const TopoDS_Shape & SS,
|
|||||||
bool SMESHDS_Mesh::RemoveHypothesis(const TopoDS_Shape & S,
|
bool SMESHDS_Mesh::RemoveHypothesis(const TopoDS_Shape & S,
|
||||||
const SMESHDS_Hypothesis * H)
|
const SMESHDS_Hypothesis * H)
|
||||||
{
|
{
|
||||||
if( myShapeToHypothesis.IsBound( S.Oriented(TopAbs_FORWARD) ) )
|
if( myShapeToHypothesis.IsBound( S/*.Oriented(TopAbs_FORWARD)*/ ) )
|
||||||
{
|
{
|
||||||
list<const SMESHDS_Hypothesis *>& alist=myShapeToHypothesis.ChangeFind( S.Oriented(TopAbs_FORWARD) );
|
list<const SMESHDS_Hypothesis *>& alist=myShapeToHypothesis.ChangeFind( S/*.Oriented(TopAbs_FORWARD)*/ );
|
||||||
list<const SMESHDS_Hypothesis*>::iterator ith=find(alist.begin(),alist.end(), H );
|
list<const SMESHDS_Hypothesis*>::iterator ith=find(alist.begin(),alist.end(), H );
|
||||||
if (ith != alist.end())
|
if (ith != alist.end())
|
||||||
{
|
{
|
||||||
@ -790,7 +792,7 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddPolyhedralVolume
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
static void removeFromContainers (map<int,SMESHDS_SubMesh*>& theSubMeshes,
|
static void removeFromContainers (SMESHDS_Mesh* theMesh,
|
||||||
set<SMESHDS_GroupBase*>& theGroups,
|
set<SMESHDS_GroupBase*>& theGroups,
|
||||||
list<const SMDS_MeshElement*>& theElems,
|
list<const SMDS_MeshElement*>& theElems,
|
||||||
const bool isNode)
|
const bool isNode)
|
||||||
@ -821,18 +823,17 @@ static void removeFromContainers (map<int,SMESHDS_SubMesh*>& theSubMeshes,
|
|||||||
|
|
||||||
// Rm from sub-meshes
|
// Rm from sub-meshes
|
||||||
// Element should belong to only one sub-mesh
|
// Element should belong to only one sub-mesh
|
||||||
if ( !theSubMeshes.empty() )
|
if ( theMesh->SubMeshes()->more() )
|
||||||
{
|
{
|
||||||
SMESHDS_Mesh* mesh = theSubMeshes.begin()->second->GetParent();
|
|
||||||
list<const SMDS_MeshElement *>::iterator elIt = theElems.begin();
|
list<const SMDS_MeshElement *>::iterator elIt = theElems.begin();
|
||||||
if ( isNode ) {
|
if ( isNode ) {
|
||||||
for ( ; elIt != theElems.end(); ++elIt )
|
for ( ; elIt != theElems.end(); ++elIt )
|
||||||
if ( SMESHDS_SubMesh* sm = mesh->MeshElements( (*elIt)->getshapeId() ))
|
if ( SMESHDS_SubMesh* sm = theMesh->MeshElements( (*elIt)->getshapeId() ))
|
||||||
sm->RemoveNode( static_cast<const SMDS_MeshNode*> (*elIt), deleted );
|
sm->RemoveNode( static_cast<const SMDS_MeshNode*> (*elIt), deleted );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for ( ; elIt != theElems.end(); ++elIt )
|
for ( ; elIt != theElems.end(); ++elIt )
|
||||||
if ( SMESHDS_SubMesh* sm = mesh->MeshElements( (*elIt)->getshapeId() ))
|
if ( SMESHDS_SubMesh* sm = theMesh->MeshElements( (*elIt)->getshapeId() ))
|
||||||
sm->RemoveElement( *elIt, deleted );
|
sm->RemoveElement( *elIt, deleted );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -840,36 +841,34 @@ static void removeFromContainers (map<int,SMESHDS_SubMesh*>& theSubMeshes,
|
|||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : RemoveNode
|
//function : RemoveNode
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void SMESHDS_Mesh::RemoveNode(const SMDS_MeshNode * n)
|
void SMESHDS_Mesh::RemoveNode(const SMDS_MeshNode * n)
|
||||||
{
|
{
|
||||||
if ( n->NbInverseElements() == 0 && !(hasConstructionEdges() || hasConstructionFaces()))
|
if ( n->NbInverseElements() == 0 && !(hasConstructionEdges() || hasConstructionFaces()))
|
||||||
{
|
{
|
||||||
SMESHDS_SubMesh* subMesh=0;
|
SMESHDS_SubMesh* subMesh = MeshElements( n->getshapeId() );
|
||||||
map<int,SMESHDS_SubMesh*>::iterator SubIt =
|
SMESHDS_SubMeshIteratorPtr subIt;
|
||||||
myShapeIndexToSubMesh.find( n->getshapeId() );
|
if ( !subMesh )
|
||||||
if ( SubIt != myShapeIndexToSubMesh.end() )
|
subIt = SubMeshes();
|
||||||
subMesh = SubIt->second;
|
for ( ; !subMesh && subIt->more(); ) {
|
||||||
else
|
subMesh = const_cast< SMESHDS_SubMesh* >( subIt->next() );
|
||||||
SubIt = myShapeIndexToSubMesh.begin();
|
if ( subMesh->IsComplexSubmesh() || !subMesh->Contains( n ))
|
||||||
for ( ; !subMesh && SubIt != myShapeIndexToSubMesh.end(); SubIt++ )
|
subMesh = 0;
|
||||||
if (!SubIt->second->IsComplexSubmesh() && SubIt->second->Contains( n ))
|
}
|
||||||
subMesh = SubIt->second;
|
|
||||||
|
|
||||||
RemoveFreeNode( n, subMesh, true);
|
RemoveFreeNode( n, subMesh, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
myScript->RemoveNode(n->GetID());
|
myScript->RemoveNode(n->GetID());
|
||||||
|
|
||||||
list<const SMDS_MeshElement *> removedElems;
|
list<const SMDS_MeshElement *> removedElems;
|
||||||
list<const SMDS_MeshElement *> removedNodes;
|
list<const SMDS_MeshElement *> removedNodes;
|
||||||
|
|
||||||
SMDS_Mesh::RemoveElement( n, removedElems, removedNodes, true );
|
SMDS_Mesh::RemoveElement( n, removedElems, removedNodes, true );
|
||||||
|
|
||||||
removeFromContainers( myShapeIndexToSubMesh, myGroups, removedElems, false );
|
removeFromContainers( this, myGroups, removedElems, false );
|
||||||
removeFromContainers( myShapeIndexToSubMesh, myGroups, removedNodes, true );
|
removeFromContainers( this, myGroups, removedNodes, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -917,11 +916,8 @@ void SMESHDS_Mesh::RemoveElement(const SMDS_MeshElement * elt)
|
|||||||
{
|
{
|
||||||
SMESHDS_SubMesh* subMesh=0;
|
SMESHDS_SubMesh* subMesh=0;
|
||||||
if ( elt->getshapeId() > 0 )
|
if ( elt->getshapeId() > 0 )
|
||||||
{
|
subMesh = MeshElements( elt->getshapeId() );
|
||||||
map<int,SMESHDS_SubMesh*>::iterator SubIt = myShapeIndexToSubMesh.find( elt->getshapeId() );
|
|
||||||
if ( SubIt != myShapeIndexToSubMesh.end() )
|
|
||||||
subMesh = SubIt->second;
|
|
||||||
}
|
|
||||||
RemoveFreeElement( elt, subMesh, true);
|
RemoveFreeElement( elt, subMesh, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -933,7 +929,7 @@ void SMESHDS_Mesh::RemoveElement(const SMDS_MeshElement * elt)
|
|||||||
|
|
||||||
SMDS_Mesh::RemoveElement(elt, removedElems, removedNodes, false);
|
SMDS_Mesh::RemoveElement(elt, removedElems, removedNodes, false);
|
||||||
|
|
||||||
removeFromContainers( myShapeIndexToSubMesh, myGroups, removedElems, false );
|
removeFromContainers( this, myGroups, removedElems, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -987,9 +983,9 @@ void SMESHDS_Mesh::ClearMesh()
|
|||||||
SMDS_Mesh::Clear();
|
SMDS_Mesh::Clear();
|
||||||
|
|
||||||
// clear submeshes
|
// clear submeshes
|
||||||
map<int,SMESHDS_SubMesh*>::iterator sub, subEnd = myShapeIndexToSubMesh.end();
|
SMESHDS_SubMeshIteratorPtr smIt = SubMeshes();
|
||||||
for ( sub = myShapeIndexToSubMesh.begin(); sub != subEnd; ++sub )
|
while ( SMESHDS_SubMesh* sm = const_cast< SMESHDS_SubMesh* >( smIt->next() ))
|
||||||
sub->second->Clear();
|
sm->Clear();
|
||||||
|
|
||||||
// clear groups
|
// clear groups
|
||||||
TGroups::iterator group, groupEnd = myGroups.end();
|
TGroups::iterator group, groupEnd = myGroups.end();
|
||||||
@ -1011,8 +1007,6 @@ void SMESHDS_Mesh::ClearMesh()
|
|||||||
* \brief return submesh by shape
|
* \brief return submesh by shape
|
||||||
* \param shape - the sub-shape
|
* \param shape - the sub-shape
|
||||||
* \retval SMESHDS_SubMesh* - the found submesh
|
* \retval SMESHDS_SubMesh* - the found submesh
|
||||||
*
|
|
||||||
* search of submeshes is optimized
|
|
||||||
*/
|
*/
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
||||||
@ -1021,35 +1015,7 @@ SMESHDS_SubMesh* SMESHDS_Mesh::getSubmesh( const TopoDS_Shape & shape )
|
|||||||
if ( shape.IsNull() )
|
if ( shape.IsNull() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ( !myCurSubShape.IsNull() && shape.IsSame( myCurSubShape ))
|
return NewSubMesh( ShapeToIndex( shape ));
|
||||||
return myCurSubMesh;
|
|
||||||
|
|
||||||
getSubmesh( ShapeToIndex( shape ));
|
|
||||||
myCurSubShape = shape;
|
|
||||||
return myCurSubMesh;
|
|
||||||
}
|
|
||||||
|
|
||||||
//================================================================================
|
|
||||||
/*!
|
|
||||||
* \brief return submesh by sub-shape index
|
|
||||||
* \param Index - the sub-shape index
|
|
||||||
* \retval SMESHDS_SubMesh* - the found submesh
|
|
||||||
* search of submeshes is optimized
|
|
||||||
*/
|
|
||||||
//================================================================================
|
|
||||||
|
|
||||||
SMESHDS_SubMesh* SMESHDS_Mesh::getSubmesh( const int Index )
|
|
||||||
{
|
|
||||||
//Update or build submesh
|
|
||||||
if ( Index != myCurSubID ) {
|
|
||||||
map<int,SMESHDS_SubMesh*>::iterator it = myShapeIndexToSubMesh.find( Index );
|
|
||||||
if ( it == myShapeIndexToSubMesh.end() )
|
|
||||||
it = myShapeIndexToSubMesh.insert( make_pair(Index, new SMESHDS_SubMesh(this, Index) )).first;
|
|
||||||
myCurSubMesh = it->second;
|
|
||||||
myCurSubID = Index;
|
|
||||||
myCurSubShape.Nullify(); // myCurSubShape no more corresponds to submesh
|
|
||||||
}
|
|
||||||
return myCurSubMesh;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
@ -1142,12 +1108,9 @@ void SMESHDS_Mesh::SetNodeOnVertex(const SMDS_MeshNode * aNode,
|
|||||||
void SMESHDS_Mesh::UnSetNodeOnShape(const SMDS_MeshNode* aNode)
|
void SMESHDS_Mesh::UnSetNodeOnShape(const SMDS_MeshNode* aNode)
|
||||||
{
|
{
|
||||||
int shapeId = aNode->getshapeId();
|
int shapeId = aNode->getshapeId();
|
||||||
if (shapeId >= 0)
|
if (shapeId > 0)
|
||||||
{
|
if ( SMESHDS_SubMesh* sm = MeshElements( shapeId ))
|
||||||
map<int, SMESHDS_SubMesh*>::iterator it = myShapeIndexToSubMesh.find(shapeId);
|
sm->RemoveNode(aNode, /*deleted=*/false);
|
||||||
if (it != myShapeIndexToSubMesh.end())
|
|
||||||
it->second->RemoveNode(aNode, /*deleted=*/false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -1167,16 +1130,13 @@ void SMESHDS_Mesh::SetMeshElementOnShape(const SMDS_MeshElement * anElement,
|
|||||||
void SMESHDS_Mesh::UnSetMeshElementOnShape(const SMDS_MeshElement * elem,
|
void SMESHDS_Mesh::UnSetMeshElementOnShape(const SMDS_MeshElement * elem,
|
||||||
const TopoDS_Shape & S)
|
const TopoDS_Shape & S)
|
||||||
{
|
{
|
||||||
int Index = myIndexToShape.FindIndex(S);
|
if ( SMESHDS_SubMesh* sm = MeshElements( S ))
|
||||||
|
{
|
||||||
map<int,SMESHDS_SubMesh*>::iterator it = myShapeIndexToSubMesh.find( Index );
|
if (elem->GetType() == SMDSAbs_Node)
|
||||||
if ( it != myShapeIndexToSubMesh.end() )
|
sm->RemoveNode(static_cast<const SMDS_MeshNode*> (elem), /*deleted=*/false);
|
||||||
{
|
else
|
||||||
if (elem->GetType() == SMDSAbs_Node)
|
sm->RemoveElement(elem, /*deleted=*/false);
|
||||||
it->second->RemoveNode(static_cast<const SMDS_MeshNode*> (elem), /*deleted=*/false);
|
}
|
||||||
else
|
|
||||||
it->second->RemoveElement(elem, /*deleted=*/false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -1185,7 +1145,7 @@ void SMESHDS_Mesh::UnSetMeshElementOnShape(const SMDS_MeshElement * elem,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
TopoDS_Shape SMESHDS_Mesh::ShapeToMesh() const
|
TopoDS_Shape SMESHDS_Mesh::ShapeToMesh() const
|
||||||
{
|
{
|
||||||
return myShape;
|
return myShape;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -1213,11 +1173,7 @@ bool SMESHDS_Mesh::IsGroupOfSubShapes (const TopoDS_Shape& theShape) const
|
|||||||
SMESHDS_SubMesh * SMESHDS_Mesh::MeshElements(const TopoDS_Shape & S) const
|
SMESHDS_SubMesh * SMESHDS_Mesh::MeshElements(const TopoDS_Shape & S) const
|
||||||
{
|
{
|
||||||
int Index = ShapeToIndex(S);
|
int Index = ShapeToIndex(S);
|
||||||
TShapeIndexToSubMesh::const_iterator anIter = myShapeIndexToSubMesh.find(Index);
|
return (SMESHDS_SubMesh *) ( Index ? mySubMeshHolder->Get( Index ) : 0 );
|
||||||
if (anIter != myShapeIndexToSubMesh.end())
|
|
||||||
return anIter->second;
|
|
||||||
else
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@ -1225,11 +1181,7 @@ SMESHDS_SubMesh * SMESHDS_Mesh::MeshElements(const TopoDS_Shape & S) const
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
SMESHDS_SubMesh * SMESHDS_Mesh::MeshElements(const int Index) const
|
SMESHDS_SubMesh * SMESHDS_Mesh::MeshElements(const int Index) const
|
||||||
{
|
{
|
||||||
TShapeIndexToSubMesh::const_iterator anIter = myShapeIndexToSubMesh.find(Index);
|
return const_cast< SMESHDS_SubMesh* >( mySubMeshHolder->Get( Index ));
|
||||||
if (anIter != myShapeIndexToSubMesh.end())
|
|
||||||
return anIter->second;
|
|
||||||
else
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -1239,13 +1191,23 @@ SMESHDS_SubMesh * SMESHDS_Mesh::MeshElements(const int Index) const
|
|||||||
list<int> SMESHDS_Mesh::SubMeshIndices() const
|
list<int> SMESHDS_Mesh::SubMeshIndices() const
|
||||||
{
|
{
|
||||||
list<int> anIndices;
|
list<int> anIndices;
|
||||||
std::map<int,SMESHDS_SubMesh*>::const_iterator anIter = myShapeIndexToSubMesh.begin();
|
SMESHDS_SubMeshIteratorPtr smIt = SubMeshes();
|
||||||
for (; anIter != myShapeIndexToSubMesh.end(); anIter++) {
|
while ( const SMESHDS_SubMesh* sm = smIt->next() )
|
||||||
anIndices.push_back((*anIter).first);
|
anIndices.push_back( sm->GetID() );
|
||||||
}
|
|
||||||
return anIndices;
|
return anIndices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : SubMeshes
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
SMESHDS_SubMeshIteratorPtr SMESHDS_Mesh::SubMeshes() const
|
||||||
|
{
|
||||||
|
return SMESHDS_SubMeshIteratorPtr( mySubMeshHolder->GetIterator() );
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : GetHypothesis
|
//function : GetHypothesis
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -1254,8 +1216,8 @@ list<int> SMESHDS_Mesh::SubMeshIndices() const
|
|||||||
const list<const SMESHDS_Hypothesis*>&
|
const list<const SMESHDS_Hypothesis*>&
|
||||||
SMESHDS_Mesh::GetHypothesis(const TopoDS_Shape & S) const
|
SMESHDS_Mesh::GetHypothesis(const TopoDS_Shape & S) const
|
||||||
{
|
{
|
||||||
if ( myShapeToHypothesis.IsBound( S.Oriented(TopAbs_FORWARD) ) ) // ignore orientation of S
|
if ( myShapeToHypothesis.IsBound( S/*.Oriented(TopAbs_FORWARD)*/ ) ) // ignore orientation of S
|
||||||
return myShapeToHypothesis.Find( S.Oriented(TopAbs_FORWARD) );
|
return myShapeToHypothesis.Find( S/*.Oriented(TopAbs_FORWARD)*/ );
|
||||||
|
|
||||||
static list<const SMESHDS_Hypothesis*> empty;
|
static list<const SMESHDS_Hypothesis*> empty;
|
||||||
return empty;
|
return empty;
|
||||||
@ -1300,9 +1262,8 @@ void SMESHDS_Mesh::ClearScript()
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool SMESHDS_Mesh::HasMeshElements(const TopoDS_Shape & S) const
|
bool SMESHDS_Mesh::HasMeshElements(const TopoDS_Shape & S) const
|
||||||
{
|
{
|
||||||
if (myShape.IsNull()) MESSAGE("myShape is NULL");
|
int Index = myIndexToShape.FindIndex(S);
|
||||||
int Index = myIndexToShape.FindIndex(S);
|
return mySubMeshHolder->Get( Index );
|
||||||
return myShapeIndexToSubMesh.find(Index)!=myShapeIndexToSubMesh.end();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -1311,7 +1272,7 @@ bool SMESHDS_Mesh::HasMeshElements(const TopoDS_Shape & S) const
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool SMESHDS_Mesh::HasHypothesis(const TopoDS_Shape & S)
|
bool SMESHDS_Mesh::HasHypothesis(const TopoDS_Shape & S)
|
||||||
{
|
{
|
||||||
return myShapeToHypothesis.IsBound(S.Oriented(TopAbs_FORWARD));
|
return myShapeToHypothesis.IsBound(S/*.Oriented(TopAbs_FORWARD)*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -1320,15 +1281,12 @@ bool SMESHDS_Mesh::HasHypothesis(const TopoDS_Shape & S)
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
SMESHDS_SubMesh * SMESHDS_Mesh::NewSubMesh(int Index)
|
SMESHDS_SubMesh * SMESHDS_Mesh::NewSubMesh(int Index)
|
||||||
{
|
{
|
||||||
SMESHDS_SubMesh* SM = 0;
|
SMESHDS_SubMesh* SM = MeshElements( Index );
|
||||||
TShapeIndexToSubMesh::iterator anIter = myShapeIndexToSubMesh.find(Index);
|
if ( !SM )
|
||||||
if (anIter == myShapeIndexToSubMesh.end())
|
|
||||||
{
|
{
|
||||||
SM = new SMESHDS_SubMesh(this, Index);
|
SM = new SMESHDS_SubMesh(this, Index);
|
||||||
myShapeIndexToSubMesh[Index]=SM;
|
mySubMeshHolder->Add( Index, SM );
|
||||||
}
|
}
|
||||||
else
|
|
||||||
SM = anIter->second;
|
|
||||||
return SM;
|
return SM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1394,7 +1352,7 @@ const TopoDS_Shape& SMESHDS_Mesh::IndexToShape(int ShapeIndex) const
|
|||||||
|
|
||||||
int SMESHDS_Mesh::MaxSubMeshIndex() const
|
int SMESHDS_Mesh::MaxSubMeshIndex() const
|
||||||
{
|
{
|
||||||
return myShapeIndexToSubMesh.empty() ? 0 : myShapeIndexToSubMesh.rbegin()->first;
|
return mySubMeshHolder->GetMaxID();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -1417,8 +1375,7 @@ int SMESHDS_Mesh::ShapeToIndex(const TopoDS_Shape & S) const
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void SMESHDS_Mesh::SetNodeInVolume(const SMDS_MeshNode* aNode, int Index)
|
void SMESHDS_Mesh::SetNodeInVolume(const SMDS_MeshNode* aNode, int Index)
|
||||||
{
|
{
|
||||||
//add(aNode, getSubmesh(Index));
|
if ( add( aNode, NewSubMesh( Index )))
|
||||||
if ( add( aNode, getSubmesh( Index )))
|
|
||||||
((SMDS_MeshNode*) aNode)->SetPosition( SMDS_SpacePosition::originSpacePosition());
|
((SMDS_MeshNode*) aNode)->SetPosition( SMDS_SpacePosition::originSpacePosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1429,7 +1386,7 @@ void SMESHDS_Mesh::SetNodeInVolume(const SMDS_MeshNode* aNode, int Index)
|
|||||||
void SMESHDS_Mesh::SetNodeOnFace(const SMDS_MeshNode* aNode, int Index, double u, double v)
|
void SMESHDS_Mesh::SetNodeOnFace(const SMDS_MeshNode* aNode, int Index, double u, double v)
|
||||||
{
|
{
|
||||||
//Set Position on Node
|
//Set Position on Node
|
||||||
if ( add( aNode, getSubmesh( Index )))
|
if ( add( aNode, NewSubMesh( Index )))
|
||||||
const_cast< SMDS_MeshNode* >
|
const_cast< SMDS_MeshNode* >
|
||||||
( aNode )->SetPosition(SMDS_PositionPtr(new SMDS_FacePosition( u, v)));
|
( aNode )->SetPosition(SMDS_PositionPtr(new SMDS_FacePosition( u, v)));
|
||||||
}
|
}
|
||||||
@ -1443,7 +1400,7 @@ void SMESHDS_Mesh::SetNodeOnEdge(const SMDS_MeshNode* aNode,
|
|||||||
double u)
|
double u)
|
||||||
{
|
{
|
||||||
//Set Position on Node
|
//Set Position on Node
|
||||||
if ( add( aNode, getSubmesh( Index )))
|
if ( add( aNode, NewSubMesh( Index )))
|
||||||
const_cast< SMDS_MeshNode* >
|
const_cast< SMDS_MeshNode* >
|
||||||
( aNode )->SetPosition(SMDS_PositionPtr(new SMDS_EdgePosition(u)));
|
( aNode )->SetPosition(SMDS_PositionPtr(new SMDS_EdgePosition(u)));
|
||||||
}
|
}
|
||||||
@ -1455,7 +1412,7 @@ void SMESHDS_Mesh::SetNodeOnEdge(const SMDS_MeshNode* aNode,
|
|||||||
void SMESHDS_Mesh::SetNodeOnVertex(const SMDS_MeshNode* aNode, int Index)
|
void SMESHDS_Mesh::SetNodeOnVertex(const SMDS_MeshNode* aNode, int Index)
|
||||||
{
|
{
|
||||||
//Set Position on Node
|
//Set Position on Node
|
||||||
if ( add( aNode, getSubmesh( Index )))
|
if ( add( aNode, NewSubMesh( Index )))
|
||||||
const_cast< SMDS_MeshNode* >
|
const_cast< SMDS_MeshNode* >
|
||||||
( aNode )->SetPosition(SMDS_PositionPtr(new SMDS_VertexPosition()));
|
( aNode )->SetPosition(SMDS_PositionPtr(new SMDS_VertexPosition()));
|
||||||
}
|
}
|
||||||
@ -1467,7 +1424,7 @@ void SMESHDS_Mesh::SetNodeOnVertex(const SMDS_MeshNode* aNode, int Index)
|
|||||||
void SMESHDS_Mesh::SetMeshElementOnShape(const SMDS_MeshElement* anElement,
|
void SMESHDS_Mesh::SetMeshElementOnShape(const SMDS_MeshElement* anElement,
|
||||||
int Index)
|
int Index)
|
||||||
{
|
{
|
||||||
add( anElement, getSubmesh( Index ));
|
add( anElement, NewSubMesh( Index ));
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -1479,9 +1436,7 @@ SMESHDS_Mesh::~SMESHDS_Mesh()
|
|||||||
// myScript
|
// myScript
|
||||||
delete myScript;
|
delete myScript;
|
||||||
// submeshes
|
// submeshes
|
||||||
TShapeIndexToSubMesh::iterator i_sm = myShapeIndexToSubMesh.begin();
|
delete mySubMeshHolder;
|
||||||
for ( ; i_sm != myShapeIndexToSubMesh.end(); ++i_sm )
|
|
||||||
delete i_sm->second;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2279,20 +2234,20 @@ void SMESHDS_Mesh::compactMesh()
|
|||||||
int myCellsSize = myCells.size();
|
int myCellsSize = myCells.size();
|
||||||
int newSmdsId = 0;
|
int newSmdsId = 0;
|
||||||
for (int i = 0; i < myCellsSize; i++)
|
for (int i = 0; i < myCellsSize; i++)
|
||||||
|
{
|
||||||
|
if (myCells[i])
|
||||||
{
|
{
|
||||||
if (myCells[i])
|
newSmdsId++; // SMDS id start to 1
|
||||||
{
|
assert(newSmdsId <= newCellSize);
|
||||||
newSmdsId++; // SMDS id start to 1
|
newCells[newSmdsId] = myCells[i];
|
||||||
assert(newSmdsId <= newCellSize);
|
newCells[newSmdsId]->setId(newSmdsId);
|
||||||
newCells[newSmdsId] = myCells[i];
|
//MESSAGE("myCells["<< i << "] --> newCells[" << newSmdsId << "]");
|
||||||
newCells[newSmdsId]->setId(newSmdsId);
|
int idvtk = myCells[i]->getVtkId();
|
||||||
//MESSAGE("myCells["<< i << "] --> newCells[" << newSmdsId << "]");
|
//newSmdsToVtk[newSmdsId] = idvtk;
|
||||||
int idvtk = myCells[i]->getVtkId();
|
assert(idvtk < newCellSize);
|
||||||
//newSmdsToVtk[newSmdsId] = idvtk;
|
newVtkToSmds[idvtk] = newSmdsId;
|
||||||
assert(idvtk < newCellSize);
|
|
||||||
newVtkToSmds[idvtk] = newSmdsId;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
myCells.swap(newCells);
|
myCells.swap(newCells);
|
||||||
//myCellIdSmdsToVtk.swap(newSmdsToVtk);
|
//myCellIdSmdsToVtk.swap(newSmdsToVtk);
|
||||||
@ -2305,12 +2260,9 @@ void SMESHDS_Mesh::compactMesh()
|
|||||||
|
|
||||||
// --- compact list myNodes and myElements in submeshes
|
// --- compact list myNodes and myElements in submeshes
|
||||||
|
|
||||||
map<int,SMESHDS_SubMesh*>::iterator it = myShapeIndexToSubMesh.begin();
|
SMESHDS_SubMeshIteratorPtr smIt = SubMeshes();
|
||||||
for(; it != myShapeIndexToSubMesh.end(); ++it)
|
while ( SMESHDS_SubMesh* sm = const_cast< SMESHDS_SubMesh* >( smIt->next() ))
|
||||||
{
|
sm->compactList();
|
||||||
(*it).second->compactList();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMESHDS_Mesh::CleanDownWardConnectivity()
|
void SMESHDS_Mesh::CleanDownWardConnectivity()
|
||||||
|
@ -35,6 +35,8 @@
|
|||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
#include <TopTools_IndexedMapOfShape.hxx>
|
||||||
#include <TopoDS_Shape.hxx>
|
#include <TopoDS_Shape.hxx>
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
class TopoDS_Solid ;
|
class TopoDS_Solid ;
|
||||||
class TopoDS_Shell ;
|
class TopoDS_Shell ;
|
||||||
class TopoDS_Face ;
|
class TopoDS_Face ;
|
||||||
@ -50,8 +52,6 @@ class SMDS_MeshVolume ;
|
|||||||
class SMDS_Mesh0DElement;
|
class SMDS_Mesh0DElement;
|
||||||
class SMDS_BallElement;
|
class SMDS_BallElement;
|
||||||
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Using of native hash_map isn't portable and don't work on WIN32 platform.
|
* Using of native hash_map isn't portable and don't work on WIN32 platform.
|
||||||
* So this functionality implement on new NCollection_DataMap technology
|
* So this functionality implement on new NCollection_DataMap technology
|
||||||
@ -566,9 +566,7 @@ public:
|
|||||||
SMESHDS_SubMesh * MeshElements(const TopoDS_Shape & S) const;
|
SMESHDS_SubMesh * MeshElements(const TopoDS_Shape & S) const;
|
||||||
SMESHDS_SubMesh * MeshElements(const int Index) const;
|
SMESHDS_SubMesh * MeshElements(const int Index) const;
|
||||||
std::list<int> SubMeshIndices() const;
|
std::list<int> SubMeshIndices() const;
|
||||||
const std::map<int,SMESHDS_SubMesh*>& SubMeshes() const
|
SMESHDS_SubMeshIteratorPtr SubMeshes() const;
|
||||||
{ return myShapeIndexToSubMesh; }
|
|
||||||
const TopoDS_Shape& GetCurrentSubShape() const { return myCurSubShape; }
|
|
||||||
|
|
||||||
bool HasHypothesis(const TopoDS_Shape & S);
|
bool HasHypothesis(const TopoDS_Shape & S);
|
||||||
const std::list<const SMESHDS_Hypothesis*>& GetHypothesis(const TopoDS_Shape & S) const;
|
const std::list<const SMESHDS_Hypothesis*>& GetHypothesis(const TopoDS_Shape & S) const;
|
||||||
@ -601,22 +599,14 @@ public:
|
|||||||
~SMESHDS_Mesh();
|
~SMESHDS_Mesh();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void addNodeToSubmesh( const SMDS_MeshNode* aNode, int Index )
|
|
||||||
{
|
|
||||||
//Update or build submesh
|
|
||||||
std::map<int,SMESHDS_SubMesh*>::iterator it = myShapeIndexToSubMesh.find( Index );
|
|
||||||
if ( it == myShapeIndexToSubMesh.end() )
|
|
||||||
it = myShapeIndexToSubMesh.insert( std::make_pair(Index, new SMESHDS_SubMesh(this, Index) )).first;
|
|
||||||
it->second->AddNode( aNode ); // add aNode to submesh
|
|
||||||
}
|
|
||||||
|
|
||||||
ShapeToHypothesis myShapeToHypothesis;
|
ShapeToHypothesis myShapeToHypothesis;
|
||||||
|
|
||||||
int myMeshID, myPersistentID;
|
int myMeshID, myPersistentID;
|
||||||
TopoDS_Shape myShape;
|
TopoDS_Shape myShape;
|
||||||
|
|
||||||
typedef std::map<int,SMESHDS_SubMesh*> TShapeIndexToSubMesh;
|
class SubMeshHolder;
|
||||||
TShapeIndexToSubMesh myShapeIndexToSubMesh;
|
SubMeshHolder* mySubMeshHolder;
|
||||||
|
|
||||||
TopTools_IndexedMapOfShape myIndexToShape;
|
TopTools_IndexedMapOfShape myIndexToShape;
|
||||||
|
|
||||||
@ -626,14 +616,8 @@ private:
|
|||||||
SMESHDS_Script* myScript;
|
SMESHDS_Script* myScript;
|
||||||
bool myIsEmbeddedMode;
|
bool myIsEmbeddedMode;
|
||||||
|
|
||||||
// optimize addition of nodes/elements to submeshes by, SetNodeInVolume() etc:
|
|
||||||
// avoid search of submeshes in maps
|
|
||||||
bool add( const SMDS_MeshElement* elem, SMESHDS_SubMesh* subMesh );
|
bool add( const SMDS_MeshElement* elem, SMESHDS_SubMesh* subMesh );
|
||||||
SMESHDS_SubMesh* getSubmesh( const TopoDS_Shape & shape);
|
SMESHDS_SubMesh* getSubmesh( const TopoDS_Shape & shape);
|
||||||
SMESHDS_SubMesh* getSubmesh( const int Index );
|
|
||||||
int myCurSubID;
|
|
||||||
TopoDS_Shape myCurSubShape;
|
|
||||||
SMESHDS_SubMesh* myCurSubMesh;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
143
src/SMESHDS/SMESHDS_TSubMeshHolder.hxx
Normal file
143
src/SMESHDS/SMESHDS_TSubMeshHolder.hxx
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
// Copyright (C) 2007-2014 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
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Lesser General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2.1 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
//
|
||||||
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
|
//
|
||||||
|
#ifndef __SMESHDS_SubMeshHolder_HXX__
|
||||||
|
#define __SMESHDS_SubMeshHolder_HXX__
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
/*!
|
||||||
|
* \brief A binder of a sub-mesh to its ID which can be negative. Provides fast
|
||||||
|
* access to a sub-mesh by its ID.
|
||||||
|
*
|
||||||
|
* Issue 52457: Addition of hypotheses is 8 time longer than meshing.
|
||||||
|
*/
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
template <class SUBMESH>
|
||||||
|
class SMESHDS_TSubMeshHolder
|
||||||
|
{
|
||||||
|
std::vector< SUBMESH* > myVec; // for ID >= 0
|
||||||
|
std::map< int, SUBMESH* > myMap; // for ID < 0
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
~SMESHDS_TSubMeshHolder()
|
||||||
|
{
|
||||||
|
DeleteAll();
|
||||||
|
}
|
||||||
|
void Add( int id, SUBMESH* sm )
|
||||||
|
{
|
||||||
|
if ( id < 0 )
|
||||||
|
{
|
||||||
|
myMap[ id ] = sm;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( myVec.size() <= id )
|
||||||
|
myVec.resize( id+1, (SUBMESH*) NULL );
|
||||||
|
myVec[ id ] = sm;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SUBMESH* Get( int id ) const
|
||||||
|
{
|
||||||
|
if ( id < 0 )
|
||||||
|
{
|
||||||
|
typename std::map< int, SUBMESH* >::const_iterator i2sm = myMap.find( id );
|
||||||
|
return (SUBMESH*) ( i2sm == myMap.end() ? NULL : i2sm->second );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return (SUBMESH*) ( id >= myVec.size() ? NULL : myVec[ id ]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void DeleteAll()
|
||||||
|
{
|
||||||
|
for ( size_t i = 0; i < myVec.size(); ++i )
|
||||||
|
delete myVec[i];
|
||||||
|
myVec.clear();
|
||||||
|
|
||||||
|
typename std::map< int, SUBMESH* >::iterator i2sm = myMap.begin();
|
||||||
|
for ( ; i2sm != myMap.end(); ++i2sm )
|
||||||
|
delete i2sm->second;
|
||||||
|
myMap.clear();
|
||||||
|
}
|
||||||
|
int GetMinID() const
|
||||||
|
{
|
||||||
|
return myMap.empty() ? 0 : myMap.begin()->first;
|
||||||
|
}
|
||||||
|
int GetMaxID() const
|
||||||
|
{
|
||||||
|
return myVec.empty() ? ( myMap.empty() ? 0 : myMap.rbegin()->first ) : myVec.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
struct Iterator : public SMDS_Iterator< SUBMESH* >
|
||||||
|
{
|
||||||
|
const SMESHDS_TSubMeshHolder<SUBMESH>* myHolder;
|
||||||
|
SUBMESH* myNext;
|
||||||
|
int myCurID, myEndID, myIDDelta;
|
||||||
|
|
||||||
|
void init( const SMESHDS_TSubMeshHolder<SUBMESH>* holder,
|
||||||
|
int firstID, int endID, int delta )
|
||||||
|
{
|
||||||
|
myHolder = holder;
|
||||||
|
myNext = 0;
|
||||||
|
myCurID = firstID;
|
||||||
|
myEndID = endID;
|
||||||
|
myIDDelta = delta;
|
||||||
|
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool more()
|
||||||
|
{
|
||||||
|
return myNext;
|
||||||
|
}
|
||||||
|
|
||||||
|
SUBMESH* next()
|
||||||
|
{
|
||||||
|
SUBMESH* res = myNext;
|
||||||
|
myNext = 0;
|
||||||
|
while ( !myNext && myCurID != myEndID )
|
||||||
|
{
|
||||||
|
myNext = myHolder->Get( myCurID );
|
||||||
|
myCurID += myIDDelta;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
virtual ~Iterator() {}
|
||||||
|
};
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
SMDS_Iterator< SUBMESH* >* GetIterator(const bool reverse=false) const
|
||||||
|
{
|
||||||
|
Iterator* iter = new Iterator;
|
||||||
|
if ( reverse ) iter->init( this, GetMaxID(), GetMinID()-1, -1 );
|
||||||
|
else iter->init( this, GetMinID(), GetMaxID()+1, +1 );
|
||||||
|
return iter;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -3696,7 +3696,8 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
|
|||||||
myLocMesh.ShapeToMesh( nullShape ); // remove shape referring data
|
myLocMesh.ShapeToMesh( nullShape ); // remove shape referring data
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !mySMESHDSMesh->SubMeshes().empty() )
|
SMESHDS_SubMeshIteratorPtr smIt = mySMESHDSMesh->SubMeshes();
|
||||||
|
if ( smIt->more() )
|
||||||
{
|
{
|
||||||
// Store submeshes
|
// Store submeshes
|
||||||
// ----------------
|
// ----------------
|
||||||
@ -3706,52 +3707,9 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
|
|||||||
// each element belongs to one or none submesh,
|
// each element belongs to one or none submesh,
|
||||||
// so for each node/element, we store a submesh ID
|
// so for each node/element, we store a submesh ID
|
||||||
|
|
||||||
// Make maps of submesh IDs of elements sorted by element IDs
|
|
||||||
// typedef int TElemID;
|
|
||||||
// typedef int TSubMID;
|
|
||||||
// map< TElemID, TSubMID > eId2smId, nId2smId;
|
|
||||||
const map<int,SMESHDS_SubMesh*>& aSubMeshes = mySMESHDSMesh->SubMeshes();
|
|
||||||
map<int,SMESHDS_SubMesh*>::const_iterator itSubM ( aSubMeshes.begin() );
|
|
||||||
// SMDS_NodeIteratorPtr itNode;
|
|
||||||
// SMDS_ElemIteratorPtr itElem;
|
|
||||||
// for ( itSubM = aSubMeshes.begin(); itSubM != aSubMeshes.end() ; itSubM++ )
|
|
||||||
// {
|
|
||||||
// TSubMID aSubMeID = itSubM->first;
|
|
||||||
// SMESHDS_SubMesh* aSubMesh = itSubM->second;
|
|
||||||
// if ( aSubMesh->IsComplexSubmesh() )
|
|
||||||
// continue; // sub-mesh containing other sub-meshes
|
|
||||||
// // nodes
|
|
||||||
// for ( itNode = aSubMesh->GetNodes(); itNode->more(); ++hint)
|
|
||||||
// nId2smId.insert( nId2smId.back(), make_pair( itNode->next()->GetID(), aSubMeID ));
|
|
||||||
// // elements
|
|
||||||
// for ( itElem = aSubMesh->GetElements(); itElem->more(); ++hint)
|
|
||||||
// hint = eId2smId.insert( eId2smId.back(), make_pair( itElem->next()->GetID(), aSubMeID ));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Care of elements that are not on submeshes
|
|
||||||
// if ( mySMESHDSMesh->NbNodes() != nId2smId.size() ) {
|
|
||||||
// for ( itNode = mySMESHDSMesh->nodesIterator(); itNode->more(); )
|
|
||||||
// /* --- stl_map.h says : */
|
|
||||||
// /* A %map relies on unique keys and thus a %pair is only inserted if its */
|
|
||||||
// /* first element (the key) is not already present in the %map. */
|
|
||||||
// nId2smId.insert( make_pair( itNode->next()->GetID(), 0 ));
|
|
||||||
// }
|
|
||||||
// int nbElems = mySMESHDSMesh->GetMeshInfo().NbElements();
|
|
||||||
// if ( nbElems != eId2smId.size() ) {
|
|
||||||
// for ( itElem = mySMESHDSMesh->elementsIterator(); itElem->more(); )
|
|
||||||
// eId2smId.insert( make_pair( itElem->next()->GetID(), 0 ));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Store submesh IDs
|
// Store submesh IDs
|
||||||
for ( int isNode = 0; isNode < 2; ++isNode )
|
for ( int isNode = 0; isNode < 2; ++isNode )
|
||||||
{
|
{
|
||||||
// map< TElemID, TSubMID >& id2smId = isNode ? nId2smId : eId2smId;
|
|
||||||
// if ( id2smId.empty() ) continue;
|
|
||||||
// map< TElemID, TSubMID >::const_iterator id_smId = id2smId.begin();
|
|
||||||
// // make and fill array of submesh IDs
|
|
||||||
// int* smIDs = new int [ id2smId.size() ];
|
|
||||||
// for ( int i = 0; id_smId != id2smId.end(); ++id_smId, ++i )
|
|
||||||
// smIDs[ i ] = id_smId->second;
|
|
||||||
SMDS_ElemIteratorPtr eIt =
|
SMDS_ElemIteratorPtr eIt =
|
||||||
mySMESHDSMesh->elementsIterator( isNode ? SMDSAbs_Node : SMDSAbs_All );
|
mySMESHDSMesh->elementsIterator( isNode ? SMDSAbs_Node : SMDSAbs_All );
|
||||||
int nbElems = isNode ? mySMESHDSMesh->NbNodes() : mySMESHDSMesh->GetMeshInfo().NbElements();
|
int nbElems = isNode ? mySMESHDSMesh->NbNodes() : mySMESHDSMesh->GetMeshInfo().NbElements();
|
||||||
@ -3790,15 +3748,15 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
|
|||||||
int nbEdgeNodes = 0, nbFaceNodes = 0;
|
int nbEdgeNodes = 0, nbFaceNodes = 0;
|
||||||
list<SMESHDS_SubMesh*> aEdgeSM, aFaceSM;
|
list<SMESHDS_SubMesh*> aEdgeSM, aFaceSM;
|
||||||
// loop on SMESHDS_SubMesh'es
|
// loop on SMESHDS_SubMesh'es
|
||||||
for ( itSubM = aSubMeshes.begin(); itSubM != aSubMeshes.end() ; itSubM++ )
|
while ( smIt->more() )
|
||||||
{
|
{
|
||||||
SMESHDS_SubMesh* aSubMesh = (*itSubM).second;
|
SMESHDS_SubMesh* aSubMesh = const_cast< SMESHDS_SubMesh* >( smIt->next() );
|
||||||
if ( aSubMesh->IsComplexSubmesh() )
|
if ( aSubMesh->IsComplexSubmesh() )
|
||||||
continue; // submesh containing other submeshs
|
continue; // submesh containing other submeshs
|
||||||
int nbNodes = aSubMesh->NbNodes();
|
int nbNodes = aSubMesh->NbNodes();
|
||||||
if ( nbNodes == 0 ) continue;
|
if ( nbNodes == 0 ) continue;
|
||||||
|
|
||||||
int aShapeID = (*itSubM).first;
|
int aShapeID = aSubMesh->GetID();
|
||||||
if ( aShapeID < 1 || aShapeID > mySMESHDSMesh->MaxShapeIndex() )
|
if ( aShapeID < 1 || aShapeID > mySMESHDSMesh->MaxShapeIndex() )
|
||||||
continue;
|
continue;
|
||||||
int aShapeType = mySMESHDSMesh->IndexToShape( aShapeID ).ShapeType();
|
int aShapeType = mySMESHDSMesh->IndexToShape( aShapeID ).ShapeType();
|
||||||
|
@ -2132,7 +2132,7 @@ bool StdMeshers_ProjectionUtils::MakeComputed(SMESH_subMesh * sm, const int iter
|
|||||||
mesh->GetHypotheses( shape, hypoFilter, hyps, true, &assignedTo );
|
mesh->GetHypotheses( shape, hypoFilter, hyps, true, &assignedTo );
|
||||||
if ( nbAlgos > 1 ) // concurrent algos
|
if ( nbAlgos > 1 ) // concurrent algos
|
||||||
{
|
{
|
||||||
list<SMESH_subMesh*> smList; // where an algo is assigned
|
vector<SMESH_subMesh*> smList; // where an algo is assigned
|
||||||
list< TopoDS_Shape >::iterator shapeIt = assignedTo.begin();
|
list< TopoDS_Shape >::iterator shapeIt = assignedTo.begin();
|
||||||
for ( ; shapeIt != assignedTo.end(); ++shapeIt )
|
for ( ; shapeIt != assignedTo.end(); ++shapeIt )
|
||||||
smList.push_back( mesh->GetSubMesh( *shapeIt ));
|
smList.push_back( mesh->GetSubMesh( *shapeIt ));
|
||||||
|
@ -994,9 +994,9 @@ bool StdMeshers_RadialQuadrangle_1D2D::computeLayerPositions(const gp_Pnt&
|
|||||||
if ( !edge.IsNull() )
|
if ( !edge.IsNull() )
|
||||||
{
|
{
|
||||||
// find a hyp usable by TNodeDistributor
|
// find a hyp usable by TNodeDistributor
|
||||||
SMESH_HypoFilter hypKind;
|
const SMESH_HypoFilter* hypKind =
|
||||||
TNodeDistributor::GetDistributor(*mesh)->InitCompatibleHypoFilter(hypKind,/*ignoreAux=*/1);
|
TNodeDistributor::GetDistributor(*mesh)->GetCompatibleHypoFilter(/*ignoreAux=*/true);
|
||||||
hyp1D = mesh->GetHypothesis( edge, hypKind, /*fromAncestors=*/true);
|
hyp1D = mesh->GetHypothesis( edge, *hypKind, /*fromAncestors=*/true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( hyp1D ) // try to compute with hyp1D
|
if ( hyp1D ) // try to compute with hyp1D
|
||||||
|
@ -1336,12 +1336,11 @@ StdMeshers_Regular_1D::GetUsedHypothesis(SMESH_Mesh & aMesh,
|
|||||||
_usedHypList.clear();
|
_usedHypList.clear();
|
||||||
_mainEdge.Nullify();
|
_mainEdge.Nullify();
|
||||||
|
|
||||||
SMESH_HypoFilter auxiliaryFilter, compatibleFilter;
|
SMESH_HypoFilter auxiliaryFilter( SMESH_HypoFilter::IsAuxiliary() );
|
||||||
auxiliaryFilter.Init( SMESH_HypoFilter::IsAuxiliary() );
|
const SMESH_HypoFilter* compatibleFilter = GetCompatibleHypoFilter(/*ignoreAux=*/true );
|
||||||
InitCompatibleHypoFilter( compatibleFilter, /*ignoreAux=*/true );
|
|
||||||
|
|
||||||
// get non-auxiliary assigned directly to aShape
|
// get non-auxiliary assigned directly to aShape
|
||||||
int nbHyp = aMesh.GetHypotheses( aShape, compatibleFilter, _usedHypList, false );
|
int nbHyp = aMesh.GetHypotheses( aShape, *compatibleFilter, _usedHypList, false );
|
||||||
|
|
||||||
if (nbHyp == 0 && aShape.ShapeType() == TopAbs_EDGE)
|
if (nbHyp == 0 && aShape.ShapeType() == TopAbs_EDGE)
|
||||||
{
|
{
|
||||||
@ -1352,7 +1351,7 @@ StdMeshers_Regular_1D::GetUsedHypothesis(SMESH_Mesh & aMesh,
|
|||||||
{
|
{
|
||||||
// Propagation of 1D hypothesis from <aMainEdge> on this edge;
|
// Propagation of 1D hypothesis from <aMainEdge> on this edge;
|
||||||
// get non-auxiliary assigned to _mainEdge
|
// get non-auxiliary assigned to _mainEdge
|
||||||
nbHyp = aMesh.GetHypotheses( _mainEdge, compatibleFilter, _usedHypList, true );
|
nbHyp = aMesh.GetHypotheses( _mainEdge, *compatibleFilter, _usedHypList, true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user