Salome HOME
Integration of PAL/SALOME V2.1.0c from OCC
[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 "SALOME_GenericObj.idl"
31
32 module GEOM
33 {
34   interface GEOM_Object;
35 };
36
37
38 module SALOME_MED
39 {
40   interface MESH;
41   interface FAMILY;
42 };
43
44
45 module SMESH
46 {
47   interface SMESH_Hypothesis;
48   typedef sequence<SMESH_Hypothesis> ListOfHypothesis;
49
50   typedef sequence<double> double_array ;
51   typedef sequence<long> long_array ;
52   typedef sequence<string> string_array ;
53   typedef sequence<long_array> array_of_long_array ;
54
55   enum log_command
56     {
57       ADD_NODE,
58       ADD_EDGE,
59       ADD_TRIANGLE,
60       ADD_QUADRANGLE,
61       ADD_TETRAHEDRON,
62       ADD_PYRAMID,
63       ADD_PRISM,
64       ADD_HEXAHEDRON,
65       REMOVE_NODE,
66       REMOVE_ELEMENT,
67       MOVE_NODE,
68       CHANGE_ELEMENT_NODES,
69       RENUMBER
70     };
71
72   struct log_block
73   {
74     long commandType;
75     long number;
76     double_array coords;
77     long_array indexes;
78   };
79
80   struct PointStruct { double x; 
81                        double y; 
82                        double z; } ; 
83   struct DirStruct   { PointStruct PS ; } ;          // analog to Occ Direction
84    
85   struct AxisStruct  { double x;
86                        double y;
87                        double z;
88                        double vx;
89                        double vy;
90                        double vz; } ;
91
92   
93   /*!
94    * Enumeration for element type, like in SMDS
95    */
96   enum ElementType
97   {
98     ALL,
99     NODE,
100     EDGE,
101     FACE,
102     VOLUME
103   };
104   
105   /*!
106    * Enumeration for hypothesis status (used by AddHypothesis() and RemoveHypothesis() methods) 
107    */  
108   enum Hypothesis_Status // in the order of severity
109   {
110     HYP_OK,
111     HYP_MISSING,      // algo misses a hypothesis
112     HYP_CONCURENT,    // several applicable hypotheses
113     HYP_BAD_PARAMETER,// hypothesis has a bad parameter value
114     HYP_UNKNOWN_FATAL,//  --- all statuses below should be considered as fatal
115                       //      for Add/RemoveHypothesis operations
116     HYP_INCOMPATIBLE, // hypothesis does not fit algo
117     HYP_NOTCONFORM,   // not conform mesh is produced appling a hypothesis
118     HYP_ALREADY_EXIST,// such hypothesis already exist
119     HYP_BAD_DIM       // bad dimension
120   }; 
121   
122   /*!
123    * Enumeration for DriverMED read status (used by ImportMEDFile() method)
124    */  
125   enum DriverMED_ReadStatus // in the order of severity
126   {
127     DRS_OK,
128     DRS_EMPTY,          // a MED file contains no mesh with the given name
129     DRS_WARN_RENUMBER,  // a MED file has overlapped ranges of element numbers,
130                         // so the numbers from the file are ignored
131     DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
132     DRS_FAIL            // general failure (exception etc.)
133   }; 
134
135   typedef sequence<log_block> log_array;
136
137   interface SMESH_Group;
138   interface SMESH_subMesh;
139   interface SMESH_MeshEditor;
140   interface SMESH_Mesh : SALOME::GenericObj
141   {
142     /*!
143      * Associate a Shape to a Mesh created with NewEmpty
144      */
145
146 //     boolean SetMesh(in GEOM::GEOM_Object anObject)
147 //        raises (SALOME::SALOME_Exception);
148
149     /*!
150      * Get the subMesh object associated to a subShape. The subMesh object
151      * gives access to nodes and elements IDs.
152      * SubMesh will be used instead of SubShape in a next idl version to 
153      * adress a specific subMesh...
154      */
155     SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
156       raises (SALOME::SALOME_Exception);
157
158     /*!
159      * Create a subMesh without reference to a subShape
160      */
161 //     SMESH_subMesh NewEmpty()
162 //       raises (SALOME::SALOME_Exception);
163
164     /*!
165      * Remove a submesh
166      */
167     void RemoveSubMesh(in SMESH_subMesh aSubMesh)
168       raises (SALOME::SALOME_Exception);
169
170     /*!
171      * Create a group
172      */
173     SMESH_Group CreateGroup( in ElementType elem_type,
174                              in string name )
175       raises (SALOME::SALOME_Exception);
176
177     /*!
178      * Create a group from geometry group
179      */
180     SMESH_Group CreateGroupFromGEOM( in ElementType elem_type,
181                                      in string name,
182                                      in GEOM::GEOM_Object theGEOMGroup )
183       raises (SALOME::SALOME_Exception);
184
185     /*!
186      * Remove a group
187      */
188     void RemoveGroup(in SMESH_Group aGroup)
189       raises (SALOME::SALOME_Exception);
190
191      /*!
192      *  Remove group with its contents
193      */
194     void RemoveGroupWithContents( in SMESH_Group aGroup )
195         raises (SALOME::SALOME_Exception);
196
197     /*!
198      * Union of two groups
199      *    New group is created. All mesh elements that are 
200      *    present in initial groups are added to the new one
201      */
202     SMESH_Group UnionGroups( in SMESH_Group aGroup1, in SMESH_Group aGroup2, in string name )
203         raises (SALOME::SALOME_Exception);
204
205     /*!
206      *  Intersection of two groups
207      *  New group is created. All mesh elements that are 
208      *  present in both initial groups are added to the new one.
209      */
210     SMESH_Group IntersectGroups( in SMESH_Group aGroup1, in SMESH_Group aGroup2, in string name )
211         raises (SALOME::SALOME_Exception);
212
213       /*!
214        *  Cut of two groups
215        *  New group is created. All mesh elements that are present in 
216        *  main group but do not present in tool group are added to the new one
217        */
218       SMESH_Group CutGroups( in SMESH_Group aMainGroup, in SMESH_Group aToolGroup, in string name )
219           raises (SALOME::SALOME_Exception);
220
221     /*!
222      * Add hypothesis to the mesh, under a particular subShape
223      * (or the main shape itself)
224      * The Add method is only used to prepare the build of the mesh and store
225      * the algorithms and associated parameters.
226      * Actual job of mesh the shape is done by MESH_Gen.
227      * @params
228      * - aSubShape : subShape obtained by a shape explode in GEOM
229      *   (or main shape)
230      * - anHyp : hypothesis object 
231      * @return
232      * - OK if the hypothesis is compatible with the subShape 
233      *   (and all previous hypothesis on the subShape)
234      * - NOK if the hypothesis is not compatible with the subShape
235      *   (or one previous hypothesis on the subShape)
236      * raises exception if hypothesis has not been created
237      */
238     Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
239                                     in SMESH_Hypothesis anHyp)
240       raises (SALOME::SALOME_Exception);
241 //     boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
242 //       raises (SALOME::SALOME_Exception);
243
244
245     /*!
246      * Remove an hypothesis previouly added with AddHypothesis.
247      */
248     Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject,
249                                        in SMESH_Hypothesis anHyp)
250       raises (SALOME::SALOME_Exception);
251 //     boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
252 //                           in SMESH_Hypothesis anHyp)
253 //       raises (SALOME::SALOME_Exception);
254
255     /*!
256      * Get the list of hypothesis added on a subShape
257      */
258     ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Object aSubObject)
259       raises (SALOME::SALOME_Exception);
260 //     ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
261 //       raises (SALOME::SALOME_Exception);
262
263     /*!
264      * Get the log of nodes and elements added or removed since previous
265      * clear of the log.
266      * @params
267      * - clearAfterGet : log is emptied after Get (safe if concurrents access)
268      */
269     //    string_array GetLog(in boolean clearAfterGet)
270     //      raises (SALOME::SALOME_Exception);
271     log_array GetLog(in boolean clearAfterGet)
272       raises (SALOME::SALOME_Exception);
273
274     /*!
275      * Clear the log of nodes and elements added or removed since previous
276      * clear. Must be used immediately after GetLog if clearAfterGet is false.
277      */
278     void ClearLog()
279       raises (SALOME::SALOME_Exception);
280
281     /*!
282      * Get the internal Id 
283      */
284     long GetId();     
285
286     /*!
287      * Get the study Id 
288      */
289     long GetStudyId();    
290     
291     SMESH_MeshEditor GetMeshEditor() 
292        raises (SALOME::SALOME_Exception);
293
294     /*!
295      * Export Mesh with DAT and MED Formats
296      */
297     void ExportDAT( in string file )
298       raises (SALOME::SALOME_Exception);
299     void ExportMED( in string file, in boolean auto_groups )
300       raises (SALOME::SALOME_Exception);
301     void ExportUNV( in string file )
302       raises (SALOME::SALOME_Exception);
303     void ExportSTL( in string file, in boolean isascii )
304       raises (SALOME::SALOME_Exception);
305
306     /*!
307      * Get MED Mesh
308      */
309     SALOME_MED::MESH GetMEDMesh()
310       raises (SALOME::SALOME_Exception);
311
312     long NbNodes()
313       raises (SALOME::SALOME_Exception);
314
315     long NbEdges()
316       raises (SALOME::SALOME_Exception);
317
318     long NbFaces()
319       raises (SALOME::SALOME_Exception);
320
321     long NbTriangles()
322       raises (SALOME::SALOME_Exception);
323
324     long NbQuadrangles()
325       raises (SALOME::SALOME_Exception);
326
327     long NbVolumes()
328       raises (SALOME::SALOME_Exception);
329
330     long NbTetras()
331       raises (SALOME::SALOME_Exception);
332
333     long NbHexas()
334       raises (SALOME::SALOME_Exception);
335
336     long NbPyramids()
337       raises (SALOME::SALOME_Exception);
338
339     long NbPrisms()
340       raises (SALOME::SALOME_Exception);
341
342     long NbSubMesh()
343       raises (SALOME::SALOME_Exception);
344
345     string Dump();
346   };
347
348   interface SMESH_subMesh : SALOME::GenericObj
349   {
350     /*!
351      * 
352      */
353     long GetNumberOfElements()
354       raises (SALOME::SALOME_Exception);
355
356     /*!
357      * 
358      */
359     long GetNumberOfNodes( in boolean all )
360       raises (SALOME::SALOME_Exception);
361
362     /*!
363      * 
364      */
365     long_array GetElementsId()
366       raises (SALOME::SALOME_Exception);
367
368     /*!
369      * 
370      */
371     long_array GetElementsByType( in ElementType theType )
372       raises (SALOME::SALOME_Exception);
373
374     /*!
375      * 
376      */
377     long_array GetNodesId()
378       raises (SALOME::SALOME_Exception);
379
380     /*!
381      * Get SMESH_Mesh which stores nodes coordinates & elements definition
382      */
383     SMESH_Mesh GetFather()
384       raises (SALOME::SALOME_Exception);
385
386     /*!
387      * Get the internal Id 
388      */
389     long GetId();    
390
391     /*!
392      * Get MED subMesh
393      */
394     SALOME_MED::FAMILY GetFamily()
395       raises (SALOME::SALOME_Exception);
396   };
397   
398   /* 
399    * This interface makes modifications on the Mesh - removing elements and nodes etc.
400    */
401   interface NumericalFunctor;
402   interface SMESH_MeshEditor {
403
404
405     boolean RemoveElements(in long_array IDsOfElements);
406
407     boolean RemoveNodes(in long_array IDsOfNodes);
408
409     boolean AddNode(in double x, in double y, in double z);
410
411     boolean AddEdge(in long_array IDsOfNodes);
412
413     boolean AddFace(in long_array IDsOfNodes);
414
415     boolean AddVolume(in long_array IDsOfNodes);
416
417     boolean MoveNode(in long NodeID, in double x, in double y, in double z);
418
419     boolean InverseDiag(in long NodeID1, in long NodeID2);
420
421     boolean DeleteDiag(in long NodeID1, in long NodeID2);
422
423     boolean Reorient(in long_array IDsOfElements);
424
425     boolean TriToQuad(in long_array       IDsOfElements,
426                       in NumericalFunctor Criterion,
427                       in double           MaxAngle);
428
429     boolean QuadToTri(in long_array       IDsOfElements,
430                       in NumericalFunctor Criterion);
431
432     boolean SplitQuad(in long_array IDsOfElements,
433                       in boolean    Diag13);
434
435     enum Smooth_Method { LAPLACIAN_SMOOTH, CENTROIDAL_SMOOTH };
436
437     boolean Smooth(in long_array    IDsOfElements,
438                    in long_array    IDsOfFixedNodes,
439                    in long          MaxNbOfIterations,
440                    in double        MaxAspectRatio,
441                    in Smooth_Method Method);
442
443     void RenumberNodes();
444
445     void RenumberElements();
446
447     void RotationSweep(in long_array       IDsOfElements,
448                        in AxisStruct       Axix,
449                        in double           AngleInRadians,
450                        in long             NbOfSteps,
451                        in double           Tolerance);
452                        
453     void ExtrusionSweep(in long_array      IDsOfElements,
454                         in DirStruct       StepVector,
455                         in long            NbOfSteps);
456
457     enum MirrorType { POINT, AXIS, PLANE };
458
459     void Mirror (in long_array       IDsOfElements,
460                  in AxisStruct       Mirror,
461                  in MirrorType       theMirrorType,
462                  in boolean          Copy);
463
464     void Translate (in long_array      IDsOfElements,
465                     in DirStruct       Vector,
466                     in boolean         Copy);
467
468     void Rotate (in long_array       IDsOfElements,
469                  in AxisStruct       Axis,
470                  in double           AngleInRadians,
471                  in boolean          Copy);
472
473     void FindCoincidentNodes (in  double              Tolerance,
474                               out array_of_long_array GroupsOfNodes);
475
476     void MergeNodes (in array_of_long_array GroupsOfNodes);
477
478     void MergeEqualElements();
479
480     boolean SewFreeBorders (in long FirstNodeID1,
481                             in long SecondNodeID1,
482                             in long LastNodeID1,
483                             in long FirstNodeID2,
484                             in long SecondNodeID2,
485                             in long LastNodeID2);
486     
487     boolean SewConformFreeBorders (in long FirstNodeID1,
488                                    in long SecondNodeID1,
489                                    in long LastNodeID1,
490                                    in long FirstNodeID2,
491                                    in long SecondNodeID2);
492
493     boolean SewBorderToSide (in long FirstNodeIDOnFreeBorder,
494                              in long SecondNodeIDOnFreeBorder,
495                              in long LastNodeIDOnFreeBorder,
496                              in long FirstNodeIDOnSide,
497                              in long LastNodeIDOnSide);
498     
499     boolean SewSideElements (in long_array IDsOfSide1Elements,
500                              in long_array IDsOfSide2Elements,
501                              in long       NodeID1OfSide1ToMerge,
502                              in long       NodeID1OfSide2ToMerge,
503                              in long       NodeID2OfSide1ToMerge,
504                              in long       NodeID2OfSide2ToMerge);
505
506   };
507 };
508
509 #endif