]> SALOME platform Git repositories - modules/smesh.git/blobdiff - src/SMESH/SMESH_ProxyMesh.hxx
Salome HOME
Revert "23418: [OCC] Mesh: Minimization of memory usage of SMESH"
[modules/smesh.git] / src / SMESH / SMESH_ProxyMesh.hxx
index 35a4c3a97b8ff6d2804084a0a6d7d1cd89ed7a47..a64002e02527730fc238d6ca4568f4efeed9927b 100644 (file)
@@ -26,7 +26,6 @@
 
 #include "SMESH_SMESH.hxx"
 
-#include "SMDS_ElementHolder.hxx"
 #include "SMESHDS_SubMesh.hxx"
 #include "SMESH_TypeDefs.hxx"
 
@@ -57,7 +56,7 @@ public:
   /*!
    * \brief Proxy sub-mesh
    */
-  class SMESH_EXPORT SubMesh : public SMESHDS_SubMesh, SMDS_ElementHolder
+  class SMESH_EXPORT SubMesh : public SMESHDS_SubMesh
   {
   public:
 
@@ -67,20 +66,19 @@ public:
     virtual void         AddElement(const SMDS_MeshElement * e);
     virtual int          NbElements() const;
     virtual int          NbNodes() const;
-    virtual SMDS_ElemIteratorPtr GetElements() const;
-    virtual SMDS_NodeIteratorPtr GetNodes() const;
+    virtual SMDS_ElemIteratorPtr GetElements(bool reverse=false) const;
+    virtual SMDS_NodeIteratorPtr GetNodes(bool reverse=false) const;
     virtual void         Clear();
     virtual bool         Contains(const SMDS_MeshElement * ME) const;
 
     template< class ITERATOR >
-      void ChangeElements( ITERATOR it, ITERATOR end )
+    void ChangeElements( ITERATOR it, ITERATOR end )
     {
       // change SubMesh contents without deleting tmp elements
       // for which the caller is responsible
       _elements.assign( it, end );
     }
-    SubMesh(const SMDS_Mesh* mesh, int index=0)
-      :SMESHDS_SubMesh(0,index), SMDS_ElementHolder(mesh), _n2n(0) {}
+    SubMesh(int index=0):SMESHDS_SubMesh(0,index),_n2n(0) {}
     virtual ~SubMesh() { Clear(); }
 
   protected:
@@ -88,20 +86,13 @@ public:
     TN2NMap*                              _n2n;
     UVPtStructVec                         _uvPtStructVec; // for SubMesh of EDGE
     friend class SMESH_ProxyMesh;
-
-  protected: // methods of SMDS_ElementHolder; remove elements before mesh compacting or clearing
-    virtual SMDS_ElemIteratorPtr getElements() { Clear(); return GetElements(); }
-    virtual void tmpClear() {}
-    virtual void add( const SMDS_MeshElement* element ) {}
-    virtual void compact() {}
-    virtual void clear() { Clear(); }
   };
   //--------------------------------------------------------------------------------
   // Public interface
 
   SMESH_ProxyMesh();
   SMESH_ProxyMesh(std::vector<SMESH_ProxyMesh::Ptr>& components);
-  SMESH_ProxyMesh(const SMESH_Mesh& mesh);
+  SMESH_ProxyMesh(const SMESH_Mesh& mesh) { _mesh = &mesh; }
   virtual ~SMESH_ProxyMesh();
 
   // Returns the submesh of a shape; it can be a proxy sub-mesh
@@ -138,11 +129,11 @@ public:
   // Interface for descendants
  protected:
 
-  void     setMesh(const SMESH_Mesh& mesh);
+  void     setMesh(const SMESH_Mesh& mesh) { _mesh = &mesh; }
 
   int      shapeIndex(const TopoDS_Shape& shape) const;
 
-  virtual SubMesh* newSubmesh(int index=0) const;
+  virtual SubMesh* newSubmesh(int index=0) const { return new SubMesh(index); }
 
   // returns a proxy sub-mesh; zero index is for the case of mesh w/o shape
   SubMesh* findProxySubMesh(int shapeIndex=0) const;
@@ -186,7 +177,7 @@ public:
   std::set< const SMDS_MeshElement* > _elemsInMesh;
 
   // Complex submesh used to iterate over elements in other sub-meshes
-  mutable SubMesh* _subContainer;
+  mutable SubMesh _subContainer;
 };
 
 #endif