Salome HOME
update
[modules/smesh.git] / idl / SMESH_Mesh.idl
1 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
3 // 
4 //  This library is free software; you can redistribute it and/or 
5 //  modify it under the terms of the GNU Lesser General Public 
6 //  License as published by the Free Software Foundation; either 
7 //  version 2.1 of the License. 
8 // 
9 //  This library is distributed in the hope that it will be useful, 
10 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 //  Lesser General Public License for more details. 
13 // 
14 //  You should have received a copy of the GNU Lesser General Public 
15 //  License along with this library; if not, write to the Free Software 
16 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
17 // 
18 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
19 //
20 //
21 //
22 //  File   : SMESH_Mesh.idl
23 //  Author : Paul RASCLE, EDF
24 //  $Header$
25
26 #ifndef _SMESH_MESH_IDL_
27 #define _SMESH_MESH_IDL_
28
29 #include "SALOME_Exception.idl"
30 #include "SMESH_Hypothesis.idl"
31
32 #include "GEOM_Shape.idl"
33 #include "MED.idl"
34
35 module SMESH
36 {
37   typedef sequence<double> double_array ;
38   typedef sequence<long> long_array ;
39   typedef sequence<string> string_array ;
40
41   enum log_command
42     {
43       ADD_NODE,
44       ADD_EDGE,
45       ADD_TRIANGLE,
46       ADD_QUADRANGLE,
47       ADD_TETRAHEDRON,
48       ADD_PYRAMID,
49       ADD_PRISM,
50       ADD_HEXAHEDRON,
51       REMOVE_NODE,
52       REMOVE_ELEMENT,
53           REMOVE_ALL
54     };
55
56   struct log_block
57   {
58     long commandType;
59     long number;
60     double_array coords;
61     long_array indexes;
62   };
63   
64   typedef sequence<log_block> log_array;
65
66   interface SMESH_subMesh;
67   interface SMESH_MeshEditor;
68   interface SMESH_Mesh
69   {
70     /*!
71      * Associate a Shape to a Mesh created with NewEmpty
72      */
73
74 //     boolean SetMesh(in GEOM::GEOM_Shape aShape)
75 //        raises (SALOME::SALOME_Exception);
76
77     /*!
78      * Get the subMesh object associated to a subShape. The subMesh object
79      * gives access to nodes and elements IDs.
80      * SubMesh will be used instead of SubShape in a next idl version to 
81      * adress a specific subMesh...
82      */
83     SMESH_subMesh GetElementsOnShape(in GEOM::GEOM_Shape aSubShape)
84       raises (SALOME::SALOME_Exception);
85
86     /*!
87      * Create a subMesh without reference to a subShape
88      */
89 //     SMESH_subMesh NewEmpty()
90 //       raises (SALOME::SALOME_Exception);
91
92     /*!
93      * Add hypothesis to the mesh, under a particular subShape
94      * (or the main shape itself)
95      * The Add method is only used to prepare the build of the mesh and store
96      * the algorithms and associated parameters.
97      * Actual job of mesh the shape is done by MESH_Gen.
98      * @params
99      * - aSubShape : subShape obtained by a shape explode in GEOM
100      *   (or main shape)
101      * - anHyp : hypothesis object 
102      * @return
103      * - OK if the hypothesis is compatible with the subShape 
104      *   (and all previous hypothesis on the subShape)
105      * - NOK if the hypothesis is not compatible with the subShape
106      *   (or one previous hypothesis on the subShape)
107      * raises exception if hypothesis has not been created
108      */
109     boolean AddHypothesis(in GEOM::GEOM_Shape aSubShape, in SMESH_Hypothesis anHyp)
110       raises (SALOME::SALOME_Exception);
111 //     boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
112 //       raises (SALOME::SALOME_Exception);
113
114
115     /*!
116      * Remove an hypothesis previouly added with AddHypothesis.
117      */
118     boolean RemoveHypothesis(in GEOM::GEOM_Shape aSubShape,
119                              in SMESH_Hypothesis anHyp)
120       raises (SALOME::SALOME_Exception);
121 //     boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
122 //                           in SMESH_Hypothesis anHyp)
123 //       raises (SALOME::SALOME_Exception);
124
125     /*!
126      * Get the list of hypothesis added on a subShape
127      */
128     ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Shape aSubShape)
129       raises (SALOME::SALOME_Exception);
130 //     ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
131 //       raises (SALOME::SALOME_Exception);
132
133     /*!
134      * Get the log of nodes and elements added or removed since previous
135      * clear of the log.
136      * @params
137      * - clearAfterGet : log is emptied after Get (safe if concurrents access)
138      */
139     //    string_array GetLog(in boolean clearAfterGet)
140     //      raises (SALOME::SALOME_Exception);
141     log_array GetLog(in boolean clearAfterGet)
142       raises (SALOME::SALOME_Exception);
143
144     /*!
145      * Clear the log of nodes and elements added or removed since previous
146      * clear. Must be used immediately after GetLog if clearAfterGet is false.
147      */
148     void ClearLog()
149       raises (SALOME::SALOME_Exception);
150
151     /*!
152      * Get the internal Id 
153      */
154     long GetId();     
155
156     /*!
157      * Get the study Id 
158      */
159     long GetStudyId();    
160     
161     SMESH_MeshEditor GetMeshEditor() 
162        raises (SALOME::SALOME_Exception);
163
164     /*!
165      * Export mesh to a file
166          * @param fileName file name where to export the file
167          * @param fileType Currently it could be either "DAT", "UNV" or "MED".
168      */
169     void Export( in string fileName, in string fileType )
170       raises (SALOME::SALOME_Exception);
171
172     /*!
173      * Get MED Mesh
174      */
175     SALOME_MED::MESH GetMEDMesh()
176       raises (SALOME::SALOME_Exception);
177
178     long NbNodes()
179       raises (SALOME::SALOME_Exception);
180
181     long NbEdges()
182       raises (SALOME::SALOME_Exception);
183
184     long NbFaces()
185       raises (SALOME::SALOME_Exception);
186
187     long NbTriangles()
188       raises (SALOME::SALOME_Exception);
189
190     long NbQuadrangles()
191       raises (SALOME::SALOME_Exception);
192
193     long NbVolumes()
194       raises (SALOME::SALOME_Exception);
195
196     long NbTetras()
197       raises (SALOME::SALOME_Exception);
198
199     long NbHexas()
200       raises (SALOME::SALOME_Exception);
201
202     long NbSubMesh()
203       raises (SALOME::SALOME_Exception);
204   };
205
206   interface SMESH_subMesh
207   {
208     /*!
209      * 
210      */
211     long GetNumberOfElements()
212       raises (SALOME::SALOME_Exception);
213
214     /*!
215      * 
216      */
217     long GetNumberOfNodes()
218       raises (SALOME::SALOME_Exception);
219
220     /*!
221      * 
222      */
223     long_array GetElementsId()
224       raises (SALOME::SALOME_Exception);
225
226     /*!
227      * 
228      */
229     long_array GetNodesId()
230       raises (SALOME::SALOME_Exception);
231
232     /*!
233      * Get SMESH_Mesh which stores nodes coordinates & elements definition
234      */
235     SMESH_Mesh GetFather()
236       raises (SALOME::SALOME_Exception);
237
238     /*!
239      * Get the internal Id 
240      */
241     long GetId();    
242
243     /*!
244      * Get MED subMesh
245      */
246     SALOME_MED::FAMILY GetFamily()
247       raises (SALOME::SALOME_Exception);
248   };
249   
250   /* 
251    * This interface makes modifications on the Mesh - removing elements and nodes
252    */     
253   interface SMESH_MeshEditor {
254
255
256     boolean RemoveElements(in long_array IDsOfElements)
257        raises (SALOME::SALOME_Exception);
258
259     boolean RemoveNodes(in long_array IDsOfNodes)
260       raises (SALOME::SALOME_Exception);
261
262     boolean AddNode(in double x, in double y, in double z)
263       raises (SALOME::SALOME_Exception);
264
265     boolean AddEdge(in long_array IDsOfNodes)
266       raises (SALOME::SALOME_Exception);
267
268     boolean AddFace(in long_array IDsOfNodes)
269       raises (SALOME::SALOME_Exception);
270
271     boolean AddVolume(in long_array IDsOfNodes)
272       raises (SALOME::SALOME_Exception);
273   };
274 };
275
276 #endif