Salome HOME
Add a ChangeLog file
[modules/smesh.git] / src / SMDS / SMDS_Mesh.cdl
1 --  SMESH SMDS : implementaion of Salome mesh data structure
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   : SMDS_Mesh.cdl
25 --  Author : Jean-Michel BOULCOURT
26 --  Module : SMESH
27
28 class Mesh from SMDS inherits MeshObject from SMDS
29
30         ---Purpose: 
31
32 uses
33     MeshNodeIDFactory from SMDS,
34     MeshElementIDFactory from SMDS,
35     ListOfMeshElement from SMDS,
36     ListOfMesh from SMDS,
37     MapOfMeshOrientedElement from SMDS,
38     MeshElement from SMDS,
39     MeshNode from SMDS,
40     ListIteratorOfListOfMesh from SMDS   
41 raises
42
43     NoSuchObject from Standard
44 is
45
46     ---================================
47     ---Category: public API methods
48     --           Mesh creation
49     --=================================
50
51     Create(nbnodes: Integer = 10; nbedges : Integer = 10; 
52            nbfaces : Integer = 10; nbvolumes : Integer = 10) returns mutable Mesh;
53     ---Purpose:  create a  new mesh.   It is  possible to  specify the
54     --          initial size  of elements.   
55     --          It is recommended  to set the size of mesh elements
56     --          in the constructor to avoid too much resizing of data storage
57
58     AddSubMesh(me: mutable) returns Mesh from SMDS
59     ---Purpose: create an submesh.
60     --          uses a private constructor to create a instance of the submesh
61     --          and attach it to the mesh parent.
62     is static;
63
64
65
66     ---================================
67     ---Category: public API methods
68     --           Mesh Element creation
69     --=================================
70
71     -- *** Nodes *** --
72    
73    
74     AddNode(me: mutable; x,y,z : Real) returns Integer
75     ---Purpose: create an instance of  MeshNode and add it to the mesh
76     --          if the mesh  has a parent then the  node is also added
77     --          to the parent mesh.
78     --          Returns a generated ID for the created node.
79     is virtual;
80
81     AddNodeWithID(me: mutable; x,y,z : Real; ID: Integer) returns Boolean
82     ---Purpose: create an instance of  MeshNode and add it to the mesh
83     --          if the mesh  has a parent then the  node is also added
84     --          to the parent mesh.
85     --          returns False in case the ID already exists
86     is virtual;
87
88     AddNode(me: mutable; ID : Integer) returns Boolean
89     ---Purpose: add  an existing node in  the mesh. This  is useful to
90     --          add a node from a parent mesh to the submesh
91     is virtual;
92
93
94     -- *** Edges *** --
95    
96     AddEdge(me: mutable; idnode1, idnode2 : Integer) returns Integer
97     ---Purpose: create an instance of MeshEdge and add it to the mesh
98     --          returns the id of the element. Returns 0 if creation failed
99     is virtual;
100
101     AddEdgeWithID(me: mutable; idnode1, idnode2, ID : Integer) returns Boolean
102     ---Purpose: create an instance of MeshEdge and add it to the mesh
103     is virtual;
104
105
106     -- *** Faces *** --
107    
108     AddFace(me: mutable; idnode1, idnode2, idnode3 : Integer) returns Integer
109     ---Purpose: create an instance of MeshFace and add it to the mesh
110     --          returns the id of the element. Returns 0 if creation failed
111     is virtual;
112
113     AddFaceWithID(me: mutable; idnode1, idnode2, idnode3, ID : Integer) returns Boolean
114     ---Purpose: create an instance of MeshFace and add it to the mesh
115     is virtual;
116
117
118     AddFace(me: mutable; idnode1, idnode2, idnode3, idnode4 : Integer) 
119     returns Integer
120     ---Purpose: create an instance of MeshFace and add it to the mesh
121     --          returns the id of the element. Returns 0 if creation failed
122     is virtual;
123
124     AddFaceWithID(me: mutable; idnode1, idnode2, idnode3, idnode4, ID : Integer) 
125     returns Boolean
126     ---Purpose: create an instance of MeshFace and add it to the mesh
127     is virtual;
128
129
130
131     -- *** Volumes *** --
132
133     AddVolume(me: mutable; idnode1, idnode2, idnode3, idnode4 : Integer) 
134     returns Integer
135     ---Purpose: create an instance of MeshVolume and add it to the mesh
136     --          returns the id of the element. Returns 0 if creation failed
137     is virtual;
138
139     AddVolumeWithID(me: mutable; idnode1, idnode2, idnode3, idnode4, ID : Integer) 
140     returns Boolean
141     ---Purpose: create an instance of MeshVolume and add it to the mesh
142     is virtual;
143
144     AddVolume(me: mutable; idnode1, idnode2, idnode3, idnode4, idnode5 : Integer) 
145     returns Integer
146     ---Purpose: create an instance of MeshVolume and add it to the mesh
147     --          returns the id of the element. Returns 0 if creation failed
148     is virtual;
149
150     AddVolumeWithID(me: mutable; idnode1, idnode2, idnode3, idnode4, idnode5, ID : Integer) 
151     returns Boolean
152     ---Purpose: create an instance of MeshVolume and add it to the mesh
153     is virtual;
154
155     AddVolume(me: mutable; idnode1, idnode2, idnode3, idnode4, idnode5, idnode6 : Integer) 
156     returns Integer
157     ---Purpose: create an instance of MeshVolume and add it to the mesh
158     --          returns the id of the element. Returns 0 if creation failed
159     is virtual;
160
161     AddVolumeWithID(me: mutable; idnode1, idnode2, idnode3, idnode4, idnode5, idnode6, ID : Integer) 
162     returns Boolean
163     ---Purpose: create an instance of MeshVolume and add it to the mesh
164     is virtual;
165
166     AddVolume(me: mutable; idnode1, idnode2, idnode3, idnode4, idnode5, idnode6,
167                            idnode7, idnode8 : Integer) 
168     returns Integer
169     ---Purpose: create an instance of MeshVolume and add it to the mesh
170     --          returns the id of the element. Returns 0 if creation failed
171     is virtual;
172
173     AddVolumeWithID(me: mutable; idnode1, idnode2, idnode3, idnode4, idnode5, idnode6,
174                            idnode7, idnode8, ID : Integer) 
175     returns Boolean
176     ---Purpose: create an instance of MeshVolume and add it to the mesh
177     is virtual;
178
179
180     AddVolume(me: mutable; node1, node2, node3, node4 : MeshElement) 
181     returns MeshElement from SMDS
182     ---Purpose: create an instance of MeshVolume and add it to the mesh
183     is static;
184
185     AddVolume(me: mutable; node1, node2, node3, node4, node5 : MeshElement) 
186     returns MeshElement from SMDS
187     ---Purpose: create an instance of MeshVolume and add it to the mesh
188     is static;
189
190     AddVolume(me: mutable; node1, node2, node3, node4, node5, node6 : MeshElement) 
191     returns MeshElement from SMDS
192     ---Purpose: create an instance of MeshVolume and add it to the mesh
193     is static;
194
195     AddVolume(me: mutable; node1, node2, node3, node4, 
196                            node5, node6, node7, node8 : MeshElement) 
197     returns MeshElement from SMDS
198     ---Purpose: create an instance of MeshVolume and add it to the mesh
199     is static;
200
201
202
203     ---================================
204     ---Category: public API methods
205     --           Mesh Element deletion
206     --=================================
207
208
209     RemoveNode(me: mutable; IDnode: Integer)
210     ---Purpose: remove the node IDnode in the mesh and in all the children mesh
211     --          if it exists, it remains in the parent mesh
212     --          if the mesh has no parent, then ID is released
213     is virtual;
214     
215     RemoveEdge(me: mutable; idnode1, idnode2 : Integer)
216     ---Purpose: remove the edge defined by idnode1,idnode2 in the mesh
217     is virtual;
218     
219     RemoveFace(me: mutable; idnode1, idnode2, idnode3 : Integer)
220     ---Purpose: remove the face defined by idnode1,idnode2,idnode3 in the mesh
221     is virtual;
222     
223     RemoveFace(me: mutable; idnode1, idnode2, idnode3, idnode4 : Integer)
224     ---Purpose: remove the face defined by idnode1,idnode2,idnode3,idnode4 in the mesh
225     is virtual;
226
227     RemoveElement(me: mutable; IDelem : Integer;removenodes : Boolean = Standard_False)
228     ---Purpose: remove the mesh element IDelem
229     --          Caution : Cannot be used to remove nodes, instead
230     --          use method RemoveNode
231     is virtual;
232
233     RemoveElement(me: mutable; elem: MeshElement;removenodes : Boolean = Standard_False)
234     is static;
235
236     RemoveFromParent(me: mutable)
237     returns Boolean
238     ---Purpose: remove this from its parent
239     --          if this has no parent then it returns False (True otherwise)
240     is virtual;
241
242     RemoveSubMesh(me: mutable; aMesh : Mesh from SMDS)
243     returns Boolean
244     ---Purpose: remove aMesh from the list of Children
245     --          if the submesh does not belong to this, it returns False
246     --          (True otherwiswe)
247     is virtual;
248
249     ---================================
250     ---Category: public API methods
251     --           Mesh exploration
252     --=================================
253
254     GetNode(me; rank: Integer; ME: MeshElement) returns MeshNode from SMDS
255     is static;
256
257     FindNode(me; idnode: Integer) returns MeshElement from SMDS
258     ---Purpose: return the meshnode idnode in the mesh
259     is static;
260
261     FindEdge(me; idnode1, idnode2: Integer) returns MeshElement from SMDS
262     ---Purpose: 
263     is static;
264
265     FindFace(me; idnode1, idnode2, idnode3: Integer) returns MeshElement from SMDS
266     ---Purpose: 
267     is static;
268
269     FindFace(me; idnode1, idnode2, idnode3, idnode4: Integer) returns MeshElement from SMDS
270     ---Purpose: 
271     is static;
272
273     FindElement(me; IDelem: Integer) returns MeshElement from SMDS
274     ---Purpose:  returns the mesh element corresponding to IDelem
275     is static;
276
277     Contains(me; elem: MeshElement) returns Boolean
278     ---Purpose: 
279     is static;
280
281     RebuildAllInverseConnections(me: mutable)
282     ---Purpose: clean the inverse connections and rebuild them
283     --          completely. If the mesh has children, the 
284     --          inverse connections are also rebuilt
285     is static;
286
287     SubMeshIterator(me;itmsh: out ListIteratorOfListOfMesh from SMDS)
288     ---Purpose: 
289     is static;
290
291     
292     NbNodes(me) returns Integer;
293     ---C++: inline
294
295     NbEdges(me) returns Integer;
296     ---C++: inline
297
298     NbFaces(me) returns Integer;
299     ---C++: inline
300
301     NbVolumes(me) returns Integer;
302     ---C++: inline
303
304     NbSubMesh(me) returns Integer;
305     ---C++: inline
306
307     DumpNodes(me);
308
309     DumpEdges(me);
310
311     DumpFaces(me);
312
313     DumpVolumes(me);
314
315     DebugStats(me);
316
317
318
319     ---Category: private or protected methods
320     --           
321
322     Create(parent: Mesh; nbnodes: Integer = 10) returns mutable Mesh
323     ---Purpose: constructor used internally to create submesh
324     --          
325     is private;
326     
327     AddNode(me: mutable; node : MeshElement ) returns Boolean
328     ---Purpose: add a node in the mesh
329     --          if the mesh has parent, the node is also added to the parent.
330     --          returns False if the node is invalid ( null handle)
331     is private;
332
333     CreateEdge(me; ID, idnode1, idnode2 : Integer) returns MeshElement from SMDS;
334
335     CreateFace(me; ID, idnode1, idnode2, idnode3 : Integer) returns MeshElement from SMDS;
336
337     CreateFace(me; ID, idnode1, idnode2, idnode3, idnode4 : Integer) 
338     returns MeshElement from SMDS;
339
340     CreateVolume(me; ID, idnode1, idnode2, idnode3, idnode4 : Integer) 
341     returns MeshElement from SMDS;
342
343     CreateVolume(me; ID, idnode1, idnode2, idnode3, idnode4, idnode5 : Integer) 
344     returns MeshElement from SMDS;
345
346     CreateVolume(me; ID, idnode1, idnode2, idnode3, idnode4, idnode5, idnode6 : Integer) 
347     returns MeshElement from SMDS;
348
349     CreateVolume(me; ID, idnode1, idnode2, idnode3, idnode4, idnode5, idnode6, idnode7, idnode8 : Integer) 
350     returns MeshElement from SMDS;
351
352
353     FindNode(me; node: MeshElement) returns MeshElement from SMDS
354     ---Purpose: 
355     is protected;
356
357     FindEdge(me; edge: MeshElement) returns MeshElement from SMDS
358     ---Purpose: 
359     is protected;
360
361     FindFace(me; face: MeshElement) returns MeshElement from SMDS
362     ---Purpose: 
363     is protected;
364
365     FindVolume(me; volume: MeshElement) returns MeshElement from SMDS
366     ---Purpose: 
367     is protected;
368
369
370     RemoveInverseElement(me; node,parent : MeshElement)
371     ---Purpose: 
372     is protected;
373
374     FreeNode(me: mutable; node: MeshElement)
375     is private;
376
377     RemoveNode(me: mutable; node: MeshElement) returns Boolean
378     is protected;
379
380     RemoveEdge(me: mutable; edge: MeshElement)
381     is protected;
382     
383     RemoveFace(me: mutable; face: MeshElement)
384     is protected;
385
386     RemoveVolume(me: mutable; volume: MeshElement)
387     is protected;
388
389
390
391     GetNode(me; ID: Integer) returns MeshElement from SMDS
392     is protected;
393
394     RemoveAncestors(me: mutable; ME: MeshElement from SMDS; map: MapOfMeshOrientedElement from SMDS)
395     is protected;
396
397     BuildMapNodeAncestors(me; ME: MeshElement from SMDS;map: in out MapOfMeshOrientedElement from SMDS)
398     is private;
399
400     BuildMapEdgeAncestors(me; ME: MeshElement from SMDS;map: in out MapOfMeshOrientedElement from SMDS)
401     is private;
402
403     BuildMapFaceAncestors(me; ME: MeshElement from SMDS;map: in out MapOfMeshOrientedElement from SMDS)
404     is private;
405
406     RebuildInverseConnections(me: mutable)
407     ---Purpose: 
408     is private;
409
410
411 fields
412
413     myNodes     : MapOfMeshOrientedElement      from SMDS;
414     myEdges     : MapOfMeshOrientedElement      from SMDS;
415     myFaces     : MapOfMeshOrientedElement      from SMDS;
416     myVolumes   : MapOfMeshOrientedElement      from SMDS;
417     myParent    : Mesh from SMDS;
418     myChildren  : ListOfMesh from SMDS;
419     myNodeIDFactory : MeshNodeIDFactory from SMDS;
420     myElementIDFactory : MeshElementIDFactory from SMDS;
421     myHasInverse : Boolean;
422 friends
423      class MeshVolumesIterator from SMDS,
424      class MeshFacesIterator from SMDS,
425      class MeshEdgesIterator from SMDS,
426      class MeshNodesIterator from SMDS
427    
428 end Mesh;