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 * ElementOrder points out entities of what order are requested
119 ORDER_ANY, /*! entities of any order */
120 ORDER_LINEAR, /*! entities of 1st order */
121 ORDER_SQUARE /*! entities of 2nd order */
125 * Enumeration for hypothesis status (used by AddHypothesis() and RemoveHypothesis() methods)
127 enum Hypothesis_Status // in the order of severity
130 HYP_MISSING, // algo misses a hypothesis
131 HYP_CONCURENT, // several applicable hypotheses
132 HYP_BAD_PARAMETER,// hypothesis has a bad parameter value
133 HYP_UNKNOWN_FATAL,// --- all statuses below should be considered as fatal
134 // for Add/RemoveHypothesis operations
135 HYP_INCOMPATIBLE, // hypothesis does not fit algo
136 HYP_NOTCONFORM, // not conform mesh is produced appling a hypothesis
137 HYP_ALREADY_EXIST,// such hypothesis already exist
138 HYP_BAD_DIM, // bad dimension
139 HYP_BAD_SUBSHAPE // shape is neither the main one, nor its subshape, nor a group
143 * Enumeration for DriverMED read status (used by ImportMEDFile() method)
145 enum DriverMED_ReadStatus // in the order of severity
148 DRS_EMPTY, // a MED file contains no mesh with the given name
149 DRS_WARN_RENUMBER, // a MED file has overlapped ranges of element numbers,
150 // so the numbers from the file are ignored
151 DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
152 DRS_FAIL // general failure (exception etc.)
156 * Enumeration for DriverMED (used by Perform() method)
158 enum MED_VERSION // in the order of severity
164 typedef sequence<log_block> log_array;
168 * Auxilary flags for advanced extrusion.
169 * BOUNDARY: create or not boundary for result of extrusion
170 * SEW: try to use existing nodes or create new nodes in any case
172 const long EXTRUSION_FLAG_BOUNDARY = 1;
173 const long EXTRUSION_FLAG_SEW = 2;
175 interface SMESH_IDSource
178 * Returns a sequence of all element IDs
183 interface SMESH_GroupBase;
184 interface SMESH_Group;
185 interface SMESH_GroupOnGeom;
186 interface SMESH_subMesh;
187 interface SMESH_MeshEditor;
188 interface SMESH_Mesh : SALOME::GenericObj, SMESH_IDSource
191 // * Associate a Shape to a Mesh created with NewEmpty
193 //boolean SetMesh(in GEOM::GEOM_Object anObject)
194 // raises (SALOME::SALOME_Exception);
197 * Get the subMesh object associated to a subShape. The subMesh object
198 * gives access to nodes and elements IDs.
199 * SubMesh will be used instead of SubShape in a next idl version to
200 * adress a specific subMesh...
202 SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
203 raises (SALOME::SALOME_Exception);
206 // * Create a subMesh without reference to a subShape
208 //SMESH_subMesh NewEmpty()
209 // raises (SALOME::SALOME_Exception);
212 * Get geom shape to mesh. A result may be nil
214 GEOM::GEOM_Object GetShapeToMesh()
215 raises (SALOME::SALOME_Exception);
220 void RemoveSubMesh(in SMESH_subMesh aSubMesh)
221 raises (SALOME::SALOME_Exception);
226 SMESH_Group CreateGroup( in ElementType elem_type,
228 raises (SALOME::SALOME_Exception);
231 * Create a group from geometry group
233 SMESH_GroupOnGeom CreateGroupFromGEOM( in ElementType elem_type,
235 in GEOM::GEOM_Object theGeomObject )
236 raises (SALOME::SALOME_Exception);
241 void RemoveGroup(in SMESH_GroupBase aGroup)
242 raises (SALOME::SALOME_Exception);
245 * Remove group with its contents
247 void RemoveGroupWithContents( in SMESH_GroupBase aGroup )
248 raises (SALOME::SALOME_Exception);
251 * Union of two groups
252 * New group is created. All mesh elements that are
253 * present in initial groups are added to the new one
255 SMESH_Group UnionGroups (in SMESH_GroupBase aGroup1,
256 in SMESH_GroupBase aGroup2,
258 raises (SALOME::SALOME_Exception);
261 * Intersection of two groups
262 * New group is created. All mesh elements that are
263 * present in both initial groups are added to the new one.
265 SMESH_Group IntersectGroups (in SMESH_GroupBase aGroup1,
266 in SMESH_GroupBase aGroup2,
268 raises (SALOME::SALOME_Exception);
272 * New group is created. All mesh elements that are present in
273 * main group but do not present in tool group are added to the new one
275 SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
276 in SMESH_GroupBase aToolGroup,
278 raises (SALOME::SALOME_Exception);
281 * Add hypothesis to the mesh, under a particular subShape
282 * (or the main shape itself)
283 * The Add method is only used to prepare the build of the mesh and store
284 * the algorithms and associated parameters.
285 * Actual job of mesh the shape is done by MESH_Gen.
287 * - aSubShape : subShape obtained by a shape explode in GEOM
289 * - anHyp : hypothesis object
291 * - OK if the hypothesis is compatible with the subShape
292 * (and all previous hypothesis on the subShape)
293 * - NOK if the hypothesis is not compatible with the subShape
294 * (or one previous hypothesis on the subShape)
295 * raises exception if hypothesis has not been created
297 Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
298 in SMESH_Hypothesis anHyp)
299 raises (SALOME::SALOME_Exception);
300 // boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
301 // raises (SALOME::SALOME_Exception);
304 * Remove an hypothesis previouly added with AddHypothesis.
306 Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject,
307 in SMESH_Hypothesis anHyp)
308 raises (SALOME::SALOME_Exception);
309 // boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
310 // in SMESH_Hypothesis anHyp)
311 // raises (SALOME::SALOME_Exception);
314 * Get the list of hypothesis added on a subShape
316 ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Object aSubObject)
317 raises (SALOME::SALOME_Exception);
318 // ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
319 // raises (SALOME::SALOME_Exception);
322 * Get the log of nodes and elements added or removed since previous
325 * - clearAfterGet : log is emptied after Get (safe if concurrents access)
327 // string_array GetLog(in boolean clearAfterGet)
328 // raises (SALOME::SALOME_Exception);
329 log_array GetLog(in boolean clearAfterGet)
330 raises (SALOME::SALOME_Exception);
333 * Clear the log of nodes and elements added or removed since previous
334 * clear. Must be used immediately after GetLog if clearAfterGet is false.
337 raises (SALOME::SALOME_Exception);
340 * Get the internal Id
350 * Obtain instance of SMESH_MeshEditor
352 SMESH_MeshEditor GetMeshEditor()
353 raises (SALOME::SALOME_Exception);
355 /*! Check group names for duplications.
356 * Consider maximum group name length stored in MED file.
358 boolean HasDuplicatedGroupNamesMED();
361 * Export Mesh to different MED Formats
363 * - auto_groups : boolean parameter for creating/not creating
364 * the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
365 * the typical use is auto_groups=false.
366 * - theVersion : define the version of format of MED file, that will be created
368 void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
369 raises (SALOME::SALOME_Exception);
372 * Export Mesh to MED_V2_1 MED format
373 * Works, just the same as ExportToMED, with MED_VERSION parameter equal to MED_V2_1.
374 * The method is kept in order to support old functionality
376 void ExportMED( in string file, in boolean auto_groups )
377 raises (SALOME::SALOME_Exception);
380 * Export Mesh to DAT, UNV and STL Formats
382 void ExportDAT( in string file )
383 raises (SALOME::SALOME_Exception);
384 void ExportUNV( in string file )
385 raises (SALOME::SALOME_Exception);
386 void ExportSTL( in string file, in boolean isascii )
387 raises (SALOME::SALOME_Exception);
392 SALOME_MED::MESH GetMEDMesh()
393 raises (SALOME::SALOME_Exception);
396 * Get informations about mesh contents
399 raises (SALOME::SALOME_Exception);
402 raises (SALOME::SALOME_Exception);
405 raises (SALOME::SALOME_Exception);
407 long NbEdgesOfOrder(in ElementOrder order)
408 raises (SALOME::SALOME_Exception);
411 raises (SALOME::SALOME_Exception);
413 long NbFacesOfOrder(in ElementOrder order)
414 raises (SALOME::SALOME_Exception);
417 raises (SALOME::SALOME_Exception);
419 long NbTrianglesOfOrder(in ElementOrder order)
420 raises (SALOME::SALOME_Exception);
423 raises (SALOME::SALOME_Exception);
425 long NbQuadranglesOfOrder(in ElementOrder order)
426 raises (SALOME::SALOME_Exception);
429 raises (SALOME::SALOME_Exception);
432 raises (SALOME::SALOME_Exception);
434 long NbVolumesOfOrder(in ElementOrder order)
435 raises (SALOME::SALOME_Exception);
438 raises (SALOME::SALOME_Exception);
440 long NbTetrasOfOrder(in ElementOrder order)
441 raises (SALOME::SALOME_Exception);
444 raises (SALOME::SALOME_Exception);
446 long NbHexasOfOrder(in ElementOrder order)
447 raises (SALOME::SALOME_Exception);
450 raises (SALOME::SALOME_Exception);
452 long NbPyramidsOfOrder(in ElementOrder order)
453 raises (SALOME::SALOME_Exception);
456 raises (SALOME::SALOME_Exception);
458 long NbPrismsOfOrder(in ElementOrder order)
459 raises (SALOME::SALOME_Exception);
462 raises (SALOME::SALOME_Exception);
465 raises (SALOME::SALOME_Exception);
467 long_array GetElementsId()
468 raises (SALOME::SALOME_Exception);
470 long_array GetElementsByType( in ElementType theType )
471 raises (SALOME::SALOME_Exception);
473 long_array GetNodesId()
474 raises (SALOME::SALOME_Exception);
477 * Returns type of mesh element
479 ElementType GetElementType( in long id, in boolean iselem )
480 raises (SALOME::SALOME_Exception);
483 * Get mesh description
494 interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
499 long GetNumberOfElements()
500 raises (SALOME::SALOME_Exception);
505 long GetNumberOfNodes( in boolean all )
506 raises (SALOME::SALOME_Exception);
511 long_array GetElementsId()
512 raises (SALOME::SALOME_Exception);
517 long_array GetElementsByType( in ElementType theType )
518 raises (SALOME::SALOME_Exception);
521 * Return type of submesh element
523 ElementType GetElementType( in long id, in boolean iselem )
524 raises (SALOME::SALOME_Exception);
529 long_array GetNodesId()
530 raises (SALOME::SALOME_Exception);
533 * Get geom shape the submesh is dedicated to
535 GEOM::GEOM_Object GetSubShape()
536 raises (SALOME::SALOME_Exception);
539 * Get SMESH_Mesh which stores nodes coordinates & elements definition
541 SMESH_Mesh GetFather()
542 raises (SALOME::SALOME_Exception);
545 * Get the internal Id
552 SALOME_MED::FAMILY GetFamily()
553 raises (SALOME::SALOME_Exception);
557 * This interface makes modifications on the Mesh - removing elements and nodes etc.
559 interface NumericalFunctor;
560 interface SMESH_MeshEditor
562 boolean RemoveElements(in long_array IDsOfElements);
564 boolean RemoveNodes(in long_array IDsOfNodes);
566 boolean AddNode(in double x, in double y, in double z);
568 boolean AddEdge(in long_array IDsOfNodes);
570 boolean AddFace(in long_array IDsOfNodes);
572 boolean AddPolygonalFace(in long_array IdsOfNodes);
574 boolean AddVolume(in long_array IDsOfNodes);
577 * Create volume of many faces, giving nodes for each face.
578 * \param IdsOfNodes List of node IDs for volume creation face by face.
579 * \param Quantities List of integer values, Quantities[i]
580 * gives quantity of nodes in face number i.
582 boolean AddPolyhedralVolume (in long_array IdsOfNodes,
583 in long_array Quantities);
586 * Create volume of many faces, giving IDs of existing faces.
587 * \param IdsOfFaces List of face IDs for volume creation.
588 * \note The created volume will refer only to nodes
589 * of the given faces, not to the faces itself.
591 boolean AddPolyhedralVolumeByFaces (in long_array IdsOfFaces);
593 boolean MoveNode(in long NodeID, in double x, in double y, in double z);
595 boolean InverseDiag(in long NodeID1, in long NodeID2);
597 boolean DeleteDiag(in long NodeID1, in long NodeID2);
599 boolean Reorient(in long_array IDsOfElements);
601 boolean ReorientObject(in SMESH_IDSource theObject);
604 * \brief Fuse neighbour triangles into quadrangles.
605 * \param theElems The triangles to be fused.
606 * \param theCriterion Is used to choose a neighbour to fuse with.
607 * \param theMaxAngle Is a max angle between element normals at which fusion
608 * is still performed; theMaxAngle is mesured in radians.
609 * \return TRUE in case of success, FALSE otherwise.
611 boolean TriToQuad (in long_array IDsOfElements,
612 in NumericalFunctor Criterion,
616 * \brief Fuse neighbour triangles into quadrangles.
618 * Behaves like the above method, taking list of elements from \a theObject
620 boolean TriToQuadObject (in SMESH_IDSource theObject,
621 in NumericalFunctor Criterion,
625 * \brief Split quadrangles into triangles.
626 * \param theElems The faces to be splitted.
627 * \param theCriterion Is used to choose a diagonal for splitting.
628 * \return TRUE in case of success, FALSE otherwise.
630 boolean QuadToTri (in long_array IDsOfElements,
631 in NumericalFunctor Criterion);
634 * \brief Split quadrangles into triangles.
636 * Behaves like the above method, taking list of elements from \a theObject
638 boolean QuadToTriObject (in SMESH_IDSource theObject,
639 in NumericalFunctor Criterion);
642 * \brief Split quadrangles into triangles.
643 * \param theElems The faces to be splitted.
644 * \param the13Diag Is used to choose a diagonal for splitting.
645 * \return TRUE in case of success, FALSE otherwise.
647 boolean SplitQuad (in long_array IDsOfElements,
651 * \brief Split quadrangles into triangles.
653 * Behaves like the above method, taking list of elements from \a theObject
655 boolean SplitQuadObject (in SMESH_IDSource theObject,
659 * Find better splitting of the given quadrangle.
660 * \param IDOfQuad ID of the quadrangle to be splitted.
661 * \param Criterion A criterion to choose a diagonal for splitting.
662 * \return 1 if 1-3 diagonal is better, 2 if 2-4
663 * diagonal is better, 0 if error occurs.
665 long BestSplit (in long IDOfQuad,
666 in NumericalFunctor Criterion);
668 enum Smooth_Method { LAPLACIAN_SMOOTH, CENTROIDAL_SMOOTH };
670 boolean Smooth(in long_array IDsOfElements,
671 in long_array IDsOfFixedNodes,
672 in long MaxNbOfIterations,
673 in double MaxAspectRatio,
674 in Smooth_Method Method);
676 boolean SmoothObject(in SMESH_IDSource theObject,
677 in long_array IDsOfFixedNodes,
678 in long MaxNbOfIterations,
679 in double MaxAspectRatio,
680 in Smooth_Method Method);
682 boolean SmoothParametric(in long_array IDsOfElements,
683 in long_array IDsOfFixedNodes,
684 in long MaxNbOfIterations,
685 in double MaxAspectRatio,
686 in Smooth_Method Method);
688 boolean SmoothParametricObject(in SMESH_IDSource theObject,
689 in long_array IDsOfFixedNodes,
690 in long MaxNbOfIterations,
691 in double MaxAspectRatio,
692 in Smooth_Method Method);
694 void RenumberNodes();
696 void RenumberElements();
698 void RotationSweep(in long_array IDsOfElements,
700 in double AngleInRadians,
702 in double Tolerance);
704 void RotationSweepObject(in SMESH_IDSource theObject,
706 in double AngleInRadians,
708 in double Tolerance);
710 void ExtrusionSweep(in long_array IDsOfElements,
711 in DirStruct StepVector,
715 * Generate new elements by extrusion of theElements
716 * by StepVector by NbOfSteps
717 * param ExtrFlags set flags for performing extrusion
718 * param SewTolerance - uses for comparing locations of nodes if flag
719 * EXTRUSION_FLAG_SEW is set
721 void AdvancedExtrusion(in long_array IDsOfElements,
722 in DirStruct StepVector,
725 in double SewTolerance);
727 void ExtrusionSweepObject(in SMESH_IDSource theObject,
728 in DirStruct StepVector,
731 void ExtrusionSweepObject1D(in SMESH_IDSource theObject,
732 in DirStruct StepVector,
735 void ExtrusionSweepObject2D(in SMESH_IDSource theObject,
736 in DirStruct StepVector,
739 enum Extrusion_Error {
744 EXTR_BAD_STARTING_NODE,
745 EXTR_BAD_ANGLES_NUMBER,
746 EXTR_CANT_GET_TANGENT
749 Extrusion_Error ExtrusionAlongPath(in long_array IDsOfElements,
750 in SMESH_Mesh PathMesh,
751 in GEOM::GEOM_Object PathShape,
753 in boolean HasAngles,
754 in double_array Angles,
755 in boolean HasRefPoint,
756 in PointStruct RefPoint);
758 Extrusion_Error ExtrusionAlongPathObject(in SMESH_IDSource theObject,
759 in SMESH_Mesh PathMesh,
760 in GEOM::GEOM_Object PathShape,
762 in boolean HasAngles,
763 in double_array Angles,
764 in boolean HasRefPoint,
765 in PointStruct RefPoint);
767 enum MirrorType { POINT, AXIS, PLANE };
769 void Mirror (in long_array IDsOfElements,
770 in AxisStruct Mirror,
771 in MirrorType theMirrorType,
774 void MirrorObject (in SMESH_IDSource theObject,
775 in AxisStruct Mirror,
776 in MirrorType theMirrorType,
779 void Translate (in long_array IDsOfElements,
783 void TranslateObject (in SMESH_IDSource theObject,
787 void Rotate (in long_array IDsOfElements,
789 in double AngleInRadians,
792 void RotateObject (in SMESH_IDSource theObject,
794 in double AngleInRadians,
797 void FindCoincidentNodes (in double Tolerance,
798 out array_of_long_array GroupsOfNodes);
800 void MergeNodes (in array_of_long_array GroupsOfNodes);
802 void MergeEqualElements();
806 SEW_BORDER1_NOT_FOUND,
807 SEW_BORDER2_NOT_FOUND,
808 SEW_BOTH_BORDERS_NOT_FOUND,
810 SEW_VOLUMES_TO_SPLIT,
811 // for SewSideElements() only:
812 SEW_DIFF_NB_OF_ELEMENTS,
813 SEW_TOPO_DIFF_SETS_OF_ELEMENTS,
818 Sew_Error SewFreeBorders (in long FirstNodeID1,
819 in long SecondNodeID1,
821 in long FirstNodeID2,
822 in long SecondNodeID2,
824 in boolean CreatePolygons,
825 in boolean CreatePolyedrs);
827 Sew_Error SewConformFreeBorders (in long FirstNodeID1,
828 in long SecondNodeID1,
830 in long FirstNodeID2,
831 in long SecondNodeID2);
833 Sew_Error SewBorderToSide (in long FirstNodeIDOnFreeBorder,
834 in long SecondNodeIDOnFreeBorder,
835 in long LastNodeIDOnFreeBorder,
836 in long FirstNodeIDOnSide,
837 in long LastNodeIDOnSide,
838 in boolean CreatePolygons,
839 in boolean CreatePolyedrs);
841 Sew_Error SewSideElements (in long_array IDsOfSide1Elements,
842 in long_array IDsOfSide2Elements,
843 in long NodeID1OfSide1ToMerge,
844 in long NodeID1OfSide2ToMerge,
845 in long NodeID2OfSide1ToMerge,
846 in long NodeID2OfSide2ToMerge);