return _computeCost;
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
-// bool SMESH_subMesh::SubMeshesReady()
-// {
-// bool subMeshesReady = true;
-// SMESH_subMeshIteratorPtr smIt = getDependsOnIterator(false,true);
-// while ( smIt->more() ) {
-// SMESH_subMesh *sm = smIt->next();
-// bool computeOk = (sm->GetComputeState() == COMPUTE_OK ||
-// sm->GetComputeState() == READY_TO_COMPUTE);
-// if (!computeOk)
-// {
-// subMeshesReady = false;
-// SCRUTE(sm->GetId());
-// break;
-// }
-// }
-// return subMeshesReady;
-// }
-
//=============================================================================
/*!
* Construct dependence on first level subMeshes. complex shapes (compsolid,
const map < int, SMESH_subMesh * >& SMESH_subMesh::DependsOn()
{
- if (_dependenceAnalysed)
+ if ( _dependenceAnalysed || !_father->HasShapeToMesh() )
return _mapDepend;
- //MESSAGE("SMESH_subMesh::DependsOn");
-
int type = _subShape.ShapeType();
- //SCRUTE(type);
switch (type)
{
case TopAbs_COMPOUND:
+ {
+ list< TopoDS_Shape > compounds( 1, _subShape );
+ list< TopoDS_Shape >::iterator comp = compounds.begin();
+ for ( ; comp != compounds.end(); ++comp )
{
- //MESSAGE("compound");
- for (TopExp_Explorer exp(_subShape, TopAbs_SOLID); exp.More();exp.Next())
- {
- insertDependence(exp.Current());
- }
- for (TopExp_Explorer exp(_subShape, TopAbs_SHELL, TopAbs_SOLID); exp.More(); exp.Next())
- {
- if ( BRep_Tool::IsClosed(exp.Current() ))
- insertDependence(exp.Current()); //only shell not in solid
- else
- for (TopExp_Explorer expF(exp.Current(), TopAbs_FACE); expF.More();expF.Next())
- insertDependence(expF.Current()); // issue 0020959: HEXA_3D fails on shell
-
- }
- for (TopExp_Explorer exp(_subShape, TopAbs_FACE, TopAbs_SHELL); exp.More();exp.Next())
- {
- insertDependence(exp.Current());
- }
- for (TopExp_Explorer exp(_subShape, TopAbs_EDGE, TopAbs_FACE); exp.More();exp.Next())
- {
- insertDependence(exp.Current());
- }
- for (TopExp_Explorer exp(_subShape, TopAbs_VERTEX, TopAbs_EDGE); exp.More();exp.Next())
- {
- insertDependence(exp.Current());
- }
- break;
- }
- case TopAbs_COMPSOLID:
- {
- //MESSAGE("compsolid");
- for (TopExp_Explorer exp(_subShape, TopAbs_SOLID); exp.More(); exp.Next())
- {
- insertDependence(exp.Current());
- }
- break;
- }
- case TopAbs_SHELL:
- {
- //MESSAGE("shell");
- for (TopExp_Explorer exp(_subShape, TopAbs_FACE); exp.More(); exp.Next())
- {
- insertDependence(exp.Current());
- }
- break;
- }
- case TopAbs_WIRE:
- {
- //MESSAGE("wire");
- for (TopExp_Explorer exp(_subShape, TopAbs_EDGE); exp.More(); exp.Next())
- {
- insertDependence(exp.Current());
- }
- break;
- }
- case TopAbs_SOLID:
- {
- //MESSAGE("solid");
- if(_father->HasShapeToMesh()) {
- for (TopExp_Explorer exp(_subShape, TopAbs_FACE); exp.More();exp.Next())
+ for ( TopoDS_Iterator sub( *comp ); sub.More(); sub.Next() )
+ switch ( sub.Value().ShapeType() )
{
- insertDependence(exp.Current());
+ case TopAbs_COMPOUND: compounds.push_back( sub.Value() ); break;
+ case TopAbs_COMPSOLID: insertDependence( sub.Value(), TopAbs_SOLID ); break;
+ case TopAbs_SOLID: insertDependence( sub.Value(), TopAbs_SOLID ); break;
+ case TopAbs_SHELL: insertDependence( sub.Value(), TopAbs_FACE ); break;
+ case TopAbs_FACE: insertDependence( sub.Value(), TopAbs_FACE ); break;
+ case TopAbs_WIRE: insertDependence( sub.Value(), TopAbs_EDGE ); break;
+ case TopAbs_EDGE: insertDependence( sub.Value(), TopAbs_EDGE ); break;
+ case TopAbs_VERTEX: insertDependence( sub.Value(), TopAbs_VERTEX ); break;
+ default:;
}
- }
- break;
- }
- case TopAbs_FACE:
- {
- //MESSAGE("face");
- for (TopExp_Explorer exp(_subShape, TopAbs_EDGE); exp.More();exp.Next())
- {
- insertDependence(exp.Current());
- }
- break;
- }
- case TopAbs_EDGE:
- {
- //MESSAGE("edge");
- for (TopExp_Explorer exp(_subShape, TopAbs_VERTEX); exp.More(); exp.Next())
- {
- insertDependence(exp.Current());
- }
- break;
- }
- case TopAbs_VERTEX:
- {
- break;
- }
- default:
- {
- break;
}
}
+ break;
+ case TopAbs_COMPSOLID: insertDependence( _subShape, TopAbs_SOLID ); break;
+ case TopAbs_SOLID: insertDependence( _subShape, TopAbs_FACE ); break;
+ case TopAbs_SHELL: insertDependence( _subShape, TopAbs_FACE ); break;
+ case TopAbs_FACE: insertDependence( _subShape, TopAbs_EDGE ); break;
+ case TopAbs_WIRE: insertDependence( _subShape, TopAbs_EDGE ); break;
+ case TopAbs_EDGE: insertDependence( _subShape, TopAbs_VERTEX ); break;
+ default:;
+ }
_dependenceAnalysed = true;
return _mapDepend;
}
*/
//=============================================================================
-void SMESH_subMesh::insertDependence(const TopoDS_Shape aSubShape)
+void SMESH_subMesh::insertDependence(const TopoDS_Shape aShape,
+ TopAbs_ShapeEnum aSubType)
{
- SMESH_subMesh *aSubMesh = _father->GetSubMesh(aSubShape);
- int cle = dependsOnMapKey( aSubMesh );
- if ( _mapDepend.find( cle ) == _mapDepend.end())
+ TopExp_Explorer sub( aShape, aSubType );
+ for ( ; sub.More(); sub.Next() )
{
- _mapDepend[cle] = aSubMesh;
- const map < int, SMESH_subMesh * > & subMap = aSubMesh->DependsOn();
- _mapDepend.insert( subMap.begin(), subMap.end() );
+ SMESH_subMesh *aSubMesh = _father->GetSubMesh( sub.Current() );
+ int cle = dependsOnMapKey( aSubMesh );
+ if ( _mapDepend.find( cle ) == _mapDepend.end())
+ {
+ _mapDepend[cle] = aSubMesh;
+ const map < int, SMESH_subMesh * > & subMap = aSubMesh->DependsOn();
+ _mapDepend.insert( subMap.begin(), subMap.end() );
+ }
}
}
void SMESH_subMesh::DumpAlgoState(bool isMain)
{
- // if (dim < 1) return;
- if (isMain)
- {
- const map < int, SMESH_subMesh * >&subMeshes = DependsOn();
-
- map < int, SMESH_subMesh * >::const_iterator itsub;
- for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++)
- {
- SMESH_subMesh *sm = (*itsub).second;
- sm->DumpAlgoState(false);
- }
- }
- //int type = _subShape.ShapeType();
- MESSAGE("dim = " << SMESH_Gen::GetShapeDim(_subShape) <<
- " type of shape " << _subShape.ShapeType());
- switch (_algoState)
- {
- case NO_ALGO:
- MESSAGE(" AlgoState = NO_ALGO");
- break;
- case MISSING_HYP:
- MESSAGE(" AlgoState = MISSING_HYP");
- break;
- case HYP_OK:
- MESSAGE(" AlgoState = HYP_OK");
- break;
- }
- switch (_computeState)
- {
- case NOT_READY:
- MESSAGE(" ComputeState = NOT_READY");
- break;
- case READY_TO_COMPUTE:
- MESSAGE(" ComputeState = READY_TO_COMPUTE");
- break;
- case COMPUTE_OK:
- MESSAGE(" ComputeState = COMPUTE_OK");
- break;
- case FAILED_TO_COMPUTE:
- MESSAGE(" ComputeState = FAILED_TO_COMPUTE");
- break;
- }
+ if (isMain)
+ {
+ const map < int, SMESH_subMesh * >&subMeshes = DependsOn();
+
+ map < int, SMESH_subMesh * >::const_iterator itsub;
+ for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++)
+ {
+ SMESH_subMesh *sm = (*itsub).second;
+ sm->DumpAlgoState(false);
+ }
+ }
+ MESSAGE("dim = " << SMESH_Gen::GetShapeDim(_subShape) <<
+ " type of shape " << _subShape.ShapeType());
+ switch (_algoState)
+ {
+ case NO_ALGO : MESSAGE(" AlgoState = NO_ALGO"); break;
+ case MISSING_HYP : MESSAGE(" AlgoState = MISSING_HYP"); break;
+ case HYP_OK : MESSAGE(" AlgoState = HYP_OK");break;
+ }
+ switch (_computeState)
+ {
+ case NOT_READY : MESSAGE(" ComputeState = NOT_READY");break;
+ case READY_TO_COMPUTE : MESSAGE(" ComputeState = READY_TO_COMPUTE");break;
+ case COMPUTE_OK : MESSAGE(" ComputeState = COMPUTE_OK");break;
+ case FAILED_TO_COMPUTE: MESSAGE(" ComputeState = FAILED_TO_COMPUTE");break;
+ }
}
//================================================================================
}
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
+//=======================================================================
+//function : cleanDependants
+//purpose :
+//=======================================================================
void SMESH_subMesh::cleanDependants()
{
}
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
+//=======================================================================
+//function : removeSubMeshElementsAndNodes
+//purpose :
+//=======================================================================
void SMESH_subMesh::removeSubMeshElementsAndNodes()
{
*/
//================================================================================
-bool SMESH_subMesh::FindIntersection(const SMESH_subMesh* theOther,
+bool SMESH_subMesh::FindIntersection(const SMESH_subMesh* theOther,
std::set<const SMESH_subMesh*>& theSetOfCommon ) const
{
int oldNb = theSetOfCommon.size();
+
// check main submeshes
const map <int, SMESH_subMesh*>::const_iterator otherEnd = theOther->_mapDepend.end();
if ( theOther->_mapDepend.find(this->GetId()) != otherEnd )
theSetOfCommon.insert( this );
if ( _mapDepend.find(theOther->GetId()) != _mapDepend.end() )
theSetOfCommon.insert( theOther );
+
// check common submeshes
map <int, SMESH_subMesh*>::const_iterator mapIt = _mapDepend.begin();
for( ; mapIt != _mapDepend.end(); mapIt++ )