Salome HOME
The default method of selection management is added:
[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     /*!
415      * Return type of mesh element
416      */    
417     ElementType GetElementType( in long id, in boolean iselem )
418       raises (SALOME::SALOME_Exception);
419
420     string Dump();
421   };
422
423   interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
424   {
425     /*!
426      * 
427      */
428     long GetNumberOfElements()
429       raises (SALOME::SALOME_Exception);
430
431     /*!
432      * 
433      */
434     long GetNumberOfNodes( in boolean all )
435       raises (SALOME::SALOME_Exception);
436
437     /*!
438      * 
439      */
440     long_array GetElementsId()
441       raises (SALOME::SALOME_Exception);
442
443     /*!
444      * 
445      */
446     long_array GetElementsByType( in ElementType theType )
447       raises (SALOME::SALOME_Exception);
448
449     /*!
450      * Return type of submesh element
451      */
452     ElementType GetElementType( in long id, in boolean iselem )
453       raises (SALOME::SALOME_Exception);
454       
455     /*!
456      * 
457      */
458     long_array GetNodesId()
459       raises (SALOME::SALOME_Exception);
460
461     /*!
462      * Get geom shape the submesh is dedicated to
463      */
464     GEOM::GEOM_Object GetSubShape()
465       raises (SALOME::SALOME_Exception);
466
467     /*!
468      * Get SMESH_Mesh which stores nodes coordinates & elements definition
469      */
470     SMESH_Mesh GetFather()
471       raises (SALOME::SALOME_Exception);
472
473     /*!
474      * Get the internal Id 
475      */
476     long GetId();
477
478
479     /*!
480      * Get MED subMesh
481      */
482     SALOME_MED::FAMILY GetFamily()
483       raises (SALOME::SALOME_Exception);
484   };
485   
486   /*!
487    * This interface makes modifications on the Mesh - removing elements and nodes etc.
488    */
489   interface NumericalFunctor;
490   interface SMESH_MeshEditor {
491
492
493     boolean RemoveElements(in long_array IDsOfElements);
494
495     boolean RemoveNodes(in long_array IDsOfNodes);
496
497     boolean AddNode(in double x, in double y, in double z);
498
499     boolean AddEdge(in long_array IDsOfNodes);
500
501     boolean AddFace(in long_array IDsOfNodes);
502
503     boolean AddVolume(in long_array IDsOfNodes);
504
505     //boolean AddPolygonalFace (in long_array IdsOfNodes);
506
507     /*!
508      *  Create volume of many faces, giving nodes for each face.
509      *  \param IdsOfNodes List of node IDs for volume creation face by face.
510      *  \param Quantities List of integer values, Quantities[i]
511      *         gives quantity of nodes in face number i.
512      */
513     boolean AddPolyhedralVolume (in long_array IdsOfNodes,
514                                  in long_array Quantities);
515
516     /*!
517      *  Create volume of many faces, giving IDs of existing faces.
518      *  \param IdsOfFaces List of face IDs for volume creation.
519      *  \note The created volume will refer only to nodes
520      *        of the given faces, not to the faces itself.
521      */
522     boolean AddPolyhedralVolumeByFaces (in long_array IdsOfFaces);
523
524     boolean MoveNode(in long NodeID, in double x, in double y, in double z);
525
526     boolean InverseDiag(in long NodeID1, in long NodeID2);
527
528     boolean DeleteDiag(in long NodeID1, in long NodeID2);
529
530     boolean Reorient(in long_array IDsOfElements);
531     
532     boolean ReorientObject(in SMESH_IDSource  theObject);
533
534     boolean TriToQuad(in long_array       IDsOfElements,
535                       in NumericalFunctor Criterion,
536                       in double           MaxAngle);
537     
538     boolean TriToQuadObject(in SMESH_IDSource   theObject,
539                             in NumericalFunctor Criterion,
540                             in double           MaxAngle);
541     
542     boolean QuadToTri(in long_array       IDsOfElements,
543                       in NumericalFunctor Criterion);
544
545     boolean SplitQuad(in long_array IDsOfElements,
546                       in boolean    Diag13);
547
548     boolean SplitQuadObject(in SMESH_IDSource   theObject,
549                             in boolean    Diag13);
550
551     enum Smooth_Method { LAPLACIAN_SMOOTH, CENTROIDAL_SMOOTH };
552
553     boolean Smooth(in long_array    IDsOfElements,
554                    in long_array    IDsOfFixedNodes,
555                    in long          MaxNbOfIterations,
556                    in double        MaxAspectRatio,
557                    in Smooth_Method Method);
558
559     boolean SmoothObject(in SMESH_IDSource  theObject,
560                          in long_array      IDsOfFixedNodes,
561                          in long            MaxNbOfIterations,
562                          in double          MaxAspectRatio,
563                          in Smooth_Method   Method);
564
565     boolean SmoothParametric(in long_array    IDsOfElements,
566                              in long_array    IDsOfFixedNodes,
567                              in long          MaxNbOfIterations,
568                              in double        MaxAspectRatio,
569                              in Smooth_Method Method);
570
571     boolean SmoothParametricObject(in SMESH_IDSource  theObject,
572                                    in long_array      IDsOfFixedNodes,
573                                    in long            MaxNbOfIterations,
574                                    in double          MaxAspectRatio,
575                                    in Smooth_Method   Method);
576
577     void RenumberNodes();
578
579     void RenumberElements();
580
581     void RotationSweep(in long_array       IDsOfElements,
582                        in AxisStruct       Axix,
583                        in double           AngleInRadians,
584                        in long             NbOfSteps,
585                        in double           Tolerance);
586
587     void RotationSweepObject(in SMESH_IDSource  theObject,
588                              in AxisStruct      Axix,
589                              in double          AngleInRadians,
590                              in long            NbOfSteps,
591                              in double          Tolerance);
592                        
593     void ExtrusionSweep(in long_array      IDsOfElements,
594                         in DirStruct       StepVector,
595                         in long            NbOfSteps);
596
597     void ExtrusionSweepObject(in SMESH_IDSource  theObject,
598                               in DirStruct       StepVector,
599                               in long            NbOfSteps);
600
601     void ExtrusionSweepObject1D(in SMESH_IDSource theObject,
602                                 in DirStruct      StepVector,
603                                 in long           NbOfSteps);
604
605     void ExtrusionSweepObject2D(in SMESH_IDSource theObject,
606                                 in DirStruct      StepVector,
607                                 in long           NbOfSteps);
608
609     enum Extrusion_Error {
610       EXTR_OK,
611       EXTR_NO_ELEMENTS, 
612       EXTR_PATH_NOT_EDGE,
613       EXTR_BAD_PATH_SHAPE,
614       EXTR_BAD_STARTING_NODE,
615       EXTR_BAD_ANGLES_NUMBER,
616       EXTR_CANT_GET_TANGENT
617       };
618
619     Extrusion_Error ExtrusionAlongPath(in long_array        IDsOfElements,
620                                        in SMESH_Mesh        PathMesh,
621                                        in GEOM::GEOM_Object PathShape,
622                                        in long              NodeStart,
623                                        in boolean           HasAngles,
624                                        in double_array      Angles,
625                                        in boolean           HasRefPoint,
626                                        in PointStruct       RefPoint);
627
628     Extrusion_Error ExtrusionAlongPathObject(in SMESH_IDSource    theObject,
629                                              in SMESH_Mesh        PathMesh,
630                                              in GEOM::GEOM_Object PathShape,
631                                              in long              NodeStart,
632                                              in boolean           HasAngles,
633                                              in double_array      Angles,
634                                              in boolean           HasRefPoint,
635                                              in PointStruct       RefPoint);
636
637     enum MirrorType { POINT, AXIS, PLANE };
638
639     void Mirror (in long_array       IDsOfElements,
640                  in AxisStruct       Mirror,
641                  in MirrorType       theMirrorType,
642                  in boolean          Copy);
643
644     void MirrorObject (in SMESH_IDSource  theObject,
645                        in AxisStruct      Mirror,
646                        in MirrorType      theMirrorType,
647                        in boolean         Copy);
648
649     void Translate (in long_array      IDsOfElements,
650                     in DirStruct       Vector,
651                     in boolean         Copy);
652
653     void TranslateObject (in SMESH_IDSource  theObject,
654                           in DirStruct       Vector,
655                           in boolean         Copy);
656     
657     void Rotate (in long_array       IDsOfElements,
658                  in AxisStruct       Axis,
659                  in double           AngleInRadians,
660                  in boolean          Copy);
661
662     void RotateObject (in SMESH_IDSource  theObject,
663                        in AxisStruct      Axis,
664                        in double          AngleInRadians,
665                        in boolean         Copy);
666     
667     void FindCoincidentNodes (in  double              Tolerance,
668                               out array_of_long_array GroupsOfNodes);
669
670     void MergeNodes (in array_of_long_array GroupsOfNodes);
671
672     void MergeEqualElements();
673
674     enum Sew_Error {
675       SEW_OK,
676       SEW_BORDER1_NOT_FOUND,
677       SEW_BORDER2_NOT_FOUND,
678       SEW_BOTH_BORDERS_NOT_FOUND,
679       SEW_BAD_SIDE_NODES,
680       SEW_VOLUMES_TO_SPLIT,
681       // for SewSideElements() only:
682       SEW_DIFF_NB_OF_ELEMENTS,
683       SEW_TOPO_DIFF_SETS_OF_ELEMENTS,
684       SEW_BAD_SIDE1_NODES,
685       SEW_BAD_SIDE2_NODES
686       };
687
688     Sew_Error SewFreeBorders (in long FirstNodeID1,
689                               in long SecondNodeID1,
690                               in long LastNodeID1,
691                               in long FirstNodeID2,
692                               in long SecondNodeID2,
693                               in long LastNodeID2,
694                               in boolean CreatePolygons,
695                               in boolean CreatePolyedrs);
696
697     Sew_Error SewConformFreeBorders (in long FirstNodeID1,
698                                      in long SecondNodeID1,
699                                      in long LastNodeID1,
700                                      in long FirstNodeID2,
701                                      in long SecondNodeID2);
702
703     Sew_Error SewBorderToSide (in long FirstNodeIDOnFreeBorder,
704                                in long SecondNodeIDOnFreeBorder,
705                                in long LastNodeIDOnFreeBorder,
706                                in long FirstNodeIDOnSide,
707                                in long LastNodeIDOnSide,
708                                in boolean CreatePolygons,
709                                in boolean CreatePolyedrs);
710
711     Sew_Error SewSideElements (in long_array IDsOfSide1Elements,
712                                in long_array IDsOfSide2Elements,
713                                in long       NodeID1OfSide1ToMerge,
714                                in long       NodeID1OfSide2ToMerge,
715                                in long       NodeID2OfSide1ToMerge,
716                                in long       NodeID2OfSide2ToMerge);
717
718   };
719 };
720
721 #endif