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"
32 #include "GEOM_Gen.idl"
38 interface SMESH_Hypothesis;
39 typedef sequence<SMESH_Hypothesis> ListOfHypothesis;
41 typedef sequence<double> double_array ;
42 typedef sequence<long> long_array ;
43 typedef sequence<string> string_array ;
44 typedef sequence<long_array> array_of_long_array ;
62 CHANGE_POLYHEDRON_NODES,
74 struct PointStruct { double x;
77 struct DirStruct { PointStruct PS ; } ; // analog to Occ Direction
79 struct AxisStruct { double x;
88 * Enumeration for element type, like in SMDS
100 * Enumeration for hypothesis status (used by AddHypothesis() and RemoveHypothesis() methods)
102 enum Hypothesis_Status // in the order of severity
105 HYP_MISSING, // algo misses a hypothesis
106 HYP_CONCURENT, // several applicable hypotheses
107 HYP_BAD_PARAMETER,// hypothesis has a bad parameter value
108 HYP_UNKNOWN_FATAL,// --- all statuses below should be considered as fatal
109 // for Add/RemoveHypothesis operations
110 HYP_INCOMPATIBLE, // hypothesis does not fit algo
111 HYP_NOTCONFORM, // not conform mesh is produced appling a hypothesis
112 HYP_ALREADY_EXIST,// such hypothesis already exist
113 HYP_BAD_DIM // bad dimension
117 * Enumeration for DriverMED read status (used by ImportMEDFile() method)
119 enum DriverMED_ReadStatus // in the order of severity
122 DRS_EMPTY, // a MED file contains no mesh with the given name
123 DRS_WARN_RENUMBER, // a MED file has overlapped ranges of element numbers,
124 // so the numbers from the file are ignored
125 DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
126 DRS_FAIL // general failure (exception etc.)
130 * Enumeration for DriverMED (used by Perform() method)
132 enum MED_VERSION // in the order of severity
138 typedef sequence<log_block> log_array;
142 * Auxilary flags for advanced extrusion.
143 * BOUNDARY: create or not boundary for result of extrusion
144 * SEW: try to use existing nodes or create new nodes in any case
146 const long EXTRUSION_FLAG_BOUNDARY = 1;
147 const long EXTRUSION_FLAG_SEW = 2;
149 interface SMESH_IDSource
152 * Returns a sequence of all element IDs
157 interface SMESH_GroupBase;
158 interface SMESH_Group;
159 interface SMESH_GroupOnGeom;
160 interface SMESH_subMesh;
161 interface SMESH_MeshEditor;
162 interface SMESH_Mesh : SALOME::GenericObj, SMESH_IDSource
165 // * Associate a Shape to a Mesh created with NewEmpty
167 //boolean SetMesh(in GEOM::GEOM_Object anObject)
168 // raises (SALOME::SALOME_Exception);
171 * Get the subMesh object associated to a subShape. The subMesh object
172 * gives access to nodes and elements IDs.
173 * SubMesh will be used instead of SubShape in a next idl version to
174 * adress a specific subMesh...
176 SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
177 raises (SALOME::SALOME_Exception);
180 // * Create a subMesh without reference to a subShape
182 //SMESH_subMesh NewEmpty()
183 // raises (SALOME::SALOME_Exception);
186 * Get geom shape to mesh. A result may be nil
188 GEOM::GEOM_Object GetShapeToMesh()
189 raises (SALOME::SALOME_Exception);
194 void RemoveSubMesh(in SMESH_subMesh aSubMesh)
195 raises (SALOME::SALOME_Exception);
200 SMESH_Group CreateGroup( in ElementType elem_type,
202 raises (SALOME::SALOME_Exception);
205 * Create a group from geometry group
207 SMESH_GroupOnGeom CreateGroupFromGEOM( in ElementType elem_type,
209 in GEOM::GEOM_Object theGeomObject )
210 raises (SALOME::SALOME_Exception);
215 void RemoveGroup(in SMESH_GroupBase aGroup)
216 raises (SALOME::SALOME_Exception);
219 * Remove group with its contents
221 void RemoveGroupWithContents( in SMESH_GroupBase aGroup )
222 raises (SALOME::SALOME_Exception);
225 * Union of two groups
226 * New group is created. All mesh elements that are
227 * present in initial groups are added to the new one
229 SMESH_Group UnionGroups (in SMESH_GroupBase aGroup1,
230 in SMESH_GroupBase aGroup2,
232 raises (SALOME::SALOME_Exception);
235 * Intersection of two groups
236 * New group is created. All mesh elements that are
237 * present in both initial groups are added to the new one.
239 SMESH_Group IntersectGroups (in SMESH_GroupBase aGroup1,
240 in SMESH_GroupBase aGroup2,
242 raises (SALOME::SALOME_Exception);
246 * New group is created. All mesh elements that are present in
247 * main group but do not present in tool group are added to the new one
249 SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
250 in SMESH_GroupBase aToolGroup,
252 raises (SALOME::SALOME_Exception);
255 * Add hypothesis to the mesh, under a particular subShape
256 * (or the main shape itself)
257 * The Add method is only used to prepare the build of the mesh and store
258 * the algorithms and associated parameters.
259 * Actual job of mesh the shape is done by MESH_Gen.
261 * - aSubShape : subShape obtained by a shape explode in GEOM
263 * - anHyp : hypothesis object
265 * - OK if the hypothesis is compatible with the subShape
266 * (and all previous hypothesis on the subShape)
267 * - NOK if the hypothesis is not compatible with the subShape
268 * (or one previous hypothesis on the subShape)
269 * raises exception if hypothesis has not been created
271 Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
272 in SMESH_Hypothesis anHyp)
273 raises (SALOME::SALOME_Exception);
274 // boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
275 // raises (SALOME::SALOME_Exception);
278 * Remove an hypothesis previouly added with AddHypothesis.
280 Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject,
281 in SMESH_Hypothesis anHyp)
282 raises (SALOME::SALOME_Exception);
283 // boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
284 // in SMESH_Hypothesis anHyp)
285 // raises (SALOME::SALOME_Exception);
288 * Get the list of hypothesis added on a subShape
290 ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Object aSubObject)
291 raises (SALOME::SALOME_Exception);
292 // ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
293 // raises (SALOME::SALOME_Exception);
296 * Get the log of nodes and elements added or removed since previous
299 * - clearAfterGet : log is emptied after Get (safe if concurrents access)
301 // string_array GetLog(in boolean clearAfterGet)
302 // raises (SALOME::SALOME_Exception);
303 log_array GetLog(in boolean clearAfterGet)
304 raises (SALOME::SALOME_Exception);
307 * Clear the log of nodes and elements added or removed since previous
308 * clear. Must be used immediately after GetLog if clearAfterGet is false.
311 raises (SALOME::SALOME_Exception);
314 * Get the internal Id
324 * Obtain instance of SMESH_MeshEditor
326 SMESH_MeshEditor GetMeshEditor()
327 raises (SALOME::SALOME_Exception);
330 * Export Mesh to different MED Formats
332 * - auto_groups : boolean parameter for creating/not creating
333 * the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
334 * the typical use is auto_groups=false.
335 * - theVersion : define the version of format of MED file, that will be created
337 void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
338 raises (SALOME::SALOME_Exception);
341 * Export Mesh to MED_V2_1 MED format
342 * Works, just the same as ExportToMED, with MED_VERSION parameter equal to MED_V2_1.
343 * The method is kept in order to support old functionality
345 void ExportMED( in string file, in boolean auto_groups )
346 raises (SALOME::SALOME_Exception);
349 * Export Mesh to DAT, UNV and STL Formats
351 void ExportDAT( in string file )
352 raises (SALOME::SALOME_Exception);
353 void ExportUNV( in string file )
354 raises (SALOME::SALOME_Exception);
355 void ExportSTL( in string file, in boolean isascii )
356 raises (SALOME::SALOME_Exception);
361 SALOME_MED::MESH GetMEDMesh()
362 raises (SALOME::SALOME_Exception);
365 * Get informations about mesh contents
368 raises (SALOME::SALOME_Exception);
371 raises (SALOME::SALOME_Exception);
374 raises (SALOME::SALOME_Exception);
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);
409 long_array GetElementsId()
410 raises (SALOME::SALOME_Exception);
412 long_array GetElementsByType( in ElementType theType )
413 raises (SALOME::SALOME_Exception);
415 long_array GetNodesId()
416 raises (SALOME::SALOME_Exception);
419 * Returns type of mesh element
421 ElementType GetElementType( in long id, in boolean iselem )
422 raises (SALOME::SALOME_Exception);
425 * Get mesh description
430 interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
435 long GetNumberOfElements()
436 raises (SALOME::SALOME_Exception);
441 long GetNumberOfNodes( in boolean all )
442 raises (SALOME::SALOME_Exception);
447 long_array GetElementsId()
448 raises (SALOME::SALOME_Exception);
453 long_array GetElementsByType( in ElementType theType )
454 raises (SALOME::SALOME_Exception);
457 * Return type of submesh element
459 ElementType GetElementType( in long id, in boolean iselem )
460 raises (SALOME::SALOME_Exception);
465 long_array GetNodesId()
466 raises (SALOME::SALOME_Exception);
469 * Get geom shape the submesh is dedicated to
471 GEOM::GEOM_Object GetSubShape()
472 raises (SALOME::SALOME_Exception);
475 * Get SMESH_Mesh which stores nodes coordinates & elements definition
477 SMESH_Mesh GetFather()
478 raises (SALOME::SALOME_Exception);
481 * Get the internal Id
488 SALOME_MED::FAMILY GetFamily()
489 raises (SALOME::SALOME_Exception);
493 * This interface makes modifications on the Mesh - removing elements and nodes etc.
495 interface NumericalFunctor;
496 interface SMESH_MeshEditor
498 boolean RemoveElements(in long_array IDsOfElements);
500 boolean RemoveNodes(in long_array IDsOfNodes);
502 boolean AddNode(in double x, in double y, in double z);
504 boolean AddEdge(in long_array IDsOfNodes);
506 boolean AddFace(in long_array IDsOfNodes);
508 boolean AddVolume(in long_array IDsOfNodes);
511 * Create volume of many faces, giving nodes for each face.
512 * \param IdsOfNodes List of node IDs for volume creation face by face.
513 * \param Quantities List of integer values, Quantities[i]
514 * gives quantity of nodes in face number i.
516 boolean AddPolyhedralVolume (in long_array IdsOfNodes,
517 in long_array Quantities);
520 * Create volume of many faces, giving IDs of existing faces.
521 * \param IdsOfFaces List of face IDs for volume creation.
522 * \note The created volume will refer only to nodes
523 * of the given faces, not to the faces itself.
525 boolean AddPolyhedralVolumeByFaces (in long_array IdsOfFaces);
527 boolean MoveNode(in long NodeID, in double x, in double y, in double z);
529 boolean InverseDiag(in long NodeID1, in long NodeID2);
531 boolean DeleteDiag(in long NodeID1, in long NodeID2);
533 boolean Reorient(in long_array IDsOfElements);
535 boolean ReorientObject(in SMESH_IDSource theObject);
538 * \brief Fuse neighbour triangles into quadrangles.
539 * \param theElems The triangles to be fused.
540 * \param theCriterion Is used to choose a neighbour to fuse with.
541 * \param theMaxAngle Is a max angle between element normals at which fusion
542 * is still performed; theMaxAngle is mesured in radians.
543 * \return TRUE in case of success, FALSE otherwise.
545 boolean TriToQuad (in long_array IDsOfElements,
546 in NumericalFunctor Criterion,
550 * \brief Fuse neighbour triangles into quadrangles.
552 * Behaves like the above method, taking list of elements from \a theObject
554 boolean TriToQuadObject (in SMESH_IDSource theObject,
555 in NumericalFunctor Criterion,
559 * \brief Split quadrangles into triangles.
560 * \param theElems The faces to be splitted.
561 * \param theCriterion Is used to choose a diagonal for splitting.
562 * \return TRUE in case of success, FALSE otherwise.
564 boolean QuadToTri (in long_array IDsOfElements,
565 in NumericalFunctor Criterion);
568 * \brief Split quadrangles into triangles.
570 * Behaves like the above method, taking list of elements from \a theObject
572 boolean QuadToTriObject (in SMESH_IDSource theObject,
573 in NumericalFunctor Criterion);
576 * \brief Split quadrangles into triangles.
577 * \param theElems The faces to be splitted.
578 * \param the13Diag Is used to choose a diagonal for splitting.
579 * \return TRUE in case of success, FALSE otherwise.
581 boolean SplitQuad (in long_array IDsOfElements,
585 * \brief Split quadrangles into triangles.
587 * Behaves like the above method, taking list of elements from \a theObject
589 boolean SplitQuadObject (in SMESH_IDSource theObject,
593 * Find better splitting of the given quadrangle.
594 * \param IDOfQuad ID of the quadrangle to be splitted.
595 * \param Criterion A criterion to choose a diagonal for splitting.
596 * \return 1 if 1-3 diagonal is better, 2 if 2-4
597 * diagonal is better, 0 if error occurs.
599 long BestSplit (in long IDOfQuad,
600 in NumericalFunctor Criterion);
602 enum Smooth_Method { LAPLACIAN_SMOOTH, CENTROIDAL_SMOOTH };
604 boolean Smooth(in long_array IDsOfElements,
605 in long_array IDsOfFixedNodes,
606 in long MaxNbOfIterations,
607 in double MaxAspectRatio,
608 in Smooth_Method Method);
610 boolean SmoothObject(in SMESH_IDSource theObject,
611 in long_array IDsOfFixedNodes,
612 in long MaxNbOfIterations,
613 in double MaxAspectRatio,
614 in Smooth_Method Method);
616 boolean SmoothParametric(in long_array IDsOfElements,
617 in long_array IDsOfFixedNodes,
618 in long MaxNbOfIterations,
619 in double MaxAspectRatio,
620 in Smooth_Method Method);
622 boolean SmoothParametricObject(in SMESH_IDSource theObject,
623 in long_array IDsOfFixedNodes,
624 in long MaxNbOfIterations,
625 in double MaxAspectRatio,
626 in Smooth_Method Method);
628 void RenumberNodes();
630 void RenumberElements();
632 void RotationSweep(in long_array IDsOfElements,
634 in double AngleInRadians,
636 in double Tolerance);
638 void RotationSweepObject(in SMESH_IDSource theObject,
640 in double AngleInRadians,
642 in double Tolerance);
644 void ExtrusionSweep(in long_array IDsOfElements,
645 in DirStruct StepVector,
649 * Generate new elements by extrusion of theElements
650 * by StepVector by NbOfSteps
651 * param ExtrFlags set flags for performing extrusion
652 * param SewTolerance - uses for comparing locations of nodes if flag
653 * EXTRUSION_FLAG_SEW is set
655 void AdvancedExtrusion(in long_array IDsOfElements,
656 in DirStruct StepVector,
659 in double SewTolerance);
661 void ExtrusionSweepObject(in SMESH_IDSource theObject,
662 in DirStruct StepVector,
665 void ExtrusionSweepObject1D(in SMESH_IDSource theObject,
666 in DirStruct StepVector,
669 void ExtrusionSweepObject2D(in SMESH_IDSource theObject,
670 in DirStruct StepVector,
673 enum Extrusion_Error {
678 EXTR_BAD_STARTING_NODE,
679 EXTR_BAD_ANGLES_NUMBER,
680 EXTR_CANT_GET_TANGENT
683 Extrusion_Error ExtrusionAlongPath(in long_array IDsOfElements,
684 in SMESH_Mesh PathMesh,
685 in GEOM::GEOM_Object PathShape,
687 in boolean HasAngles,
688 in double_array Angles,
689 in boolean HasRefPoint,
690 in PointStruct RefPoint);
692 Extrusion_Error ExtrusionAlongPathObject(in SMESH_IDSource theObject,
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 enum MirrorType { POINT, AXIS, PLANE };
703 void Mirror (in long_array IDsOfElements,
704 in AxisStruct Mirror,
705 in MirrorType theMirrorType,
708 void MirrorObject (in SMESH_IDSource theObject,
709 in AxisStruct Mirror,
710 in MirrorType theMirrorType,
713 void Translate (in long_array IDsOfElements,
717 void TranslateObject (in SMESH_IDSource theObject,
721 void Rotate (in long_array IDsOfElements,
723 in double AngleInRadians,
726 void RotateObject (in SMESH_IDSource theObject,
728 in double AngleInRadians,
731 void FindCoincidentNodes (in double Tolerance,
732 out array_of_long_array GroupsOfNodes);
734 void MergeNodes (in array_of_long_array GroupsOfNodes);
736 void MergeEqualElements();
740 SEW_BORDER1_NOT_FOUND,
741 SEW_BORDER2_NOT_FOUND,
742 SEW_BOTH_BORDERS_NOT_FOUND,
744 SEW_VOLUMES_TO_SPLIT,
745 // for SewSideElements() only:
746 SEW_DIFF_NB_OF_ELEMENTS,
747 SEW_TOPO_DIFF_SETS_OF_ELEMENTS,
752 Sew_Error SewFreeBorders (in long FirstNodeID1,
753 in long SecondNodeID1,
755 in long FirstNodeID2,
756 in long SecondNodeID2,
758 in boolean CreatePolygons,
759 in boolean CreatePolyedrs);
761 Sew_Error SewConformFreeBorders (in long FirstNodeID1,
762 in long SecondNodeID1,
764 in long FirstNodeID2,
765 in long SecondNodeID2);
767 Sew_Error SewBorderToSide (in long FirstNodeIDOnFreeBorder,
768 in long SecondNodeIDOnFreeBorder,
769 in long LastNodeIDOnFreeBorder,
770 in long FirstNodeIDOnSide,
771 in long LastNodeIDOnSide,
772 in boolean CreatePolygons,
773 in boolean CreatePolyedrs);
775 Sew_Error SewSideElements (in long_array IDsOfSide1Elements,
776 in long_array IDsOfSide2Elements,
777 in long NodeID1OfSide1ToMerge,
778 in long NodeID1OfSide2ToMerge,
779 in long NodeID2OfSide1ToMerge,
780 in long NodeID2OfSide2ToMerge);