Salome HOME
DCQ : Merge with Ecole_Ete_a6.
[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 "SALOME_GenericObj.idl"
33 //#include "GEOM_Shape.idl"
34 //#include "MED.idl"
35
36 module GEOM
37 {
38   interface GEOM_Shape;
39 };
40
41
42 module SALOME_MED
43 {
44   interface MESH;
45   interface FAMILY;
46 };
47
48
49 module SMESH
50 {
51   interface SMESH_Hypothesis;
52   typedef sequence<SMESH_Hypothesis> ListOfHypothesis;
53
54   typedef sequence<double> double_array ;
55   typedef sequence<long> long_array ;
56   typedef sequence<string> string_array ;
57
58   enum log_command
59     {
60       ADD_NODE,
61       ADD_EDGE,
62       ADD_TRIANGLE,
63       ADD_QUADRANGLE,
64       ADD_TETRAHEDRON,
65       ADD_PYRAMID,
66       ADD_PRISM,
67       ADD_HEXAHEDRON,
68       REMOVE_NODE,
69       REMOVE_ELEMENT
70     };
71
72   struct log_block
73   {
74     long commandType;
75     long number;
76     double_array coords;
77     long_array indexes;
78   };
79
80   
81   /*!
82    * Enumeration for element type, like in SMDS
83    */
84   enum ElementType
85   {
86     ALL,
87     NODE,
88     EDGE,
89     FACE,
90     VOLUME
91   };
92   
93   /*!
94    * Enumeration for hypothesis status (used by AddHypothesis() and RemoveHypothesis() methods) 
95    */  
96   enum Hypothesis_Status // in the order of severity
97   {
98     HYP_OK,
99     HYP_MISSING,      // algo misses a hypothesis
100     HYP_CONCURENT,    // several applicable hypotheses
101     HYP_BAD_PARAMETER,// hypothesis has a bad parameter value
102     HYP_UNKNOWN_FATAL,//  --- all statuses below should be considered as fatal
103                       //      for Add/RemoveHypothesis operations
104     HYP_INCOMPATIBLE, // hypothesis does not fit algo
105     HYP_NOTCONFORM,   // not conform mesh is produced appling a hypothesis
106     HYP_ALREADY_EXIST,// such hypothesis already exist
107     HYP_BAD_DIM       // bad dimension
108   }; 
109   
110   /*!
111    * Enumeration for DriverMED read status (used by ImportMEDFile() method)
112    */  
113   enum DriverMED_ReadStatus // in the order of severity
114   {
115     DRS_OK,
116     DRS_EMPTY,          // a MED file contains no mesh with the given name
117     DRS_WARN_RENUMBER,  // a MED file has overlapped ranges of element numbers,
118                         // so the numbers from the file are ignored
119     DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
120     DRS_FAIL            // general failure (exception etc.)
121   }; 
122
123   typedef sequence<log_block> log_array;
124
125   interface SMESH_Group;
126   interface SMESH_subMesh;
127   interface SMESH_MeshEditor;
128   interface SMESH_Mesh : SALOME::GenericObj
129   {
130     /*!
131      * Associate a Shape to a Mesh created with NewEmpty
132      */
133
134 //     boolean SetMesh(in GEOM::GEOM_Shape aShape)
135 //        raises (SALOME::SALOME_Exception);
136
137     /*!
138      * Get the subMesh object associated to a subShape. The subMesh object
139      * gives access to nodes and elements IDs.
140      * SubMesh will be used instead of SubShape in a next idl version to 
141      * adress a specific subMesh...
142      */
143     SMESH_subMesh GetSubMesh(in GEOM::GEOM_Shape aSubShape, in string name)
144       raises (SALOME::SALOME_Exception);
145
146     /*!
147      * Create a subMesh without reference to a subShape
148      */
149 //     SMESH_subMesh NewEmpty()
150 //       raises (SALOME::SALOME_Exception);
151
152     /*!
153      * Remove a submesh
154      */
155     void RemoveSubMesh(in SMESH_subMesh aSubMesh)
156       raises (SALOME::SALOME_Exception);
157
158     /*!
159      * Create a group
160      */
161     SMESH_Group CreateGroup( in ElementType elem_type,
162                              in string name )
163       raises (SALOME::SALOME_Exception);
164
165     /*!
166      * Remove a group
167      */
168     void RemoveGroup(in SMESH_Group aGroup)
169       raises (SALOME::SALOME_Exception);
170
171     /*!
172      * Add hypothesis to the mesh, under a particular subShape
173      * (or the main shape itself)
174      * The Add method is only used to prepare the build of the mesh and store
175      * the algorithms and associated parameters.
176      * Actual job of mesh the shape is done by MESH_Gen.
177      * @params
178      * - aSubShape : subShape obtained by a shape explode in GEOM
179      *   (or main shape)
180      * - anHyp : hypothesis object 
181      * @return
182      * - OK if the hypothesis is compatible with the subShape 
183      *   (and all previous hypothesis on the subShape)
184      * - NOK if the hypothesis is not compatible with the subShape
185      *   (or one previous hypothesis on the subShape)
186      * raises exception if hypothesis has not been created
187      */
188     Hypothesis_Status AddHypothesis(in GEOM::GEOM_Shape aSubShape,
189                                     in SMESH_Hypothesis anHyp)
190       raises (SALOME::SALOME_Exception);
191 //     boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
192 //       raises (SALOME::SALOME_Exception);
193
194
195     /*!
196      * Remove an hypothesis previouly added with AddHypothesis.
197      */
198     Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Shape aSubShape,
199                                        in SMESH_Hypothesis anHyp)
200       raises (SALOME::SALOME_Exception);
201 //     boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
202 //                           in SMESH_Hypothesis anHyp)
203 //       raises (SALOME::SALOME_Exception);
204
205     /*!
206      * Get the list of hypothesis added on a subShape
207      */
208     ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Shape aSubShape)
209       raises (SALOME::SALOME_Exception);
210 //     ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
211 //       raises (SALOME::SALOME_Exception);
212
213     /*!
214      * Get the log of nodes and elements added or removed since previous
215      * clear of the log.
216      * @params
217      * - clearAfterGet : log is emptied after Get (safe if concurrents access)
218      */
219     //    string_array GetLog(in boolean clearAfterGet)
220     //      raises (SALOME::SALOME_Exception);
221     log_array GetLog(in boolean clearAfterGet)
222       raises (SALOME::SALOME_Exception);
223
224     /*!
225      * Clear the log of nodes and elements added or removed since previous
226      * clear. Must be used immediately after GetLog if clearAfterGet is false.
227      */
228     void ClearLog()
229       raises (SALOME::SALOME_Exception);
230
231     /*!
232      * Get the internal Id 
233      */
234     long GetId();     
235
236     /*!
237      * Get the study Id 
238      */
239     long GetStudyId();    
240     
241     SMESH_MeshEditor GetMeshEditor() 
242        raises (SALOME::SALOME_Exception);
243
244     /*!
245      * Export Mesh with DAT and MED Formats
246      */
247     void ExportDAT( in string file )
248       raises (SALOME::SALOME_Exception);
249     void ExportMED( in string file, in boolean auto_groups )
250       raises (SALOME::SALOME_Exception);
251     void ExportUNV( in string file )
252       raises (SALOME::SALOME_Exception);
253
254     /*!
255      * Get MED Mesh
256      */
257     SALOME_MED::MESH GetMEDMesh()
258       raises (SALOME::SALOME_Exception);
259
260     long NbNodes()
261       raises (SALOME::SALOME_Exception);
262
263     long NbEdges()
264       raises (SALOME::SALOME_Exception);
265
266     long NbFaces()
267       raises (SALOME::SALOME_Exception);
268
269     long NbTriangles()
270       raises (SALOME::SALOME_Exception);
271
272     long NbQuadrangles()
273       raises (SALOME::SALOME_Exception);
274
275     long NbVolumes()
276       raises (SALOME::SALOME_Exception);
277
278     long NbTetras()
279       raises (SALOME::SALOME_Exception);
280
281     long NbHexas()
282       raises (SALOME::SALOME_Exception);
283
284     long NbPyramids()
285       raises (SALOME::SALOME_Exception);
286
287     long NbPrisms()
288       raises (SALOME::SALOME_Exception);
289
290     long NbSubMesh()
291       raises (SALOME::SALOME_Exception);
292
293     string Dump();
294   };
295
296   interface SMESH_subMesh : SALOME::GenericObj
297   {
298     /*!
299      * 
300      */
301     long GetNumberOfElements()
302       raises (SALOME::SALOME_Exception);
303
304     /*!
305      * 
306      */
307     long GetNumberOfNodes()
308       raises (SALOME::SALOME_Exception);
309
310     /*!
311      * 
312      */
313     long_array GetElementsId()
314       raises (SALOME::SALOME_Exception);
315
316     /*!
317      * 
318      */
319     long_array GetElementsByType( in ElementType theType )
320       raises (SALOME::SALOME_Exception);
321
322     /*!
323      * 
324      */
325     long_array GetNodesId()
326       raises (SALOME::SALOME_Exception);
327
328     /*!
329      * Get SMESH_Mesh which stores nodes coordinates & elements definition
330      */
331     SMESH_Mesh GetFather()
332       raises (SALOME::SALOME_Exception);
333
334     /*!
335      * Get the internal Id 
336      */
337     long GetId();    
338
339     /*!
340      * Get MED subMesh
341      */
342     SALOME_MED::FAMILY GetFamily()
343       raises (SALOME::SALOME_Exception);
344   };
345   
346   /* 
347    * This interface makes modifications on the Mesh - removing elements and nodes
348    */     
349   interface SMESH_MeshEditor {
350
351
352     boolean RemoveElements(in long_array IDsOfElements)
353        raises (SALOME::SALOME_Exception);
354
355     boolean RemoveNodes(in long_array IDsOfNodes)
356       raises (SALOME::SALOME_Exception);
357
358     boolean AddNode(in double x, in double y, in double z)
359       raises (SALOME::SALOME_Exception);
360
361     boolean AddEdge(in long_array IDsOfNodes)
362       raises (SALOME::SALOME_Exception);
363
364     boolean AddFace(in long_array IDsOfNodes)
365       raises (SALOME::SALOME_Exception);
366
367     boolean AddVolume(in long_array IDsOfNodes)
368       raises (SALOME::SALOME_Exception);
369   };
370 };
371
372 #endif