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 MED Formats
329 void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
330 raises (SALOME::SALOME_Exception);
331 void ExportMED( in string file, in boolean auto_groups )
332 raises (SALOME::SALOME_Exception);
335 * Export Mesh to DAT, UNV and STL Formats
337 void ExportDAT( in string file )
338 raises (SALOME::SALOME_Exception);
339 void ExportUNV( in string file )
340 raises (SALOME::SALOME_Exception);
341 void ExportSTL( in string file, in boolean isascii )
342 raises (SALOME::SALOME_Exception);
347 SALOME_MED::MESH GetMEDMesh()
348 raises (SALOME::SALOME_Exception);
351 raises (SALOME::SALOME_Exception);
354 raises (SALOME::SALOME_Exception);
357 raises (SALOME::SALOME_Exception);
360 raises (SALOME::SALOME_Exception);
363 raises (SALOME::SALOME_Exception);
366 raises (SALOME::SALOME_Exception);
369 raises (SALOME::SALOME_Exception);
372 raises (SALOME::SALOME_Exception);
375 raises (SALOME::SALOME_Exception);
378 raises (SALOME::SALOME_Exception);
381 raises (SALOME::SALOME_Exception);
384 raises (SALOME::SALOME_Exception);
386 long_array GetElementsId()
387 raises (SALOME::SALOME_Exception);
389 long_array GetElementsByType( in ElementType theType )
390 raises (SALOME::SALOME_Exception);
392 long_array GetNodesId()
393 raises (SALOME::SALOME_Exception);
398 interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
403 long GetNumberOfElements()
404 raises (SALOME::SALOME_Exception);
409 long GetNumberOfNodes( in boolean all )
410 raises (SALOME::SALOME_Exception);
415 long_array GetElementsId()
416 raises (SALOME::SALOME_Exception);
421 long_array GetElementsByType( in ElementType theType )
422 raises (SALOME::SALOME_Exception);
427 long_array GetNodesId()
428 raises (SALOME::SALOME_Exception);
431 * Get geom shape the submesh is dedicated to
433 GEOM::GEOM_Object GetSubShape()
434 raises (SALOME::SALOME_Exception);
437 * Get SMESH_Mesh which stores nodes coordinates & elements definition
439 SMESH_Mesh GetFather()
440 raises (SALOME::SALOME_Exception);
443 * Get the internal Id
450 SALOME_MED::FAMILY GetFamily()
451 raises (SALOME::SALOME_Exception);
455 * This interface makes modifications on the Mesh - removing elements and nodes etc.
457 interface NumericalFunctor;
458 interface SMESH_MeshEditor {
461 boolean RemoveElements(in long_array IDsOfElements);
463 boolean RemoveNodes(in long_array IDsOfNodes);
465 boolean AddNode(in double x, in double y, in double z);
467 boolean AddEdge(in long_array IDsOfNodes);
469 boolean AddFace(in long_array IDsOfNodes);
471 boolean AddVolume(in long_array IDsOfNodes);
473 boolean MoveNode(in long NodeID, in double x, in double y, in double z);
475 boolean InverseDiag(in long NodeID1, in long NodeID2);
477 boolean DeleteDiag(in long NodeID1, in long NodeID2);
479 boolean Reorient(in long_array IDsOfElements);
481 boolean ReorientObject(in SMESH_IDSource theObject);
483 boolean TriToQuad(in long_array IDsOfElements,
484 in NumericalFunctor Criterion,
487 boolean TriToQuadObject(in SMESH_IDSource theObject,
488 in NumericalFunctor Criterion,
491 boolean QuadToTri(in long_array IDsOfElements,
492 in NumericalFunctor Criterion);
494 boolean SplitQuad(in long_array IDsOfElements,
497 boolean SplitQuadObject(in SMESH_IDSource theObject,
500 enum Smooth_Method { LAPLACIAN_SMOOTH, CENTROIDAL_SMOOTH };
502 boolean Smooth(in long_array IDsOfElements,
503 in long_array IDsOfFixedNodes,
504 in long MaxNbOfIterations,
505 in double MaxAspectRatio,
506 in Smooth_Method Method);
508 boolean SmoothObject(in SMESH_IDSource theObject,
509 in long_array IDsOfFixedNodes,
510 in long MaxNbOfIterations,
511 in double MaxAspectRatio,
512 in Smooth_Method Method);
514 void RenumberNodes();
516 void RenumberElements();
518 void RotationSweep(in long_array IDsOfElements,
520 in double AngleInRadians,
522 in double Tolerance);
524 void RotationSweepObject(in SMESH_IDSource theObject,
526 in double AngleInRadians,
528 in double Tolerance);
530 void ExtrusionSweep(in long_array IDsOfElements,
531 in DirStruct StepVector,
534 void ExtrusionSweepObject(in SMESH_IDSource theObject,
535 in DirStruct StepVector,
538 enum Extrusion_Error {
543 EXTR_BAD_STARTING_NODE,
544 EXTR_BAD_ANGLES_NUMBER,
545 EXTR_CANT_GET_TANGENT
548 Extrusion_Error ExtrusionAlongPath(in long_array IDsOfElements,
549 in SMESH_Mesh PathMesh,
550 in GEOM::GEOM_Object PathShape,
552 in boolean HasAngles,
553 in double_array Angles,
554 in boolean HasRefPoint,
555 in PointStruct RefPoint);
557 Extrusion_Error ExtrusionAlongPathObject(in SMESH_IDSource theObject,
558 in SMESH_Mesh PathMesh,
559 in GEOM::GEOM_Object PathShape,
561 in boolean HasAngles,
562 in double_array Angles,
563 in boolean HasRefPoint,
564 in PointStruct RefPoint);
566 enum MirrorType { POINT, AXIS, PLANE };
568 void Mirror (in long_array IDsOfElements,
569 in AxisStruct Mirror,
570 in MirrorType theMirrorType,
573 void MirrorObject (in SMESH_IDSource theObject,
574 in AxisStruct Mirror,
575 in MirrorType theMirrorType,
578 void Translate (in long_array IDsOfElements,
582 void TranslateObject (in SMESH_IDSource theObject,
586 void Rotate (in long_array IDsOfElements,
588 in double AngleInRadians,
591 void RotateObject (in SMESH_IDSource theObject,
593 in double AngleInRadians,
596 void FindCoincidentNodes (in double Tolerance,
597 out array_of_long_array GroupsOfNodes);
599 void MergeNodes (in array_of_long_array GroupsOfNodes);
601 void MergeEqualElements();
605 SEW_BORDER1_NOT_FOUND,
606 SEW_BORDER2_NOT_FOUND,
607 SEW_BOTH_BORDERS_NOT_FOUND,
609 SEW_VOLUMES_TO_SPLIT,
610 // for SewSideElements() only:
611 SEW_DIFF_NB_OF_ELEMENTS,
612 SEW_TOPO_DIFF_SETS_OF_ELEMENTS,
617 Sew_Error SewFreeBorders (in long FirstNodeID1,
618 in long SecondNodeID1,
620 in long FirstNodeID2,
621 in long SecondNodeID2,
622 in long LastNodeID2);
624 Sew_Error SewConformFreeBorders (in long FirstNodeID1,
625 in long SecondNodeID1,
627 in long FirstNodeID2,
628 in long SecondNodeID2);
630 Sew_Error SewBorderToSide (in long FirstNodeIDOnFreeBorder,
631 in long SecondNodeIDOnFreeBorder,
632 in long LastNodeIDOnFreeBorder,
633 in long FirstNodeIDOnSide,
634 in long LastNodeIDOnSide);
636 Sew_Error SewSideElements (in long_array IDsOfSide1Elements,
637 in long_array IDsOfSide2Elements,
638 in long NodeID1OfSide1ToMerge,
639 in long NodeID1OfSide2ToMerge,
640 in long NodeID2OfSide1ToMerge,
641 in long NodeID2OfSide2ToMerge);