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 * Get mesh description
425 interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
430 long GetNumberOfElements()
431 raises (SALOME::SALOME_Exception);
436 long GetNumberOfNodes( in boolean all )
437 raises (SALOME::SALOME_Exception);
442 long_array GetElementsId()
443 raises (SALOME::SALOME_Exception);
448 long_array GetElementsByType( in ElementType theType )
449 raises (SALOME::SALOME_Exception);
454 long_array GetNodesId()
455 raises (SALOME::SALOME_Exception);
458 * Get geom shape the submesh is dedicated to
460 GEOM::GEOM_Object GetSubShape()
461 raises (SALOME::SALOME_Exception);
464 * Get SMESH_Mesh which stores nodes coordinates & elements definition
466 SMESH_Mesh GetFather()
467 raises (SALOME::SALOME_Exception);
470 * Get the internal Id
477 SALOME_MED::FAMILY GetFamily()
478 raises (SALOME::SALOME_Exception);
482 * This interface makes modifications on the Mesh - removing elements and nodes etc.
484 interface NumericalFunctor;
485 interface SMESH_MeshEditor
487 boolean RemoveElements(in long_array IDsOfElements);
489 boolean RemoveNodes(in long_array IDsOfNodes);
491 boolean AddNode(in double x, in double y, in double z);
493 boolean AddEdge(in long_array IDsOfNodes);
495 boolean AddFace(in long_array IDsOfNodes);
497 boolean AddVolume(in long_array IDsOfNodes);
500 * Create volume of many faces, giving nodes for each face.
501 * \param IdsOfNodes List of node IDs for volume creation face by face.
502 * \param Quantities List of integer values, Quantities[i]
503 * gives quantity of nodes in face number i.
505 boolean AddPolyhedralVolume (in long_array IdsOfNodes,
506 in long_array Quantities);
509 * Create volume of many faces, giving IDs of existing faces.
510 * \param IdsOfFaces List of face IDs for volume creation.
511 * \note The created volume will refer only to nodes
512 * of the given faces, not to the faces itself.
514 boolean AddPolyhedralVolumeByFaces (in long_array IdsOfFaces);
516 boolean MoveNode(in long NodeID, in double x, in double y, in double z);
518 boolean InverseDiag(in long NodeID1, in long NodeID2);
520 boolean DeleteDiag(in long NodeID1, in long NodeID2);
522 boolean Reorient(in long_array IDsOfElements);
524 boolean ReorientObject(in SMESH_IDSource theObject);
527 * \brief Fuse neighbour triangles into quadrangles.
528 * \param theElems The triangles to be fused.
529 * \param theCriterion Is used to choose a neighbour to fuse with.
530 * \param theMaxAngle Is a max angle between element normals at which fusion
531 * is still performed; theMaxAngle is mesured in radians.
532 * \return TRUE in case of success, FALSE otherwise.
534 boolean TriToQuad (in long_array IDsOfElements,
535 in NumericalFunctor Criterion,
539 * \brief Fuse neighbour triangles into quadrangles.
541 * Behaves like the above method, taking list of elements from \a theObject
543 boolean TriToQuadObject (in SMESH_IDSource theObject,
544 in NumericalFunctor Criterion,
548 * \brief Split quadrangles into triangles.
549 * \param theElems The faces to be splitted.
550 * \param theCriterion Is used to choose a diagonal for splitting.
551 * \return TRUE in case of success, FALSE otherwise.
553 boolean QuadToTri (in long_array IDsOfElements,
554 in NumericalFunctor Criterion);
557 * \brief Split quadrangles into triangles.
559 * Behaves like the above method, taking list of elements from \a theObject
561 boolean QuadToTriObject (in SMESH_IDSource theObject,
562 in NumericalFunctor Criterion);
565 * \brief Split quadrangles into triangles.
566 * \param theElems The faces to be splitted.
567 * \param the13Diag Is used to choose a diagonal for splitting.
568 * \return TRUE in case of success, FALSE otherwise.
570 boolean SplitQuad (in long_array IDsOfElements,
574 * \brief Split quadrangles into triangles.
576 * Behaves like the above method, taking list of elements from \a theObject
578 boolean SplitQuadObject (in SMESH_IDSource theObject,
582 * Find better splitting of the given quadrangle.
583 * \param IDOfQuad ID of the quadrangle to be splitted.
584 * \param Criterion A criterion to choose a diagonal for splitting.
585 * \return 1 if 1-3 diagonal is better, 2 if 2-4
586 * diagonal is better, 0 if error occurs.
588 long BestSplit (in long IDOfQuad,
589 in NumericalFunctor Criterion);
591 enum Smooth_Method { LAPLACIAN_SMOOTH, CENTROIDAL_SMOOTH };
593 boolean Smooth(in long_array IDsOfElements,
594 in long_array IDsOfFixedNodes,
595 in long MaxNbOfIterations,
596 in double MaxAspectRatio,
597 in Smooth_Method Method);
599 boolean SmoothObject(in SMESH_IDSource theObject,
600 in long_array IDsOfFixedNodes,
601 in long MaxNbOfIterations,
602 in double MaxAspectRatio,
603 in Smooth_Method Method);
605 boolean SmoothParametric(in long_array IDsOfElements,
606 in long_array IDsOfFixedNodes,
607 in long MaxNbOfIterations,
608 in double MaxAspectRatio,
609 in Smooth_Method Method);
611 boolean SmoothParametricObject(in SMESH_IDSource theObject,
612 in long_array IDsOfFixedNodes,
613 in long MaxNbOfIterations,
614 in double MaxAspectRatio,
615 in Smooth_Method Method);
617 void RenumberNodes();
619 void RenumberElements();
621 void RotationSweep(in long_array IDsOfElements,
623 in double AngleInRadians,
625 in double Tolerance);
627 void RotationSweepObject(in SMESH_IDSource theObject,
629 in double AngleInRadians,
631 in double Tolerance);
633 void ExtrusionSweep(in long_array IDsOfElements,
634 in DirStruct StepVector,
637 void ExtrusionSweepObject(in SMESH_IDSource theObject,
638 in DirStruct StepVector,
641 void ExtrusionSweepObject1D(in SMESH_IDSource theObject,
642 in DirStruct StepVector,
645 void ExtrusionSweepObject2D(in SMESH_IDSource theObject,
646 in DirStruct StepVector,
649 enum Extrusion_Error {
654 EXTR_BAD_STARTING_NODE,
655 EXTR_BAD_ANGLES_NUMBER,
656 EXTR_CANT_GET_TANGENT
659 Extrusion_Error ExtrusionAlongPath(in long_array IDsOfElements,
660 in SMESH_Mesh PathMesh,
661 in GEOM::GEOM_Object PathShape,
663 in boolean HasAngles,
664 in double_array Angles,
665 in boolean HasRefPoint,
666 in PointStruct RefPoint);
668 Extrusion_Error ExtrusionAlongPathObject(in SMESH_IDSource theObject,
669 in SMESH_Mesh PathMesh,
670 in GEOM::GEOM_Object PathShape,
672 in boolean HasAngles,
673 in double_array Angles,
674 in boolean HasRefPoint,
675 in PointStruct RefPoint);
677 enum MirrorType { POINT, AXIS, PLANE };
679 void Mirror (in long_array IDsOfElements,
680 in AxisStruct Mirror,
681 in MirrorType theMirrorType,
684 void MirrorObject (in SMESH_IDSource theObject,
685 in AxisStruct Mirror,
686 in MirrorType theMirrorType,
689 void Translate (in long_array IDsOfElements,
693 void TranslateObject (in SMESH_IDSource theObject,
697 void Rotate (in long_array IDsOfElements,
699 in double AngleInRadians,
702 void RotateObject (in SMESH_IDSource theObject,
704 in double AngleInRadians,
707 void FindCoincidentNodes (in double Tolerance,
708 out array_of_long_array GroupsOfNodes);
710 void MergeNodes (in array_of_long_array GroupsOfNodes);
712 void MergeEqualElements();
716 SEW_BORDER1_NOT_FOUND,
717 SEW_BORDER2_NOT_FOUND,
718 SEW_BOTH_BORDERS_NOT_FOUND,
720 SEW_VOLUMES_TO_SPLIT,
721 // for SewSideElements() only:
722 SEW_DIFF_NB_OF_ELEMENTS,
723 SEW_TOPO_DIFF_SETS_OF_ELEMENTS,
728 Sew_Error SewFreeBorders (in long FirstNodeID1,
729 in long SecondNodeID1,
731 in long FirstNodeID2,
732 in long SecondNodeID2,
734 in boolean CreatePolygons,
735 in boolean CreatePolyedrs);
737 Sew_Error SewConformFreeBorders (in long FirstNodeID1,
738 in long SecondNodeID1,
740 in long FirstNodeID2,
741 in long SecondNodeID2);
743 Sew_Error SewBorderToSide (in long FirstNodeIDOnFreeBorder,
744 in long SecondNodeIDOnFreeBorder,
745 in long LastNodeIDOnFreeBorder,
746 in long FirstNodeIDOnSide,
747 in long LastNodeIDOnSide,
748 in boolean CreatePolygons,
749 in boolean CreatePolyedrs);
751 Sew_Error SewSideElements (in long_array IDsOfSide1Elements,
752 in long_array IDsOfSide2Elements,
753 in long NodeID1OfSide1ToMerge,
754 in long NodeID1OfSide2ToMerge,
755 in long NodeID2OfSide1ToMerge,
756 in long NodeID2OfSide2ToMerge);