Salome HOME
PAL16842 (Genertion of groups when a mesh is transformed)
authoreap <eap@opencascade.com>
Mon, 12 Nov 2007 09:57:41 +0000 (09:57 +0000)
committereap <eap@opencascade.com>
Mon, 12 Nov 2007 09:57:41 +0000 (09:57 +0000)
+  typedef boost::shared_ptr< SMDS_Iterator<SMESH_Group*> > GroupIteratorPtr;
+  GroupIteratorPtr GetGroups() const;

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

index 9a236a186ba5a95036646a8b167f4511dcd2e09a..0b361a52ba302c4eb2285dee267a39119f3fe326 100644 (file)
@@ -37,6 +37,7 @@
 #include "SMESHDS_GroupOnGeom.hxx"
 #include "SMESHDS_Document.hxx"
 #include "SMDS_MeshVolume.hxx"
+#include "SMDS_SetIterator.hxx"
 
 #include "utilities.h"
 
@@ -1228,9 +1229,21 @@ SMESH_Group* SMESH_Mesh::AddGroup (const SMDSAbs_ElementType theType,
   return aGroup;
 }
 
+//================================================================================
+/*!
+ * \brief Return iterator on all existing groups
+ */
+//================================================================================
+
+SMESH_Mesh::GroupIteratorPtr SMESH_Mesh::GetGroups() const
+{
+  typedef map <int, SMESH_Group *> TMap;
+  return GroupIteratorPtr( new SMDS_mapIterator<TMap>( _mapGroup ));
+}
+
 //=============================================================================
 /*!
- *  
+ * \brief Return a group by ID
  */
 //=============================================================================
 
@@ -1244,11 +1257,11 @@ SMESH_Group* SMESH_Mesh::GetGroup (const int theGroupID)
 
 //=============================================================================
 /*!
- *  
+ * \brief Return IDs of all groups
  */
 //=============================================================================
 
-list<int> SMESH_Mesh::GetGroupIds()
+list<int> SMESH_Mesh::GetGroupIds() const
 {
   list<int> anIds;
   for ( map<int, SMESH_Group*>::const_iterator it = _mapGroup.begin(); it != _mapGroup.end(); it++ )
index e8ccaf7a0db33757a609caf71e2af7a9df9fc4ed..3005f678e0b77f28527105a6905d2a5d9093f69c 100644 (file)
@@ -217,13 +217,16 @@ public:
                         int&                      theId,
                          const TopoDS_Shape&       theShape=TopoDS_Shape());
   
-  SMESH_Group* GetGroup (const int theGroupID);
+  typedef boost::shared_ptr< SMDS_Iterator<SMESH_Group*> > GroupIteratorPtr;
+  GroupIteratorPtr GetGroups() const;
   
-  std::list<int> GetGroupIds();
+  std::list<int> GetGroupIds() const;
   
+  SMESH_Group* GetGroup (const int theGroupID);
+
   void RemoveGroup (const int theGroupID);
 
+
   SMDSAbs_ElementType GetElementType( const int id, const bool iselem );
 
   //