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"
34 interface GEOM_Object;
47 interface SMESH_Hypothesis;
48 typedef sequence<SMESH_Hypothesis> ListOfHypothesis;
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 ;
71 CHANGE_POLYHEDRON_NODES,
83 struct PointStruct { double x;
86 struct DirStruct { PointStruct PS ; } ; // analog to Occ Direction
88 struct AxisStruct { double x;
97 * Enumeration for element type, like in SMDS
109 * Enumeration for hypothesis status (used by AddHypothesis() and RemoveHypothesis() methods)
111 enum Hypothesis_Status // in the order of severity
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
126 * Enumeration for DriverMED read status (used by ImportMEDFile() method)
128 enum DriverMED_ReadStatus // in the order of severity
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.)
139 * Enumeration for DriverMED (used by Perform() method)
141 enum MED_VERSION // in the order of severity
147 typedef sequence<log_block> log_array;
150 interface SMESH_IDSource
153 * Returns a sequence of all element IDs
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
166 // * Associate a Shape to a Mesh created with NewEmpty
168 //boolean SetMesh(in GEOM::GEOM_Object anObject)
169 // raises (SALOME::SALOME_Exception);
172 * Get the subMesh object associated to a subShape. The subMesh object
173 * gives access to nodes and elements IDs.
174 * SubMesh will be used instead of SubShape in a next idl version to
175 * adress a specific subMesh...
177 SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
178 raises (SALOME::SALOME_Exception);
181 // * Create a subMesh without reference to a subShape
183 //SMESH_subMesh NewEmpty()
184 // raises (SALOME::SALOME_Exception);
187 * Get geom shape to mesh. A result may be nil
189 GEOM::GEOM_Object GetShapeToMesh()
190 raises (SALOME::SALOME_Exception);
195 void RemoveSubMesh(in SMESH_subMesh aSubMesh)
196 raises (SALOME::SALOME_Exception);
201 SMESH_Group CreateGroup( in ElementType elem_type,
203 raises (SALOME::SALOME_Exception);
206 * Create a group from geometry group
208 SMESH_GroupOnGeom CreateGroupFromGEOM( in ElementType elem_type,
210 in GEOM::GEOM_Object theGeomObject )
211 raises (SALOME::SALOME_Exception);
216 void RemoveGroup(in SMESH_GroupBase aGroup)
217 raises (SALOME::SALOME_Exception);
220 * Remove group with its contents
222 void RemoveGroupWithContents( in SMESH_GroupBase aGroup )
223 raises (SALOME::SALOME_Exception);
226 * Union of two groups
227 * New group is created. All mesh elements that are
228 * present in initial groups are added to the new one
230 SMESH_Group UnionGroups (in SMESH_GroupBase aGroup1,
231 in SMESH_GroupBase aGroup2,
233 raises (SALOME::SALOME_Exception);
236 * Intersection of two groups
237 * New group is created. All mesh elements that are
238 * present in both initial groups are added to the new one.
240 SMESH_Group IntersectGroups (in SMESH_GroupBase aGroup1,
241 in SMESH_GroupBase aGroup2,
243 raises (SALOME::SALOME_Exception);
247 * New group is created. All mesh elements that are present in
248 * main group but do not present in tool group are added to the new one
250 SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
251 in SMESH_GroupBase aToolGroup,
253 raises (SALOME::SALOME_Exception);
256 * Add hypothesis to the mesh, under a particular subShape
257 * (or the main shape itself)
258 * The Add method is only used to prepare the build of the mesh and store
259 * the algorithms and associated parameters.
260 * Actual job of mesh the shape is done by MESH_Gen.
262 * - aSubShape : subShape obtained by a shape explode in GEOM
264 * - anHyp : hypothesis object
266 * - OK if the hypothesis is compatible with the subShape
267 * (and all previous hypothesis on the subShape)
268 * - NOK if the hypothesis is not compatible with the subShape
269 * (or one previous hypothesis on the subShape)
270 * raises exception if hypothesis has not been created
272 Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
273 in SMESH_Hypothesis anHyp)
274 raises (SALOME::SALOME_Exception);
275 // boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
276 // raises (SALOME::SALOME_Exception);
279 * Remove an hypothesis previouly added with AddHypothesis.
281 Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject,
282 in SMESH_Hypothesis anHyp)
283 raises (SALOME::SALOME_Exception);
284 // boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
285 // in SMESH_Hypothesis anHyp)
286 // raises (SALOME::SALOME_Exception);
289 * Get the list of hypothesis added on a subShape
291 ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Object aSubObject)
292 raises (SALOME::SALOME_Exception);
293 // ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
294 // raises (SALOME::SALOME_Exception);
297 * Get the log of nodes and elements added or removed since previous
300 * - clearAfterGet : log is emptied after Get (safe if concurrents access)
302 // string_array GetLog(in boolean clearAfterGet)
303 // raises (SALOME::SALOME_Exception);
304 log_array GetLog(in boolean clearAfterGet)
305 raises (SALOME::SALOME_Exception);
308 * Clear the log of nodes and elements added or removed since previous
309 * clear. Must be used immediately after GetLog if clearAfterGet is false.
312 raises (SALOME::SALOME_Exception);
315 * Get the internal Id
325 * Obtain instance of SMESH_MeshEditor
327 SMESH_MeshEditor GetMeshEditor()
328 raises (SALOME::SALOME_Exception);
331 * Export Mesh to different MED Formats
333 * - auto_groups : boolean parameter for creating/not creating
334 * the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
335 * the typical use is auto_groups=false.
336 * - theVersion : define the version of format of MED file, that will be created
338 void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
339 raises (SALOME::SALOME_Exception);
342 * Export Mesh to MED_V2_1 MED format
343 * Works, just the same as ExportToMED, with MED_VERSION parameter equal to MED_V2_1.
344 * The method is kept in order to support old functionality
346 void ExportMED( in string file, in boolean auto_groups )
347 raises (SALOME::SALOME_Exception);
350 * Export Mesh to DAT, UNV and STL Formats
352 void ExportDAT( in string file )
353 raises (SALOME::SALOME_Exception);
354 void ExportUNV( in string file )
355 raises (SALOME::SALOME_Exception);
356 void ExportSTL( in string file, in boolean isascii )
357 raises (SALOME::SALOME_Exception);
362 SALOME_MED::MESH GetMEDMesh()
363 raises (SALOME::SALOME_Exception);
366 * Get informations about mesh contents
369 raises (SALOME::SALOME_Exception);
372 raises (SALOME::SALOME_Exception);
375 raises (SALOME::SALOME_Exception);
378 raises (SALOME::SALOME_Exception);
381 raises (SALOME::SALOME_Exception);
384 raises (SALOME::SALOME_Exception);
387 raises (SALOME::SALOME_Exception);
390 raises (SALOME::SALOME_Exception);
393 raises (SALOME::SALOME_Exception);
396 raises (SALOME::SALOME_Exception);
399 raises (SALOME::SALOME_Exception);
402 raises (SALOME::SALOME_Exception);
405 raises (SALOME::SALOME_Exception);
408 raises (SALOME::SALOME_Exception);
410 long_array GetElementsId()
411 raises (SALOME::SALOME_Exception);
413 long_array GetElementsByType( in ElementType theType )
414 raises (SALOME::SALOME_Exception);
416 long_array GetNodesId()
417 raises (SALOME::SALOME_Exception);
420 * Returns type of mesh element
422 ElementType GetElementType( in long id, in boolean iselem )
423 raises (SALOME::SALOME_Exception);
426 * Get mesh description
431 interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
436 long GetNumberOfElements()
437 raises (SALOME::SALOME_Exception);
442 long GetNumberOfNodes( in boolean all )
443 raises (SALOME::SALOME_Exception);
448 long_array GetElementsId()
449 raises (SALOME::SALOME_Exception);
454 long_array GetElementsByType( in ElementType theType )
455 raises (SALOME::SALOME_Exception);
458 * Return type of submesh element
460 ElementType GetElementType( in long id, in boolean iselem )
461 raises (SALOME::SALOME_Exception);
466 long_array GetNodesId()
467 raises (SALOME::SALOME_Exception);
470 * Get geom shape the submesh is dedicated to
472 GEOM::GEOM_Object GetSubShape()
473 raises (SALOME::SALOME_Exception);
476 * Get SMESH_Mesh which stores nodes coordinates & elements definition
478 SMESH_Mesh GetFather()
479 raises (SALOME::SALOME_Exception);
482 * Get the internal Id
489 SALOME_MED::FAMILY GetFamily()
490 raises (SALOME::SALOME_Exception);
494 * This interface makes modifications on the Mesh - removing elements and nodes etc.
496 interface NumericalFunctor;
497 interface SMESH_MeshEditor
499 boolean RemoveElements(in long_array IDsOfElements);
501 boolean RemoveNodes(in long_array IDsOfNodes);
503 boolean AddNode(in double x, in double y, in double z);
505 boolean AddEdge(in long_array IDsOfNodes);
507 boolean AddFace(in long_array IDsOfNodes);
509 boolean AddVolume(in long_array IDsOfNodes);
512 * Create volume of many faces, giving nodes for each face.
513 * \param IdsOfNodes List of node IDs for volume creation face by face.
514 * \param Quantities List of integer values, Quantities[i]
515 * gives quantity of nodes in face number i.
517 boolean AddPolyhedralVolume (in long_array IdsOfNodes,
518 in long_array Quantities);
521 * Create volume of many faces, giving IDs of existing faces.
522 * \param IdsOfFaces List of face IDs for volume creation.
523 * \note The created volume will refer only to nodes
524 * of the given faces, not to the faces itself.
526 boolean AddPolyhedralVolumeByFaces (in long_array IdsOfFaces);
528 boolean MoveNode(in long NodeID, in double x, in double y, in double z);
530 boolean InverseDiag(in long NodeID1, in long NodeID2);
532 boolean DeleteDiag(in long NodeID1, in long NodeID2);
534 boolean Reorient(in long_array IDsOfElements);
536 boolean ReorientObject(in SMESH_IDSource theObject);
539 * \brief Fuse neighbour triangles into quadrangles.
540 * \param theElems The triangles to be fused.
541 * \param theCriterion Is used to choose a neighbour to fuse with.
542 * \param theMaxAngle Is a max angle between element normals at which fusion
543 * is still performed; theMaxAngle is mesured in radians.
544 * \return TRUE in case of success, FALSE otherwise.
546 boolean TriToQuad (in long_array IDsOfElements,
547 in NumericalFunctor Criterion,
551 * \brief Fuse neighbour triangles into quadrangles.
553 * Behaves like the above method, taking list of elements from \a theObject
555 boolean TriToQuadObject (in SMESH_IDSource theObject,
556 in NumericalFunctor Criterion,
560 * \brief Split quadrangles into triangles.
561 * \param theElems The faces to be splitted.
562 * \param theCriterion Is used to choose a diagonal for splitting.
563 * \return TRUE in case of success, FALSE otherwise.
565 boolean QuadToTri (in long_array IDsOfElements,
566 in NumericalFunctor Criterion);
569 * \brief Split quadrangles into triangles.
571 * Behaves like the above method, taking list of elements from \a theObject
573 boolean QuadToTriObject (in SMESH_IDSource theObject,
574 in NumericalFunctor Criterion);
577 * \brief Split quadrangles into triangles.
578 * \param theElems The faces to be splitted.
579 * \param the13Diag Is used to choose a diagonal for splitting.
580 * \return TRUE in case of success, FALSE otherwise.
582 boolean SplitQuad (in long_array IDsOfElements,
586 * \brief Split quadrangles into triangles.
588 * Behaves like the above method, taking list of elements from \a theObject
590 boolean SplitQuadObject (in SMESH_IDSource theObject,
594 * Find better splitting of the given quadrangle.
595 * \param IDOfQuad ID of the quadrangle to be splitted.
596 * \param Criterion A criterion to choose a diagonal for splitting.
597 * \return 1 if 1-3 diagonal is better, 2 if 2-4
598 * diagonal is better, 0 if error occurs.
600 long BestSplit (in long IDOfQuad,
601 in NumericalFunctor Criterion);
603 enum Smooth_Method { LAPLACIAN_SMOOTH, CENTROIDAL_SMOOTH };
605 boolean Smooth(in long_array IDsOfElements,
606 in long_array IDsOfFixedNodes,
607 in long MaxNbOfIterations,
608 in double MaxAspectRatio,
609 in Smooth_Method Method);
611 boolean SmoothObject(in SMESH_IDSource theObject,
612 in long_array IDsOfFixedNodes,
613 in long MaxNbOfIterations,
614 in double MaxAspectRatio,
615 in Smooth_Method Method);
617 boolean SmoothParametric(in long_array IDsOfElements,
618 in long_array IDsOfFixedNodes,
619 in long MaxNbOfIterations,
620 in double MaxAspectRatio,
621 in Smooth_Method Method);
623 boolean SmoothParametricObject(in SMESH_IDSource theObject,
624 in long_array IDsOfFixedNodes,
625 in long MaxNbOfIterations,
626 in double MaxAspectRatio,
627 in Smooth_Method Method);
629 void RenumberNodes();
631 void RenumberElements();
633 void RotationSweep(in long_array IDsOfElements,
635 in double AngleInRadians,
637 in double Tolerance);
639 void RotationSweepObject(in SMESH_IDSource theObject,
641 in double AngleInRadians,
643 in double Tolerance);
645 void ExtrusionSweep(in long_array IDsOfElements,
646 in DirStruct StepVector,
649 void ExtrusionSweepObject(in SMESH_IDSource theObject,
650 in DirStruct StepVector,
653 void ExtrusionSweepObject1D(in SMESH_IDSource theObject,
654 in DirStruct StepVector,
657 void ExtrusionSweepObject2D(in SMESH_IDSource theObject,
658 in DirStruct StepVector,
661 enum Extrusion_Error {
666 EXTR_BAD_STARTING_NODE,
667 EXTR_BAD_ANGLES_NUMBER,
668 EXTR_CANT_GET_TANGENT
671 Extrusion_Error ExtrusionAlongPath(in long_array IDsOfElements,
672 in SMESH_Mesh PathMesh,
673 in GEOM::GEOM_Object PathShape,
675 in boolean HasAngles,
676 in double_array Angles,
677 in boolean HasRefPoint,
678 in PointStruct RefPoint);
680 Extrusion_Error ExtrusionAlongPathObject(in SMESH_IDSource theObject,
681 in SMESH_Mesh PathMesh,
682 in GEOM::GEOM_Object PathShape,
684 in boolean HasAngles,
685 in double_array Angles,
686 in boolean HasRefPoint,
687 in PointStruct RefPoint);
689 enum MirrorType { POINT, AXIS, PLANE };
691 void Mirror (in long_array IDsOfElements,
692 in AxisStruct Mirror,
693 in MirrorType theMirrorType,
696 void MirrorObject (in SMESH_IDSource theObject,
697 in AxisStruct Mirror,
698 in MirrorType theMirrorType,
701 void Translate (in long_array IDsOfElements,
705 void TranslateObject (in SMESH_IDSource theObject,
709 void Rotate (in long_array IDsOfElements,
711 in double AngleInRadians,
714 void RotateObject (in SMESH_IDSource theObject,
716 in double AngleInRadians,
719 void FindCoincidentNodes (in double Tolerance,
720 out array_of_long_array GroupsOfNodes);
722 void MergeNodes (in array_of_long_array GroupsOfNodes);
724 void MergeEqualElements();
728 SEW_BORDER1_NOT_FOUND,
729 SEW_BORDER2_NOT_FOUND,
730 SEW_BOTH_BORDERS_NOT_FOUND,
732 SEW_VOLUMES_TO_SPLIT,
733 // for SewSideElements() only:
734 SEW_DIFF_NB_OF_ELEMENTS,
735 SEW_TOPO_DIFF_SETS_OF_ELEMENTS,
740 Sew_Error SewFreeBorders (in long FirstNodeID1,
741 in long SecondNodeID1,
743 in long FirstNodeID2,
744 in long SecondNodeID2,
746 in boolean CreatePolygons,
747 in boolean CreatePolyedrs);
749 Sew_Error SewConformFreeBorders (in long FirstNodeID1,
750 in long SecondNodeID1,
752 in long FirstNodeID2,
753 in long SecondNodeID2);
755 Sew_Error SewBorderToSide (in long FirstNodeIDOnFreeBorder,
756 in long SecondNodeIDOnFreeBorder,
757 in long LastNodeIDOnFreeBorder,
758 in long FirstNodeIDOnSide,
759 in long LastNodeIDOnSide,
760 in boolean CreatePolygons,
761 in boolean CreatePolyedrs);
763 Sew_Error SewSideElements (in long_array IDsOfSide1Elements,
764 in long_array IDsOfSide2Elements,
765 in long NodeID1OfSide1ToMerge,
766 in long NodeID1OfSide2ToMerge,
767 in long NodeID2OfSide1ToMerge,
768 in long NodeID2OfSide2ToMerge);