]> SALOME platform Git repositories - modules/smesh.git/blob - idl/SMESH_Mesh.idl
Salome HOME
PAL16842 (Genertion of groups when a mesh is transformed)
[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.salome-platform.org/ or email : webmaster.salome@opencascade.com
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 #include "GEOM_Gen.idl"
32 #include "MED.idl"
33
34 module SMESH
35 {
36   interface SMESH_Hypothesis;
37   typedef sequence<SMESH_Hypothesis> ListOfHypothesis;
38   interface SMESH_GroupBase;
39   typedef sequence<SMESH_GroupBase> ListOfGroups;
40
41   typedef sequence<double    > double_array ;
42   typedef sequence<long      > long_array ;
43   typedef sequence<string    > string_array ;
44   typedef sequence<long_array> array_of_long_array ;
45
46   enum log_command
47     {
48       ADD_NODE,
49       ADD_EDGE,
50       ADD_TRIANGLE,
51       ADD_QUADRANGLE,
52       ADD_POLYGON,
53       ADD_TETRAHEDRON,
54       ADD_PYRAMID,
55       ADD_PRISM,
56       ADD_HEXAHEDRON,
57       ADD_POLYHEDRON,
58       REMOVE_NODE,
59       REMOVE_ELEMENT,
60       MOVE_NODE,
61       CHANGE_ELEMENT_NODES,
62       CHANGE_POLYHEDRON_NODES,
63       RENUMBER,
64       ADD_QUADEDGE,
65       ADD_QUADTRIANGLE,
66       ADD_QUADQUADRANGLE,
67       ADD_QUADTETRAHEDRON,
68       ADD_QUADPYRAMID,
69       ADD_QUADPENTAHEDRON,
70       ADD_QUADHEXAHEDRON
71     };
72
73   struct log_block
74   {
75     long commandType;
76     long number;
77     double_array coords;
78     long_array indexes;
79   };
80
81   struct PointStruct { double x;
82                        double y;
83                        double z; } ;
84
85   typedef sequence<PointStruct> nodes_array;
86
87   struct DirStruct   { PointStruct PS ; } ;          // analog to Occ Direction
88
89   struct AxisStruct  { double x;
90                        double y;
91                        double z;
92                        double vx;
93                        double vy;
94                        double vz; } ;
95
96
97   /*!
98    * Enumeration for element type, like in SMDS
99    */
100   enum ElementType
101   {
102     ALL,
103     NODE,
104     EDGE,
105     FACE,
106     VOLUME
107   };
108   
109   /*!
110    * ElementOrder points out entities of what order are requested
111    */
112   enum ElementOrder {
113     ORDER_ANY,          /*! entities of any order */
114     ORDER_LINEAR,       /*! entities of 1st order */
115     ORDER_QUADRATIC     /*! entities of 2nd order */
116   };
117
118   /*!
119    * Enumeration for hypothesis status (used by AddHypothesis() and RemoveHypothesis() methods)
120    */
121   enum Hypothesis_Status // in the order of severity
122   {
123     HYP_OK,
124     HYP_MISSING,      // algo misses a hypothesis
125     HYP_CONCURENT,    // several applicable hypotheses
126     HYP_BAD_PARAMETER,// hypothesis has a bad parameter value
127     HYP_HIDDEN_ALGO,  // an algo is hidden by an upper dim algo generating all-dim elements
128     HYP_HIDING_ALGO,  // an algo hides lower dim algos by generating all-dim elements
129     HYP_UNKNOWN_FATAL,//  --- all statuses below should be considered as fatal
130                       //      for Add/RemoveHypothesis operations
131     HYP_INCOMPATIBLE, // hypothesis does not fit algo
132     HYP_NOTCONFORM,   // not conform mesh is produced appling a hypothesis
133     HYP_ALREADY_EXIST,// such hypothesis already exist
134     HYP_BAD_DIM,      // bad dimension
135     HYP_BAD_SUBSHAPE, // shape is neither the main one, nor its subshape, nor a group
136     HYP_BAD_GEOMETRY  // geometry mismatches algorithm's expectation
137   };
138
139   /*!
140    * Enumeration for DriverMED read status (used by ImportMEDFile() method)
141    */
142   enum DriverMED_ReadStatus // in the order of severity
143   {
144     DRS_OK,
145     DRS_EMPTY,          // a MED file contains no mesh with the given name
146     DRS_WARN_RENUMBER,  // a MED file has overlapped ranges of element numbers,
147                         // so the numbers from the file are ignored
148     DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
149     DRS_FAIL            // general failure (exception etc.)
150   };
151
152   /*!
153    * Enumeration for DriverMED (used by Perform() method)
154    */
155   enum MED_VERSION // in the order of severity
156   {
157     MED_V2_1,
158     MED_V2_2
159   };
160
161   typedef sequence<log_block> log_array;
162
163
164   /*!
165    * Auxilary flags for advanced extrusion.
166    * BOUNDARY: create or not boundary for result of extrusion
167    * SEW:      try to use existing nodes or create new nodes in any case
168    */
169   const long EXTRUSION_FLAG_BOUNDARY = 1;
170   const long EXTRUSION_FLAG_SEW = 2;
171   
172   interface SMESH_IDSource
173   {
174     /*!
175      * Returns a sequence of all element IDs
176      */
177     long_array GetIDs();
178   };
179
180   interface SMESH_Group;
181   interface SMESH_GroupOnGeom;
182   interface SMESH_subMesh;
183   interface SMESH_MeshEditor;
184   interface SMESH_Mesh : SALOME::GenericObj, SMESH_IDSource
185   {
186     /*!
187      * Return true if there is a geometry to be meshed
188      */
189     boolean HasShapeToMesh()
190       raises (SALOME::SALOME_Exception);
191
192     /*!
193      * Get geom shape to mesh. A result sould not be nil. Use HasShapeToMesh()
194      * to know if a returned shape 
195      */
196     GEOM::GEOM_Object GetShapeToMesh()
197       raises (SALOME::SALOME_Exception);
198
199
200     /*!
201      * Get the subMesh object associated to a subShape. The subMesh object
202      * gives access to nodes and elements IDs.
203      * SubMesh will be used instead of SubShape in a next idl version to
204      * adress a specific subMesh...
205      */
206     SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
207       raises (SALOME::SALOME_Exception);
208
209     /*!
210      * Remove a submesh
211      */
212     void RemoveSubMesh(in SMESH_subMesh aSubMesh)
213       raises (SALOME::SALOME_Exception);
214
215
216     /*!
217      * Create a group
218      */
219     SMESH_Group CreateGroup( in ElementType elem_type,
220                              in string name )
221       raises (SALOME::SALOME_Exception);
222
223     /*!
224      * Create a group from geometry group
225      */
226     SMESH_GroupOnGeom CreateGroupFromGEOM( in ElementType elem_type,
227                                           in string name,
228                                           in GEOM::GEOM_Object theGeomObject )
229       raises (SALOME::SALOME_Exception);
230
231     /*!
232      * Remove a group
233      */
234     void RemoveGroup(in SMESH_GroupBase aGroup)
235       raises (SALOME::SALOME_Exception);
236
237     /*!
238      *  Remove group with its contents
239      */
240     void RemoveGroupWithContents( in SMESH_GroupBase aGroup )
241       raises (SALOME::SALOME_Exception);
242
243     /*!
244      *  Get the list of groups existing in the mesh
245      */
246     ListOfGroups GetGroups()
247       raises (SALOME::SALOME_Exception);
248
249     /*!
250      *  Get number of groups existing in the mesh
251      */
252     long NbGroups()
253       raises (SALOME::SALOME_Exception);
254
255     /*!
256      * Union of two groups
257      *    New group is created. All mesh elements that are
258      *    present in initial groups are added to the new one
259      */
260     SMESH_Group UnionGroups (in SMESH_GroupBase aGroup1,
261                              in SMESH_GroupBase aGroup2,
262                              in string          name )
263       raises (SALOME::SALOME_Exception);
264
265     /*!
266      *  Intersection of two groups
267      *  New group is created. All mesh elements that are
268      *  present in both initial groups are added to the new one.
269      */
270     SMESH_Group IntersectGroups (in SMESH_GroupBase aGroup1,
271                                  in SMESH_GroupBase aGroup2,
272                                  in string          name )
273       raises (SALOME::SALOME_Exception);
274
275     /*!
276      *  Cut of two groups
277      *  New group is created. All mesh elements that are present in
278      *  main group but do not present in tool group are added to the new one
279      */
280     SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
281                            in SMESH_GroupBase aToolGroup,
282                            in string          name )
283       raises (SALOME::SALOME_Exception);
284
285     /*!
286      * Add hypothesis to the mesh, under a particular subShape
287      * (or the main shape itself)
288      * The Add method is only used to prepare the build of the mesh and store
289      * the algorithms and associated parameters.
290      * Actual job of mesh the shape is done by MESH_Gen.
291      * @params
292      * - aSubShape : subShape obtained by a shape explode in GEOM
293      *   (or main shape)
294      * - anHyp : hypothesis object
295      * @return
296      * - OK if the hypothesis is compatible with the subShape
297      *   (and all previous hypothesis on the subShape)
298      * - NOK if the hypothesis is not compatible with the subShape
299      *   (or one previous hypothesis on the subShape)
300      * raises exception if hypothesis has not been created
301      */
302     Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
303                                     in SMESH_Hypothesis anHyp)
304       raises (SALOME::SALOME_Exception);
305 //     boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
306 //       raises (SALOME::SALOME_Exception);
307
308     /*!
309      * Remove an hypothesis previouly added with AddHypothesis.
310      */
311     Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject,
312                                        in SMESH_Hypothesis anHyp)
313       raises (SALOME::SALOME_Exception);
314 //     boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
315 //                           in SMESH_Hypothesis anHyp)
316 //       raises (SALOME::SALOME_Exception);
317
318     /*!
319      * Get the list of hypothesis added on a subShape
320      */
321     ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Object aSubObject)
322       raises (SALOME::SALOME_Exception);
323 //     ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
324 //       raises (SALOME::SALOME_Exception);
325
326     /*!
327      * Get the log of nodes and elements added or removed since previous
328      * clear of the log.
329      * @params
330      * - clearAfterGet : log is emptied after Get (safe if concurrents access)
331      */
332     //    string_array GetLog(in boolean clearAfterGet)
333     //      raises (SALOME::SALOME_Exception);
334     log_array GetLog(in boolean clearAfterGet)
335       raises (SALOME::SALOME_Exception);
336
337     /*!
338      * Clear the log of nodes and elements added or removed since previous
339      * clear. Must be used immediately after GetLog if clearAfterGet is false.
340      */
341     void ClearLog()
342       raises (SALOME::SALOME_Exception);
343
344     /*!
345      * Toggle auto color mode on the object.
346      * @params
347      * - theAutoColor : flag which toggles auto color mode.
348      */
349     void SetAutoColor(in boolean theAutoColor)
350       raises (SALOME::SALOME_Exception);
351
352     /*!
353      * Get flag of object's auto color mode.
354      */
355     boolean GetAutoColor()
356       raises (SALOME::SALOME_Exception);
357
358     /*!
359      * Get the internal Id
360      */
361     long GetId();
362
363     /*!
364      * Get the study Id
365      */
366     long GetStudyId();
367
368     /*!
369      * Obtain instance of SMESH_MeshEditor
370      */
371     SMESH_MeshEditor GetMeshEditor()
372       raises (SALOME::SALOME_Exception);
373
374     /*!
375      * Return SMESH_MeshEditor that would not modify the mesh but
376      * fill MeshPreviewStruct
377      */
378     SMESH_MeshEditor GetMeshEditPreviewer()
379       raises (SALOME::SALOME_Exception);
380
381     /*! Check group names for duplications.
382      *  Consider maximum group name length stored in MED file.
383      */
384     boolean HasDuplicatedGroupNamesMED();
385
386     /*!
387      * Export Mesh to different MED Formats
388      * @params
389      * - auto_groups : boolean parameter for creating/not creating
390      *   the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
391      *   the typical use is auto_groups=false.
392      * - theVersion : define the version of format of MED file, that will be created
393      */
394     void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
395       raises (SALOME::SALOME_Exception);
396
397     /*!
398      * Export Mesh to MED_V2_1 MED format
399      * Works, just the same as ExportToMED, with MED_VERSION parameter equal to MED_V2_1.
400      * The method is kept in order to support old functionality
401      */
402     void ExportMED( in string file, in boolean auto_groups )
403       raises (SALOME::SALOME_Exception);
404
405     /*!
406      * Export Mesh to DAT, UNV and STL Formats
407      * (UNV supported version is I-DEAS 10)
408      */
409     void ExportDAT( in string file )
410       raises (SALOME::SALOME_Exception);
411     void ExportUNV( in string file )
412       raises (SALOME::SALOME_Exception);
413     void ExportSTL( in string file, in boolean isascii )
414       raises (SALOME::SALOME_Exception);
415
416     /*!
417      * Get MED Mesh
418      */
419     SALOME_MED::MESH GetMEDMesh()
420       raises (SALOME::SALOME_Exception);
421
422     /*!
423      * Get informations about mesh contents
424      */
425     long NbNodes()
426       raises (SALOME::SALOME_Exception);
427
428     long NbElements()
429       raises (SALOME::SALOME_Exception);
430
431     long NbEdges()
432       raises (SALOME::SALOME_Exception);
433
434     long NbEdgesOfOrder(in ElementOrder order)
435       raises (SALOME::SALOME_Exception);
436
437     long NbFaces()
438       raises (SALOME::SALOME_Exception);
439
440     long NbFacesOfOrder(in ElementOrder order)
441       raises (SALOME::SALOME_Exception);
442
443     long NbTriangles()
444       raises (SALOME::SALOME_Exception);
445
446     long NbTrianglesOfOrder(in ElementOrder order)
447       raises (SALOME::SALOME_Exception);
448
449     long NbQuadrangles()
450       raises (SALOME::SALOME_Exception);
451
452     long NbQuadranglesOfOrder(in ElementOrder order)
453       raises (SALOME::SALOME_Exception);
454
455     long NbPolygons()
456       raises (SALOME::SALOME_Exception);
457
458     long NbVolumes()
459       raises (SALOME::SALOME_Exception);
460
461     long NbVolumesOfOrder(in ElementOrder order)
462       raises (SALOME::SALOME_Exception);
463
464     long NbTetras()
465       raises (SALOME::SALOME_Exception);
466
467     long NbTetrasOfOrder(in ElementOrder order)
468       raises (SALOME::SALOME_Exception);
469
470     long NbHexas()
471       raises (SALOME::SALOME_Exception);
472
473     long NbHexasOfOrder(in ElementOrder order)
474       raises (SALOME::SALOME_Exception);
475
476     long NbPyramids()
477       raises (SALOME::SALOME_Exception);
478
479     long NbPyramidsOfOrder(in ElementOrder order)
480       raises (SALOME::SALOME_Exception);
481
482     long NbPrisms()
483       raises (SALOME::SALOME_Exception);
484
485     long NbPrismsOfOrder(in ElementOrder order)
486       raises (SALOME::SALOME_Exception);
487
488     long NbPolyhedrons()
489       raises (SALOME::SALOME_Exception);
490
491     long NbSubMesh()
492       raises (SALOME::SALOME_Exception);
493
494     long_array GetElementsId()
495       raises (SALOME::SALOME_Exception);
496
497     long_array GetElementsByType( in ElementType theType )
498       raises (SALOME::SALOME_Exception);
499
500     long_array GetNodesId()
501       raises (SALOME::SALOME_Exception);
502     
503     /*!
504      * Returns type of mesh element
505      */    
506     ElementType GetElementType( in long id, in boolean iselem )
507       raises (SALOME::SALOME_Exception);
508
509     long_array GetSubMeshElementsId(in long ShapeID)
510       raises (SALOME::SALOME_Exception);
511
512     long_array GetSubMeshNodesId(in long ShapeID, in boolean all )
513       raises (SALOME::SALOME_Exception);
514     
515     ElementType GetSubMeshElementType(in long ShapeID)
516       raises (SALOME::SALOME_Exception);
517
518     /*!
519      * Get mesh description
520      */
521     string Dump();
522
523     /*!
524      * Get mesh pointer
525      */
526     long long GetMeshPtr();
527
528     /*!
529      * Get XYZ coordinates of node as list of double
530      * If there is not node for given ID - returns empty list
531      */
532     double_array GetNodeXYZ(in long id);
533
534     /*!
535      * For given node returns list of IDs of inverse elements
536      * If there is not node for given ID - returns empty list
537      */
538     long_array GetNodeInverseElements(in long id);
539
540     /*!
541      * If given element is node returns IDs of shape from position
542      * If there is not node for given ID - returns -1
543      */
544     long GetShapeID(in long id);
545
546     /*!
547      * For given element returns ID of result shape after 
548      * ::FindShape() from SMESH_MeshEditor
549      * If there is not element for given ID - returns -1
550      */
551     long GetShapeIDForElem(in long id);
552
553     /*!
554      * Returns number of nodes for given element
555      * If there is not element for given ID - returns -1
556      */
557     long GetElemNbNodes(in long id);
558
559     /*!
560      * Returns IDs of nodes of given element
561      */
562     long_array GetElemNodes(in long id);
563
564     /*!
565      * Returns ID of node by given index for given element
566      * If there is not element for given ID - returns -1
567      * If there is not node for given index - returns -2
568      */
569     long GetElemNode(in long id, in long index);
570
571     /*!
572      * Returns true if given node is medium node
573      * in given quadratic element
574      */
575     boolean IsMediumNode(in long ide, in long idn);
576
577     /*!
578      * Returns true if given node is medium node
579      * in one of quadratic elements
580      */
581     boolean IsMediumNodeOfAnyElem(in long idn, in ElementType elem_type);
582
583     /*!
584      * Returns number of edges for given element
585      */
586     long ElemNbEdges(in long id);
587
588     /*!
589      * Returns number of faces for given element
590      */
591     long ElemNbFaces(in long id);
592
593     /*!
594      * Returns true if given element is polygon
595      */
596     boolean IsPoly(in long id);
597
598     /*!
599      * Returns true if given element is quadratic
600      */
601     boolean IsQuadratic(in long id);
602
603     /*!
604      * Returns XYZ coordinates of bary center for given element
605      * as list of double
606      * If there is not element for given ID - returns empty list
607      */
608     double_array BaryCenter(in long id);
609
610   };
611
612   interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
613   {
614     /*!
615      *
616      */
617     long GetNumberOfElements()
618       raises (SALOME::SALOME_Exception);
619
620     /*!
621      *
622      */
623     long GetNumberOfNodes( in boolean all )
624       raises (SALOME::SALOME_Exception);
625
626     /*!
627      *
628      */
629     long_array GetElementsId()
630       raises (SALOME::SALOME_Exception);
631
632     /*!
633      *
634      */
635     long_array GetElementsByType( in ElementType theType )
636       raises (SALOME::SALOME_Exception);
637     
638     /*!
639      * Return type of submesh element
640      */
641     ElementType GetElementType( in long id, in boolean iselem )
642       raises (SALOME::SALOME_Exception);
643
644     /*!
645      *
646      */
647     long_array GetNodesId()
648       raises (SALOME::SALOME_Exception);
649
650     /*!
651      * Get geom shape the submesh is dedicated to
652      */
653     GEOM::GEOM_Object GetSubShape()
654       raises (SALOME::SALOME_Exception);
655
656     /*!
657      * Get SMESH_Mesh which stores nodes coordinates & elements definition
658      */
659     SMESH_Mesh GetFather()
660       raises (SALOME::SALOME_Exception);
661
662     /*!
663      * Get the internal Id
664      */
665     long GetId();
666
667     /*!
668      * Get MED subMesh
669      */
670     SALOME_MED::FAMILY GetFamily()
671       raises (SALOME::SALOME_Exception);
672   };
673
674 };
675
676 #endif