*/
//================================================================================
-namespace {
- int dependsOnMapKey( const SMESH_subMesh* sm )
+namespace
+{
+ int dependsOnMapKey( TopAbs_ShapeEnum type, int shapeID )
{
- int type = sm->GetSubShape().ShapeType();
- int ordType = 9 - type; // 2 = Vertex, 8 = CompSolid
- int cle = sm->GetId();
+ int ordType = 9 - int(type); // 2 = Vertex, 8 = CompSolid
+ int cle = shapeID;
cle += 10000000 * ordType; // sort map by ordType then index
return cle;
}
+ int dependsOnMapKey( const SMESH_subMesh* sm )
+ {
+ return dependsOnMapKey( sm->GetSubShape().ShapeType(), sm->GetId() );
+ }
}
//=============================================================================
for ( ; sub.More(); sub.Next() )
{
SMESH_subMesh *aSubMesh = _father->GetSubMesh( sub.Current() );
+ if ( aSubMesh->GetId() == 0 )
+ continue; // not a sub-shape of the shape to mesh
int cle = dependsOnMapKey( aSubMesh );
if ( _mapDepend.find( cle ) == _mapDepend.end())
{
return other ? _mapDepend.count( dependsOnMapKey( other )) : false;
}
+//================================================================================
+/*!
+ * \brief Return \c true if \a this sub-mesh depends on a \a shape
+ */
+//================================================================================
+
+bool SMESH_subMesh::DependsOn( const int shapeID ) const
+{
+ return DependsOn( _father->GetSubMeshContaining( shapeID ));
+}
+
//=============================================================================
/*!
* Return a shape of \a this sub-mesh
// le retour des evenement father n'indiquent pas que add ou remove fait
SMESH_Hypothesis::Hypothesis_Status aux_ret, ret = SMESH_Hypothesis::HYP_OK;
+ if ( _Id == 0 ) return ret; // not a sub-shape of the shape to mesh
SMESHDS_Mesh* meshDS =_father->GetMeshDS();
SMESH_Algo* algo = 0;
f.AndNot( SMESH_HypoFilter::Is( algo ));
const SMESH_Hypothesis * prevAlgo = _father->GetHypothesis( this, f, true );
if (prevAlgo &&
- string(algo->GetName()) != string(prevAlgo->GetName()) )
+ string( algo->GetName()) != prevAlgo->GetName())
modifiedHyp = true;
}
else
// detect algorithm hiding
//
- if ( ret == SMESH_Hypothesis::HYP_OK &&
- ( event == ADD_ALGO || event == ADD_FATHER_ALGO ) &&
+ if ( ret == SMESH_Hypothesis::HYP_OK &&
+ ( event == ADD_ALGO || event == ADD_FATHER_ALGO ) && algo &&
algo->GetName() == anHyp->GetName() )
{
// is algo hidden?
!theAlgo->OnlyUnaryInput() ) // all adjacent shapes will be meshed by this algo?
return true;
- SMESH_Gen* gen =_father->GetGen();
-
// only local algo is to be checked
//if ( gen->IsGlobalHypothesis( theAlgo, *_father ))
if ( _subShape.ShapeType() == _father->GetMeshDS()->ShapeToMesh().ShapeType() )
if ( !sm->IsEmpty() )
{
const bool sameShapeType = ( prevShapeType == sm->GetSubShape().ShapeType() );
- bool keepSubMeshes = ( sameShapeType && toKeepPrevShapeType );
+ bool keepSubMeshes = ( sameShapeType && toKeepPrevShapeType );
if ( !sameShapeType )
{
// check if the algo allows presence of global algos of dimension the algo
// remember all sub-meshes of sm
if ( keepSubMeshes )
{
- SMESH_subMeshIteratorPtr smIt2 = getDependsOnIterator(false,true);
+ SMESH_subMeshIteratorPtr smIt2 = getDependsOnIterator(false);
while ( smIt2->more() )
smToKeep.insert( smIt2->next() );
}
SMESH_Hypothesis::Hypothesis_Status hyp_status;
algo = GetAlgo();
- if(algo && !aResMap.count(this) )
+ if( algo && !aResMap.count( this ))
{
ret = algo->CheckHypothesis((*_father), _subShape, hyp_status);
if (!ret) return false;
- if (_father->HasShapeToMesh() && algo->NeedDiscreteBoundary())
+ if (_father->HasShapeToMesh() && algo->NeedDiscreteBoundary() )
{
// check submeshes needed
bool subMeshEvaluated = true;
return false;
}
_computeError = SMESH_ComputeError::New(COMPERR_OK,"",algo);
- ret = algo->Evaluate((*_father), _subShape, aResMap);
+ if ( IsMeshComputed() )
+ {
+ vector<int> & nbEntities = aResMap[ this ];
+ nbEntities.resize( SMDSEntity_Last, 0 );
+ if ( SMESHDS_SubMesh* sm = GetSubMeshDS() )
+ {
+ nbEntities[ SMDSEntity_Node ] = sm->NbNodes();
+ SMDS_ElemIteratorPtr elemIt = sm->GetElements();
+ while ( elemIt->more() )
+ nbEntities[ elemIt->next()->GetEntityType() ]++;
+ }
+ }
+ else
+ {
+ ret = algo->Evaluate((*_father), _subShape, aResMap);
+ }
aResMap.insert( make_pair( this,vector<int>(0)));
}
{
_Iterator(SMDS_Iterator<SMESH_subMesh*>* subIt,
SMESH_subMesh* prepend,
- SMESH_subMesh* append): myIt(subIt),myAppend(append)
+ SMESH_subMesh* append): myAppend(append), myIt(subIt)
{
myCur = prepend ? prepend : myIt->more() ? myIt->next() : append;
if ( myCur == append ) append = 0;
bool SMESH_subMesh::FindIntersection(const SMESH_subMesh* theOther,
std::set<const SMESH_subMesh*>& theSetOfCommon ) const
{
- int oldNb = theSetOfCommon.size();
+ size_t oldNb = theSetOfCommon.size();
// check main submeshes
const map <int, SMESH_subMesh*>::const_iterator otherEnd = theOther->_mapDepend.end();