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 ;
80 struct PointStruct { double x;
83 struct DirStruct { PointStruct PS ; } ; // analog to Occ Direction
85 struct AxisStruct { double x;
94 * Enumeration for element type, like in SMDS
106 * Enumeration for hypothesis status (used by AddHypothesis() and RemoveHypothesis() methods)
108 enum Hypothesis_Status // in the order of severity
111 HYP_MISSING, // algo misses a hypothesis
112 HYP_CONCURENT, // several applicable hypotheses
113 HYP_BAD_PARAMETER,// hypothesis has a bad parameter value
114 HYP_UNKNOWN_FATAL,// --- all statuses below should be considered as fatal
115 // for Add/RemoveHypothesis operations
116 HYP_INCOMPATIBLE, // hypothesis does not fit algo
117 HYP_NOTCONFORM, // not conform mesh is produced appling a hypothesis
118 HYP_ALREADY_EXIST,// such hypothesis already exist
119 HYP_BAD_DIM // bad dimension
123 * Enumeration for DriverMED read status (used by ImportMEDFile() method)
125 enum DriverMED_ReadStatus // in the order of severity
128 DRS_EMPTY, // a MED file contains no mesh with the given name
129 DRS_WARN_RENUMBER, // a MED file has overlapped ranges of element numbers,
130 // so the numbers from the file are ignored
131 DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
132 DRS_FAIL // general failure (exception etc.)
136 * Enumeration for DriverMED (used by Perform() method)
138 enum MED_VERSION // in the order of severity
144 typedef sequence<log_block> log_array;
147 interface SMESH_IDSource
150 * Returns a sequence of all element IDs
155 interface SMESH_GroupBase;
156 interface SMESH_Group;
157 interface SMESH_GroupOnGeom;
158 interface SMESH_subMesh;
159 interface SMESH_MeshEditor;
160 interface SMESH_Mesh : SALOME::GenericObj, SMESH_IDSource
163 * Associate a Shape to a Mesh created with NewEmpty
166 // boolean SetMesh(in GEOM::GEOM_Object anObject)
167 // raises (SALOME::SALOME_Exception);
170 * Get the subMesh object associated to a subShape. The subMesh object
171 * gives access to nodes and elements IDs.
172 * SubMesh will be used instead of SubShape in a next idl version to
173 * adress a specific subMesh...
175 SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
176 raises (SALOME::SALOME_Exception);
179 * Create a subMesh without reference to a subShape
181 // SMESH_subMesh NewEmpty()
182 // raises (SALOME::SALOME_Exception);
185 * Get geom shape to mesh. A result may be nil
187 GEOM::GEOM_Object GetShapeToMesh()
188 raises (SALOME::SALOME_Exception);
193 void RemoveSubMesh(in SMESH_subMesh aSubMesh)
194 raises (SALOME::SALOME_Exception);
199 SMESH_Group CreateGroup( in ElementType elem_type,
201 raises (SALOME::SALOME_Exception);
204 * Create a group from geometry group
206 SMESH_GroupOnGeom CreateGroupFromGEOM( in ElementType elem_type,
208 in GEOM::GEOM_Object theGeomObject )
209 raises (SALOME::SALOME_Exception);
214 void RemoveGroup(in SMESH_GroupBase aGroup)
215 raises (SALOME::SALOME_Exception);
218 * Remove group with its contents
220 void RemoveGroupWithContents( in SMESH_GroupBase aGroup )
221 raises (SALOME::SALOME_Exception);
224 * Union of two groups
225 * New group is created. All mesh elements that are
226 * present in initial groups are added to the new one
228 SMESH_Group UnionGroups (in SMESH_GroupBase aGroup1,
229 in SMESH_GroupBase aGroup2,
231 raises (SALOME::SALOME_Exception);
234 * Intersection of two groups
235 * New group is created. All mesh elements that are
236 * present in both initial groups are added to the new one.
238 SMESH_Group IntersectGroups (in SMESH_GroupBase aGroup1,
239 in SMESH_GroupBase aGroup2,
241 raises (SALOME::SALOME_Exception);
245 * New group is created. All mesh elements that are present in
246 * main group but do not present in tool group are added to the new one
248 SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
249 in SMESH_GroupBase aToolGroup,
251 raises (SALOME::SALOME_Exception);
254 * Add hypothesis to the mesh, under a particular subShape
255 * (or the main shape itself)
256 * The Add method is only used to prepare the build of the mesh and store
257 * the algorithms and associated parameters.
258 * Actual job of mesh the shape is done by MESH_Gen.
260 * - aSubShape : subShape obtained by a shape explode in GEOM
262 * - anHyp : hypothesis object
264 * - OK if the hypothesis is compatible with the subShape
265 * (and all previous hypothesis on the subShape)
266 * - NOK if the hypothesis is not compatible with the subShape
267 * (or one previous hypothesis on the subShape)
268 * raises exception if hypothesis has not been created
270 Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
271 in SMESH_Hypothesis anHyp)
272 raises (SALOME::SALOME_Exception);
273 // boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
274 // 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
323 SMESH_MeshEditor GetMeshEditor()
324 raises (SALOME::SALOME_Exception);
327 * Export Mesh to different MED Formats
329 * - auto_groups : boolean parameter for creating/not creating
330 * the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
331 * the typical use is auto_groups=false.
332 * - theVersion : define the version of format of MED file, that will be created
334 void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
335 raises (SALOME::SALOME_Exception);
337 * Export Mesh to MED_V2_1 MED format
338 * Works, just the same as ExportToMED, with MED_VERSION parameter equal to MED_V2_1.
339 * The method is kept in order to support old functionality
341 void ExportMED( in string file, in boolean auto_groups )
342 raises (SALOME::SALOME_Exception);
345 * Export Mesh to DAT, UNV and STL Formats
347 void ExportDAT( in string file )
348 raises (SALOME::SALOME_Exception);
349 void ExportUNV( in string file )
350 raises (SALOME::SALOME_Exception);
351 void ExportSTL( in string file, in boolean isascii )
352 raises (SALOME::SALOME_Exception);
357 SALOME_MED::MESH GetMEDMesh()
358 raises (SALOME::SALOME_Exception);
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);
396 long_array GetElementsId()
397 raises (SALOME::SALOME_Exception);
399 long_array GetElementsByType( in ElementType theType )
400 raises (SALOME::SALOME_Exception);
402 long_array GetNodesId()
403 raises (SALOME::SALOME_Exception);
408 interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
413 long GetNumberOfElements()
414 raises (SALOME::SALOME_Exception);
419 long GetNumberOfNodes( in boolean all )
420 raises (SALOME::SALOME_Exception);
425 long_array GetElementsId()
426 raises (SALOME::SALOME_Exception);
431 long_array GetElementsByType( in ElementType theType )
432 raises (SALOME::SALOME_Exception);
437 long_array GetNodesId()
438 raises (SALOME::SALOME_Exception);
441 * Get geom shape the submesh is dedicated to
443 GEOM::GEOM_Object GetSubShape()
444 raises (SALOME::SALOME_Exception);
447 * Get SMESH_Mesh which stores nodes coordinates & elements definition
449 SMESH_Mesh GetFather()
450 raises (SALOME::SALOME_Exception);
453 * Get the internal Id
460 SALOME_MED::FAMILY GetFamily()
461 raises (SALOME::SALOME_Exception);
465 * This interface makes modifications on the Mesh - removing elements and nodes etc.
467 interface NumericalFunctor;
468 interface SMESH_MeshEditor {
471 boolean RemoveElements(in long_array IDsOfElements);
473 boolean RemoveNodes(in long_array IDsOfNodes);
475 boolean AddNode(in double x, in double y, in double z);
477 boolean AddEdge(in long_array IDsOfNodes);
479 boolean AddFace(in long_array IDsOfNodes);
481 boolean AddVolume(in long_array IDsOfNodes);
483 boolean MoveNode(in long NodeID, in double x, in double y, in double z);
485 boolean InverseDiag(in long NodeID1, in long NodeID2);
487 boolean DeleteDiag(in long NodeID1, in long NodeID2);
489 boolean Reorient(in long_array IDsOfElements);
491 boolean ReorientObject(in SMESH_IDSource theObject);
493 boolean TriToQuad(in long_array IDsOfElements,
494 in NumericalFunctor Criterion,
497 boolean TriToQuadObject(in SMESH_IDSource theObject,
498 in NumericalFunctor Criterion,
501 boolean QuadToTri(in long_array IDsOfElements,
502 in NumericalFunctor Criterion);
504 boolean SplitQuad(in long_array IDsOfElements,
507 boolean SplitQuadObject(in SMESH_IDSource theObject,
510 enum Smooth_Method { LAPLACIAN_SMOOTH, CENTROIDAL_SMOOTH };
512 boolean Smooth(in long_array IDsOfElements,
513 in long_array IDsOfFixedNodes,
514 in long MaxNbOfIterations,
515 in double MaxAspectRatio,
516 in Smooth_Method Method);
518 boolean SmoothObject(in SMESH_IDSource theObject,
519 in long_array IDsOfFixedNodes,
520 in long MaxNbOfIterations,
521 in double MaxAspectRatio,
522 in Smooth_Method Method);
524 void RenumberNodes();
526 void RenumberElements();
528 void RotationSweep(in long_array IDsOfElements,
530 in double AngleInRadians,
532 in double Tolerance);
534 void RotationSweepObject(in SMESH_IDSource theObject,
536 in double AngleInRadians,
538 in double Tolerance);
540 void ExtrusionSweep(in long_array IDsOfElements,
541 in DirStruct StepVector,
544 void ExtrusionSweepObject(in SMESH_IDSource theObject,
545 in DirStruct StepVector,
548 void ExtrusionSweepObject1D(in SMESH_IDSource theObject,
549 in DirStruct StepVector,
552 void ExtrusionSweepObject2D(in SMESH_IDSource theObject,
553 in DirStruct StepVector,
556 enum Extrusion_Error {
561 EXTR_BAD_STARTING_NODE,
562 EXTR_BAD_ANGLES_NUMBER,
563 EXTR_CANT_GET_TANGENT
566 Extrusion_Error ExtrusionAlongPath(in long_array IDsOfElements,
567 in SMESH_Mesh PathMesh,
568 in GEOM::GEOM_Object PathShape,
570 in boolean HasAngles,
571 in double_array Angles,
572 in boolean HasRefPoint,
573 in PointStruct RefPoint);
575 Extrusion_Error ExtrusionAlongPathObject(in SMESH_IDSource theObject,
576 in SMESH_Mesh PathMesh,
577 in GEOM::GEOM_Object PathShape,
579 in boolean HasAngles,
580 in double_array Angles,
581 in boolean HasRefPoint,
582 in PointStruct RefPoint);
584 enum MirrorType { POINT, AXIS, PLANE };
586 void Mirror (in long_array IDsOfElements,
587 in AxisStruct Mirror,
588 in MirrorType theMirrorType,
591 void MirrorObject (in SMESH_IDSource theObject,
592 in AxisStruct Mirror,
593 in MirrorType theMirrorType,
596 void Translate (in long_array IDsOfElements,
600 void TranslateObject (in SMESH_IDSource theObject,
604 void Rotate (in long_array IDsOfElements,
606 in double AngleInRadians,
609 void RotateObject (in SMESH_IDSource theObject,
611 in double AngleInRadians,
614 void FindCoincidentNodes (in double Tolerance,
615 out array_of_long_array GroupsOfNodes);
617 void MergeNodes (in array_of_long_array GroupsOfNodes);
619 void MergeEqualElements();
623 SEW_BORDER1_NOT_FOUND,
624 SEW_BORDER2_NOT_FOUND,
625 SEW_BOTH_BORDERS_NOT_FOUND,
627 SEW_VOLUMES_TO_SPLIT,
628 // for SewSideElements() only:
629 SEW_DIFF_NB_OF_ELEMENTS,
630 SEW_TOPO_DIFF_SETS_OF_ELEMENTS,
635 Sew_Error SewFreeBorders (in long FirstNodeID1,
636 in long SecondNodeID1,
638 in long FirstNodeID2,
639 in long SecondNodeID2,
640 in long LastNodeID2);
642 Sew_Error SewConformFreeBorders (in long FirstNodeID1,
643 in long SecondNodeID1,
645 in long FirstNodeID2,
646 in long SecondNodeID2);
648 Sew_Error SewBorderToSide (in long FirstNodeIDOnFreeBorder,
649 in long SecondNodeIDOnFreeBorder,
650 in long LastNodeIDOnFreeBorder,
651 in long FirstNodeIDOnSide,
652 in long LastNodeIDOnSide);
654 Sew_Error SewSideElements (in long_array IDsOfSide1Elements,
655 in long_array IDsOfSide2Elements,
656 in long NodeID1OfSide1ToMerge,
657 in long NodeID1OfSide2ToMerge,
658 in long NodeID2OfSide1ToMerge,
659 in long NodeID2OfSide2ToMerge);