Salome HOME
Update copyright information
[modules/smesh.git] / src / SMDS / SMDS_Mesh.hxx
index 00db00fa1fceabb4cf3a9e5d2e703abb127c5575..a0def42babed485b46a05903deee31dd1af8009a 100644 (file)
@@ -1,56 +1,47 @@
-//  SMESH SMDS : implementaion of Salome mesh data structure
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
 //
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
 //
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//  SMESH SMDS : implementaion of Salome mesh data structure
 //  File   : SMDS_Mesh.hxx
 //  Module : SMESH
-
+//
 #ifndef _SMDS_Mesh_HeaderFile
 #define _SMDS_Mesh_HeaderFile
 
+#include "SMESH_SMDS.hxx"
+
 #include "SMDS_MeshNode.hxx"
 #include "SMDS_MeshEdge.hxx"
 #include "SMDS_MeshFace.hxx"
 #include "SMDS_MeshVolume.hxx"
 #include "SMDS_MeshElementIDFactory.hxx"
+#include "SMDS_MeshInfo.hxx"
 #include "SMDS_ElemIterator.hxx"
 #include <NCollection_Map.hxx>
 
-//#ifdef WNT
-//#include <SALOME_WNT.hxx>
-//#else
-//#define SALOME_WNT_EXPORT
-//#endif
-#if defined WNT && defined WIN32 && defined SMDS_EXPORTS
-#define SMDS_WNT_EXPORT __declspec( dllexport )
-#else
-#define SMDS_WNT_EXPORT
-#endif
-
 #include <boost/shared_ptr.hpp>
 #include <set>
 #include <list>
 
-class SMDS_WNT_EXPORT SMDS_Mesh:public SMDS_MeshObject{
+class SMDS_EXPORT SMDS_Mesh:public SMDS_MeshObject{
 public:
   
   SMDS_Mesh();
@@ -437,16 +428,18 @@ public:
    *  Implemented for fast cleaning of meshes.
    */
   virtual void RemoveFreeElement(const SMDS_MeshElement * elem);
+
+  virtual void Clear();
   
   virtual bool RemoveFromParent();
   virtual bool RemoveSubMesh(const SMDS_Mesh * aMesh);
 
-  static bool ChangeElementNodes(const SMDS_MeshElement * elem,
-                                 const SMDS_MeshNode    * nodes[],
-                                 const int                nbnodes);
-  static bool ChangePolyhedronNodes(const SMDS_MeshElement * elem,
-                                    std::vector<const SMDS_MeshNode*> nodes,
-                                    std::vector<int>                  quantities);
+  bool ChangeElementNodes(const SMDS_MeshElement * elem,
+                          const SMDS_MeshNode    * nodes[],
+                          const int                nbnodes);
+  bool ChangePolyhedronNodes(const SMDS_MeshElement *                 elem,
+                             const std::vector<const SMDS_MeshNode*>& nodes,
+                             const std::vector<int> &                 quantities);
 
   virtual void Renumber (const bool isNodes, const int startID = 1, const int deltaID = 1);
   // Renumber all nodes or elements.
@@ -491,11 +484,19 @@ public:
   const SMDS_MeshFace *FindFace(std::vector<int> nodes_ids) const;
   static const SMDS_MeshFace* FindFace(std::vector<const SMDS_MeshNode *> nodes);
 
+  /*!
+   * \brief Raise an exception if free memory (ram+swap) too low
+    * \param doNotRaise - if true, suppres exception, just return free memory size
+    * \retval int - amount of available memory in MB or negative number in failure case
+   */
+  static int CheckMemory(const bool doNotRaise=false) throw (std::bad_alloc);
+
   int MaxNodeID() const;
   int MinNodeID() const;
   int MaxElementID() const;
   int MinElementID() const;
 
+  const SMDS_MeshInfo& GetMeshInfo() const { return myInfo; }
 
   int NbNodes() const;
   int NbEdges() const;
@@ -558,15 +559,16 @@ private:
 
   // Fields PRIVATE
   
-  SetOfNodes myNodes;
-  SetOfEdges myEdges;
-  SetOfFaces myFaces;
-  SetOfVolumes myVolumes;
-  SMDS_Mesh *myParent;
+  SetOfNodes             myNodes;
+  SetOfEdges             myEdges;
+  SetOfFaces             myFaces;
+  SetOfVolumes           myVolumes;
+  SMDS_Mesh *            myParent;
   std::list<SMDS_Mesh *> myChildren;
   SMDS_MeshElementIDFactory *myNodeIDFactory;
   SMDS_MeshElementIDFactory *myElementIDFactory;
-  
+  SMDS_MeshInfo          myInfo;
+
   bool myHasConstructionEdges;
   bool myHasConstructionFaces;
   bool myHasInverseElements;