From: eap Date: Mon, 7 Nov 2005 14:34:02 +0000 (+0000) Subject: PAL10158. Add clearMesh() where call ComputeStateEngine(CLEANDEP) X-Git-Tag: V3_1_0a3~23 X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=commitdiff_plain;h=7a320061b4ca9eff8f4f56ac0f42c1a85c59cc4d;hp=e292bda630ab4962307e7c2b2a1524710a0d3b61 PAL10158. Add clearMesh() where call ComputeStateEngine(CLEANDEP) --- diff --git a/src/SMESH/SMESH_Pattern.cxx b/src/SMESH/SMESH_Pattern.cxx index fb9b5afc1..4809aa7e6 100644 --- a/src/SMESH/SMESH_Pattern.cxx +++ b/src/SMESH/SMESH_Pattern.cxx @@ -3466,6 +3466,35 @@ bool SMESH_Pattern:: return makePoly; } +//======================================================================= +//function : clearMesh +//purpose : clear mesh elements existing on myShape in theMesh +//======================================================================= + +void SMESH_Pattern::clearMesh(SMESH_Mesh* theMesh) const +{ + + if ( !myShape.IsNull() ) + { + if ( SMESH_subMesh * aSubMesh = theMesh->GetSubMesh/*Containing*/( myShape )) + { + aSubMesh->ComputeStateEngine( SMESH_subMesh::CLEANDEP ); + } + else { + SMESHDS_Mesh* aMeshDS = theMesh->GetMeshDS(); + if ( SMESHDS_SubMesh* aSubMeshDS = aMeshDS->MeshElements( myShape )) + { + SMDS_ElemIteratorPtr eIt = aSubMeshDS->GetElements(); + while ( eIt->more() ) + aMeshDS->RemoveElement( eIt->next() ); + SMDS_NodeIteratorPtr nIt = aSubMeshDS->GetNodes(); + while ( nIt->more() ) + aMeshDS->RemoveNode( static_cast( nIt->next() )); + } + } + } +} + //======================================================================= //function : MakeMesh //purpose : Create nodes and elements in using nodes @@ -3485,26 +3514,12 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh, SMESHDS_Mesh* aMeshDS = theMesh->GetMeshDS(); // clear elements and nodes existing on myShape - - if ( !myShape.IsNull() ) - { - SMESH_subMesh * aSubMesh = theMesh->GetSubMeshContaining( myShape ); - SMESHDS_SubMesh * aSubMeshDS = aMeshDS->MeshElements( myShape ); - if ( aSubMesh ) - aSubMesh->ComputeStateEngine( SMESH_subMesh::CLEAN ); - else if ( aSubMeshDS ) - { - SMDS_ElemIteratorPtr eIt = aSubMeshDS->GetElements(); - while ( eIt->more() ) - aMeshDS->RemoveElement( eIt->next() ); - SMDS_NodeIteratorPtr nIt = aSubMeshDS->GetNodes(); - while ( nIt->more() ) - aMeshDS->RemoveNode( static_cast( nIt->next() )); - } - } + clearMesh(theMesh); bool onMeshElements = ( !myElements.empty() ); + // Create missing nodes + vector< const SMDS_MeshNode* > nodesVector; // i-th point/xyz -> node if ( onMeshElements ) {