Salome HOME
GPUSPHGUI: add Offset transformation
[modules/smesh.git] / src / SMDS / SMDS_Mesh.hxx
index c0dc013b48c6c386db4b01ee197401a022afd749..00b31a33c782c31ceda7e1a775c41362040af6ee 100644 (file)
@@ -20,7 +20,7 @@
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-//  SMESH SMDS : implementaion of Salome mesh data structure
+//  SMESH SMDS : implementation of Salome mesh data structure
 //  File   : SMDS_Mesh.hxx
 //  Module : SMESH
 //
@@ -69,12 +69,12 @@ public:
 
   SMDS_Mesh();
   
-  //! to retreive this SMDS_Mesh instance from its elements (index stored in SMDS_Elements)
+  //! to retrieve this SMDS_Mesh instance from its elements (index stored in SMDS_Elements)
   static std::vector<SMDS_Mesh*> _meshList;
 
   //! actual nodes coordinates, cells definition and reverse connectivity are stored in a vtkUnstructuredGrid
-  inline SMDS_UnstructuredGrid* getGrid() {return myGrid; }
-  inline int getMeshId() {return myMeshId; }
+  inline SMDS_UnstructuredGrid* getGrid() { return myGrid; }
+  inline int getMeshId() { return myMeshId; }
 
   virtual SMDS_NodeIteratorPtr   nodesIterator     (bool idInceasingOrder=false) const;
   virtual SMDS_EdgeIteratorPtr   edgesIterator     (bool idInceasingOrder=false) const;
@@ -454,6 +454,53 @@ public:
                                      const SMDS_MeshNode * n25,
                                      const SMDS_MeshNode * n36);
 
+  // 2d order Pentahedron with 18 nodes
+  virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3,
+                                           int n4, int n5, int n6,
+                                           int n12,int n23,int n31,
+                                           int n45,int n56,int n64,
+                                           int n14,int n25,int n36,
+                                           int n1245, int n2356, int n1346,
+                                           int ID);
+  virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
+                                           const SMDS_MeshNode * n2,
+                                           const SMDS_MeshNode * n3,
+                                           const SMDS_MeshNode * n4,
+                                           const SMDS_MeshNode * n5,
+                                           const SMDS_MeshNode * n6,
+                                           const SMDS_MeshNode * n12,
+                                           const SMDS_MeshNode * n23,
+                                           const SMDS_MeshNode * n31,
+                                           const SMDS_MeshNode * n45,
+                                           const SMDS_MeshNode * n56,
+                                           const SMDS_MeshNode * n64,
+                                           const SMDS_MeshNode * n14,
+                                           const SMDS_MeshNode * n25,
+                                           const SMDS_MeshNode * n36,
+                                           const SMDS_MeshNode * n1245,
+                                           const SMDS_MeshNode * n2356,
+                                           const SMDS_MeshNode * n1346,
+                                           int ID);
+  virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
+                                     const SMDS_MeshNode * n2,
+                                     const SMDS_MeshNode * n3,
+                                     const SMDS_MeshNode * n4,
+                                     const SMDS_MeshNode * n5,
+                                     const SMDS_MeshNode * n6,
+                                     const SMDS_MeshNode * n12,
+                                     const SMDS_MeshNode * n23,
+                                     const SMDS_MeshNode * n31,
+                                     const SMDS_MeshNode * n45,
+                                     const SMDS_MeshNode * n56,
+                                     const SMDS_MeshNode * n64,
+                                     const SMDS_MeshNode * n14,
+                                     const SMDS_MeshNode * n25,
+                                     const SMDS_MeshNode * n36,
+                                     const SMDS_MeshNode * n1245,
+                                     const SMDS_MeshNode * n2356,
+                                     const SMDS_MeshNode * n1346);
+
+
   // 2d oreder Hexahedrons with 20 nodes
   virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
                                            int n5, int n6, int n7, int n8,
@@ -641,6 +688,7 @@ public:
   virtual void Renumber (const bool isNodes, const int startID = 1, const int deltaID = 1);
   // Renumber all nodes or elements.
   virtual void compactMesh();
+  virtual void CompactMesh() { compactMesh(); }
 
   const SMDS_MeshNode *FindNode(int idnode) const;
   const SMDS_MeshNode *FindNodeVtk(int idnode) const;
@@ -654,7 +702,7 @@ public:
                                 int idnode4, int idnode5, int idnode6) const;
   const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3, int idnode4,
                                 int idnode5, int idnode6, int idnode7, int idnode8) const;
