From: eap Date: Fri, 21 Nov 2008 11:00:26 +0000 (+0000) Subject: 0019957: EDF 785 SMESH: Convert Quadratic and Group on GEOM X-Git-Tag: V5_1_0rc2~15 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=302341f64cb2ac9a3296f1c30317722947b16a0b;p=modules%2Fsmesh.git 0019957: EDF 785 SMESH: Convert Quadratic and Group on GEOM add an arg to RemoveFreeElement() and RemoveFreeNode() --- diff --git a/src/SMESHDS/SMESHDS_Mesh.cxx b/src/SMESHDS/SMESHDS_Mesh.cxx index da435996b..153498bdf 100644 --- a/src/SMESHDS/SMESHDS_Mesh.cxx +++ b/src/SMESHDS/SMESHDS_Mesh.cxx @@ -705,13 +705,15 @@ void SMESHDS_Mesh::RemoveNode(const SMDS_MeshNode * n) //function : RemoveFreeNode //purpose : //======================================================================= -void SMESHDS_Mesh::RemoveFreeNode(const SMDS_MeshNode * n, SMESHDS_SubMesh * subMesh) +void SMESHDS_Mesh::RemoveFreeNode(const SMDS_MeshNode * n, + SMESHDS_SubMesh * subMesh, + bool fromGroups) { myScript->RemoveNode(n->GetID()); // Rm from group // Node can belong to several groups - if (!myGroups.empty()) { + if (fromGroups && !myGroups.empty()) { set::iterator GrIt = myGroups.begin(); for (; GrIt != myGroups.end(); GrIt++) { SMESHDS_Group* group = dynamic_cast(*GrIt); @@ -754,7 +756,9 @@ void SMESHDS_Mesh::RemoveElement(const SMDS_MeshElement * elt) //function : RemoveFreeElement //purpose : //======================================================================== -void SMESHDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elt, SMESHDS_SubMesh * subMesh) +void SMESHDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elt, + SMESHDS_SubMesh * subMesh, + bool fromGroups) { if (elt->GetType() == SMDSAbs_Node) { RemoveFreeNode( static_cast(elt), subMesh); @@ -769,11 +773,13 @@ void SMESHDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elt, SMESHDS_SubMe // Rm from group // Node can belong to several groups - set::iterator GrIt = myGroups.begin(); - for (; GrIt != myGroups.end(); GrIt++) { - SMESHDS_Group* group = dynamic_cast(*GrIt); - if (group && !group->IsEmpty()) - group->SMDSGroup().Remove(elt); + if ( fromGroups && !myGroups.empty() ) { + set::iterator GrIt = myGroups.begin(); + for (; GrIt != myGroups.end(); GrIt++) { + SMESHDS_Group* group = dynamic_cast(*GrIt); + if (group && !group->IsEmpty()) + group->SMDSGroup().Remove(elt); + } } // Rm from sub-mesh diff --git a/src/SMESHDS/SMESHDS_Mesh.hxx b/src/SMESHDS/SMESHDS_Mesh.hxx index f600112c3..f4cc00f12 100644 --- a/src/SMESHDS/SMESHDS_Mesh.hxx +++ b/src/SMESHDS/SMESHDS_Mesh.hxx @@ -379,8 +379,8 @@ public: * Methods do not work for meshes with descendants. * Implemented for fast cleaning of meshes. */ - void RemoveFreeNode(const SMDS_MeshNode *, SMESHDS_SubMesh *); - void RemoveFreeElement(const SMDS_MeshElement *, SMESHDS_SubMesh *); + void RemoveFreeNode (const SMDS_MeshNode *, SMESHDS_SubMesh *, bool fromGroups=true); + void RemoveFreeElement(const SMDS_MeshElement *, SMESHDS_SubMesh *, bool fromGroups=true); void ClearMesh();