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,
90 struct PointStruct { double x;
93 struct DirStruct { PointStruct PS ; } ; // analog to Occ Direction
95 struct AxisStruct { double x;
104 * Enumeration for element type, like in SMDS
116 * Enumeration for hypothesis status (used by AddHypothesis() and RemoveHypothesis() methods)
118 enum Hypothesis_Status // in the order of severity
121 HYP_MISSING, // algo misses a hypothesis
122 HYP_CONCURENT, // several applicable hypotheses
123 HYP_BAD_PARAMETER,// hypothesis has a bad parameter value
124 HYP_UNKNOWN_FATAL,// --- all statuses below should be considered as fatal
125 // for Add/RemoveHypothesis operations
126 HYP_INCOMPATIBLE, // hypothesis does not fit algo
127 HYP_NOTCONFORM, // not conform mesh is produced appling a hypothesis
128 HYP_ALREADY_EXIST,// such hypothesis already exist
129 HYP_BAD_DIM // bad dimension
133 * Enumeration for DriverMED read status (used by ImportMEDFile() method)
135 enum DriverMED_ReadStatus // in the order of severity
138 DRS_EMPTY, // a MED file contains no mesh with the given name
139 DRS_WARN_RENUMBER, // a MED file has overlapped ranges of element numbers,
140 // so the numbers from the file are ignored
141 DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
142 DRS_FAIL // general failure (exception etc.)
146 * Enumeration for DriverMED (used by Perform() method)
148 enum MED_VERSION // in the order of severity
154 typedef sequence<log_block> log_array;
158 * Auxilary flags for advanced extrusion.
159 * BOUNDARY: create or not boundary for result of extrusion
160 * SEW: try to use existing nodes or create new nodes in any case
162 const long EXTRUSION_FLAG_BOUNDARY = 1;
163 const long EXTRUSION_FLAG_SEW = 2;
165 interface SMESH_IDSource
168 * Returns a sequence of all element IDs
173 interface SMESH_GroupBase;
174 interface SMESH_Group;
175 interface SMESH_GroupOnGeom;
176 interface SMESH_subMesh;
177 interface SMESH_MeshEditor;
178 interface SMESH_Mesh : SALOME::GenericObj, SMESH_IDSource
181 // * Associate a Shape to a Mesh created with NewEmpty
183 //boolean SetMesh(in GEOM::GEOM_Object anObject)
184 // raises (SALOME::SALOME_Exception);
187 * Get the subMesh object associated to a subShape. The subMesh object
188 * gives access to nodes and elements IDs.
189 * SubMesh will be used instead of SubShape in a next idl version to
190 * adress a specific subMesh...
192 SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
193 raises (SALOME::SALOME_Exception);
196 // * Create a subMesh without reference to a subShape
198 //SMESH_subMesh NewEmpty()
199 // raises (SALOME::SALOME_Exception);
202 * Get geom shape to mesh. A result may be nil
204 GEOM::GEOM_Object GetShapeToMesh()
205 raises (SALOME::SALOME_Exception);
210 void RemoveSubMesh(in SMESH_subMesh aSubMesh)
211 raises (SALOME::SALOME_Exception);
216 SMESH_Group CreateGroup( in ElementType elem_type,
218 raises (SALOME::SALOME_Exception);
221 * Create a group from geometry group
223 SMESH_GroupOnGeom CreateGroupFromGEOM( in ElementType elem_type,
225 in GEOM::GEOM_Object theGeomObject )
226 raises (SALOME::SALOME_Exception);
231 void RemoveGroup(in SMESH_GroupBase aGroup)
232 raises (SALOME::SALOME_Exception);
235 * Remove group with its contents
237 void RemoveGroupWithContents( in SMESH_GroupBase aGroup )
238 raises (SALOME::SALOME_Exception);
241 * Union of two groups
242 * New group is created. All mesh elements that are
243 * present in initial groups are added to the new one
245 SMESH_Group UnionGroups (in SMESH_GroupBase aGroup1,
246 in SMESH_GroupBase aGroup2,
248 raises (SALOME::SALOME_Exception);
251 * Intersection of two groups
252 * New group is created. All mesh elements that are
253 * present in both initial groups are added to the new one.
255 SMESH_Group IntersectGroups (in SMESH_GroupBase aGroup1,
256 in SMESH_GroupBase aGroup2,
258 raises (SALOME::SALOME_Exception);
262 * New group is created. All mesh elements that are present in
263 * main group but do not present in tool group are added to the new one
265 SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
266 in SMESH_GroupBase aToolGroup,
268 raises (SALOME::SALOME_Exception);
271 * Add hypothesis to the mesh, under a particular subShape
272 * (or the main shape itself)
273 * The Add method is only used to prepare the build of the mesh and store
274 * the algorithms and associated parameters.
275 * Actual job of mesh the shape is done by MESH_Gen.
277 * - aSubShape : subShape obtained by a shape explode in GEOM
279 * - anHyp : hypothesis object
281 * - OK if the hypothesis is compatible with the subShape
282 * (and all previous hypothesis on the subShape)
283 * - NOK if the hypothesis is not compatible with the subShape
284 * (or one previous hypothesis on the subShape)
285 * raises exception if hypothesis has not been created
287 Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
288 in SMESH_Hypothesis anHyp)
289 raises (SALOME::SALOME_Exception);
290 // boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
291 // raises (SALOME::SALOME_Exception);
294 * Remove an hypothesis previouly added with AddHypothesis.
296 Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject,
297 in SMESH_Hypothesis anHyp)
298 raises (SALOME::SALOME_Exception);
299 // boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
300 // in SMESH_Hypothesis anHyp)
301 // raises (SALOME::SALOME_Exception);
304 * Get the list of hypothesis added on a subShape
306 ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Object aSubObject)
307 raises (SALOME::SALOME_Exception);
308 // ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
309 // raises (SALOME::SALOME_Exception);
312 * Get the log of nodes and elements added or removed since previous
315 * - clearAfterGet : log is emptied after Get (safe if concurrents access)
317 // string_array GetLog(in boolean clearAfterGet)
318 // raises (SALOME::SALOME_Exception);
319 log_array GetLog(in boolean clearAfterGet)
320 raises (SALOME::SALOME_Exception);
323 * Clear the log of nodes and elements added or removed since previous
324 * clear. Must be used immediately after GetLog if clearAfterGet is false.
327 raises (SALOME::SALOME_Exception);
330 * Get the internal Id
340 * Obtain instance of SMESH_MeshEditor
342 SMESH_MeshEditor GetMeshEditor()
343 raises (SALOME::SALOME_Exception);
346 * Export Mesh to different MED Formats
348 * - auto_groups : boolean parameter for creating/not creating
349 * the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
350 * the typical use is auto_groups=false.
351 * - theVersion : define the version of format of MED file, that will be created
353 void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
354 raises (SALOME::SALOME_Exception);
357 * Export Mesh to MED_V2_1 MED format
358 * Works, just the same as ExportToMED, with MED_VERSION parameter equal to MED_V2_1.
359 * The method is kept in order to support old functionality
361 void ExportMED( in string file, in boolean auto_groups )
362 raises (SALOME::SALOME_Exception);
365 * Export Mesh to DAT, UNV and STL Formats
367 void ExportDAT( in string file )
368 raises (SALOME::SALOME_Exception);
369 void ExportUNV( in string file )
370 raises (SALOME::SALOME_Exception);
371 void ExportSTL( in string file, in boolean isascii )
372 raises (SALOME::SALOME_Exception);
377 SALOME_MED::MESH GetMEDMesh()
378 raises (SALOME::SALOME_Exception);
381 * Get informations about mesh contents
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);
411 raises (SALOME::SALOME_Exception);
414 raises (SALOME::SALOME_Exception);
417 raises (SALOME::SALOME_Exception);
420 raises (SALOME::SALOME_Exception);
423 raises (SALOME::SALOME_Exception);
425 long_array GetElementsId()
426 raises (SALOME::SALOME_Exception);
428 long_array GetElementsByType( in ElementType theType )
429 raises (SALOME::SALOME_Exception);
431 long_array GetNodesId()
432 raises (SALOME::SALOME_Exception);
435 * Returns type of mesh element
437 ElementType GetElementType( in long id, in boolean iselem )
438 raises (SALOME::SALOME_Exception);
441 * Get mesh description
446 interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
451 long GetNumberOfElements()
452 raises (SALOME::SALOME_Exception);
457 long GetNumberOfNodes( in boolean all )
458 raises (SALOME::SALOME_Exception);
463 long_array GetElementsId()
464 raises (SALOME::SALOME_Exception);
469 long_array GetElementsByType( in ElementType theType )
470 raises (SALOME::SALOME_Exception);
473 * Return type of submesh element
475 ElementType GetElementType( in long id, in boolean iselem )
476 raises (SALOME::SALOME_Exception);
481 long_array GetNodesId()
482 raises (SALOME::SALOME_Exception);
485 * Get geom shape the submesh is dedicated to
487 GEOM::GEOM_Object GetSubShape()
488 raises (SALOME::SALOME_Exception);
491 * Get SMESH_Mesh which stores nodes coordinates & elements definition
493 SMESH_Mesh GetFather()
494 raises (SALOME::SALOME_Exception);
497 * Get the internal Id
504 SALOME_MED::FAMILY GetFamily()
505 raises (SALOME::SALOME_Exception);
509 * This interface makes modifications on the Mesh - removing elements and nodes etc.
511 interface NumericalFunctor;
512 interface SMESH_MeshEditor
514 boolean RemoveElements(in long_array IDsOfElements);
516 boolean RemoveNodes(in long_array IDsOfNodes);
518 boolean AddNode(in double x, in double y, in double z);
520 boolean AddEdge(in long_array IDsOfNodes);
522 boolean AddFace(in long_array IDsOfNodes);
524 boolean AddPolygonalFace(in long_array IdsOfNodes);
526 boolean AddVolume(in long_array IDsOfNodes);
529 * Create volume of many faces, giving nodes for each face.
530 * \param IdsOfNodes List of node IDs for volume creation face by face.
531 * \param Quantities List of integer values, Quantities[i]
532 * gives quantity of nodes in face number i.
534 boolean AddPolyhedralVolume (in long_array IdsOfNodes,
535 in long_array Quantities);
538 * Create volume of many faces, giving IDs of existing faces.
539 * \param IdsOfFaces List of face IDs for volume creation.
540 * \note The created volume will refer only to nodes
541 * of the given faces, not to the faces itself.
543 boolean AddPolyhedralVolumeByFaces (in long_array IdsOfFaces);
545 boolean MoveNode(in long NodeID, in double x, in double y, in double z);
547 boolean InverseDiag(in long NodeID1, in long NodeID2);
549 boolean DeleteDiag(in long NodeID1, in long NodeID2);
551 boolean Reorient(in long_array IDsOfElements);
553 boolean ReorientObject(in SMESH_IDSource theObject);
556 * \brief Fuse neighbour triangles into quadrangles.
557 * \param theElems The triangles to be fused.
558 * \param theCriterion Is used to choose a neighbour to fuse with.
559 * \param theMaxAngle Is a max angle between element normals at which fusion
560 * is still performed; theMaxAngle is mesured in radians.
561 * \return TRUE in case of success, FALSE otherwise.
563 boolean TriToQuad (in long_array IDsOfElements,
564 in NumericalFunctor Criterion,
568 * \brief Fuse neighbour triangles into quadrangles.
570 * Behaves like the above method, taking list of elements from \a theObject
572 boolean TriToQuadObject (in SMESH_IDSource theObject,
573 in NumericalFunctor Criterion,
577 * \brief Split quadrangles into triangles.
578 * \param theElems The faces to be splitted.
579 * \param theCriterion Is used to choose a diagonal for splitting.
580 * \return TRUE in case of success, FALSE otherwise.
582 boolean QuadToTri (in long_array IDsOfElements,
583 in NumericalFunctor Criterion);
586 * \brief Split quadrangles into triangles.
588 * Behaves like the above method, taking list of elements from \a theObject
590 boolean QuadToTriObject (in SMESH_IDSource theObject,
591 in NumericalFunctor Criterion);
594 * \brief Split quadrangles into triangles.
595 * \param theElems The faces to be splitted.
596 * \param the13Diag Is used to choose a diagonal for splitting.
597 * \return TRUE in case of success, FALSE otherwise.
599 boolean SplitQuad (in long_array IDsOfElements,
603 * \brief Split quadrangles into triangles.
605 * Behaves like the above method, taking list of elements from \a theObject
607 boolean SplitQuadObject (in SMESH_IDSource theObject,
611 * Find better splitting of the given quadrangle.
612 * \param IDOfQuad ID of the quadrangle to be splitted.
613 * \param Criterion A criterion to choose a diagonal for splitting.
614 * \return 1 if 1-3 diagonal is better, 2 if 2-4
615 * diagonal is better, 0 if error occurs.
617 long BestSplit (in long IDOfQuad,
618 in NumericalFunctor Criterion);
620 enum Smooth_Method { LAPLACIAN_SMOOTH, CENTROIDAL_SMOOTH };
622 boolean Smooth(in long_array IDsOfElements,
623 in long_array IDsOfFixedNodes,
624 in long MaxNbOfIterations,
625 in double MaxAspectRatio,
626 in Smooth_Method Method);
628 boolean SmoothObject(in SMESH_IDSource theObject,
629 in long_array IDsOfFixedNodes,
630 in long MaxNbOfIterations,
631 in double MaxAspectRatio,
632 in Smooth_Method Method);
634 boolean SmoothParametric(in long_array IDsOfElements,
635 in long_array IDsOfFixedNodes,
636 in long MaxNbOfIterations,
637 in double MaxAspectRatio,
638 in Smooth_Method Method);
640 boolean SmoothParametricObject(in SMESH_IDSource theObject,
641 in long_array IDsOfFixedNodes,
642 in long MaxNbOfIterations,
643 in double MaxAspectRatio,
644 in Smooth_Method Method);
646 void RenumberNodes();
648 void RenumberElements();
650 void RotationSweep(in long_array IDsOfElements,
652 in double AngleInRadians,
654 in double Tolerance);
656 void RotationSweepObject(in SMESH_IDSource theObject,
658 in double AngleInRadians,
660 in double Tolerance);
662 void ExtrusionSweep(in long_array IDsOfElements,
663 in DirStruct StepVector,
667 * Generate new elements by extrusion of theElements
668 * by StepVector by NbOfSteps
669 * param ExtrFlags set flags for performing extrusion
670 * param SewTolerance - uses for comparing locations of nodes if flag
671 * EXTRUSION_FLAG_SEW is set
673 void AdvancedExtrusion(in long_array IDsOfElements,
674 in DirStruct StepVector,
677 in double SewTolerance);
679 void ExtrusionSweepObject(in SMESH_IDSource theObject,
680 in DirStruct StepVector,
683 void ExtrusionSweepObject1D(in SMESH_IDSource theObject,
684 in DirStruct StepVector,
687 void ExtrusionSweepObject2D(in SMESH_IDSource theObject,
688 in DirStruct StepVector,
691 enum Extrusion_Error {
696 EXTR_BAD_STARTING_NODE,
697 EXTR_BAD_ANGLES_NUMBER,
698 EXTR_CANT_GET_TANGENT
701 Extrusion_Error ExtrusionAlongPath(in long_array IDsOfElements,
702 in SMESH_Mesh PathMesh,
703 in GEOM::GEOM_Object PathShape,
705 in boolean HasAngles,
706 in double_array Angles,
707 in boolean HasRefPoint,
708 in PointStruct RefPoint);
710 Extrusion_Error ExtrusionAlongPathObject(in SMESH_IDSource theObject,
711 in SMESH_Mesh PathMesh,
712 in GEOM::GEOM_Object PathShape,
714 in boolean HasAngles,
715 in double_array Angles,
716 in boolean HasRefPoint,
717 in PointStruct RefPoint);
719 enum MirrorType { POINT, AXIS, PLANE };
721 void Mirror (in long_array IDsOfElements,
722 in AxisStruct Mirror,
723 in MirrorType theMirrorType,
726 void MirrorObject (in SMESH_IDSource theObject,
727 in AxisStruct Mirror,
728 in MirrorType theMirrorType,
731 void Translate (in long_array IDsOfElements,
735 void TranslateObject (in SMESH_IDSource theObject,
739 void Rotate (in long_array IDsOfElements,
741 in double AngleInRadians,
744 void RotateObject (in SMESH_IDSource theObject,
746 in double AngleInRadians,
749 void FindCoincidentNodes (in double Tolerance,
750 out array_of_long_array GroupsOfNodes);
752 void MergeNodes (in array_of_long_array GroupsOfNodes);
754 void MergeEqualElements();
758 SEW_BORDER1_NOT_FOUND,
759 SEW_BORDER2_NOT_FOUND,
760 SEW_BOTH_BORDERS_NOT_FOUND,
762 SEW_VOLUMES_TO_SPLIT,
763 // for SewSideElements() only:
764 SEW_DIFF_NB_OF_ELEMENTS,
765 SEW_TOPO_DIFF_SETS_OF_ELEMENTS,
770 Sew_Error SewFreeBorders (in long FirstNodeID1,
771 in long SecondNodeID1,
773 in long FirstNodeID2,
774 in long SecondNodeID2,
776 in boolean CreatePolygons,
777 in boolean CreatePolyedrs);
779 Sew_Error SewConformFreeBorders (in long FirstNodeID1,
780 in long SecondNodeID1,
782 in long FirstNodeID2,
783 in long SecondNodeID2);
785 Sew_Error SewBorderToSide (in long FirstNodeIDOnFreeBorder,
786 in long SecondNodeIDOnFreeBorder,
787 in long LastNodeIDOnFreeBorder,
788 in long FirstNodeIDOnSide,
789 in long LastNodeIDOnSide,
790 in boolean CreatePolygons,
791 in boolean CreatePolyedrs);
793 Sew_Error SewSideElements (in long_array IDsOfSide1Elements,
794 in long_array IDsOfSide2Elements,
795 in long NodeID1OfSide1ToMerge,
796 in long NodeID1OfSide2ToMerge,
797 in long NodeID2OfSide1ToMerge,
798 in long NodeID2OfSide2ToMerge);