-  const SMDS_MeshElement *FindElement(int IDelem) const;
+  virtual const SMDS_MeshElement * FindElement(int IDelem) const;
   static const SMDS_Mesh0DElement* Find0DElement(const SMDS_MeshNode * n);
   static const SMDS_BallElement* FindBall(const SMDS_MeshNode * n);
   static const SMDS_MeshEdge* FindEdge(const SMDS_MeshNode * n1,
@@ -689,6 +737,9 @@ public:
   static const SMDS_MeshElement* FindElement(const std::vector<const SMDS_MeshNode *>& nodes,
                                              const SMDSAbs_ElementType                 type=SMDSAbs_All,
                                              const bool                                noMedium=true);
+  static int GetElementsByNodes(const std::vector<const SMDS_MeshNode *>& nodes,
+                                std::vector<const SMDS_MeshElement *>&    foundElems,
+                                const SMDSAbs_ElementType                 type=SMDSAbs_All);
 
   /*!
    * \brief Raise an exception if free memory (ram+swap) too low
@@ -705,6 +756,7 @@ public:
   const SMDS_MeshInfo& GetMeshInfo() const { return myInfo; }
 
   virtual int NbNodes() const;
+  virtual int NbElements() const;
   virtual int Nb0DElements() const;
   virtual int NbBalls() const;
   virtual int NbEdges() const;
@@ -739,14 +791,10 @@ public:
   typedef std::vector<SMDS_MeshNode *> SetOfNodes;
   typedef std::vector<SMDS_MeshCell *> SetOfCells;
 
-  void updateNodeMinMax();
-  void updateBoundingBox();
+  //void updateBoundingBox();
   double getMaxDim();
   int fromVtkToSmds(int vtkid);
 
-  void incrementNodesCapacity(int nbNodes);
-  void incrementCellsCapacity(int nbCells);
-  void adjustStructure();
   void dumpGrid(std::string ficdump="dumpGrid");
   static int chunkSize;
 
@@ -754,7 +802,7 @@ public:
   inline void setMyModified() { this->myModified = true; }
 
   void Modified();
-  unsigned long GetMTime() const;
+  vtkMTimeType GetMTime() const;
   bool isCompacted();
 
 protected:
@@ -809,10 +857,10 @@ protected:
   int myMeshId;
 
   //! actual nodes coordinates, cells definition and reverse connectivity are stored in a vtkUnstructuredGrid
-  SMDS_UnstructuredGrid*      myGrid;
+  SMDS_UnstructuredGrid*        myGrid;
 
   //! Small objects like SMDS_MeshNode are allocated by chunks to limit memory costs of new
-  ObjectPool<SMDS_MeshNode>* myNodePool;
+  ObjectPool<SMDS_MeshNode>*    myNodePool;
 
   //! Small objects like SMDS_VtkVolume are allocated by chunks to limit memory costs of new
   ObjectPool<SMDS_VtkVolume>*   myVolumePool;
@@ -820,32 +868,27 @@ protected:
   ObjectPool<SMDS_VtkEdge>*     myEdgePool;
   ObjectPool<SMDS_BallElement>* myBallPool;
 
-  //! SMDS_MeshNodes refer to vtk nodes (vtk id = index in myNodes),store reference to this mesh, and sub-shape
-  SetOfNodes             myNodes;
-
-  //! SMDS_MeshCells refer to vtk cells (vtk id != index in myCells),store reference to this mesh, and sub-shape
-  SetOfCells             myCells;
+  //! SMDS_MeshNodes refer to vtk nodes (vtk id != index in myNodes),store reference to this mesh, and sub-shape
+  SetOfNodes                    myNodes;
+  SetOfCells                    myCells;
 
   //! a buffer to speed up elements addition by excluding some memory allocation
-  std::vector<vtkIdType> myNodeIds;
+  std::vector<vtkIdType>        myNodeIds;
 
   //! for cells only: index = ID in vtkUnstructuredGrid, value = ID for SMDS users
-  std::vector<int>       myCellIdVtkToSmds;
+  std::vector<int>              myCellIdVtkToSmds;
 
-  SMDS_Mesh *            myParent;
-  std::list<SMDS_Mesh *> myChildren;
-  SMDS_MeshNodeIDFactory *myNodeIDFactory;
-  SMDS_MeshElementIDFactory *myElementIDFactory;
-  SMDS_MeshInfo          myInfo;
+  SMDS_Mesh *                   myParent;
+  std::list<SMDS_Mesh *>        myChildren;
+  SMDS_MeshNodeIDFactory *      myNodeIDFactory;
+  SMDS_MeshElementIDFactory *   myElementIDFactory;
+  SMDS_MeshInfo                 myInfo;
 
   //! any add, remove or change of node or cell
   bool myModified;
   //! use a counter to keep track of modifications
   unsigned long myModifTime, myCompactTime;
 
-  int myNodeMin;
-  int myNodeMax;
-
   bool myHasConstructionEdges;
   bool myHasConstructionFaces;
   bool myHasInverseElements;