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;
151 * Auxilary flags for advanced extrusion.
152 * BOUNDARY: create or not boundary for result of extrusion
153 * SEW: try to use existing nodes or create new nodes in any case
155 const long EXTRUSION_FLAG_BOUNDARY = 1;
156 const long EXTRUSION_FLAG_SEW = 2;
158 interface SMESH_IDSource
161 * Returns a sequence of all element IDs
166 interface SMESH_GroupBase;
167 interface SMESH_Group;
168 interface SMESH_GroupOnGeom;
169 interface SMESH_subMesh;
170 interface SMESH_MeshEditor;
171 interface SMESH_Mesh : SALOME::GenericObj, SMESH_IDSource
174 // * Associate a Shape to a Mesh created with NewEmpty
176 //boolean SetMesh(in GEOM::GEOM_Object anObject)
177 // raises (SALOME::SALOME_Exception);
180 * Get the subMesh object associated to a subShape. The subMesh object
181 * gives access to nodes and elements IDs.
182 * SubMesh will be used instead of SubShape in a next idl version to
183 * adress a specific subMesh...
185 SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
186 raises (SALOME::SALOME_Exception);
189 // * Create a subMesh without reference to a subShape
191 //SMESH_subMesh NewEmpty()
192 // raises (SALOME::SALOME_Exception);
195 * Get geom shape to mesh. A result may be nil
197 GEOM::GEOM_Object GetShapeToMesh()
198 raises (SALOME::SALOME_Exception);
203 void RemoveSubMesh(in SMESH_subMesh aSubMesh)
204 raises (SALOME::SALOME_Exception);
209 SMESH_Group CreateGroup( in ElementType elem_type,
211 raises (SALOME::SALOME_Exception);
214 * Create a group from geometry group
216 SMESH_GroupOnGeom CreateGroupFromGEOM( in ElementType elem_type,
218 in GEOM::GEOM_Object theGeomObject )
219 raises (SALOME::SALOME_Exception);
224 void RemoveGroup(in SMESH_GroupBase aGroup)
225 raises (SALOME::SALOME_Exception);
228 * Remove group with its contents
230 void RemoveGroupWithContents( in SMESH_GroupBase aGroup )
231 raises (SALOME::SALOME_Exception);
234 * Union of two groups
235 * New group is created. All mesh elements that are
236 * present in initial groups are added to the new one
238 SMESH_Group UnionGroups (in SMESH_GroupBase aGroup1,
239 in SMESH_GroupBase aGroup2,
241 raises (SALOME::SALOME_Exception);
244 * Intersection of two groups
245 * New group is created. All mesh elements that are
246 * present in both initial groups are added to the new one.
248 SMESH_Group IntersectGroups (in SMESH_GroupBase aGroup1,
249 in SMESH_GroupBase aGroup2,
251 raises (SALOME::SALOME_Exception);
255 * New group is created. All mesh elements that are present in
256 * main group but do not present in tool group are added to the new one
258 SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
259 in SMESH_GroupBase aToolGroup,
261 raises (SALOME::SALOME_Exception);
264 * Add hypothesis to the mesh, under a particular subShape
265 * (or the main shape itself)
266 * The Add method is only used to prepare the build of the mesh and store
267 * the algorithms and associated parameters.
268 * Actual job of mesh the shape is done by MESH_Gen.
270 * - aSubShape : subShape obtained by a shape explode in GEOM
272 * - anHyp : hypothesis object
274 * - OK if the hypothesis is compatible with the subShape
275 * (and all previous hypothesis on the subShape)
276 * - NOK if the hypothesis is not compatible with the subShape
277 * (or one previous hypothesis on the subShape)
278 * raises exception if hypothesis has not been created
280 Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
281 in SMESH_Hypothesis anHyp)
282 raises (SALOME::SALOME_Exception);
283 // boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
284 // raises (SALOME::SALOME_Exception);
287 * Remove an hypothesis previouly added with AddHypothesis.
289 Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject,
290 in SMESH_Hypothesis anHyp)
291 raises (SALOME::SALOME_Exception);
292 // boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
293 // in SMESH_Hypothesis anHyp)
294 // raises (SALOME::SALOME_Exception);
297 * Get the list of hypothesis added on a subShape
299 ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Object aSubObject)
300 raises (SALOME::SALOME_Exception);
301 // ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
302 // raises (SALOME::SALOME_Exception);
305 * Get the log of nodes and elements added or removed since previous
308 * - clearAfterGet : log is emptied after Get (safe if concurrents access)
310 // string_array GetLog(in boolean clearAfterGet)
311 // raises (SALOME::SALOME_Exception);
312 log_array GetLog(in boolean clearAfterGet)
313 raises (SALOME::SALOME_Exception);
316 * Clear the log of nodes and elements added or removed since previous
317 * clear. Must be used immediately after GetLog if clearAfterGet is false.
320 raises (SALOME::SALOME_Exception);
323 * Get the internal Id
333 * Obtain instance of SMESH_MeshEditor
335 SMESH_MeshEditor GetMeshEditor()
336 raises (SALOME::SALOME_Exception);
339 * Export Mesh to different MED Formats
341 * - auto_groups : boolean parameter for creating/not creating
342 * the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
343 * the typical use is auto_groups=false.
344 * - theVersion : define the version of format of MED file, that will be created
346 void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
347 raises (SALOME::SALOME_Exception);
350 * Export Mesh to MED_V2_1 MED format
351 * Works, just the same as ExportToMED, with MED_VERSION parameter equal to MED_V2_1.
352 * The method is kept in order to support old functionality
354 void ExportMED( in string file, in boolean auto_groups )
355 raises (SALOME::SALOME_Exception);
358 * Export Mesh to DAT, UNV and STL Formats
360 void ExportDAT( in string file )
361 raises (SALOME::SALOME_Exception);
362 void ExportUNV( in string file )
363 raises (SALOME::SALOME_Exception);
364 void ExportSTL( in string file, in boolean isascii )
365 raises (SALOME::SALOME_Exception);
370 SALOME_MED::MESH GetMEDMesh()
371 raises (SALOME::SALOME_Exception);
374 * Get informations about mesh contents
377 raises (SALOME::SALOME_Exception);
380 raises (SALOME::SALOME_Exception);
383 raises (SALOME::SALOME_Exception);
386 raises (SALOME::SALOME_Exception);
389 raises (SALOME::SALOME_Exception);
392 raises (SALOME::SALOME_Exception);
395 raises (SALOME::SALOME_Exception);
398 raises (SALOME::SALOME_Exception);
401 raises (SALOME::SALOME_Exception);
404 raises (SALOME::SALOME_Exception);
407 raises (SALOME::SALOME_Exception);
410 raises (SALOME::SALOME_Exception);
413 raises (SALOME::SALOME_Exception);
416 raises (SALOME::SALOME_Exception);
418 long_array GetElementsId()
419 raises (SALOME::SALOME_Exception);
421 long_array GetElementsByType( in ElementType theType )
422 raises (SALOME::SALOME_Exception);
424 long_array GetNodesId()
425 raises (SALOME::SALOME_Exception);
428 * Returns type of mesh element
430 ElementType GetElementType( in long id, in boolean iselem )
431 raises (SALOME::SALOME_Exception);
434 * Get mesh description
439 interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
444 long GetNumberOfElements()
445 raises (SALOME::SALOME_Exception);
450 long GetNumberOfNodes( in boolean all )
451 raises (SALOME::SALOME_Exception);
456 long_array GetElementsId()
457 raises (SALOME::SALOME_Exception);
462 long_array GetElementsByType( in ElementType theType )
463 raises (SALOME::SALOME_Exception);
466 * Return type of submesh element
468 ElementType GetElementType( in long id, in boolean iselem )
469 raises (SALOME::SALOME_Exception);
474 long_array GetNodesId()
475 raises (SALOME::SALOME_Exception);
478 * Get geom shape the submesh is dedicated to
480 GEOM::GEOM_Object GetSubShape()
481 raises (SALOME::SALOME_Exception);
484 * Get SMESH_Mesh which stores nodes coordinates & elements definition
486 SMESH_Mesh GetFather()
487 raises (SALOME::SALOME_Exception);
490 * Get the internal Id
497 SALOME_MED::FAMILY GetFamily()
498 raises (SALOME::SALOME_Exception);
502 * This interface makes modifications on the Mesh - removing elements and nodes etc.
504 interface NumericalFunctor;
505 interface SMESH_MeshEditor
507 boolean RemoveElements(in long_array IDsOfElements);
509 boolean RemoveNodes(in long_array IDsOfNodes);
511 boolean AddNode(in double x, in double y, in double z);
513 boolean AddEdge(in long_array IDsOfNodes);
515 boolean AddFace(in long_array IDsOfNodes);
517 boolean AddVolume(in long_array IDsOfNodes);
520 * Create volume of many faces, giving nodes for each face.
521 * \param IdsOfNodes List of node IDs for volume creation face by face.
522 * \param Quantities List of integer values, Quantities[i]
523 * gives quantity of nodes in face number i.
525 boolean AddPolyhedralVolume (in long_array IdsOfNodes,
526 in long_array Quantities);
529 * Create volume of many faces, giving IDs of existing faces.
530 * \param IdsOfFaces List of face IDs for volume creation.
531 * \note The created volume will refer only to nodes
532 * of the given faces, not to the faces itself.
534 boolean AddPolyhedralVolumeByFaces (in long_array IdsOfFaces);
536 boolean MoveNode(in long NodeID, in double x, in double y, in double z);
538 boolean InverseDiag(in long NodeID1, in long NodeID2);
540 boolean DeleteDiag(in long NodeID1, in long NodeID2);
542 boolean Reorient(in long_array IDsOfElements);
544 boolean ReorientObject(in SMESH_IDSource theObject);
547 * \brief Fuse neighbour triangles into quadrangles.
548 * \param theElems The triangles to be fused.
549 * \param theCriterion Is used to choose a neighbour to fuse with.
550 * \param theMaxAngle Is a max angle between element normals at which fusion
551 * is still performed; theMaxAngle is mesured in radians.
552 * \return TRUE in case of success, FALSE otherwise.
554 boolean TriToQuad (in long_array IDsOfElements,
555 in NumericalFunctor Criterion,
559 * \brief Fuse neighbour triangles into quadrangles.
561 * Behaves like the above method, taking list of elements from \a theObject
563 boolean TriToQuadObject (in SMESH_IDSource theObject,
564 in NumericalFunctor Criterion,
568 * \brief Split quadrangles into triangles.
569 * \param theElems The faces to be splitted.
570 * \param theCriterion Is used to choose a diagonal for splitting.
571 * \return TRUE in case of success, FALSE otherwise.
573 boolean QuadToTri (in long_array IDsOfElements,
574 in NumericalFunctor Criterion);
577 * \brief Split quadrangles into triangles.
579 * Behaves like the above method, taking list of elements from \a theObject
581 boolean QuadToTriObject (in SMESH_IDSource theObject,
582 in NumericalFunctor Criterion);
585 * \brief Split quadrangles into triangles.
586 * \param theElems The faces to be splitted.
587 * \param the13Diag Is used to choose a diagonal for splitting.
588 * \return TRUE in case of success, FALSE otherwise.
590 boolean SplitQuad (in long_array IDsOfElements,
594 * \brief Split quadrangles into triangles.
596 * Behaves like the above method, taking list of elements from \a theObject
598 boolean SplitQuadObject (in SMESH_IDSource theObject,
602 * Find better splitting of the given quadrangle.
603 * \param IDOfQuad ID of the quadrangle to be splitted.
604 * \param Criterion A criterion to choose a diagonal for splitting.
605 * \return 1 if 1-3 diagonal is better, 2 if 2-4
606 * diagonal is better, 0 if error occurs.
608 long BestSplit (in long IDOfQuad,
609 in NumericalFunctor Criterion);
611 enum Smooth_Method { LAPLACIAN_SMOOTH, CENTROIDAL_SMOOTH };
613 boolean Smooth(in long_array IDsOfElements,
614 in long_array IDsOfFixedNodes,
615 in long MaxNbOfIterations,
616 in double MaxAspectRatio,
617 in Smooth_Method Method);
619 boolean SmoothObject(in SMESH_IDSource theObject,
620 in long_array IDsOfFixedNodes,
621 in long MaxNbOfIterations,
622 in double MaxAspectRatio,
623 in Smooth_Method Method);
625 boolean SmoothParametric(in long_array IDsOfElements,
626 in long_array IDsOfFixedNodes,
627 in long MaxNbOfIterations,
628 in double MaxAspectRatio,
629 in Smooth_Method Method);
631 boolean SmoothParametricObject(in SMESH_IDSource theObject,
632 in long_array IDsOfFixedNodes,
633 in long MaxNbOfIterations,
634 in double MaxAspectRatio,
635 in Smooth_Method Method);
637 void RenumberNodes();
639 void RenumberElements();
641 void RotationSweep(in long_array IDsOfElements,
643 in double AngleInRadians,
645 in double Tolerance);
647 void RotationSweepObject(in SMESH_IDSource theObject,
649 in double AngleInRadians,
651 in double Tolerance);
653 void ExtrusionSweep(in long_array IDsOfElements,
654 in DirStruct StepVector,
658 * Generate new elements by extrusion of theElements
659 * by StepVector by NbOfSteps
660 * param ExtrFlags set flags for performing extrusion
661 * param SewTolerance - uses for comparing locations of nodes if flag
662 * EXTRUSION_FLAG_SEW is set
664 void AdvancedExtrusion(in long_array IDsOfElements,
665 in DirStruct StepVector,
668 in double SewTolerance);
670 void ExtrusionSweepObject(in SMESH_IDSource theObject,
671 in DirStruct StepVector,
674 void ExtrusionSweepObject1D(in SMESH_IDSource theObject,
675 in DirStruct StepVector,
678 void ExtrusionSweepObject2D(in SMESH_IDSource theObject,
679 in DirStruct StepVector,
682 enum Extrusion_Error {
687 EXTR_BAD_STARTING_NODE,
688 EXTR_BAD_ANGLES_NUMBER,
689 EXTR_CANT_GET_TANGENT
692 Extrusion_Error ExtrusionAlongPath(in long_array IDsOfElements,
693 in SMESH_Mesh PathMesh,
694 in GEOM::GEOM_Object PathShape,
696 in boolean HasAngles,
697 in double_array Angles,
698 in boolean HasRefPoint,
699 in PointStruct RefPoint);
701 Extrusion_Error ExtrusionAlongPathObject(in SMESH_IDSource theObject,
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 enum MirrorType { POINT, AXIS, PLANE };
712 void Mirror (in long_array IDsOfElements,
713 in AxisStruct Mirror,
714 in MirrorType theMirrorType,
717 void MirrorObject (in SMESH_IDSource theObject,
718 in AxisStruct Mirror,
719 in MirrorType theMirrorType,
722 void Translate (in long_array IDsOfElements,
726 void TranslateObject (in SMESH_IDSource theObject,
730 void Rotate (in long_array IDsOfElements,
732 in double AngleInRadians,
735 void RotateObject (in SMESH_IDSource theObject,
737 in double AngleInRadians,
740 void FindCoincidentNodes (in double Tolerance,
741 out array_of_long_array GroupsOfNodes);
743 void MergeNodes (in array_of_long_array GroupsOfNodes);
745 void MergeEqualElements();
749 SEW_BORDER1_NOT_FOUND,
750 SEW_BORDER2_NOT_FOUND,
751 SEW_BOTH_BORDERS_NOT_FOUND,
753 SEW_VOLUMES_TO_SPLIT,
754 // for SewSideElements() only:
755 SEW_DIFF_NB_OF_ELEMENTS,
756 SEW_TOPO_DIFF_SETS_OF_ELEMENTS,
761 Sew_Error SewFreeBorders (in long FirstNodeID1,
762 in long SecondNodeID1,
764 in long FirstNodeID2,
765 in long SecondNodeID2,
767 in boolean CreatePolygons,
768 in boolean CreatePolyedrs);
770 Sew_Error SewConformFreeBorders (in long FirstNodeID1,
771 in long SecondNodeID1,
773 in long FirstNodeID2,
774 in long SecondNodeID2);
776 Sew_Error SewBorderToSide (in long FirstNodeIDOnFreeBorder,
777 in long SecondNodeIDOnFreeBorder,
778 in long LastNodeIDOnFreeBorder,
779 in long FirstNodeIDOnSide,
780 in long LastNodeIDOnSide,
781 in boolean CreatePolygons,
782 in boolean CreatePolyedrs);
784 Sew_Error SewSideElements (in long_array IDsOfSide1Elements,
785 in long_array IDsOfSide2Elements,
786 in long NodeID1OfSide1ToMerge,
787 in long NodeID1OfSide2ToMerge,
788 in long NodeID2OfSide1ToMerge,
789 in long NodeID2OfSide2ToMerge);