0019957: EDF 785 SMESH: Convert Quadratic and Group on GEOM

add an arg to RemoveFreeElement() and RemoveFreeNode()
This commit is contained in:
eap 2008-11-21 11:00:26 +00:00
parent 8543a7f613
commit 302341f64c
2 changed files with 16 additions and 10 deletions

View File

@ -705,13 +705,15 @@ void SMESHDS_Mesh::RemoveNode(const SMDS_MeshNode * n)
//function : RemoveFreeNode //function : RemoveFreeNode
//purpose : //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()); myScript->RemoveNode(n->GetID());
// Rm from group // Rm from group
// Node can belong to several groups // Node can belong to several groups
if (!myGroups.empty()) { if (fromGroups && !myGroups.empty()) {
set<SMESHDS_GroupBase*>::iterator GrIt = myGroups.begin(); set<SMESHDS_GroupBase*>::iterator GrIt = myGroups.begin();
for (; GrIt != myGroups.end(); GrIt++) { for (; GrIt != myGroups.end(); GrIt++) {
SMESHDS_Group* group = dynamic_cast<SMESHDS_Group*>(*GrIt); SMESHDS_Group* group = dynamic_cast<SMESHDS_Group*>(*GrIt);
@ -754,7 +756,9 @@ void SMESHDS_Mesh::RemoveElement(const SMDS_MeshElement * elt)
//function : RemoveFreeElement //function : RemoveFreeElement
//purpose : //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) { if (elt->GetType() == SMDSAbs_Node) {
RemoveFreeNode( static_cast<const SMDS_MeshNode*>(elt), subMesh); RemoveFreeNode( static_cast<const SMDS_MeshNode*>(elt), subMesh);
@ -769,12 +773,14 @@ void SMESHDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elt, SMESHDS_SubMe
// Rm from group // Rm from group
// Node can belong to several groups // Node can belong to several groups
if ( fromGroups && !myGroups.empty() ) {
set<SMESHDS_GroupBase*>::iterator GrIt = myGroups.begin(); set<SMESHDS_GroupBase*>::iterator GrIt = myGroups.begin();
for (; GrIt != myGroups.end(); GrIt++) { for (; GrIt != myGroups.end(); GrIt++) {
SMESHDS_Group* group = dynamic_cast<SMESHDS_Group*>(*GrIt); SMESHDS_Group* group = dynamic_cast<SMESHDS_Group*>(*GrIt);
if (group && !group->IsEmpty()) if (group && !group->IsEmpty())
group->SMDSGroup().Remove(elt); group->SMDSGroup().Remove(elt);
} }
}
// Rm from sub-mesh // Rm from sub-mesh
// Element should belong to only one sub-mesh // Element should belong to only one sub-mesh

View File

@ -379,8 +379,8 @@ public:
* Methods do not work for meshes with descendants. * Methods do not work for meshes with descendants.
* Implemented for fast cleaning of meshes. * Implemented for fast cleaning of meshes.
*/ */
void RemoveFreeNode(const SMDS_MeshNode *, SMESHDS_SubMesh *); void RemoveFreeNode (const SMDS_MeshNode *, SMESHDS_SubMesh *, bool fromGroups=true);
void RemoveFreeElement(const SMDS_MeshElement *, SMESHDS_SubMesh *); void RemoveFreeElement(const SMDS_MeshElement *, SMESHDS_SubMesh *, bool fromGroups=true);
void ClearMesh(); void ClearMesh();