23121: EDF 11163 SMESH: Orphan node generated on a 3D mesh

This commit is contained in:
eap 2015-06-26 20:09:20 +03:00
parent bf4083bfee
commit 897fdb92b6
2 changed files with 74 additions and 177 deletions

View File

@ -401,30 +401,6 @@ int SMESH_subMesh::computeCost() const
return _computeCost; 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, * Construct dependence on first level subMeshes. complex shapes (compsolid,
@ -439,109 +415,41 @@ int SMESH_subMesh::computeCost() const
const map < int, SMESH_subMesh * >& SMESH_subMesh::DependsOn() const map < int, SMESH_subMesh * >& SMESH_subMesh::DependsOn()
{ {
if (_dependenceAnalysed) if ( _dependenceAnalysed || !_father->HasShapeToMesh() )
return _mapDepend; return _mapDepend;
//MESSAGE("SMESH_subMesh::DependsOn");
int type = _subShape.ShapeType(); int type = _subShape.ShapeType();
//SCRUTE(type);
switch (type) switch (type)
{ {
case TopAbs_COMPOUND: case TopAbs_COMPOUND:
{ {
//MESSAGE("compound"); list< TopoDS_Shape > compounds( 1, _subShape );
for (TopExp_Explorer exp(_subShape, TopAbs_SOLID); exp.More();exp.Next()) list< TopoDS_Shape >::iterator comp = compounds.begin();
for ( ; comp != compounds.end(); ++comp )
{ {
insertDependence(exp.Current()); for ( TopoDS_Iterator sub( *comp ); sub.More(); sub.Next() )
switch ( sub.Value().ShapeType() )
{
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:;
} }
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())
{
insertDependence(exp.Current());
} }
} }
break; break;
} case TopAbs_COMPSOLID: insertDependence( _subShape, TopAbs_SOLID ); break;
case TopAbs_FACE: case TopAbs_SOLID: insertDependence( _subShape, TopAbs_FACE ); break;
{ case TopAbs_SHELL: insertDependence( _subShape, TopAbs_FACE ); break;
//MESSAGE("face"); case TopAbs_FACE: insertDependence( _subShape, TopAbs_EDGE ); break;
for (TopExp_Explorer exp(_subShape, TopAbs_EDGE); exp.More();exp.Next()) case TopAbs_WIRE: insertDependence( _subShape, TopAbs_EDGE ); break;
{ case TopAbs_EDGE: insertDependence( _subShape, TopAbs_VERTEX ); break;
insertDependence(exp.Current()); default:;
}
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;
}
} }
_dependenceAnalysed = true; _dependenceAnalysed = true;
return _mapDepend; return _mapDepend;
@ -570,9 +478,13 @@ namespace {
*/ */
//============================================================================= //=============================================================================
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); TopExp_Explorer sub( aShape, aSubType );
for ( ; sub.More(); sub.Next() )
{
SMESH_subMesh *aSubMesh = _father->GetSubMesh( sub.Current() );
int cle = dependsOnMapKey( aSubMesh ); int cle = dependsOnMapKey( aSubMesh );
if ( _mapDepend.find( cle ) == _mapDepend.end()) if ( _mapDepend.find( cle ) == _mapDepend.end())
{ {
@ -581,6 +493,7 @@ void SMESH_subMesh::insertDependence(const TopoDS_Shape aSubShape)
_mapDepend.insert( subMap.begin(), subMap.end() ); _mapDepend.insert( subMap.begin(), subMap.end() );
} }
} }
}
//================================================================================ //================================================================================
/*! /*!
@ -1353,7 +1266,6 @@ void SMESH_subMesh::cleanDependsOn( SMESH_Algo* algoRequiringCleaning/*=0*/ )
void SMESH_subMesh::DumpAlgoState(bool isMain) void SMESH_subMesh::DumpAlgoState(bool isMain)
{ {
// if (dim < 1) return;
if (isMain) if (isMain)
{ {
const map < int, SMESH_subMesh * >&subMeshes = DependsOn(); const map < int, SMESH_subMesh * >&subMeshes = DependsOn();
@ -1365,35 +1277,20 @@ void SMESH_subMesh::DumpAlgoState(bool isMain)
sm->DumpAlgoState(false); sm->DumpAlgoState(false);
} }
} }
//int type = _subShape.ShapeType();
MESSAGE("dim = " << SMESH_Gen::GetShapeDim(_subShape) << MESSAGE("dim = " << SMESH_Gen::GetShapeDim(_subShape) <<
" type of shape " << _subShape.ShapeType()); " type of shape " << _subShape.ShapeType());
switch (_algoState) switch (_algoState)
{ {
case NO_ALGO: case NO_ALGO : MESSAGE(" AlgoState = NO_ALGO"); break;
MESSAGE(" AlgoState = NO_ALGO"); case MISSING_HYP : MESSAGE(" AlgoState = MISSING_HYP"); break;
break; case HYP_OK : MESSAGE(" AlgoState = HYP_OK");break;
case MISSING_HYP:
MESSAGE(" AlgoState = MISSING_HYP");
break;
case HYP_OK:
MESSAGE(" AlgoState = HYP_OK");
break;
} }
switch (_computeState) switch (_computeState)
{ {
case NOT_READY: case NOT_READY : MESSAGE(" ComputeState = NOT_READY");break;
MESSAGE(" ComputeState = NOT_READY"); case READY_TO_COMPUTE : MESSAGE(" ComputeState = READY_TO_COMPUTE");break;
break; case COMPUTE_OK : MESSAGE(" ComputeState = COMPUTE_OK");break;
case READY_TO_COMPUTE: case FAILED_TO_COMPUTE: MESSAGE(" ComputeState = FAILED_TO_COMPUTE");break;
MESSAGE(" ComputeState = READY_TO_COMPUTE");
break;
case COMPUTE_OK:
MESSAGE(" ComputeState = COMPUTE_OK");
break;
case FAILED_TO_COMPUTE:
MESSAGE(" ComputeState = FAILED_TO_COMPUTE");
break;
} }
} }
@ -2080,11 +1977,10 @@ void SMESH_subMesh::updateDependantsState(const compute_event theEvent)
} }
} }
//============================================================================= //=======================================================================
/*! //function : cleanDependants
* //purpose :
*/ //=======================================================================
//=============================================================================
void SMESH_subMesh::cleanDependants() void SMESH_subMesh::cleanDependants()
{ {
@ -2105,11 +2001,10 @@ void SMESH_subMesh::cleanDependants()
} }
} }
//============================================================================= //=======================================================================
/*! //function : removeSubMeshElementsAndNodes
* //purpose :
*/ //=======================================================================
//=============================================================================
void SMESH_subMesh::removeSubMeshElementsAndNodes() void SMESH_subMesh::removeSubMeshElementsAndNodes()
{ {
@ -2663,12 +2558,14 @@ bool SMESH_subMesh::FindIntersection(const SMESH_subMesh* theOther,
std::set<const SMESH_subMesh*>& theSetOfCommon ) const std::set<const SMESH_subMesh*>& theSetOfCommon ) const
{ {
int oldNb = theSetOfCommon.size(); int oldNb = theSetOfCommon.size();
// check main submeshes // check main submeshes
const map <int, SMESH_subMesh*>::const_iterator otherEnd = theOther->_mapDepend.end(); const map <int, SMESH_subMesh*>::const_iterator otherEnd = theOther->_mapDepend.end();
if ( theOther->_mapDepend.find(this->GetId()) != otherEnd ) if ( theOther->_mapDepend.find(this->GetId()) != otherEnd )
theSetOfCommon.insert( this ); theSetOfCommon.insert( this );
if ( _mapDepend.find(theOther->GetId()) != _mapDepend.end() ) if ( _mapDepend.find(theOther->GetId()) != _mapDepend.end() )
theSetOfCommon.insert( theOther ); theSetOfCommon.insert( theOther );
// check common submeshes // check common submeshes
map <int, SMESH_subMesh*>::const_iterator mapIt = _mapDepend.begin(); map <int, SMESH_subMesh*>::const_iterator mapIt = _mapDepend.begin();
for( ; mapIt != _mapDepend.end(); mapIt++ ) for( ; mapIt != _mapDepend.end(); mapIt++ )

View File

@ -280,7 +280,7 @@ public:
protected: protected:
// ================================================================== // ==================================================================
void insertDependence(const TopoDS_Shape aSubShape); void insertDependence(const TopoDS_Shape aShape, TopAbs_ShapeEnum aSubType );
void removeSubMeshElementsAndNodes(); void removeSubMeshElementsAndNodes();
void updateDependantsState(const compute_event theEvent); void updateDependantsState(const compute_event theEvent);