Salome HOME
22812: EDF 9218 SMESH: An empty group is created when using the duplicate nodes and...
[modules/smesh.git] / src / SMESH / SMESH_MeshEditor.cxx
index 08cc1d9c2338fe8f628a01af17d75fa9593bd045..75a8f216ea9f3f92946928069082fbcf0a4e0a22 100644 (file)
@@ -11247,6 +11247,14 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector<TIDSorted
         }
     }
 
+  // Remove empty groups (issue 0022812)
+  std::map<std::string, SMESH_Group*>::iterator name_group = mapOfJunctionGroups.begin();
+  for ( ; name_group != mapOfJunctionGroups.end(); ++name_group )
+  {
+    if ( name_group->second && name_group->second->GetGroupDS()->IsEmpty() )
+      myMesh->RemoveGroup( name_group->second->GetGroupDS()->GetID() );
+  }
+
   meshDS->CleanDownWardConnectivity(); // Mesh has been modified, downward connectivity is no more usable, free memory
   grid->BuildLinks();