Salome HOME
Implement sweep mesh elements along a path (PAL7218).
[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   /*!
136    * Enumeration for DriverMED (used by Perform() method)
137    */  
138   enum MED_VERSION // in the order of severity
139   {
140     MED_V2_1,
141     MED_V2_2
142   };
143
144   typedef sequence<log_block> log_array;
145
146
147   interface SMESH_IDSource
148   {
149     /*!
150      * Returns a sequence of all element IDs
151      */
152     long_array GetIDs();
153   };
154   
155   interface SMESH_GroupBase;
156   interface SMESH_Group;
157   interface SMESH_GroupOnGeom;
158   interface SMESH_subMesh;
159   interface SMESH_MeshEditor;
160   interface SMESH_Mesh : SALOME::GenericObj, SMESH_IDSource
161   {
162     /*!
163      * Associate a Shape to a Mesh created with NewEmpty
164      */
165
166 //     boolean SetMesh(in GEOM::GEOM_Object anObject)
167 //        raises (SALOME::SALOME_Exception);
168
169     /*!
170      * Get the subMesh object associated to a subShape. The subMesh object
171      * gives access to nodes and elements IDs.
172      * SubMesh will be used instead of SubShape in a next idl version to 
173      * adress a specific subMesh...
174      */
175     SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
176       raises (SALOME::SALOME_Exception);
177
178     /*!
179      * Create a subMesh without reference to a subShape
180      */
181 //     SMESH_subMesh NewEmpty()
182 //       raises (SALOME::SALOME_Exception);
183
184     /*!
185      * Get geom shape to mesh. A result may be nil
186      */
187     GEOM::GEOM_Object GetShapeToMesh()
188       raises (SALOME::SALOME_Exception);
189
190     /*!
191      * Remove a submesh
192      */
193     void RemoveSubMesh(in SMESH_subMesh aSubMesh)
194       raises (SALOME::SALOME_Exception);
195
196     /*!
197      * Create a group
198      */
199     SMESH_Group CreateGroup( in ElementType elem_type,
200                              in string name )
201       raises (SALOME::SALOME_Exception);
202
203     /*!
204      * Create a group from geometry group
205      */
206     SMESH_GroupOnGeom CreateGroupFromGEOM( in ElementType elem_type,
207                                           in string name,
208                                           in GEOM::GEOM_Object theGeomObject )
209       raises (SALOME::SALOME_Exception);
210
211     /*!
212      * Remove a group
213      */
214     void RemoveGroup(in SMESH_GroupBase aGroup)
215       raises (SALOME::SALOME_Exception);
216
217      /*!
218      *  Remove group with its contents
219      */
220     void RemoveGroupWithContents( in SMESH_GroupBase aGroup )
221         raises (SALOME::SALOME_Exception);
222
223     /*!
224      * Union of two groups
225      *    New group is created. All mesh elements that are 
226      *    present in initial groups are added to the new one
227      */
228     SMESH_Group UnionGroups (in SMESH_GroupBase aGroup1,
229                              in SMESH_GroupBase aGroup2,
230                              in string          name )
231         raises (SALOME::SALOME_Exception);
232
233     /*!
234      *  Intersection of two groups
235      *  New group is created. All mesh elements that are 
236      *  present in both initial groups are added to the new one.
237      */
238     SMESH_Group IntersectGroups (in SMESH_GroupBase aGroup1,
239                                  in SMESH_GroupBase aGroup2,
240                                  in string          name )
241         raises (SALOME::SALOME_Exception);
242
243       /*!
244        *  Cut of two groups
245        *  New group is created. All mesh elements that are present in 
246        *  main group but do not present in tool group are added to the new one
247        */
248       SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
249                              in SMESH_GroupBase aToolGroup,
250                              in string          name )
251           raises (SALOME::SALOME_Exception);
252
253     /*!
254      * Add hypothesis to the mesh, under a particular subShape
255      * (or the main shape itself)
256      * The Add method is only used to prepare the build of the mesh and store
257      * the algorithms and associated parameters.
258      * Actual job of mesh the shape is done by MESH_Gen.
259      * @params
260      * - aSubShape : subShape obtained by a shape explode in GEOM
261      *   (or main shape)
262      * - anHyp : hypothesis object 
263      * @return
264      * - OK if the hypothesis is compatible with the subShape 
265      *   (and all previous hypothesis on the subShape)
266      * - NOK if the hypothesis is not compatible with the subShape
267      *   (or one previous hypothesis on the subShape)
268      * raises exception if hypothesis has not been created
269      */
270     Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
271                                     in SMESH_Hypothesis anHyp)
272       raises (SALOME::SALOME_Exception);
273 //     boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
274 //       raises (SALOME::SALOME_Exception);
275
276
277     /*!
278      * Remove an hypothesis previouly added with AddHypothesis.
279      */
280     Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject,
281                                        in SMESH_Hypothesis anHyp)
282       raises (SALOME::SALOME_Exception);
283 //     boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
284 //                           in SMESH_Hypothesis anHyp)
285 //       raises (SALOME::SALOME_Exception);
286
287     /*!
288      * Get the list of hypothesis added on a subShape
289      */
290     ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Object aSubObject)
291       raises (SALOME::SALOME_Exception);
292 //     ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
293 //       raises (SALOME::SALOME_Exception);
294
295     /*!
296      * Get the log of nodes and elements added or removed since previous
297      * clear of the log.
298      * @params
299      * - clearAfterGet : log is emptied after Get (safe if concurrents access)
300      */
301     //    string_array GetLog(in boolean clearAfterGet)
302     //      raises (SALOME::SALOME_Exception);
303     log_array GetLog(in boolean clearAfterGet)
304       raises (SALOME::SALOME_Exception);
305
306     /*!
307      * Clear the log of nodes and elements added or removed since previous
308      * clear. Must be used immediately after GetLog if clearAfterGet is false.
309      */
310     void ClearLog()
311       raises (SALOME::SALOME_Exception);
312
313     /*!
314      * Get the internal Id 
315      */
316     long GetId();     
317
318     /*!
319      * Get the study Id 
320      */
321     long GetStudyId();    
322     
323     SMESH_MeshEditor GetMeshEditor() 
324        raises (SALOME::SALOME_Exception);
325
326     /*!
327      * Export Mesh to MED Formats
328      */
329     void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
330       raises (SALOME::SALOME_Exception);
331     void ExportMED( in string file, in boolean auto_groups )
332       raises (SALOME::SALOME_Exception);
333
334     /*!
335      * Export Mesh to DAT, UNV and STL Formats
336      */
337     void ExportDAT( in string file )
338       raises (SALOME::SALOME_Exception);
339     void ExportUNV( in string file )
340       raises (SALOME::SALOME_Exception);
341     void ExportSTL( in string file, in boolean isascii )
342       raises (SALOME::SALOME_Exception);
343
344     /*!
345      * Get MED Mesh
346      */
347     SALOME_MED::MESH GetMEDMesh()
348       raises (SALOME::SALOME_Exception);
349
350     long NbNodes()
351       raises (SALOME::SALOME_Exception);
352
353     long NbElements()
354       raises (SALOME::SALOME_Exception);
355
356     long NbEdges()
357       raises (SALOME::SALOME_Exception);
358
359     long NbFaces()
360       raises (SALOME::SALOME_Exception);
361
362     long NbTriangles()
363       raises (SALOME::SALOME_Exception);
364
365     long NbQuadrangles()
366       raises (SALOME::SALOME_Exception);
367
368     long NbVolumes()
369       raises (SALOME::SALOME_Exception);
370
371     long NbTetras()
372       raises (SALOME::SALOME_Exception);
373
374     long NbHexas()
375       raises (SALOME::SALOME_Exception);
376
377     long NbPyramids()
378       raises (SALOME::SALOME_Exception);
379
380     long NbPrisms()
381       raises (SALOME::SALOME_Exception);
382
383     long NbSubMesh()
384       raises (SALOME::SALOME_Exception);
385
386     long_array GetElementsId()
387       raises (SALOME::SALOME_Exception);
388
389     long_array GetElementsByType( in ElementType theType )
390       raises (SALOME::SALOME_Exception);
391
392     long_array GetNodesId()
393       raises (SALOME::SALOME_Exception);
394
395     string Dump();
396   };
397
398   interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
399   {
400     /*!
401      * 
402      */
403     long GetNumberOfElements()
404       raises (SALOME::SALOME_Exception);
405
406     /*!
407      * 
408      */
409     long GetNumberOfNodes( in boolean all )
410       raises (SALOME::SALOME_Exception);
411
412     /*!
413      * 
414      */
415     long_array GetElementsId()
416       raises (SALOME::SALOME_Exception);
417
418     /*!
419      * 
420      */
421     long_array GetElementsByType( in ElementType theType )
422       raises (SALOME::SALOME_Exception);
423
424     /*!
425      * 
426      */
427     long_array GetNodesId()
428       raises (SALOME::SALOME_Exception);
429
430     /*!
431      * Get geom shape the submesh is dedicated to
432      */
433     GEOM::GEOM_Object GetSubShape()
434       raises (SALOME::SALOME_Exception);
435
436     /*!
437      * Get SMESH_Mesh which stores nodes coordinates & elements definition
438      */
439     SMESH_Mesh GetFather()
440       raises (SALOME::SALOME_Exception);
441
442     /*!
443      * Get the internal Id 
444      */
445     long GetId();    
446
447     /*!
448      * Get MED subMesh
449      */
450     SALOME_MED::FAMILY GetFamily()
451       raises (SALOME::SALOME_Exception);
452   };
453   
454   /* 
455    * This interface makes modifications on the Mesh - removing elements and nodes etc.
456    */
457   interface NumericalFunctor;
458   interface SMESH_MeshEditor {
459
460
461     boolean RemoveElements(in long_array IDsOfElements);
462
463     boolean RemoveNodes(in long_array IDsOfNodes);
464
465     boolean AddNode(in double x, in double y, in double z);
466
467     boolean AddEdge(in long_array IDsOfNodes);
468
469     boolean AddFace(in long_array IDsOfNodes);
470
471     boolean AddVolume(in long_array IDsOfNodes);
472
473     boolean MoveNode(in long NodeID, in double x, in double y, in double z);
474
475     boolean InverseDiag(in long NodeID1, in long NodeID2);
476
477     boolean DeleteDiag(in long NodeID1, in long NodeID2);
478
479     boolean Reorient(in long_array IDsOfElements);
480     
481     boolean ReorientObject(in SMESH_IDSource  theObject);
482
483     boolean TriToQuad(in long_array       IDsOfElements,
484                       in NumericalFunctor Criterion,
485                       in double           MaxAngle);
486     
487     boolean TriToQuadObject(in SMESH_IDSource   theObject,
488                             in NumericalFunctor Criterion,
489                             in double           MaxAngle);
490     
491     boolean QuadToTri(in long_array       IDsOfElements,
492                       in NumericalFunctor Criterion);
493
494     boolean SplitQuad(in long_array IDsOfElements,
495                       in boolean    Diag13);
496
497     boolean SplitQuadObject(in SMESH_IDSource   theObject,
498                             in boolean    Diag13);
499
500     enum Smooth_Method { LAPLACIAN_SMOOTH, CENTROIDAL_SMOOTH };
501
502     boolean Smooth(in long_array    IDsOfElements,
503                    in long_array    IDsOfFixedNodes,
504                    in long          MaxNbOfIterations,
505                    in double        MaxAspectRatio,
506                    in Smooth_Method Method);
507
508     boolean SmoothObject(in SMESH_IDSource  theObject,
509                          in long_array      IDsOfFixedNodes,
510                          in long            MaxNbOfIterations,
511                          in double          MaxAspectRatio,
512                          in Smooth_Method   Method);
513
514     void RenumberNodes();
515
516     void RenumberElements();
517
518     void RotationSweep(in long_array       IDsOfElements,
519                        in AxisStruct       Axix,
520                        in double           AngleInRadians,
521                        in long             NbOfSteps,
522                        in double           Tolerance);
523
524     void RotationSweepObject(in SMESH_IDSource  theObject,
525                              in AxisStruct      Axix,
526                              in double          AngleInRadians,
527                              in long            NbOfSteps,
528                              in double          Tolerance);
529                        
530     void ExtrusionSweep(in long_array      IDsOfElements,
531                         in DirStruct       StepVector,
532                         in long            NbOfSteps);
533
534     void ExtrusionSweepObject(in SMESH_IDSource  theObject,
535                               in DirStruct       StepVector,
536                               in long            NbOfSteps);
537
538     enum Extrusion_Error {
539       EXTR_OK,
540       EXTR_NO_ELEMENTS, 
541       EXTR_PATH_NOT_EDGE,
542       EXTR_BAD_PATH_SHAPE,
543       EXTR_BAD_STARTING_NODE,
544       EXTR_BAD_ANGLES_NUMBER,
545       EXTR_CANT_GET_TANGENT
546       };
547
548     Extrusion_Error ExtrusionAlongPath(in long_array        IDsOfElements,
549                                        in SMESH_Mesh        PathMesh,
550                                        in GEOM::GEOM_Object PathShape,
551                                        in long              NodeStart,
552                                        in boolean           HasAngles,
553                                        in double_array      Angles,
554                                        in boolean           HasRefPoint,
555                                        in PointStruct       RefPoint);
556
557     Extrusion_Error ExtrusionAlongPathObject(in SMESH_IDSource    theObject,
558                                              in SMESH_Mesh        PathMesh,
559                                              in GEOM::GEOM_Object PathShape,
560                                              in long              NodeStart,
561                                              in boolean           HasAngles,
562                                              in double_array      Angles,
563                                              in boolean           HasRefPoint,
564                                              in PointStruct       RefPoint);
565
566     enum MirrorType { POINT, AXIS, PLANE };
567
568     void Mirror (in long_array       IDsOfElements,
569                  in AxisStruct       Mirror,
570                  in MirrorType       theMirrorType,
571                  in boolean          Copy);
572
573     void MirrorObject (in SMESH_IDSource  theObject,
574                        in AxisStruct      Mirror,
575                        in MirrorType      theMirrorType,
576                        in boolean         Copy);
577
578     void Translate (in long_array      IDsOfElements,
579                     in DirStruct       Vector,
580                     in boolean         Copy);
581
582     void TranslateObject (in SMESH_IDSource  theObject,
583                           in DirStruct       Vector,
584                           in boolean         Copy);
585     
586     void Rotate (in long_array       IDsOfElements,
587                  in AxisStruct       Axis,
588                  in double           AngleInRadians,
589                  in boolean          Copy);
590
591     void RotateObject (in SMESH_IDSource  theObject,
592                        in AxisStruct      Axis,
593                        in double          AngleInRadians,
594                        in boolean         Copy);
595     
596     void FindCoincidentNodes (in  double              Tolerance,
597                               out array_of_long_array GroupsOfNodes);
598
599     void MergeNodes (in array_of_long_array GroupsOfNodes);
600
601     void MergeEqualElements();
602
603     enum Sew_Error {
604       SEW_OK,
605       SEW_BORDER1_NOT_FOUND,
606       SEW_BORDER2_NOT_FOUND,
607       SEW_BOTH_BORDERS_NOT_FOUND,
608       SEW_BAD_SIDE_NODES,
609       SEW_VOLUMES_TO_SPLIT,
610       // for SewSideElements() only:
611       SEW_DIFF_NB_OF_ELEMENTS,
612       SEW_TOPO_DIFF_SETS_OF_ELEMENTS,
613       SEW_BAD_SIDE1_NODES,
614       SEW_BAD_SIDE2_NODES
615       };
616
617     Sew_Error SewFreeBorders (in long FirstNodeID1,
618                               in long SecondNodeID1,
619                               in long LastNodeID1,
620                               in long FirstNodeID2,
621                               in long SecondNodeID2,
622                               in long LastNodeID2);
623
624     Sew_Error SewConformFreeBorders (in long FirstNodeID1,
625                                      in long SecondNodeID1,
626                                      in long LastNodeID1,
627                                      in long FirstNodeID2,
628                                      in long SecondNodeID2);
629
630     Sew_Error SewBorderToSide (in long FirstNodeIDOnFreeBorder,
631                                in long SecondNodeIDOnFreeBorder,
632                                in long LastNodeIDOnFreeBorder,
633                                in long FirstNodeIDOnSide,
634                                in long LastNodeIDOnSide);
635
636     Sew_Error SewSideElements (in long_array IDsOfSide1Elements,
637                                in long_array IDsOfSide2Elements,
638                                in long       NodeID1OfSide1ToMerge,
639                                in long       NodeID1OfSide2ToMerge,
640                                in long       NodeID2OfSide1ToMerge,
641                                in long       NodeID2OfSide2ToMerge);
642
643   };
644 };
645
646 #endif