1 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
18 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
22 // File : SMESH_Mesh.idl
23 // Author : Paul RASCLE, EDF
26 #ifndef _SMESH_MESH_IDL_
27 #define _SMESH_MESH_IDL_
29 #include "SALOME_Exception.idl"
30 #include "SALOME_GenericObj.idl"
31 #include "GEOM_Gen.idl"
36 interface SMESH_Hypothesis;
37 typedef sequence<SMESH_Hypothesis> ListOfHypothesis;
39 typedef sequence<double> double_array ;
40 typedef sequence<long> long_array ;
41 typedef sequence<string> string_array ;
42 typedef sequence<long_array> array_of_long_array ;
60 CHANGE_POLYHEDRON_NODES,
79 struct PointStruct { double x;
82 struct DirStruct { PointStruct PS ; } ; // analog to Occ Direction
84 struct AxisStruct { double x;
93 * Enumeration for element type, like in SMDS
105 * ElementOrder points out entities of what order are requested
108 ORDER_ANY, /*! entities of any order */
109 ORDER_LINEAR, /*! entities of 1st order */
110 ORDER_QUADRATIC /*! entities of 2nd order */
114 * Enumeration for hypothesis status (used by AddHypothesis() and RemoveHypothesis() methods)
116 enum Hypothesis_Status // in the order of severity
119 HYP_MISSING, // algo misses a hypothesis
120 HYP_CONCURENT, // several applicable hypotheses
121 HYP_BAD_PARAMETER,// hypothesis has a bad parameter value
122 HYP_UNKNOWN_FATAL,// --- all statuses below should be considered as fatal
123 // for Add/RemoveHypothesis operations
124 HYP_INCOMPATIBLE, // hypothesis does not fit algo
125 HYP_NOTCONFORM, // not conform mesh is produced appling a hypothesis
126 HYP_ALREADY_EXIST,// such hypothesis already exist
127 HYP_BAD_DIM, // bad dimension
128 HYP_BAD_SUBSHAPE // shape is neither the main one, nor its subshape, nor a group
132 * Enumeration for DriverMED read status (used by ImportMEDFile() method)
134 enum DriverMED_ReadStatus // in the order of severity
137 DRS_EMPTY, // a MED file contains no mesh with the given name
138 DRS_WARN_RENUMBER, // a MED file has overlapped ranges of element numbers,
139 // so the numbers from the file are ignored
140 DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
141 DRS_FAIL // general failure (exception etc.)
145 * Enumeration for DriverMED (used by Perform() method)
147 enum MED_VERSION // in the order of severity
153 typedef sequence<log_block> log_array;
157 * Auxilary flags for advanced extrusion.
158 * BOUNDARY: create or not boundary for result of extrusion
159 * SEW: try to use existing nodes or create new nodes in any case
161 const long EXTRUSION_FLAG_BOUNDARY = 1;
162 const long EXTRUSION_FLAG_SEW = 2;
164 interface SMESH_IDSource
167 * Returns a sequence of all element IDs
172 interface SMESH_GroupBase;
173 interface SMESH_Group;
174 interface SMESH_GroupOnGeom;
175 interface SMESH_subMesh;
176 interface SMESH_MeshEditor;
177 interface SMESH_Mesh : SALOME::GenericObj, SMESH_IDSource
180 // * Associate a Shape to a Mesh created with NewEmpty
182 //boolean SetMesh(in GEOM::GEOM_Object anObject)
183 // raises (SALOME::SALOME_Exception);
186 * Get the subMesh object associated to a subShape. The subMesh object
187 * gives access to nodes and elements IDs.
188 * SubMesh will be used instead of SubShape in a next idl version to
189 * adress a specific subMesh...
191 SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
192 raises (SALOME::SALOME_Exception);
195 // * Create a subMesh without reference to a subShape
197 //SMESH_subMesh NewEmpty()
198 // raises (SALOME::SALOME_Exception);
201 * Get geom shape to mesh. A result may be nil
203 GEOM::GEOM_Object GetShapeToMesh()
204 raises (SALOME::SALOME_Exception);
209 void RemoveSubMesh(in SMESH_subMesh aSubMesh)
210 raises (SALOME::SALOME_Exception);
215 SMESH_Group CreateGroup( in ElementType elem_type,
217 raises (SALOME::SALOME_Exception);
220 * Create a group from geometry group
222 SMESH_GroupOnGeom CreateGroupFromGEOM( in ElementType elem_type,
224 in GEOM::GEOM_Object theGeomObject )
225 raises (SALOME::SALOME_Exception);
230 void RemoveGroup(in SMESH_GroupBase aGroup)
231 raises (SALOME::SALOME_Exception);
234 * Remove group with its contents
236 void RemoveGroupWithContents( in SMESH_GroupBase aGroup )
237 raises (SALOME::SALOME_Exception);
240 * Union of two groups
241 * New group is created. All mesh elements that are
242 * present in initial groups are added to the new one
244 SMESH_Group UnionGroups (in SMESH_GroupBase aGroup1,
245 in SMESH_GroupBase aGroup2,
247 raises (SALOME::SALOME_Exception);
250 * Intersection of two groups
251 * New group is created. All mesh elements that are
252 * present in both initial groups are added to the new one.
254 SMESH_Group IntersectGroups (in SMESH_GroupBase aGroup1,
255 in SMESH_GroupBase aGroup2,
257 raises (SALOME::SALOME_Exception);
261 * New group is created. All mesh elements that are present in
262 * main group but do not present in tool group are added to the new one
264 SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
265 in SMESH_GroupBase aToolGroup,
267 raises (SALOME::SALOME_Exception);
270 * Add hypothesis to the mesh, under a particular subShape
271 * (or the main shape itself)
272 * The Add method is only used to prepare the build of the mesh and store
273 * the algorithms and associated parameters.
274 * Actual job of mesh the shape is done by MESH_Gen.
276 * - aSubShape : subShape obtained by a shape explode in GEOM
278 * - anHyp : hypothesis object
280 * - OK if the hypothesis is compatible with the subShape
281 * (and all previous hypothesis on the subShape)
282 * - NOK if the hypothesis is not compatible with the subShape
283 * (or one previous hypothesis on the subShape)
284 * raises exception if hypothesis has not been created
286 Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
287 in SMESH_Hypothesis anHyp)
288 raises (SALOME::SALOME_Exception);
289 // boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
290 // raises (SALOME::SALOME_Exception);
293 * Remove an hypothesis previouly added with AddHypothesis.
295 Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject,
296 in SMESH_Hypothesis anHyp)
297 raises (SALOME::SALOME_Exception);
298 // boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
299 // in SMESH_Hypothesis anHyp)
300 // raises (SALOME::SALOME_Exception);
303 * Get the list of hypothesis added on a subShape
305 ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Object aSubObject)
306 raises (SALOME::SALOME_Exception);
307 // ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
308 // raises (SALOME::SALOME_Exception);
311 * Get the log of nodes and elements added or removed since previous
314 * - clearAfterGet : log is emptied after Get (safe if concurrents access)
316 // string_array GetLog(in boolean clearAfterGet)
317 // raises (SALOME::SALOME_Exception);
318 log_array GetLog(in boolean clearAfterGet)
319 raises (SALOME::SALOME_Exception);
322 * Clear the log of nodes and elements added or removed since previous
323 * clear. Must be used immediately after GetLog if clearAfterGet is false.
326 raises (SALOME::SALOME_Exception);
329 * Get the internal Id
339 * Obtain instance of SMESH_MeshEditor
341 SMESH_MeshEditor GetMeshEditor()
342 raises (SALOME::SALOME_Exception);
344 /*! Check group names for duplications.
345 * Consider maximum group name length stored in MED file.
347 boolean HasDuplicatedGroupNamesMED();
350 * Export Mesh to different MED Formats
352 * - auto_groups : boolean parameter for creating/not creating
353 * the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
354 * the typical use is auto_groups=false.
355 * - theVersion : define the version of format of MED file, that will be created
357 void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
358 raises (SALOME::SALOME_Exception);
361 * Export Mesh to MED_V2_1 MED format
362 * Works, just the same as ExportToMED, with MED_VERSION parameter equal to MED_V2_1.
363 * The method is kept in order to support old functionality
365 void ExportMED( in string file, in boolean auto_groups )
366 raises (SALOME::SALOME_Exception);
369 * Export Mesh to DAT, UNV and STL Formats
371 void ExportDAT( in string file )
372 raises (SALOME::SALOME_Exception);
373 void ExportUNV( in string file )
374 raises (SALOME::SALOME_Exception);
375 void ExportSTL( in string file, in boolean isascii )
376 raises (SALOME::SALOME_Exception);
381 SALOME_MED::MESH GetMEDMesh()
382 raises (SALOME::SALOME_Exception);
385 * Get informations about mesh contents
388 raises (SALOME::SALOME_Exception);
391 raises (SALOME::SALOME_Exception);
394 raises (SALOME::SALOME_Exception);
396 long NbEdgesOfOrder(in ElementOrder order)
397 raises (SALOME::SALOME_Exception);
400 raises (SALOME::SALOME_Exception);
402 long NbFacesOfOrder(in ElementOrder order)
403 raises (SALOME::SALOME_Exception);
406 raises (SALOME::SALOME_Exception);
408 long NbTrianglesOfOrder(in ElementOrder order)
409 raises (SALOME::SALOME_Exception);
412 raises (SALOME::SALOME_Exception);
414 long NbQuadranglesOfOrder(in ElementOrder order)
415 raises (SALOME::SALOME_Exception);
418 raises (SALOME::SALOME_Exception);
421 raises (SALOME::SALOME_Exception);
423 long NbVolumesOfOrder(in ElementOrder order)
424 raises (SALOME::SALOME_Exception);
427 raises (SALOME::SALOME_Exception);
429 long NbTetrasOfOrder(in ElementOrder order)
430 raises (SALOME::SALOME_Exception);
433 raises (SALOME::SALOME_Exception);
435 long NbHexasOfOrder(in ElementOrder order)
436 raises (SALOME::SALOME_Exception);
439 raises (SALOME::SALOME_Exception);
441 long NbPyramidsOfOrder(in ElementOrder order)
442 raises (SALOME::SALOME_Exception);
445 raises (SALOME::SALOME_Exception);
447 long NbPrismsOfOrder(in ElementOrder order)
448 raises (SALOME::SALOME_Exception);
451 raises (SALOME::SALOME_Exception);
454 raises (SALOME::SALOME_Exception);
456 long_array GetElementsId()
457 raises (SALOME::SALOME_Exception);
459 long_array GetElementsByType( in ElementType theType )
460 raises (SALOME::SALOME_Exception);
462 long_array GetNodesId()
463 raises (SALOME::SALOME_Exception);
466 * Returns type of mesh element
468 ElementType GetElementType( in long id, in boolean iselem )
469 raises (SALOME::SALOME_Exception);
472 * Get mesh description
483 interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
488 long GetNumberOfElements()
489 raises (SALOME::SALOME_Exception);
494 long GetNumberOfNodes( in boolean all )
495 raises (SALOME::SALOME_Exception);
500 long_array GetElementsId()
501 raises (SALOME::SALOME_Exception);
506 long_array GetElementsByType( in ElementType theType )
507 raises (SALOME::SALOME_Exception);
510 * Return type of submesh element
512 ElementType GetElementType( in long id, in boolean iselem )
513 raises (SALOME::SALOME_Exception);
518 long_array GetNodesId()
519 raises (SALOME::SALOME_Exception);
522 * Get geom shape the submesh is dedicated to
524 GEOM::GEOM_Object GetSubShape()
525 raises (SALOME::SALOME_Exception);
528 * Get SMESH_Mesh which stores nodes coordinates & elements definition
530 SMESH_Mesh GetFather()
531 raises (SALOME::SALOME_Exception);
534 * Get the internal Id
541 SALOME_MED::FAMILY GetFamily()
542 raises (SALOME::SALOME_Exception);
546 * This interface makes modifications on the Mesh - removing elements and nodes etc.
548 interface NumericalFunctor;
549 interface SMESH_MeshEditor
551 boolean RemoveElements(in long_array IDsOfElements);
553 boolean RemoveNodes(in long_array IDsOfNodes);
555 boolean AddNode(in double x, in double y, in double z);
557 boolean AddEdge(in long_array IDsOfNodes);
559 boolean AddFace(in long_array IDsOfNodes);
561 boolean AddPolygonalFace(in long_array IdsOfNodes);
563 boolean AddVolume(in long_array IDsOfNodes);
566 * Create volume of many faces, giving nodes for each face.
567 * \param IdsOfNodes List of node IDs for volume creation face by face.
568 * \param Quantities List of integer values, Quantities[i]
569 * gives quantity of nodes in face number i.
571 boolean AddPolyhedralVolume (in long_array IdsOfNodes,
572 in long_array Quantities);
575 * Create volume of many faces, giving IDs of existing faces.
576 * \param IdsOfFaces List of face IDs for volume creation.
577 * \note The created volume will refer only to nodes
578 * of the given faces, not to the faces itself.
580 boolean AddPolyhedralVolumeByFaces (in long_array IdsOfFaces);
582 boolean MoveNode(in long NodeID, in double x, in double y, in double z);
584 boolean InverseDiag(in long NodeID1, in long NodeID2);
586 boolean DeleteDiag(in long NodeID1, in long NodeID2);
588 boolean Reorient(in long_array IDsOfElements);
590 boolean ReorientObject(in SMESH_IDSource theObject);
593 * \brief Fuse neighbour triangles into quadrangles.
594 * \param theElems The triangles to be fused.
595 * \param theCriterion Is used to choose a neighbour to fuse with.
596 * \param theMaxAngle Is a max angle between element normals at which fusion
597 * is still performed; theMaxAngle is mesured in radians.
598 * \return TRUE in case of success, FALSE otherwise.
600 boolean TriToQuad (in long_array IDsOfElements,
601 in NumericalFunctor Criterion,
605 * \brief Fuse neighbour triangles into quadrangles.
607 * Behaves like the above method, taking list of elements from \a theObject
609 boolean TriToQuadObject (in SMESH_IDSource theObject,
610 in NumericalFunctor Criterion,
614 * \brief Split quadrangles into triangles.
615 * \param theElems The faces to be splitted.
616 * \param theCriterion Is used to choose a diagonal for splitting.
617 * \return TRUE in case of success, FALSE otherwise.
619 boolean QuadToTri (in long_array IDsOfElements,
620 in NumericalFunctor Criterion);
623 * \brief Split quadrangles into triangles.
625 * Behaves like the above method, taking list of elements from \a theObject
627 boolean QuadToTriObject (in SMESH_IDSource theObject,
628 in NumericalFunctor Criterion);
631 * \brief Split quadrangles into triangles.
632 * \param theElems The faces to be splitted.
633 * \param the13Diag Is used to choose a diagonal for splitting.
634 * \return TRUE in case of success, FALSE otherwise.
636 boolean SplitQuad (in long_array IDsOfElements,
640 * \brief Split quadrangles into triangles.
642 * Behaves like the above method, taking list of elements from \a theObject
644 boolean SplitQuadObject (in SMESH_IDSource theObject,
648 * Find better splitting of the given quadrangle.
649 * \param IDOfQuad ID of the quadrangle to be splitted.
650 * \param Criterion A criterion to choose a diagonal for splitting.
651 * \return 1 if 1-3 diagonal is better, 2 if 2-4
652 * diagonal is better, 0 if error occurs.
654 long BestSplit (in long IDOfQuad,
655 in NumericalFunctor Criterion);
657 enum Smooth_Method { LAPLACIAN_SMOOTH, CENTROIDAL_SMOOTH };
659 boolean Smooth(in long_array IDsOfElements,
660 in long_array IDsOfFixedNodes,
661 in long MaxNbOfIterations,
662 in double MaxAspectRatio,
663 in Smooth_Method Method);
665 boolean SmoothObject(in SMESH_IDSource theObject,
666 in long_array IDsOfFixedNodes,
667 in long MaxNbOfIterations,
668 in double MaxAspectRatio,
669 in Smooth_Method Method);
671 boolean SmoothParametric(in long_array IDsOfElements,
672 in long_array IDsOfFixedNodes,
673 in long MaxNbOfIterations,
674 in double MaxAspectRatio,
675 in Smooth_Method Method);
677 boolean SmoothParametricObject(in SMESH_IDSource theObject,
678 in long_array IDsOfFixedNodes,
679 in long MaxNbOfIterations,
680 in double MaxAspectRatio,
681 in Smooth_Method Method);
683 void RenumberNodes();
685 void RenumberElements();
687 void RotationSweep(in long_array IDsOfElements,
689 in double AngleInRadians,
691 in double Tolerance);
693 void RotationSweepObject(in SMESH_IDSource theObject,
695 in double AngleInRadians,
697 in double Tolerance);
699 void ExtrusionSweep(in long_array IDsOfElements,
700 in DirStruct StepVector,
704 * Generate new elements by extrusion of theElements
705 * by StepVector by NbOfSteps
706 * param ExtrFlags set flags for performing extrusion
707 * param SewTolerance - uses for comparing locations of nodes if flag
708 * EXTRUSION_FLAG_SEW is set
710 void AdvancedExtrusion(in long_array IDsOfElements,
711 in DirStruct StepVector,
714 in double SewTolerance);
716 void ExtrusionSweepObject(in SMESH_IDSource theObject,
717 in DirStruct StepVector,
720 void ExtrusionSweepObject1D(in SMESH_IDSource theObject,
721 in DirStruct StepVector,
724 void ExtrusionSweepObject2D(in SMESH_IDSource theObject,
725 in DirStruct StepVector,
728 enum Extrusion_Error {
733 EXTR_BAD_STARTING_NODE,
734 EXTR_BAD_ANGLES_NUMBER,
735 EXTR_CANT_GET_TANGENT
738 Extrusion_Error ExtrusionAlongPath(in long_array IDsOfElements,
739 in SMESH_Mesh PathMesh,
740 in GEOM::GEOM_Object PathShape,
742 in boolean HasAngles,
743 in double_array Angles,
744 in boolean HasRefPoint,
745 in PointStruct RefPoint);
747 Extrusion_Error ExtrusionAlongPathObject(in SMESH_IDSource theObject,
748 in SMESH_Mesh PathMesh,
749 in GEOM::GEOM_Object PathShape,
751 in boolean HasAngles,
752 in double_array Angles,
753 in boolean HasRefPoint,
754 in PointStruct RefPoint);
756 enum MirrorType { POINT, AXIS, PLANE };
758 void Mirror (in long_array IDsOfElements,
759 in AxisStruct Mirror,
760 in MirrorType theMirrorType,
763 void MirrorObject (in SMESH_IDSource theObject,
764 in AxisStruct Mirror,
765 in MirrorType theMirrorType,
768 void Translate (in long_array IDsOfElements,
772 void TranslateObject (in SMESH_IDSource theObject,
776 void Rotate (in long_array IDsOfElements,
778 in double AngleInRadians,
781 void RotateObject (in SMESH_IDSource theObject,
783 in double AngleInRadians,
786 void FindCoincidentNodes (in double Tolerance,
787 out array_of_long_array GroupsOfNodes);
789 void MergeNodes (in array_of_long_array GroupsOfNodes);
791 void MergeEqualElements();
795 SEW_BORDER1_NOT_FOUND,
796 SEW_BORDER2_NOT_FOUND,
797 SEW_BOTH_BORDERS_NOT_FOUND,
799 SEW_VOLUMES_TO_SPLIT,
800 // for SewSideElements() only:
801 SEW_DIFF_NB_OF_ELEMENTS,
802 SEW_TOPO_DIFF_SETS_OF_ELEMENTS,
807 Sew_Error SewFreeBorders (in long FirstNodeID1,
808 in long SecondNodeID1,
810 in long FirstNodeID2,
811 in long SecondNodeID2,
813 in boolean CreatePolygons,
814 in boolean CreatePolyedrs);
816 Sew_Error SewConformFreeBorders (in long FirstNodeID1,
817 in long SecondNodeID1,
819 in long FirstNodeID2,
820 in long SecondNodeID2);
822 Sew_Error SewBorderToSide (in long FirstNodeIDOnFreeBorder,
823 in long SecondNodeIDOnFreeBorder,
824 in long LastNodeIDOnFreeBorder,
825 in long FirstNodeIDOnSide,
826 in long LastNodeIDOnSide,
827 in boolean CreatePolygons,
828 in boolean CreatePolyedrs);
830 Sew_Error SewSideElements (in long_array IDsOfSide1Elements,
831 in long_array IDsOfSide2Elements,
832 in long NodeID1OfSide1ToMerge,
833 in long NodeID1OfSide2ToMerge,
834 in long NodeID2OfSide1ToMerge,
835 in long NodeID2OfSide2ToMerge);