]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
0021801: EDF 2143 SMESH: random order of groups returned by ExtrusionSweepObject2D
authoreap <eap@opencascade.com>
Tue, 21 Aug 2012 14:13:23 +0000 (14:13 +0000)
committereap <eap@opencascade.com>
Tue, 21 Aug 2012 14:13:23 +0000 (14:13 +0000)
+  SMESH_Group* AddGroup (SMESHDS_GroupBase* groupDS)

src/SMESH/SMESH_Mesh.cxx
src/SMESH/SMESH_Mesh.hxx

index 1057d3deee69e87f7e9ea71f983b7a9638267865..2b41f59a30294f76d46980c21fbf5d8818325694 100644 (file)
@@ -1651,6 +1651,35 @@ SMESH_Group* SMESH_Mesh::AddGroup (const SMDSAbs_ElementType theType,
   return aGroup;
 }
 
+//================================================================================
+/*!
+ * \brief Creates a group based on an existing SMESHDS group. Group ID should be unique
+ */
+//================================================================================
+
+SMESH_Group* SMESH_Mesh::AddGroup (SMESHDS_GroupBase* groupDS) throw(SALOME_Exception)
+{
+  if ( !groupDS ) 
+    throw SALOME_Exception(LOCALIZED ("SMESH_Mesh::AddGroup(): NULL SMESHDS_GroupBase"));
+
+  map <int, SMESH_Group*>::iterator i_g = _mapGroup.find( groupDS->GetID() );
+  if ( i_g != _mapGroup.end() && i_g->second )
+  {
+    if ( i_g->second->GetGroupDS() == groupDS )
+      return i_g->second;
+    else
+      throw SALOME_Exception(LOCALIZED ("SMESH_Mesh::AddGroup() wrong ID of SMESHDS_GroupBase"));
+  }
+  SMESH_Group* aGroup = new SMESH_Group (groupDS);
+  _mapGroup[ groupDS->GetID() ] = aGroup;
+  GetMeshDS()->AddGroup( aGroup->GetGroupDS() );
+
+  _groupId = 1 + _mapGroup.rbegin()->first;
+
+  return aGroup;
+}
+
+
 //================================================================================
 /*!
  * \brief Creates SMESH_Groups for not wrapped SMESHDS_Groups
index 5ae3cc61c74899b386205e1231d7e81a630e89c6..3f719496fa290be87e42ddabeb5fc9ae1f72a423 100644 (file)
@@ -287,7 +287,9 @@ public:
                          int&                      theId,
                          const TopoDS_Shape&       theShape=TopoDS_Shape(),
                          const SMESH_PredicatePtr& thePredicate=SMESH_PredicatePtr());
-  
+
+  SMESH_Group* AddGroup (SMESHDS_GroupBase* groupDS) throw(SALOME_Exception);
+
   typedef boost::shared_ptr< SMDS_Iterator<SMESH_Group*> > GroupIteratorPtr;
   GroupIteratorPtr GetGroups() const;