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;
150 interface SMESH_IDSource
153 * Returns a sequence of all element IDs
158 interface SMESH_GroupBase;
159 interface SMESH_Group;
160 interface SMESH_GroupOnGeom;
161 interface SMESH_subMesh;
162 interface SMESH_MeshEditor;
163 interface SMESH_Mesh : SALOME::GenericObj, SMESH_IDSource
166 * Associate a Shape to a Mesh created with NewEmpty
169 // boolean SetMesh(in GEOM::GEOM_Object anObject)
170 // raises (SALOME::SALOME_Exception);
173 * Get the subMesh object associated to a subShape. The subMesh object
174 * gives access to nodes and elements IDs.
175 * SubMesh will be used instead of SubShape in a next idl version to
176 * adress a specific subMesh...
178 SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
179 raises (SALOME::SALOME_Exception);
182 * Create a subMesh without reference to a subShape
184 // SMESH_subMesh NewEmpty()
185 // raises (SALOME::SALOME_Exception);
188 * Get geom shape to mesh. A result may be nil
190 GEOM::GEOM_Object GetShapeToMesh()
191 raises (SALOME::SALOME_Exception);
196 void RemoveSubMesh(in SMESH_subMesh aSubMesh)
197 raises (SALOME::SALOME_Exception);
202 SMESH_Group CreateGroup( in ElementType elem_type,
204 raises (SALOME::SALOME_Exception);
207 * Create a group from geometry group
209 SMESH_GroupOnGeom CreateGroupFromGEOM( in ElementType elem_type,
211 in GEOM::GEOM_Object theGeomObject )
212 raises (SALOME::SALOME_Exception);
217 void RemoveGroup(in SMESH_GroupBase aGroup)
218 raises (SALOME::SALOME_Exception);
221 * Remove group with its contents
223 void RemoveGroupWithContents( in SMESH_GroupBase aGroup )
224 raises (SALOME::SALOME_Exception);
227 * Union of two groups
228 * New group is created. All mesh elements that are
229 * present in initial groups are added to the new one
231 SMESH_Group UnionGroups (in SMESH_GroupBase aGroup1,
232 in SMESH_GroupBase aGroup2,
234 raises (SALOME::SALOME_Exception);
237 * Intersection of two groups
238 * New group is created. All mesh elements that are
239 * present in both initial groups are added to the new one.
241 SMESH_Group IntersectGroups (in SMESH_GroupBase aGroup1,
242 in SMESH_GroupBase aGroup2,
244 raises (SALOME::SALOME_Exception);
248 * New group is created. All mesh elements that are present in
249 * main group but do not present in tool group are added to the new one
251 SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
252 in SMESH_GroupBase aToolGroup,
254 raises (SALOME::SALOME_Exception);
257 * Add hypothesis to the mesh, under a particular subShape
258 * (or the main shape itself)
259 * The Add method is only used to prepare the build of the mesh and store
260 * the algorithms and associated parameters.
261 * Actual job of mesh the shape is done by MESH_Gen.
263 * - aSubShape : subShape obtained by a shape explode in GEOM
265 * - anHyp : hypothesis object
267 * - OK if the hypothesis is compatible with the subShape
268 * (and all previous hypothesis on the subShape)
269 * - NOK if the hypothesis is not compatible with the subShape
270 * (or one previous hypothesis on the subShape)
271 * raises exception if hypothesis has not been created
273 Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
274 in SMESH_Hypothesis anHyp)
275 raises (SALOME::SALOME_Exception);
276 // boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
277 // raises (SALOME::SALOME_Exception);
281 * Remove an hypothesis previouly added with AddHypothesis.
283 Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject,
284 in SMESH_Hypothesis anHyp)
285 raises (SALOME::SALOME_Exception);
286 // boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
287 // in SMESH_Hypothesis anHyp)
288 // raises (SALOME::SALOME_Exception);
291 * Get the list of hypothesis added on a subShape
293 ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Object aSubObject)
294 raises (SALOME::SALOME_Exception);
295 // ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
296 // raises (SALOME::SALOME_Exception);
299 * Get the log of nodes and elements added or removed since previous
302 * - clearAfterGet : log is emptied after Get (safe if concurrents access)
304 // string_array GetLog(in boolean clearAfterGet)
305 // raises (SALOME::SALOME_Exception);
306 log_array GetLog(in boolean clearAfterGet)
307 raises (SALOME::SALOME_Exception);
310 * Clear the log of nodes and elements added or removed since previous
311 * clear. Must be used immediately after GetLog if clearAfterGet is false.
314 raises (SALOME::SALOME_Exception);
317 * Get the internal Id
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);
340 * Export Mesh to MED_V2_1 MED format
341 * Works, just the same as ExportToMED, with MED_VERSION parameter equal to MED_V2_1.
342 * The method is kept in order to support old functionality
344 void ExportMED( in string file, in boolean auto_groups )
345 raises (SALOME::SALOME_Exception);
348 * Export Mesh to DAT, UNV and STL Formats
350 void ExportDAT( in string file )
351 raises (SALOME::SALOME_Exception);
352 void ExportUNV( in string file )
353 raises (SALOME::SALOME_Exception);
354 void ExportSTL( in string file, in boolean isascii )
355 raises (SALOME::SALOME_Exception);
360 SALOME_MED::MESH GetMEDMesh()
361 raises (SALOME::SALOME_Exception);
364 raises (SALOME::SALOME_Exception);
367 raises (SALOME::SALOME_Exception);
370 raises (SALOME::SALOME_Exception);
373 raises (SALOME::SALOME_Exception);
376 raises (SALOME::SALOME_Exception);
379 raises (SALOME::SALOME_Exception);
382 raises (SALOME::SALOME_Exception);
385 raises (SALOME::SALOME_Exception);
388 raises (SALOME::SALOME_Exception);
391 raises (SALOME::SALOME_Exception);
394 raises (SALOME::SALOME_Exception);
397 raises (SALOME::SALOME_Exception);
400 raises (SALOME::SALOME_Exception);
403 raises (SALOME::SALOME_Exception);
405 long_array GetElementsId()
406 raises (SALOME::SALOME_Exception);
408 long_array GetElementsByType( in ElementType theType )
409 raises (SALOME::SALOME_Exception);
411 long_array GetNodesId()
412 raises (SALOME::SALOME_Exception);
417 interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
422 long GetNumberOfElements()
423 raises (SALOME::SALOME_Exception);
428 long GetNumberOfNodes( in boolean all )
429 raises (SALOME::SALOME_Exception);
434 long_array GetElementsId()
435 raises (SALOME::SALOME_Exception);
440 long_array GetElementsByType( in ElementType theType )
441 raises (SALOME::SALOME_Exception);
446 long_array GetNodesId()
447 raises (SALOME::SALOME_Exception);
450 * Get geom shape the submesh is dedicated to
452 GEOM::GEOM_Object GetSubShape()
453 raises (SALOME::SALOME_Exception);
456 * Get SMESH_Mesh which stores nodes coordinates & elements definition
458 SMESH_Mesh GetFather()
459 raises (SALOME::SALOME_Exception);
462 * Get the internal Id
469 SALOME_MED::FAMILY GetFamily()
470 raises (SALOME::SALOME_Exception);
474 * This interface makes modifications on the Mesh - removing elements and nodes etc.
476 interface NumericalFunctor;
477 interface SMESH_MeshEditor {
480 boolean RemoveElements(in long_array IDsOfElements);
482 boolean RemoveNodes(in long_array IDsOfNodes);
484 boolean AddNode(in double x, in double y, in double z);
486 boolean AddEdge(in long_array IDsOfNodes);
488 boolean AddFace(in long_array IDsOfNodes);
490 boolean AddVolume(in long_array IDsOfNodes);
492 //boolean AddPolygonalFace (in long_array IdsOfNodes);
495 * Create volume of many faces, giving nodes for each face.
496 * \param IdsOfNodes List of node IDs for volume creation face by face.
497 * \param Quantities List of integer values, Quantities[i]
498 * gives quantity of nodes in face number i.
500 boolean AddPolyhedralVolume (in long_array IdsOfNodes,
501 in long_array Quantities);
504 * Create volume of many faces, giving IDs of existing faces.
505 * \param IdsOfFaces List of face IDs for volume creation.
506 * \note The created volume will refer only to nodes
507 * of the given faces, not to the faces itself.
509 boolean AddPolyhedralVolumeByFaces (in long_array IdsOfFaces);
511 boolean MoveNode(in long NodeID, in double x, in double y, in double z);
513 boolean InverseDiag(in long NodeID1, in long NodeID2);
515 boolean DeleteDiag(in long NodeID1, in long NodeID2);
517 boolean Reorient(in long_array IDsOfElements);
519 boolean ReorientObject(in SMESH_IDSource theObject);
521 boolean TriToQuad(in long_array IDsOfElements,
522 in NumericalFunctor Criterion,
525 boolean TriToQuadObject(in SMESH_IDSource theObject,
526 in NumericalFunctor Criterion,
529 boolean QuadToTri(in long_array IDsOfElements,
530 in NumericalFunctor Criterion);
532 boolean SplitQuad(in long_array IDsOfElements,
535 boolean SplitQuadObject(in SMESH_IDSource theObject,
538 enum Smooth_Method { LAPLACIAN_SMOOTH, CENTROIDAL_SMOOTH };
540 boolean Smooth(in long_array IDsOfElements,
541 in long_array IDsOfFixedNodes,
542 in long MaxNbOfIterations,
543 in double MaxAspectRatio,
544 in Smooth_Method Method);
546 boolean SmoothObject(in SMESH_IDSource theObject,
547 in long_array IDsOfFixedNodes,
548 in long MaxNbOfIterations,
549 in double MaxAspectRatio,
550 in Smooth_Method Method);
552 boolean SmoothParametric(in long_array IDsOfElements,
553 in long_array IDsOfFixedNodes,
554 in long MaxNbOfIterations,
555 in double MaxAspectRatio,
556 in Smooth_Method Method);
558 boolean SmoothParametricObject(in SMESH_IDSource theObject,
559 in long_array IDsOfFixedNodes,
560 in long MaxNbOfIterations,
561 in double MaxAspectRatio,
562 in Smooth_Method Method);
564 void RenumberNodes();
566 void RenumberElements();
568 void RotationSweep(in long_array IDsOfElements,
570 in double AngleInRadians,
572 in double Tolerance);
574 void RotationSweepObject(in SMESH_IDSource theObject,
576 in double AngleInRadians,
578 in double Tolerance);
580 void ExtrusionSweep(in long_array IDsOfElements,
581 in DirStruct StepVector,
584 void ExtrusionSweepObject(in SMESH_IDSource theObject,
585 in DirStruct StepVector,
588 void ExtrusionSweepObject1D(in SMESH_IDSource theObject,
589 in DirStruct StepVector,
592 void ExtrusionSweepObject2D(in SMESH_IDSource theObject,
593 in DirStruct StepVector,
596 enum Extrusion_Error {
601 EXTR_BAD_STARTING_NODE,
602 EXTR_BAD_ANGLES_NUMBER,
603 EXTR_CANT_GET_TANGENT
606 Extrusion_Error ExtrusionAlongPath(in long_array IDsOfElements,
607 in SMESH_Mesh PathMesh,
608 in GEOM::GEOM_Object PathShape,
610 in boolean HasAngles,
611 in double_array Angles,
612 in boolean HasRefPoint,
613 in PointStruct RefPoint);
615 Extrusion_Error ExtrusionAlongPathObject(in SMESH_IDSource theObject,
616 in SMESH_Mesh PathMesh,
617 in GEOM::GEOM_Object PathShape,
619 in boolean HasAngles,
620 in double_array Angles,
621 in boolean HasRefPoint,
622 in PointStruct RefPoint);
624 enum MirrorType { POINT, AXIS, PLANE };
626 void Mirror (in long_array IDsOfElements,
627 in AxisStruct Mirror,
628 in MirrorType theMirrorType,
631 void MirrorObject (in SMESH_IDSource theObject,
632 in AxisStruct Mirror,
633 in MirrorType theMirrorType,
636 void Translate (in long_array IDsOfElements,
640 void TranslateObject (in SMESH_IDSource theObject,
644 void Rotate (in long_array IDsOfElements,
646 in double AngleInRadians,
649 void RotateObject (in SMESH_IDSource theObject,
651 in double AngleInRadians,
654 void FindCoincidentNodes (in double Tolerance,
655 out array_of_long_array GroupsOfNodes);
657 void MergeNodes (in array_of_long_array GroupsOfNodes);
659 void MergeEqualElements();
663 SEW_BORDER1_NOT_FOUND,
664 SEW_BORDER2_NOT_FOUND,
665 SEW_BOTH_BORDERS_NOT_FOUND,
667 SEW_VOLUMES_TO_SPLIT,
668 // for SewSideElements() only:
669 SEW_DIFF_NB_OF_ELEMENTS,
670 SEW_TOPO_DIFF_SETS_OF_ELEMENTS,
675 Sew_Error SewFreeBorders (in long FirstNodeID1,
676 in long SecondNodeID1,
678 in long FirstNodeID2,
679 in long SecondNodeID2,
681 in boolean CreatePolygons,
682 in boolean CreatePolyedrs);
684 Sew_Error SewConformFreeBorders (in long FirstNodeID1,
685 in long SecondNodeID1,
687 in long FirstNodeID2,
688 in long SecondNodeID2);
690 Sew_Error SewBorderToSide (in long FirstNodeIDOnFreeBorder,
691 in long SecondNodeIDOnFreeBorder,
692 in long LastNodeIDOnFreeBorder,
693 in long FirstNodeIDOnSide,
694 in long LastNodeIDOnSide,
695 in boolean CreatePolygons,
696 in boolean CreatePolyedrs);
698 Sew_Error SewSideElements (in long_array IDsOfSide1Elements,
699 in long_array IDsOfSide2Elements,
700 in long NodeID1OfSide1ToMerge,
701 in long NodeID1OfSide2ToMerge,
702 in long NodeID2OfSide1ToMerge,
703 in long NodeID2OfSide2ToMerge);