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
130 HYP_BAD_SUBSHAPE // shape is neither the main one, nor its subshape, nor a group
134 * Enumeration for DriverMED read status (used by ImportMEDFile() method)
136 enum DriverMED_ReadStatus // in the order of severity
139 DRS_EMPTY, // a MED file contains no mesh with the given name
140 DRS_WARN_RENUMBER, // a MED file has overlapped ranges of element numbers,
141 // so the numbers from the file are ignored
142 DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
143 DRS_FAIL // general failure (exception etc.)
147 * Enumeration for DriverMED (used by Perform() method)
149 enum MED_VERSION // in the order of severity
155 typedef sequence<log_block> log_array;
159 * Auxilary flags for advanced extrusion.
160 * BOUNDARY: create or not boundary for result of extrusion
161 * SEW: try to use existing nodes or create new nodes in any case
163 const long EXTRUSION_FLAG_BOUNDARY = 1;
164 const long EXTRUSION_FLAG_SEW = 2;
166 interface SMESH_IDSource
169 * Returns a sequence of all element IDs
174 interface SMESH_GroupBase;
175 interface SMESH_Group;
176 interface SMESH_GroupOnGeom;
177 interface SMESH_subMesh;
178 interface SMESH_MeshEditor;
179 interface SMESH_Mesh : SALOME::GenericObj, SMESH_IDSource
182 // * Associate a Shape to a Mesh created with NewEmpty
184 //boolean SetMesh(in GEOM::GEOM_Object anObject)
185 // raises (SALOME::SALOME_Exception);
188 * Get the subMesh object associated to a subShape. The subMesh object
189 * gives access to nodes and elements IDs.
190 * SubMesh will be used instead of SubShape in a next idl version to
191 * adress a specific subMesh...
193 SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
194 raises (SALOME::SALOME_Exception);
197 // * Create a subMesh without reference to a subShape
199 //SMESH_subMesh NewEmpty()
200 // raises (SALOME::SALOME_Exception);
203 * Get geom shape to mesh. A result may be nil
205 GEOM::GEOM_Object GetShapeToMesh()
206 raises (SALOME::SALOME_Exception);
211 void RemoveSubMesh(in SMESH_subMesh aSubMesh)
212 raises (SALOME::SALOME_Exception);
217 SMESH_Group CreateGroup( in ElementType elem_type,
219 raises (SALOME::SALOME_Exception);
222 * Create a group from geometry group
224 SMESH_GroupOnGeom CreateGroupFromGEOM( in ElementType elem_type,
226 in GEOM::GEOM_Object theGeomObject )
227 raises (SALOME::SALOME_Exception);
232 void RemoveGroup(in SMESH_GroupBase aGroup)
233 raises (SALOME::SALOME_Exception);
236 * Remove group with its contents
238 void RemoveGroupWithContents( in SMESH_GroupBase aGroup )
239 raises (SALOME::SALOME_Exception);
242 * Union of two groups
243 * New group is created. All mesh elements that are
244 * present in initial groups are added to the new one
246 SMESH_Group UnionGroups (in SMESH_GroupBase aGroup1,
247 in SMESH_GroupBase aGroup2,
249 raises (SALOME::SALOME_Exception);
252 * Intersection of two groups
253 * New group is created. All mesh elements that are
254 * present in both initial groups are added to the new one.
256 SMESH_Group IntersectGroups (in SMESH_GroupBase aGroup1,
257 in SMESH_GroupBase aGroup2,
259 raises (SALOME::SALOME_Exception);
263 * New group is created. All mesh elements that are present in
264 * main group but do not present in tool group are added to the new one
266 SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
267 in SMESH_GroupBase aToolGroup,
269 raises (SALOME::SALOME_Exception);
272 * Add hypothesis to the mesh, under a particular subShape
273 * (or the main shape itself)
274 * The Add method is only used to prepare the build of the mesh and store
275 * the algorithms and associated parameters.
276 * Actual job of mesh the shape is done by MESH_Gen.
278 * - aSubShape : subShape obtained by a shape explode in GEOM
280 * - anHyp : hypothesis object
282 * - OK if the hypothesis is compatible with the subShape
283 * (and all previous hypothesis on the subShape)
284 * - NOK if the hypothesis is not compatible with the subShape
285 * (or one previous hypothesis on the subShape)
286 * raises exception if hypothesis has not been created
288 Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
289 in SMESH_Hypothesis anHyp)
290 raises (SALOME::SALOME_Exception);
291 // boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
292 // raises (SALOME::SALOME_Exception);
295 * Remove an hypothesis previouly added with AddHypothesis.
297 Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject,
298 in SMESH_Hypothesis anHyp)
299 raises (SALOME::SALOME_Exception);
300 // boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
301 // in SMESH_Hypothesis anHyp)
302 // raises (SALOME::SALOME_Exception);
305 * Get the list of hypothesis added on a subShape
307 ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Object aSubObject)
308 raises (SALOME::SALOME_Exception);
309 // ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
310 // raises (SALOME::SALOME_Exception);
313 * Get the log of nodes and elements added or removed since previous
316 * - clearAfterGet : log is emptied after Get (safe if concurrents access)
318 // string_array GetLog(in boolean clearAfterGet)
319 // raises (SALOME::SALOME_Exception);
320 log_array GetLog(in boolean clearAfterGet)
321 raises (SALOME::SALOME_Exception);
324 * Clear the log of nodes and elements added or removed since previous
325 * clear. Must be used immediately after GetLog if clearAfterGet is false.
328 raises (SALOME::SALOME_Exception);
331 * Get the internal Id
341 * Obtain instance of SMESH_MeshEditor
343 SMESH_MeshEditor GetMeshEditor()
344 raises (SALOME::SALOME_Exception);
346 /*! Check group names for duplications.
347 * Consider maximum group name length stored in MED file.
349 boolean HasDuplicatedGroupNamesMED();
352 * Export Mesh to different MED Formats
354 * - auto_groups : boolean parameter for creating/not creating
355 * the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
356 * the typical use is auto_groups=false.
357 * - theVersion : define the version of format of MED file, that will be created
359 void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
360 raises (SALOME::SALOME_Exception);
363 * Export Mesh to MED_V2_1 MED format
364 * Works, just the same as ExportToMED, with MED_VERSION parameter equal to MED_V2_1.
365 * The method is kept in order to support old functionality
367 void ExportMED( in string file, in boolean auto_groups )
368 raises (SALOME::SALOME_Exception);
371 * Export Mesh to DAT, UNV and STL Formats
373 void ExportDAT( in string file )
374 raises (SALOME::SALOME_Exception);
375 void ExportUNV( in string file )
376 raises (SALOME::SALOME_Exception);
377 void ExportSTL( in string file, in boolean isascii )
378 raises (SALOME::SALOME_Exception);
383 SALOME_MED::MESH GetMEDMesh()
384 raises (SALOME::SALOME_Exception);
387 * Get informations about mesh contents
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);
426 raises (SALOME::SALOME_Exception);
429 raises (SALOME::SALOME_Exception);
431 long_array GetElementsId()
432 raises (SALOME::SALOME_Exception);
434 long_array GetElementsByType( in ElementType theType )
435 raises (SALOME::SALOME_Exception);
437 long_array GetNodesId()
438 raises (SALOME::SALOME_Exception);
441 * Returns type of mesh element
443 ElementType GetElementType( in long id, in boolean iselem )
444 raises (SALOME::SALOME_Exception);
447 * Get mesh description
458 interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
463 long GetNumberOfElements()
464 raises (SALOME::SALOME_Exception);
469 long GetNumberOfNodes( in boolean all )
470 raises (SALOME::SALOME_Exception);
475 long_array GetElementsId()
476 raises (SALOME::SALOME_Exception);
481 long_array GetElementsByType( in ElementType theType )
482 raises (SALOME::SALOME_Exception);
485 * Return type of submesh element
487 ElementType GetElementType( in long id, in boolean iselem )
488 raises (SALOME::SALOME_Exception);
493 long_array GetNodesId()
494 raises (SALOME::SALOME_Exception);
497 * Get geom shape the submesh is dedicated to
499 GEOM::GEOM_Object GetSubShape()
500 raises (SALOME::SALOME_Exception);
503 * Get SMESH_Mesh which stores nodes coordinates & elements definition
505 SMESH_Mesh GetFather()
506 raises (SALOME::SALOME_Exception);
509 * Get the internal Id
516 SALOME_MED::FAMILY GetFamily()
517 raises (SALOME::SALOME_Exception);
521 * This interface makes modifications on the Mesh - removing elements and nodes etc.
523 interface NumericalFunctor;
524 interface SMESH_MeshEditor
526 boolean RemoveElements(in long_array IDsOfElements);
528 boolean RemoveNodes(in long_array IDsOfNodes);
530 boolean AddNode(in double x, in double y, in double z);
532 boolean AddEdge(in long_array IDsOfNodes);
534 boolean AddFace(in long_array IDsOfNodes);
536 boolean AddPolygonalFace(in long_array IdsOfNodes);
538 boolean AddVolume(in long_array IDsOfNodes);
541 * Create volume of many faces, giving nodes for each face.
542 * \param IdsOfNodes List of node IDs for volume creation face by face.
543 * \param Quantities List of integer values, Quantities[i]
544 * gives quantity of nodes in face number i.
546 boolean AddPolyhedralVolume (in long_array IdsOfNodes,
547 in long_array Quantities);
550 * Create volume of many faces, giving IDs of existing faces.
551 * \param IdsOfFaces List of face IDs for volume creation.
552 * \note The created volume will refer only to nodes
553 * of the given faces, not to the faces itself.
555 boolean AddPolyhedralVolumeByFaces (in long_array IdsOfFaces);
557 boolean MoveNode(in long NodeID, in double x, in double y, in double z);
559 boolean InverseDiag(in long NodeID1, in long NodeID2);
561 boolean DeleteDiag(in long NodeID1, in long NodeID2);
563 boolean Reorient(in long_array IDsOfElements);
565 boolean ReorientObject(in SMESH_IDSource theObject);
568 * \brief Fuse neighbour triangles into quadrangles.
569 * \param theElems The triangles to be fused.
570 * \param theCriterion Is used to choose a neighbour to fuse with.
571 * \param theMaxAngle Is a max angle between element normals at which fusion
572 * is still performed; theMaxAngle is mesured in radians.
573 * \return TRUE in case of success, FALSE otherwise.
575 boolean TriToQuad (in long_array IDsOfElements,
576 in NumericalFunctor Criterion,
580 * \brief Fuse neighbour triangles into quadrangles.
582 * Behaves like the above method, taking list of elements from \a theObject
584 boolean TriToQuadObject (in SMESH_IDSource theObject,
585 in NumericalFunctor Criterion,
589 * \brief Split quadrangles into triangles.
590 * \param theElems The faces to be splitted.
591 * \param theCriterion Is used to choose a diagonal for splitting.
592 * \return TRUE in case of success, FALSE otherwise.
594 boolean QuadToTri (in long_array IDsOfElements,
595 in NumericalFunctor Criterion);
598 * \brief Split quadrangles into triangles.
600 * Behaves like the above method, taking list of elements from \a theObject
602 boolean QuadToTriObject (in SMESH_IDSource theObject,
603 in NumericalFunctor Criterion);
606 * \brief Split quadrangles into triangles.
607 * \param theElems The faces to be splitted.
608 * \param the13Diag Is used to choose a diagonal for splitting.
609 * \return TRUE in case of success, FALSE otherwise.
611 boolean SplitQuad (in long_array IDsOfElements,
615 * \brief Split quadrangles into triangles.
617 * Behaves like the above method, taking list of elements from \a theObject
619 boolean SplitQuadObject (in SMESH_IDSource theObject,
623 * Find better splitting of the given quadrangle.
624 * \param IDOfQuad ID of the quadrangle to be splitted.
625 * \param Criterion A criterion to choose a diagonal for splitting.
626 * \return 1 if 1-3 diagonal is better, 2 if 2-4
627 * diagonal is better, 0 if error occurs.
629 long BestSplit (in long IDOfQuad,
630 in NumericalFunctor Criterion);
632 enum Smooth_Method { LAPLACIAN_SMOOTH, CENTROIDAL_SMOOTH };
634 boolean Smooth(in long_array IDsOfElements,
635 in long_array IDsOfFixedNodes,
636 in long MaxNbOfIterations,
637 in double MaxAspectRatio,
638 in Smooth_Method Method);
640 boolean SmoothObject(in SMESH_IDSource theObject,
641 in long_array IDsOfFixedNodes,
642 in long MaxNbOfIterations,
643 in double MaxAspectRatio,
644 in Smooth_Method Method);
646 boolean SmoothParametric(in long_array IDsOfElements,
647 in long_array IDsOfFixedNodes,
648 in long MaxNbOfIterations,
649 in double MaxAspectRatio,
650 in Smooth_Method Method);
652 boolean SmoothParametricObject(in SMESH_IDSource theObject,
653 in long_array IDsOfFixedNodes,
654 in long MaxNbOfIterations,
655 in double MaxAspectRatio,
656 in Smooth_Method Method);
658 void RenumberNodes();
660 void RenumberElements();
662 void RotationSweep(in long_array IDsOfElements,
664 in double AngleInRadians,
666 in double Tolerance);
668 void RotationSweepObject(in SMESH_IDSource theObject,
670 in double AngleInRadians,
672 in double Tolerance);
674 void ExtrusionSweep(in long_array IDsOfElements,
675 in DirStruct StepVector,
679 * Generate new elements by extrusion of theElements
680 * by StepVector by NbOfSteps
681 * param ExtrFlags set flags for performing extrusion
682 * param SewTolerance - uses for comparing locations of nodes if flag
683 * EXTRUSION_FLAG_SEW is set
685 void AdvancedExtrusion(in long_array IDsOfElements,
686 in DirStruct StepVector,
689 in double SewTolerance);
691 void ExtrusionSweepObject(in SMESH_IDSource theObject,
692 in DirStruct StepVector,
695 void ExtrusionSweepObject1D(in SMESH_IDSource theObject,
696 in DirStruct StepVector,
699 void ExtrusionSweepObject2D(in SMESH_IDSource theObject,
700 in DirStruct StepVector,
703 enum Extrusion_Error {
708 EXTR_BAD_STARTING_NODE,
709 EXTR_BAD_ANGLES_NUMBER,
710 EXTR_CANT_GET_TANGENT
713 Extrusion_Error ExtrusionAlongPath(in long_array IDsOfElements,
714 in SMESH_Mesh PathMesh,
715 in GEOM::GEOM_Object PathShape,
717 in boolean HasAngles,
718 in double_array Angles,
719 in boolean HasRefPoint,
720 in PointStruct RefPoint);
722 Extrusion_Error ExtrusionAlongPathObject(in SMESH_IDSource theObject,
723 in SMESH_Mesh PathMesh,
724 in GEOM::GEOM_Object PathShape,
726 in boolean HasAngles,
727 in double_array Angles,
728 in boolean HasRefPoint,
729 in PointStruct RefPoint);
731 enum MirrorType { POINT, AXIS, PLANE };
733 void Mirror (in long_array IDsOfElements,
734 in AxisStruct Mirror,
735 in MirrorType theMirrorType,
738 void MirrorObject (in SMESH_IDSource theObject,
739 in AxisStruct Mirror,
740 in MirrorType theMirrorType,
743 void Translate (in long_array IDsOfElements,
747 void TranslateObject (in SMESH_IDSource theObject,
751 void Rotate (in long_array IDsOfElements,
753 in double AngleInRadians,
756 void RotateObject (in SMESH_IDSource theObject,
758 in double AngleInRadians,
761 void FindCoincidentNodes (in double Tolerance,
762 out array_of_long_array GroupsOfNodes);
764 void MergeNodes (in array_of_long_array GroupsOfNodes);
766 void MergeEqualElements();
770 SEW_BORDER1_NOT_FOUND,
771 SEW_BORDER2_NOT_FOUND,
772 SEW_BOTH_BORDERS_NOT_FOUND,
774 SEW_VOLUMES_TO_SPLIT,
775 // for SewSideElements() only:
776 SEW_DIFF_NB_OF_ELEMENTS,
777 SEW_TOPO_DIFF_SETS_OF_ELEMENTS,
782 Sew_Error SewFreeBorders (in long FirstNodeID1,
783 in long SecondNodeID1,
785 in long FirstNodeID2,
786 in long SecondNodeID2,
788 in boolean CreatePolygons,
789 in boolean CreatePolyedrs);
791 Sew_Error SewConformFreeBorders (in long FirstNodeID1,
792 in long SecondNodeID1,
794 in long FirstNodeID2,
795 in long SecondNodeID2);
797 Sew_Error SewBorderToSide (in long FirstNodeIDOnFreeBorder,
798 in long SecondNodeIDOnFreeBorder,
799 in long LastNodeIDOnFreeBorder,
800 in long FirstNodeIDOnSide,
801 in long LastNodeIDOnSide,
802 in boolean CreatePolygons,
803 in boolean CreatePolyedrs);
805 Sew_Error SewSideElements (in long_array IDsOfSide1Elements,
806 in long_array IDsOfSide2Elements,
807 in long NodeID1OfSide1ToMerge,
808 in long NodeID1OfSide2ToMerge,
809 in long NodeID2OfSide1ToMerge,
810 in long NodeID2OfSide2ToMerge);