1 -- SMESH SMDS : implementaion of Salome mesh data structure
3 -- Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 -- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 -- See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 -- File : SMDS_Mesh.cdl
25 -- Author : Jean-Michel BOULCOURT
28 class Mesh from SMDS inherits MeshObject from SMDS
33 MeshNodeIDFactory from SMDS,
34 MeshElementIDFactory from SMDS,
35 ListOfMeshElement from SMDS,
37 MapOfMeshOrientedElement from SMDS,
38 MeshElement from SMDS,
40 ListIteratorOfListOfMesh from SMDS
43 NoSuchObject from Standard
46 ---================================
47 ---Category: public API methods
49 --=================================
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
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.
66 ---================================
67 ---Category: public API methods
68 -- Mesh Element creation
69 --=================================
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.
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
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
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
101 AddEdgeWithID(me: mutable; idnode1, idnode2, ID : Integer) returns Boolean
102 ---Purpose: create an instance of MeshEdge and add it to the mesh
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
113 AddFaceWithID(me: mutable; idnode1, idnode2, idnode3, ID : Integer) returns Boolean
114 ---Purpose: create an instance of MeshFace and add it to the mesh
118 AddFace(me: mutable; idnode1, idnode2, idnode3, idnode4 : 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
124 AddFaceWithID(me: mutable; idnode1, idnode2, idnode3, idnode4, ID : Integer)
126 ---Purpose: create an instance of MeshFace and add it to the mesh
131 -- *** Volumes *** --
133 AddVolume(me: mutable; idnode1, idnode2, idnode3, idnode4 : 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
139 AddVolumeWithID(me: mutable; idnode1, idnode2, idnode3, idnode4, ID : Integer)
141 ---Purpose: create an instance of MeshVolume and add it to the mesh
144 AddVolume(me: mutable; idnode1, idnode2, idnode3, idnode4, idnode5 : 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
150 AddVolumeWithID(me: mutable; idnode1, idnode2, idnode3, idnode4, idnode5, ID : Integer)
152 ---Purpose: create an instance of MeshVolume and add it to the mesh
155 AddVolume(me: mutable; idnode1, idnode2, idnode3, idnode4, idnode5, idnode6 : 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
161 AddVolumeWithID(me: mutable; idnode1, idnode2, idnode3, idnode4, idnode5, idnode6, ID : Integer)
163 ---Purpose: create an instance of MeshVolume and add it to the mesh
166 AddVolume(me: mutable; idnode1, idnode2, idnode3, idnode4, idnode5, idnode6,
167 idnode7, idnode8 : 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
173 AddVolumeWithID(me: mutable; idnode1, idnode2, idnode3, idnode4, idnode5, idnode6,
174 idnode7, idnode8, ID : Integer)
176 ---Purpose: create an instance of MeshVolume and add it to the mesh
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
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
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
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
203 ---================================
204 ---Category: public API methods
205 -- Mesh Element deletion
206 --=================================
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
215 RemoveEdge(me: mutable; idnode1, idnode2 : Integer)
216 ---Purpose: remove the edge defined by idnode1,idnode2 in the mesh
219 RemoveFace(me: mutable; idnode1, idnode2, idnode3 : Integer)
220 ---Purpose: remove the face defined by idnode1,idnode2,idnode3 in the mesh
223 RemoveFace(me: mutable; idnode1, idnode2, idnode3, idnode4 : Integer)
224 ---Purpose: remove the face defined by idnode1,idnode2,idnode3,idnode4 in the mesh
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
233 RemoveElement(me: mutable; elem: MeshElement;removenodes : Boolean = Standard_False)
236 RemoveFromParent(me: mutable)
238 ---Purpose: remove this from its parent
239 -- if this has no parent then it returns False (True otherwise)
242 RemoveSubMesh(me: mutable; aMesh : Mesh from SMDS)
244 ---Purpose: remove aMesh from the list of Children
245 -- if the submesh does not belong to this, it returns False
249 ---================================
250 ---Category: public API methods
252 --=================================
254 GetNode(me; rank: Integer; ME: MeshElement) returns MeshNode from SMDS
257 FindNode(me; idnode: Integer) returns MeshElement from SMDS
258 ---Purpose: return the meshnode idnode in the mesh
261 FindEdge(me; idnode1, idnode2: Integer) returns MeshElement from SMDS
265 FindFace(me; idnode1, idnode2, idnode3: Integer) returns MeshElement from SMDS
269 FindFace(me; idnode1, idnode2, idnode3, idnode4: Integer) returns MeshElement from SMDS
273 FindElement(me; IDelem: Integer) returns MeshElement from SMDS
274 ---Purpose: returns the mesh element corresponding to IDelem
277 Contains(me; elem: MeshElement) returns Boolean
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
287 SubMeshIterator(me;itmsh: out ListIteratorOfListOfMesh from SMDS)
292 NbNodes(me) returns Integer;
295 NbEdges(me) returns Integer;
298 NbFaces(me) returns Integer;
301 NbVolumes(me) returns Integer;
304 NbSubMesh(me) returns Integer;
319 ---Category: private or protected methods
322 Create(parent: Mesh; nbnodes: Integer = 10) returns mutable Mesh
323 ---Purpose: constructor used internally to create submesh
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)
333 CreateEdge(me; ID, idnode1, idnode2 : Integer) returns MeshElement from SMDS;
335 CreateFace(me; ID, idnode1, idnode2, idnode3 : Integer) returns MeshElement from SMDS;
337 CreateFace(me; ID, idnode1, idnode2, idnode3, idnode4 : Integer)
338 returns MeshElement from SMDS;
340 CreateVolume(me; ID, idnode1, idnode2, idnode3, idnode4 : Integer)
341 returns MeshElement from SMDS;
343 CreateVolume(me; ID, idnode1, idnode2, idnode3, idnode4, idnode5 : Integer)
344 returns MeshElement from SMDS;
346 CreateVolume(me; ID, idnode1, idnode2, idnode3, idnode4, idnode5, idnode6 : Integer)
347 returns MeshElement from SMDS;
349 CreateVolume(me; ID, idnode1, idnode2, idnode3, idnode4, idnode5, idnode6, idnode7, idnode8 : Integer)
350 returns MeshElement from SMDS;
353 FindNode(me; node: MeshElement) returns MeshElement from SMDS
357 FindEdge(me; edge: MeshElement) returns MeshElement from SMDS
361 FindFace(me; face: MeshElement) returns MeshElement from SMDS
365 FindVolume(me; volume: MeshElement) returns MeshElement from SMDS
370 RemoveInverseElement(me; node,parent : MeshElement)
374 FreeNode(me: mutable; node: MeshElement)
377 RemoveNode(me: mutable; node: MeshElement) returns Boolean
380 RemoveEdge(me: mutable; edge: MeshElement)
383 RemoveFace(me: mutable; face: MeshElement)
386 RemoveVolume(me: mutable; volume: MeshElement)
391 GetNode(me; ID: Integer) returns MeshElement from SMDS
394 RemoveAncestors(me: mutable; ME: MeshElement from SMDS; map: MapOfMeshOrientedElement from SMDS)
397 BuildMapNodeAncestors(me; ME: MeshElement from SMDS;map: in out MapOfMeshOrientedElement from SMDS)
400 BuildMapEdgeAncestors(me; ME: MeshElement from SMDS;map: in out MapOfMeshOrientedElement from SMDS)
403 BuildMapFaceAncestors(me; ME: MeshElement from SMDS;map: in out MapOfMeshOrientedElement from SMDS)
406 RebuildInverseConnections(me: mutable)
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;
423 class MeshVolumesIterator from SMDS,
424 class MeshFacesIterator from SMDS,
425 class MeshEdgesIterator from SMDS,
426 class MeshNodesIterator from SMDS