Salome HOME
remove adjusting pointers for covariant returns
[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_POLYGON,
62       ADD_TETRAHEDRON,
63       ADD_PYRAMID,
64       ADD_PRISM,
65       ADD_HEXAHEDRON,
66       ADD_POLYHEDRON,
67       REMOVE_NODE,
68       REMOVE_ELEMENT,
69       MOVE_NODE,
70       CHANGE_ELEMENT_NODES,
71       CHANGE_POLYHEDRON_NODES,
72       RENUMBER
73     };
74
75   struct log_block
76   {
77     long commandType;
78     long number;
79     double_array coords;
80     long_array indexes;
81   };
82
83   struct PointStruct { double x; 
84                        double y; 
85                        double z; } ; 
86   struct DirStruct   { PointStruct PS ; } ;          // analog to Occ Direction
87    
88   struct AxisStruct  { double x;
89                        double y;
90                        double z;
91                        double vx;
92                        double vy;
93                        double vz; } ;
94
95   
96   /*!
97    * Enumeration for element type, like in SMDS
98    */
99   enum ElementType
100   {
101     ALL,
102     NODE,
103     EDGE,
104     FACE,
105     VOLUME
106   };
107   
108   /*!
109    * Enumeration for hypothesis status (used by AddHypothesis() and RemoveHypothesis() methods) 
110    */  
111   enum Hypothesis_Status // in the order of severity
112   {
113     HYP_OK,
114     HYP_MISSING,      // algo misses a hypothesis
115     HYP_CONCURENT,    // several applicable hypotheses
116     HYP_BAD_PARAMETER,// hypothesis has a bad parameter value
117     HYP_UNKNOWN_FATAL,//  --- all statuses below should be considered as fatal
118                       //      for Add/RemoveHypothesis operations
119     HYP_INCOMPATIBLE, // hypothesis does not fit algo
120     HYP_NOTCONFORM,   // not conform mesh is produced appling a hypothesis
121     HYP_ALREADY_EXIST,// such hypothesis already exist
122     HYP_BAD_DIM       // bad dimension
123   }; 
124   
125   /*!
126    * Enumeration for DriverMED read status (used by ImportMEDFile() method)
127    */  
128   enum DriverMED_ReadStatus // in the order of severity
129   {
130     DRS_OK,
131     DRS_EMPTY,          // a MED file contains no mesh with the given name
132     DRS_WARN_RENUMBER,  // a MED file has overlapped ranges of element numbers,
133                         // so the numbers from the file are ignored
134     DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
135     DRS_FAIL            // general failure (exception etc.)
136   }; 
137
138   /*!
139    * Enumeration for DriverMED (used by Perform() method)
140    */  
141   enum MED_VERSION // in the order of severity
142   {
143     MED_V2_1,
144     MED_V2_2
145   };
146
147   typedef sequence<log_block> log_array;
148
149
150   interface SMESH_IDSource
151   {
152     /*!
153      * Returns a sequence of all element IDs
154      */
155     long_array GetIDs();
156   };
157   
158   interface SMESH_GroupBase;
159   interface SMESH_Group;
160   interface SMESH_GroupOnGeom;
161   interface SMESH_subMesh;
162   interface SMESH_MeshEditor;
163   interface SMESH_Mesh : SALOME::GenericObj, SMESH_IDSource
164   {
165     /*!
166      * Associate a Shape to a Mesh created with NewEmpty
167      */
168
169 //     boolean SetMesh(in GEOM::GEOM_Object anObject)
170 //        raises (SALOME::SALOME_Exception);
171
172     /*!
173      * Get the subMesh object associated to a subShape. The subMesh object
174      * gives access to nodes and elements IDs.
175      * SubMesh will be used instead of SubShape in a next idl version to 
176      * adress a specific subMesh...
177      */
178     SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
179       raises (SALOME::SALOME_Exception);
180
181     /*!
182      * Create a subMesh without reference to a subShape
183      */
184 //     SMESH_subMesh NewEmpty()
185 //       raises (SALOME::SALOME_Exception);
186
187     /*!
188      * Get geom shape to mesh. A result may be nil
189      */
190     GEOM::GEOM_Object GetShapeToMesh()
191       raises (SALOME::SALOME_Exception);
192
193     /*!
194      * Remove a submesh
195      */
196     void RemoveSubMesh(in SMESH_subMesh aSubMesh)
197       raises (SALOME::SALOME_Exception);
198
199     /*!
200      * Create a group
201      */
202     SMESH_Group CreateGroup( in ElementType elem_type,
203                              in string name )
204       raises (SALOME::SALOME_Exception);
205
206     /*!
207      * Create a group from geometry group
208      */
209     SMESH_GroupOnGeom CreateGroupFromGEOM( in ElementType elem_type,
210                                           in string name,
211                                           in GEOM::GEOM_Object theGeomObject )
212       raises (SALOME::SALOME_Exception);
213
214     /*!
215      * Remove a group
216      */
217     void RemoveGroup(in SMESH_GroupBase aGroup)
218       raises (SALOME::SALOME_Exception);
219
220      /*!
221      *  Remove group with its contents
222      */
223     void RemoveGroupWithContents( in SMESH_GroupBase aGroup )
224         raises (SALOME::SALOME_Exception);
225
226     /*!
227      * Union of two groups
228      *    New group is created. All mesh elements that are 
229      *    present in initial groups are added to the new one
230      */
231     SMESH_Group UnionGroups (in SMESH_GroupBase aGroup1,
232                              in SMESH_GroupBase aGroup2,
233                              in string          name )
234         raises (SALOME::SALOME_Exception);
235
236     /*!
237      *  Intersection of two groups
238      *  New group is created. All mesh elements that are 
239      *  present in both initial groups are added to the new one.
240      */
241     SMESH_Group IntersectGroups (in SMESH_GroupBase aGroup1,
242                                  in SMESH_GroupBase aGroup2,
243                                  in string          name )
244         raises (SALOME::SALOME_Exception);
245
246       /*!
247        *  Cut of two groups
248        *  New group is created. All mesh elements that are present in 
249        *  main group but do not present in tool group are added to the new one
250        */
251       SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
252                              in SMESH_GroupBase aToolGroup,
253                              in string          name )
254           raises (SALOME::SALOME_Exception);
255
256     /*!
257      * Add hypothesis to the mesh, under a particular subShape
258      * (or the main shape itself)
259      * The Add method is only used to prepare the build of the mesh and store
260      * the algorithms and associated parameters.
261      * Actual job of mesh the shape is done by MESH_Gen.
262      * @params
263      * - aSubShape : subShape obtained by a shape explode in GEOM
264      *   (or main shape)
265      * - anHyp : hypothesis object 
266      * @return
267      * - OK if the hypothesis is compatible with the subShape 
268      *   (and all previous hypothesis on the subShape)
269      * - NOK if the hypothesis is not compatible with the subShape
270      *   (or one previous hypothesis on the subShape)
271      * raises exception if hypothesis has not been created
272      */
273     Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
274                                     in SMESH_Hypothesis anHyp)
275       raises (SALOME::SALOME_Exception);
276 //     boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
277 //       raises (SALOME::SALOME_Exception);
278
279
280     /*!
281      * Remove an hypothesis previouly added with AddHypothesis.
282      */
283     Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject,
284                                        in SMESH_Hypothesis anHyp)
285       raises (SALOME::SALOME_Exception);
286 //     boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
287 //                           in SMESH_Hypothesis anHyp)
288 //       raises (SALOME::SALOME_Exception);
289
290     /*!
291      * Get the list of hypothesis added on a subShape
292      */
293     ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Object aSubObject)
294       raises (SALOME::SALOME_Exception);
295 //     ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
296 //       raises (SALOME::SALOME_Exception);
297
298     /*!
299      * Get the log of nodes and elements added or removed since previous
300      * clear of the log.
301      * @params
302      * - clearAfterGet : log is emptied after Get (safe if concurrents access)
303      */
304     //    string_array GetLog(in boolean clearAfterGet)
305     //      raises (SALOME::SALOME_Exception);
306     log_array GetLog(in boolean clearAfterGet)
307       raises (SALOME::SALOME_Exception);
308
309     /*!
310      * Clear the log of nodes and elements added or removed since previous
311      * clear. Must be used immediately after GetLog if clearAfterGet is false.
312      */
313     void ClearLog()
314       raises (SALOME::SALOME_Exception);
315
316     /*!
317      * Get the internal Id 
318      */
319     long GetId();     
320
321     /*!
322      * Get the study Id 
323      */
324     long GetStudyId();    
325     
326     SMESH_MeshEditor GetMeshEditor() 
327        raises (SALOME::SALOME_Exception);
328
329     /*!
330      * Export Mesh to different MED Formats
331      * @params
332      * - auto_groups : boolean parameter for creating/not creating
333      *   the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
334      *   the typical use is auto_groups=false.
335      * - theVersion : define the version of format of MED file, that will be created
336      */
337     void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
338       raises (SALOME::SALOME_Exception);
339     /*!
340      * Export Mesh to MED_V2_1 MED format
341      * Works, just the same as ExportToMED, with MED_VERSION parameter equal to MED_V2_1.
342      * The method is kept in order to support old functionality
343      */
344     void ExportMED( in string file, in boolean auto_groups )
345       raises (SALOME::SALOME_Exception);
346
347     /*!
348      * Export Mesh to DAT, UNV and STL Formats
349      */
350     void ExportDAT( in string file )
351       raises (SALOME::SALOME_Exception);
352     void ExportUNV( in string file )
353       raises (SALOME::SALOME_Exception);
354     void ExportSTL( in string file, in boolean isascii )
355       raises (SALOME::SALOME_Exception);
356
357     /*!
358      * Get MED Mesh
359      */
360     SALOME_MED::MESH GetMEDMesh()
361       raises (SALOME::SALOME_Exception);
362
363     long NbNodes()
364       raises (SALOME::SALOME_Exception);
365
366     long NbElements()
367       raises (SALOME::SALOME_Exception);
368
369     long NbEdges()
370       raises (SALOME::SALOME_Exception);
371
372     long NbFaces()
373       raises (SALOME::SALOME_Exception);
374
375     long NbTriangles()
376       raises (SALOME::SALOME_Exception);
377
378     long NbQuadrangles()
379       raises (SALOME::SALOME_Exception);
380
381     long NbPolygons()
382       raises (SALOME::SALOME_Exception);
383
384     long NbVolumes()
385       raises (SALOME::SALOME_Exception);
386
387     long NbTetras()
388       raises (SALOME::SALOME_Exception);
389
390     long NbHexas()
391       raises (SALOME::SALOME_Exception);
392
393     long NbPyramids()
394       raises (SALOME::SALOME_Exception);
395
396     long NbPrisms()
397       raises (SALOME::SALOME_Exception);
398
399     long NbPolyhedrons()
400       raises (SALOME::SALOME_Exception);
401
402     long NbSubMesh()
403       raises (SALOME::SALOME_Exception);
404
405     long_array GetElementsId()
406       raises (SALOME::SALOME_Exception);
407
408     long_array GetElementsByType( in ElementType theType )
409       raises (SALOME::SALOME_Exception);
410
411     long_array GetNodesId()
412       raises (SALOME::SALOME_Exception);
413
414     string Dump();
415   };
416
417   interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
418   {
419     /*!
420      * 
421      */
422     long GetNumberOfElements()
423       raises (SALOME::SALOME_Exception);
424
425     /*!
426      * 
427      */
428     long GetNumberOfNodes( in boolean all )
429       raises (SALOME::SALOME_Exception);
430
431     /*!
432      * 
433      */
434     long_array GetElementsId()
435       raises (SALOME::SALOME_Exception);
436
437     /*!
438      * 
439      */
440     long_array GetElementsByType( in ElementType theType )
441       raises (SALOME::SALOME_Exception);
442
443     /*!
444      * 
445      */
446     long_array GetNodesId()
447       raises (SALOME::SALOME_Exception);
448
449     /*!
450      * Get geom shape the submesh is dedicated to
451      */
452     GEOM::GEOM_Object GetSubShape()
453       raises (SALOME::SALOME_Exception);
454
455     /*!
456      * Get SMESH_Mesh which stores nodes coordinates & elements definition
457      */
458     SMESH_Mesh GetFather()
459       raises (SALOME::SALOME_Exception);
460
461     /*!
462      * Get the internal Id 
463      */
464     long GetId();    
465
466     /*!
467      * Get MED subMesh
468      */
469     SALOME_MED::FAMILY GetFamily()
470       raises (SALOME::SALOME_Exception);
471   };
472   
473   /*!
474    * This interface makes modifications on the Mesh - removing elements and nodes etc.
475    */
476   interface NumericalFunctor;
477   interface SMESH_MeshEditor {
478
479
480     boolean RemoveElements(in long_array IDsOfElements);
481
482     boolean RemoveNodes(in long_array IDsOfNodes);
483
484     boolean AddNode(in double x, in double y, in double z);
485
486     boolean AddEdge(in long_array IDsOfNodes);
487
488     boolean AddFace(in long_array IDsOfNodes);
489
490     boolean AddVolume(in long_array IDsOfNodes);
491
492     //boolean AddPolygonalFace (in long_array IdsOfNodes);
493
494     /*!
495      *  Create volume of many faces, giving nodes for each face.
496      *  \param IdsOfNodes List of node IDs for volume creation face by face.
497      *  \param Quantities List of integer values, Quantities[i]
498      *         gives quantity of nodes in face number i.
499      */
500     boolean AddPolyhedralVolume (in long_array IdsOfNodes,
501                                  in long_array Quantities);
502
503     /*!
504      *  Create volume of many faces, giving IDs of existing faces.
505      *  \param IdsOfFaces List of face IDs for volume creation.
506      *  \note The created volume will refer only to nodes
507      *        of the given faces, not to the faces itself.
508      */
509     boolean AddPolyhedralVolumeByFaces (in long_array IdsOfFaces);
510
511     boolean MoveNode(in long NodeID, in double x, in double y, in double z);
512
513     boolean InverseDiag(in long NodeID1, in long NodeID2);
514
515     boolean DeleteDiag(in long NodeID1, in long NodeID2);
516
517     boolean Reorient(in long_array IDsOfElements);
518     
519     boolean ReorientObject(in SMESH_IDSource  theObject);
520
521     boolean TriToQuad(in long_array       IDsOfElements,
522                       in NumericalFunctor Criterion,
523                       in double           MaxAngle);
524     
525     boolean TriToQuadObject(in SMESH_IDSource   theObject,
526                             in NumericalFunctor Criterion,
527                             in double           MaxAngle);
528     
529     boolean QuadToTri(in long_array       IDsOfElements,
530                       in NumericalFunctor Criterion);
531
532     boolean SplitQuad(in long_array IDsOfElements,
533                       in boolean    Diag13);
534
535     boolean SplitQuadObject(in SMESH_IDSource   theObject,
536                             in boolean    Diag13);
537
538     enum Smooth_Method { LAPLACIAN_SMOOTH, CENTROIDAL_SMOOTH };
539
540     boolean Smooth(in long_array    IDsOfElements,
541                    in long_array    IDsOfFixedNodes,
542                    in long          MaxNbOfIterations,
543                    in double        MaxAspectRatio,
544                    in Smooth_Method Method);
545
546     boolean SmoothObject(in SMESH_IDSource  theObject,
547                          in long_array      IDsOfFixedNodes,
548                          in long            MaxNbOfIterations,
549                          in double          MaxAspectRatio,
550                          in Smooth_Method   Method);
551
552     boolean SmoothParametric(in long_array    IDsOfElements,
553                              in long_array    IDsOfFixedNodes,
554                              in long          MaxNbOfIterations,
555                              in double        MaxAspectRatio,
556                              in Smooth_Method Method);
557
558     boolean SmoothParametricObject(in SMESH_IDSource  theObject,
559                                    in long_array      IDsOfFixedNodes,
560                                    in long            MaxNbOfIterations,
561                                    in double          MaxAspectRatio,
562                                    in Smooth_Method   Method);
563
564     void RenumberNodes();
565
566     void RenumberElements();
567
568     void RotationSweep(in long_array       IDsOfElements,
569                        in AxisStruct       Axix,
570                        in double           AngleInRadians,
571                        in long             NbOfSteps,
572                        in double           Tolerance);
573
574     void RotationSweepObject(in SMESH_IDSource  theObject,
575                              in AxisStruct      Axix,
576                              in double          AngleInRadians,
577                              in long            NbOfSteps,
578                              in double          Tolerance);
579                        
580     void ExtrusionSweep(in long_array      IDsOfElements,
581                         in DirStruct       StepVector,
582                         in long            NbOfSteps);
583
584     void ExtrusionSweepObject(in SMESH_IDSource  theObject,
585                               in DirStruct       StepVector,
586                               in long            NbOfSteps);
587
588     void ExtrusionSweepObject1D(in SMESH_IDSource theObject,
589                                 in DirStruct      StepVector,
590                                 in long           NbOfSteps);
591
592     void ExtrusionSweepObject2D(in SMESH_IDSource theObject,
593                                 in DirStruct      StepVector,
594                                 in long           NbOfSteps);
595
596     enum Extrusion_Error {
597       EXTR_OK,
598       EXTR_NO_ELEMENTS, 
599       EXTR_PATH_NOT_EDGE,
600       EXTR_BAD_PATH_SHAPE,
601       EXTR_BAD_STARTING_NODE,
602       EXTR_BAD_ANGLES_NUMBER,
603       EXTR_CANT_GET_TANGENT
604       };
605
606     Extrusion_Error ExtrusionAlongPath(in long_array        IDsOfElements,
607                                        in SMESH_Mesh        PathMesh,
608                                        in GEOM::GEOM_Object PathShape,
609                                        in long              NodeStart,
610                                        in boolean           HasAngles,
611                                        in double_array      Angles,
612                                        in boolean           HasRefPoint,
613                                        in PointStruct       RefPoint);
614
615     Extrusion_Error ExtrusionAlongPathObject(in SMESH_IDSource    theObject,
616                                              in SMESH_Mesh        PathMesh,
617                                              in GEOM::GEOM_Object PathShape,
618                                              in long              NodeStart,
619                                              in boolean           HasAngles,
620                                              in double_array      Angles,
621                                              in boolean           HasRefPoint,
622                                              in PointStruct       RefPoint);
623
624     enum MirrorType { POINT, AXIS, PLANE };
625
626     void Mirror (in long_array       IDsOfElements,
627                  in AxisStruct       Mirror,
628                  in MirrorType       theMirrorType,
629                  in boolean          Copy);
630
631     void MirrorObject (in SMESH_IDSource  theObject,
632                        in AxisStruct      Mirror,
633                        in MirrorType      theMirrorType,
634                        in boolean         Copy);
635
636     void Translate (in long_array      IDsOfElements,
637                     in DirStruct       Vector,
638                     in boolean         Copy);
639
640     void TranslateObject (in SMESH_IDSource  theObject,
641                           in DirStruct       Vector,
642                           in boolean         Copy);
643     
644     void Rotate (in long_array       IDsOfElements,
645                  in AxisStruct       Axis,
646                  in double           AngleInRadians,
647                  in boolean          Copy);
648
649     void RotateObject (in SMESH_IDSource  theObject,
650                        in AxisStruct      Axis,
651                        in double          AngleInRadians,
652                        in boolean         Copy);
653     
654     void FindCoincidentNodes (in  double              Tolerance,
655                               out array_of_long_array GroupsOfNodes);
656
657     void MergeNodes (in array_of_long_array GroupsOfNodes);
658
659     void MergeEqualElements();
660
661     enum Sew_Error {
662       SEW_OK,
663       SEW_BORDER1_NOT_FOUND,
664       SEW_BORDER2_NOT_FOUND,
665       SEW_BOTH_BORDERS_NOT_FOUND,
666       SEW_BAD_SIDE_NODES,
667       SEW_VOLUMES_TO_SPLIT,
668       // for SewSideElements() only:
669       SEW_DIFF_NB_OF_ELEMENTS,
670       SEW_TOPO_DIFF_SETS_OF_ELEMENTS,
671       SEW_BAD_SIDE1_NODES,
672       SEW_BAD_SIDE2_NODES
673       };
674
675     Sew_Error SewFreeBorders (in long FirstNodeID1,
676                               in long SecondNodeID1,
677                               in long LastNodeID1,
678                               in long FirstNodeID2,
679                               in long SecondNodeID2,
680                               in long LastNodeID2,
681                               in boolean CreatePolygons,
682                               in boolean CreatePolyedrs);
683
684     Sew_Error SewConformFreeBorders (in long FirstNodeID1,
685                                      in long SecondNodeID1,
686                                      in long LastNodeID1,
687                                      in long FirstNodeID2,
688                                      in long SecondNodeID2);
689
690     Sew_Error SewBorderToSide (in long FirstNodeIDOnFreeBorder,
691                                in long SecondNodeIDOnFreeBorder,
692                                in long LastNodeIDOnFreeBorder,
693                                in long FirstNodeIDOnSide,
694                                in long LastNodeIDOnSide,
695                                in boolean CreatePolygons,
696                                in boolean CreatePolyedrs);
697
698     Sew_Error SewSideElements (in long_array IDsOfSide1Elements,
699                                in long_array IDsOfSide2Elements,
700                                in long       NodeID1OfSide1ToMerge,
701                                in long       NodeID1OfSide2ToMerge,
702                                in long       NodeID2OfSide1ToMerge,
703                                in long       NodeID2OfSide2ToMerge);
704
705   };
706 };
707
708 #endif