mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-28 18:30:35 +05:00
PAL11992. fix cleanMesh()
This commit is contained in:
parent
6c4637452d
commit
9434254db5
@ -3547,6 +3547,40 @@ bool SMESH_Pattern::
|
||||
return makePoly;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : clearSubMesh
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static bool clearSubMesh( SMESH_Mesh* theMesh,
|
||||
const TopoDS_Shape& theShape)
|
||||
{
|
||||
bool removed = false;
|
||||
if ( SMESH_subMesh * aSubMesh = theMesh->GetSubMeshContaining( theShape ))
|
||||
{
|
||||
if ( aSubMesh->GetSubMeshDS() ) {
|
||||
removed =
|
||||
aSubMesh->GetSubMeshDS()->NbElements() || aSubMesh->GetSubMeshDS()->NbNodes();
|
||||
aSubMesh->ComputeStateEngine( SMESH_subMesh::CLEAN );
|
||||
}
|
||||
}
|
||||
else {
|
||||
SMESHDS_Mesh* aMeshDS = theMesh->GetMeshDS();
|
||||
if ( SMESHDS_SubMesh* aSubMeshDS = aMeshDS->MeshElements( theShape ))
|
||||
{
|
||||
SMDS_ElemIteratorPtr eIt = aSubMeshDS->GetElements();
|
||||
removed = eIt->more();
|
||||
while ( eIt->more() )
|
||||
aMeshDS->RemoveElement( eIt->next() );
|
||||
SMDS_NodeIteratorPtr nIt = aSubMeshDS->GetNodes();
|
||||
removed = removed || nIt->more();
|
||||
while ( nIt->more() )
|
||||
aMeshDS->RemoveNode( static_cast<const SMDS_MeshNode*>( nIt->next() ));
|
||||
}
|
||||
}
|
||||
return removed;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : clearMesh
|
||||
//purpose : clear mesh elements existing on myShape in theMesh
|
||||
@ -3557,20 +3591,11 @@ void SMESH_Pattern::clearMesh(SMESH_Mesh* theMesh) const
|
||||
|
||||
if ( !myShape.IsNull() )
|
||||
{
|
||||
if ( SMESH_subMesh * aSubMesh = theMesh->GetSubMesh/*Containing*/( myShape ))
|
||||
{
|
||||
aSubMesh->ComputeStateEngine( SMESH_subMesh::CLEAN );
|
||||
}
|
||||
else {
|
||||
SMESHDS_Mesh* aMeshDS = theMesh->GetMeshDS();
|
||||
if ( SMESHDS_SubMesh* aSubMeshDS = aMeshDS->MeshElements( myShape ))
|
||||
if ( !clearSubMesh( theMesh, myShape ) && !myIs2D ) { // myShape is SHELL but volumes may be bound to SOLID
|
||||
TopTools_ListIteratorOfListOfShape it( theMesh->GetAncestors( myShape ));
|
||||
for (; it.More() && it.Value().ShapeType() == TopAbs_SOLID; it.Next())
|
||||
{
|
||||
SMDS_ElemIteratorPtr eIt = aSubMeshDS->GetElements();
|
||||
while ( eIt->more() )
|
||||
aMeshDS->RemoveElement( eIt->next() );
|
||||
SMDS_NodeIteratorPtr nIt = aSubMeshDS->GetNodes();
|
||||
while ( nIt->more() )
|
||||
aMeshDS->RemoveNode( static_cast<const SMDS_MeshNode*>( nIt->next() ));
|
||||
clearSubMesh( theMesh, it.Value() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user