Salome HOME
yfr : Merge with v1.2
[modules/smesh.git] / src / SMESHDS / SMESHDS_Mesh.hxx
1 //  SMESH SMESHDS : management of mesh data and SMESH document
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SMESHDS_Mesh.hxx
25 //  Module : SMESH
26
27 #ifndef _SMESHDS_Mesh_HeaderFile
28 #define _SMESHDS_Mesh_HeaderFile
29
30 #ifndef _Standard_HeaderFile
31 #include <Standard.hxx>
32 #endif
33 #ifndef _Handle_SMESHDS_Mesh_HeaderFile
34 #include "Handle_SMESHDS_Mesh.hxx"
35 #endif
36
37 #ifndef _Standard_Integer_HeaderFile
38 #include <Standard_Integer.hxx>
39 #endif
40 #ifndef _TopoDS_Shape_HeaderFile
41 #include <TopoDS_Shape.hxx>
42 #endif
43 #ifndef _TopoDS_Shell_HeaderFile
44 #include <TopoDS_Shell.hxx>
45 #endif
46 #ifndef _TopTools_IndexedMapOfShape_HeaderFile
47 #include <TopTools_IndexedMapOfShape.hxx>
48 #endif
49 #ifndef _SMESHDS_DataMapOfIntegerSubMesh_HeaderFile
50 #include "SMESHDS_DataMapOfIntegerSubMesh.hxx"
51 #endif
52 #ifndef _SMESHDS_DataMapOfShapeListOfPtrHypothesis_HeaderFile
53 #include "SMESHDS_DataMapOfShapeListOfPtrHypothesis.hxx"
54 #endif
55 #ifndef _Handle_SMESHDS_Script_HeaderFile
56 #include "Handle_SMESHDS_Script.hxx"
57 #endif
58 #ifndef _SMDS_Mesh_HeaderFile
59 #include "SMDS_Mesh.hxx"
60 #endif
61 #ifndef _Standard_Boolean_HeaderFile
62 #include <Standard_Boolean.hxx>
63 #endif
64 #ifndef _SMESHDS_PtrHypothesis_HeaderFile
65 #include "SMESHDS_PtrHypothesis.hxx"
66 #endif
67 #ifndef _Standard_Real_HeaderFile
68 #include <Standard_Real.hxx>
69 #endif
70 #ifndef _Handle_SMDS_MeshNode_HeaderFile
71 #include "Handle_SMDS_MeshNode.hxx"
72 #endif
73 #ifndef _Handle_SMDS_MeshElement_HeaderFile
74 #include "Handle_SMDS_MeshElement.hxx"
75 #endif
76 #ifndef _Handle_SMESHDS_SubMesh_HeaderFile
77 #include "Handle_SMESHDS_SubMesh.hxx"
78 #endif
79 class SMESHDS_Script;
80 class TopoDS_Shape;
81 class SMDS_MeshNode;
82 class TopoDS_Shell;
83 class TopoDS_Face;
84 class TopoDS_Edge;
85 class TopoDS_Vertex;
86 class SMDS_MeshElement;
87 class SMESHDS_SubMesh;
88 class SMESHDS_ListOfPtrHypothesis;
89
90
91 class SMESHDS_Mesh : public SMDS_Mesh {
92
93 public:
94
95     inline void* operator new(size_t,void* anAddress) 
96       {
97         return anAddress;
98       }
99     inline void* operator new(size_t size) 
100       { 
101         return Standard::Allocate(size); 
102       }
103     inline void  operator delete(void *anAddress) 
104       { 
105         if (anAddress) Standard::Free((Standard_Address&)anAddress); 
106       }
107 //    inline void  operator delete(void *anAddress, size_t size) 
108 //      { 
109 //        if (anAddress) Standard::Free((Standard_Address&)anAddress,size); 
110 //      }
111  // Methods PUBLIC
112  // 
113 Standard_EXPORT SMESHDS_Mesh(const Standard_Integer MeshID);
114 Standard_EXPORT   void ShapeToMesh(const TopoDS_Shape& S) ;
115 Standard_EXPORT   Standard_Boolean AddHypothesis(const TopoDS_Shape& SS,const SMESHDS_PtrHypothesis& H) ;
116 Standard_EXPORT   Standard_Boolean RemoveHypothesis(const TopoDS_Shape& S,const SMESHDS_PtrHypothesis& H) ;
117 Standard_EXPORT virtual  Standard_Integer AddNode(const Standard_Real x,const Standard_Real y,const Standard_Real z) ;
118 Standard_EXPORT virtual  void RemoveNode(const Standard_Integer ID) ;
119 Standard_EXPORT   void MoveNode(const Standard_Integer ID,const Standard_Real x,const Standard_Real y,const Standard_Real z) ;
120 Standard_EXPORT virtual  Standard_Integer AddEdge(const Standard_Integer idnode1,const Standard_Integer idnode2) ;
121 Standard_EXPORT virtual  Standard_Integer AddFace(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3) ;
122 Standard_EXPORT virtual  Standard_Integer AddFace(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) ;
123 Standard_EXPORT virtual  Standard_Integer AddVolume(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) ;
124 Standard_EXPORT virtual  Standard_Integer AddVolume(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5) ;
125 Standard_EXPORT virtual  Standard_Integer AddVolume(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6) ;
126 Standard_EXPORT virtual  Standard_Integer AddVolume(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6,const Standard_Integer idnode7,const Standard_Integer idnode8) ;
127 Standard_EXPORT virtual  void RemoveElement(const Standard_Integer IDelem) ;
128 Standard_EXPORT   void SetNodeInVolume(const Handle(SMDS_MeshNode)& aNode,const TopoDS_Shell& S) ;
129 Standard_EXPORT   void SetNodeOnFace(const Handle(SMDS_MeshNode)& aNode,const TopoDS_Face& S) ;
130 Standard_EXPORT   void SetNodeOnEdge(const Handle(SMDS_MeshNode)& aNode,const TopoDS_Edge& S) ;
131 Standard_EXPORT   void SetNodeOnVertex(const Handle(SMDS_MeshNode)& aNode,const TopoDS_Vertex& S) ;
132 Standard_EXPORT   void UnSetNodeOnShape(const Handle(SMDS_MeshNode)& aNode) ;
133 Standard_EXPORT   void SetMeshElementOnShape(const Handle(SMDS_MeshElement)& anElt,const TopoDS_Shape& S) ;
134 Standard_EXPORT   void UnSetMeshElementOnShape(const Handle(SMDS_MeshElement)& anElt,const TopoDS_Shape& S) ;
135 Standard_EXPORT   TopoDS_Shape ShapeToMesh() ;
136 Standard_EXPORT   Standard_Boolean HasMeshElements(const TopoDS_Shape& S) ;
137 Standard_EXPORT   Handle_SMESHDS_SubMesh MeshElements(const TopoDS_Shape& S) ;
138 Standard_EXPORT   Standard_Boolean HasHypothesis(const TopoDS_Shape& S) ;
139 Standard_EXPORT  const SMESHDS_ListOfPtrHypothesis& GetHypothesis(const TopoDS_Shape& S) ;
140 Standard_EXPORT  const Handle_SMESHDS_Script& GetScript() ;
141 Standard_EXPORT   void ClearScript() ;
142 Standard_EXPORT   Standard_Integer ShapeToIndex(const TopoDS_Shape& aShape) ;
143 Standard_EXPORT   TopoDS_Shape IndexToShape(const Standard_Integer ShapeIndex) ;
144 Standard_EXPORT   void NewSubMesh(const Standard_Integer Index) ;
145 Standard_EXPORT   void SetNodeInVolume(const Handle(SMDS_MeshNode)& aNode,const Standard_Integer Index) ;
146 Standard_EXPORT   void SetNodeOnFace(const Handle(SMDS_MeshNode)& aNode,const Standard_Integer Index) ;
147 Standard_EXPORT   void SetNodeOnEdge(const Handle(SMDS_MeshNode)& aNode,const Standard_Integer Index) ;
148 Standard_EXPORT   void SetNodeOnVertex(const Handle(SMDS_MeshNode)& aNode,const Standard_Integer Index) ;
149 Standard_EXPORT   void SetMeshElementOnShape(const Handle(SMDS_MeshElement)& anElt,const Standard_Integer Index) ;
150 Standard_EXPORT ~SMESHDS_Mesh();
151
152
153
154
155  // Type management
156  //
157  Standard_EXPORT friend Handle_Standard_Type& SMESHDS_Mesh_Type_();
158  Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
159  Standard_EXPORT Standard_Boolean              IsKind(const Handle(Standard_Type)&) const;
160
161 protected:
162
163  // Methods PROTECTED
164  // 
165
166
167  // Fields PROTECTED
168  //
169
170
171 private: 
172
173  // Methods PRIVATE
174  // 
175
176
177  // Fields PRIVATE
178  //
179 Standard_Integer myMeshID;
180 TopoDS_Shape myShape;
181 TopTools_IndexedMapOfShape myIndexToShape;
182 SMESHDS_DataMapOfIntegerSubMesh myShapeIndexToSubMesh;
183 SMESHDS_DataMapOfShapeListOfPtrHypothesis myShapeToHypothesis;
184 Handle_SMESHDS_Script myScript;
185
186
187 };
188
189
190
191
192
193 // other inline functions and methods (like "C++: function call" methods)
194 //
195
196
197 #endif