Salome HOME
23418: [OCC] Mesh: Minimization of memory usage of SMESH
[modules/smesh.git] / src / SMESHDS / SMESHDS_Group.cxx
index 6ffa1b19cba4e962fd5ea0db5ade44880a6afd7c..e6df602ff343532c4a4bda2185c1ee3ed681d323 100644 (file)
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-
-//  SMESH SMESHDS : idl implementation based on 'SMESH' unit's classes
 //  File   : SMESHDS_Group.cxx
 //  Module : SMESH
-//  $Header$
 //
+
 #include "SMESHDS_Group.hxx"
 #include "SMESHDS_Mesh.hxx"
 
-using namespace std;
-
 //=============================================================================
 /*!
  *  
@@ -39,8 +35,8 @@ using namespace std;
 SMESHDS_Group::SMESHDS_Group (const int                 theID,
                               const SMESHDS_Mesh*       theMesh,
                               const SMDSAbs_ElementType theType)
-     : SMESHDS_GroupBase(theID,theMesh,theType),
-       myGroup(theMesh,theType)
+  : SMESHDS_GroupBase(theID,theMesh,theType),
+    myGroup(theMesh,theType)
 {
 }
 
@@ -147,20 +143,7 @@ void SMESHDS_Group::Clear()
   myGroup.Clear();
   resetIterator();
 }
-
-// =====================
-// class MyGroupIterator
-// =====================
-
-class MyGroupIterator: public SMDS_ElemIterator
-{
-  const SMDS_MeshGroup& myGroup;
- public:
-  MyGroupIterator(const SMDS_MeshGroup& group): myGroup(group) { myGroup.InitIterator(); }
-  bool more() { return myGroup.More(); }
-  const SMDS_MeshElement* next() { return myGroup.Next(); }
-};
-   
+  
 //=======================================================================
 //function : GetElements
 //purpose  : 
@@ -168,7 +151,7 @@ class MyGroupIterator: public SMDS_ElemIterator
 
 SMDS_ElemIteratorPtr SMESHDS_Group::GetElements() const
 {
-  return SMDS_ElemIteratorPtr( new MyGroupIterator ( myGroup ));
+  return myGroup.GetElements();
 }
 
 //================================================================================
@@ -189,11 +172,14 @@ int SMESHDS_Group::GetTic() const
 
 void SMESHDS_Group::SetType(SMDSAbs_ElementType theType)
 {
-  if ( myGroup.IsEmpty() || GetType() == SMDSAbs_All ) {
+  if ( myGroup.IsEmpty() || GetType() == SMDSAbs_All )
+  {
     SMESHDS_GroupBase::SetType( theType );
     myGroup.SetType ( theType );
   }
   else
+  {
     SMESHDS_GroupBase::SetType( myGroup.GetType() );
+  }
 }