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.)
135 typedef sequence<log_block> log_array;
138 interface SMESH_IDSource
141 * Returns a sequence of all element IDs
146 interface SMESH_GroupBase;
147 interface SMESH_Group;
148 interface SMESH_GroupOnGeom;
149 interface SMESH_subMesh;
150 interface SMESH_MeshEditor;
151 interface SMESH_Mesh : SALOME::GenericObj, SMESH_IDSource
154 * Associate a Shape to a Mesh created with NewEmpty
157 // boolean SetMesh(in GEOM::GEOM_Object anObject)
158 // raises (SALOME::SALOME_Exception);
161 * Get the subMesh object associated to a subShape. The subMesh object
162 * gives access to nodes and elements IDs.
163 * SubMesh will be used instead of SubShape in a next idl version to
164 * adress a specific subMesh...
166 SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
167 raises (SALOME::SALOME_Exception);
170 * Create a subMesh without reference to a subShape
172 // SMESH_subMesh NewEmpty()
173 // raises (SALOME::SALOME_Exception);
176 * Get geom shape to mesh. A result may be nil
178 GEOM::GEOM_Object GetShapeToMesh()
179 raises (SALOME::SALOME_Exception);
184 void RemoveSubMesh(in SMESH_subMesh aSubMesh)
185 raises (SALOME::SALOME_Exception);
190 SMESH_Group CreateGroup( in ElementType elem_type,
192 raises (SALOME::SALOME_Exception);
195 * Create a group from geometry group
197 SMESH_GroupOnGeom CreateGroupFromGEOM( in ElementType elem_type,
199 in GEOM::GEOM_Object theGeomObject )
200 raises (SALOME::SALOME_Exception);
205 void RemoveGroup(in SMESH_GroupBase aGroup)
206 raises (SALOME::SALOME_Exception);
209 * Remove group with its contents
211 void RemoveGroupWithContents( in SMESH_GroupBase aGroup )
212 raises (SALOME::SALOME_Exception);
215 * Union of two groups
216 * New group is created. All mesh elements that are
217 * present in initial groups are added to the new one
219 SMESH_Group UnionGroups (in SMESH_GroupBase aGroup1,
220 in SMESH_GroupBase aGroup2,
222 raises (SALOME::SALOME_Exception);
225 * Intersection of two groups
226 * New group is created. All mesh elements that are
227 * present in both initial groups are added to the new one.
229 SMESH_Group IntersectGroups (in SMESH_GroupBase aGroup1,
230 in SMESH_GroupBase aGroup2,
232 raises (SALOME::SALOME_Exception);
236 * New group is created. All mesh elements that are present in
237 * main group but do not present in tool group are added to the new one
239 SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
240 in SMESH_GroupBase aToolGroup,
242 raises (SALOME::SALOME_Exception);
245 * Add hypothesis to the mesh, under a particular subShape
246 * (or the main shape itself)
247 * The Add method is only used to prepare the build of the mesh and store
248 * the algorithms and associated parameters.
249 * Actual job of mesh the shape is done by MESH_Gen.
251 * - aSubShape : subShape obtained by a shape explode in GEOM
253 * - anHyp : hypothesis object
255 * - OK if the hypothesis is compatible with the subShape
256 * (and all previous hypothesis on the subShape)
257 * - NOK if the hypothesis is not compatible with the subShape
258 * (or one previous hypothesis on the subShape)
259 * raises exception if hypothesis has not been created
261 Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
262 in SMESH_Hypothesis anHyp)
263 raises (SALOME::SALOME_Exception);
264 // boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
265 // raises (SALOME::SALOME_Exception);
269 * Remove an hypothesis previouly added with AddHypothesis.
271 Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject,
272 in SMESH_Hypothesis anHyp)
273 raises (SALOME::SALOME_Exception);
274 // boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
275 // in SMESH_Hypothesis anHyp)
276 // raises (SALOME::SALOME_Exception);
279 * Get the list of hypothesis added on a subShape
281 ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Object aSubObject)
282 raises (SALOME::SALOME_Exception);
283 // ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
284 // raises (SALOME::SALOME_Exception);
287 * Get the log of nodes and elements added or removed since previous
290 * - clearAfterGet : log is emptied after Get (safe if concurrents access)
292 // string_array GetLog(in boolean clearAfterGet)
293 // raises (SALOME::SALOME_Exception);
294 log_array GetLog(in boolean clearAfterGet)
295 raises (SALOME::SALOME_Exception);
298 * Clear the log of nodes and elements added or removed since previous
299 * clear. Must be used immediately after GetLog if clearAfterGet is false.
302 raises (SALOME::SALOME_Exception);
305 * Get the internal Id
314 SMESH_MeshEditor GetMeshEditor()
315 raises (SALOME::SALOME_Exception);
318 * Export Mesh with DAT and MED Formats
320 void ExportDAT( in string file )
321 raises (SALOME::SALOME_Exception);
322 void ExportMED( in string file, in boolean auto_groups )
323 raises (SALOME::SALOME_Exception);
324 void ExportUNV( in string file )
325 raises (SALOME::SALOME_Exception);
326 void ExportSTL( in string file, in boolean isascii )
327 raises (SALOME::SALOME_Exception);
332 SALOME_MED::MESH GetMEDMesh()
333 raises (SALOME::SALOME_Exception);
336 raises (SALOME::SALOME_Exception);
339 raises (SALOME::SALOME_Exception);
342 raises (SALOME::SALOME_Exception);
345 raises (SALOME::SALOME_Exception);
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);
371 interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
376 long GetNumberOfElements()
377 raises (SALOME::SALOME_Exception);
382 long GetNumberOfNodes( in boolean all )
383 raises (SALOME::SALOME_Exception);
388 long_array GetElementsId()
389 raises (SALOME::SALOME_Exception);
394 long_array GetElementsByType( in ElementType theType )
395 raises (SALOME::SALOME_Exception);
400 long_array GetNodesId()
401 raises (SALOME::SALOME_Exception);
404 * Get geom shape the submesh is dedicated to
406 GEOM::GEOM_Object GetSubShape()
407 raises (SALOME::SALOME_Exception);
410 * Get SMESH_Mesh which stores nodes coordinates & elements definition
412 SMESH_Mesh GetFather()
413 raises (SALOME::SALOME_Exception);
416 * Get the internal Id
423 SALOME_MED::FAMILY GetFamily()
424 raises (SALOME::SALOME_Exception);
428 * This interface makes modifications on the Mesh - removing elements and nodes etc.
430 interface NumericalFunctor;
431 interface SMESH_MeshEditor {
434 boolean RemoveElements(in long_array IDsOfElements);
436 boolean RemoveNodes(in long_array IDsOfNodes);
438 boolean AddNode(in double x, in double y, in double z);
440 boolean AddEdge(in long_array IDsOfNodes);
442 boolean AddFace(in long_array IDsOfNodes);
444 boolean AddVolume(in long_array IDsOfNodes);
446 boolean MoveNode(in long NodeID, in double x, in double y, in double z);
448 boolean InverseDiag(in long NodeID1, in long NodeID2);
450 boolean DeleteDiag(in long NodeID1, in long NodeID2);
452 boolean Reorient(in long_array IDsOfElements);
454 boolean ReorientObject(in SMESH_IDSource theObject);
456 boolean TriToQuad(in long_array IDsOfElements,
457 in NumericalFunctor Criterion,
460 boolean TriToQuadObject(in SMESH_IDSource theObject,
461 in NumericalFunctor Criterion,
464 boolean QuadToTri(in long_array IDsOfElements,
465 in NumericalFunctor Criterion);
467 boolean SplitQuad(in long_array IDsOfElements,
470 boolean SplitQuadObject(in SMESH_IDSource theObject,
473 enum Smooth_Method { LAPLACIAN_SMOOTH, CENTROIDAL_SMOOTH };
475 boolean Smooth(in long_array IDsOfElements,
476 in long_array IDsOfFixedNodes,
477 in long MaxNbOfIterations,
478 in double MaxAspectRatio,
479 in Smooth_Method Method);
481 boolean SmoothObject(in SMESH_IDSource theObject,
482 in long_array IDsOfFixedNodes,
483 in long MaxNbOfIterations,
484 in double MaxAspectRatio,
485 in Smooth_Method Method);
487 void RenumberNodes();
489 void RenumberElements();
491 void RotationSweep(in long_array IDsOfElements,
493 in double AngleInRadians,
495 in double Tolerance);
497 void RotationSweepObject(in SMESH_IDSource theObject,
499 in double AngleInRadians,
501 in double Tolerance);
503 void ExtrusionSweep(in long_array IDsOfElements,
504 in DirStruct StepVector,
507 void ExtrusionSweepObject(in SMESH_IDSource theObject,
508 in DirStruct StepVector,
511 enum MirrorType { POINT, AXIS, PLANE };
513 void Mirror (in long_array IDsOfElements,
514 in AxisStruct Mirror,
515 in MirrorType theMirrorType,
518 void MirrorObject (in SMESH_IDSource theObject,
519 in AxisStruct Mirror,
520 in MirrorType theMirrorType,
523 void Translate (in long_array IDsOfElements,
527 void TranslateObject (in SMESH_IDSource theObject,
531 void Rotate (in long_array IDsOfElements,
533 in double AngleInRadians,
536 void RotateObject (in SMESH_IDSource theObject,
538 in double AngleInRadians,
541 void FindCoincidentNodes (in double Tolerance,
542 out array_of_long_array GroupsOfNodes);
544 void MergeNodes (in array_of_long_array GroupsOfNodes);
546 void MergeEqualElements();
550 SEW_BORDER1_NOT_FOUND,
551 SEW_BORDER2_NOT_FOUND,
552 SEW_BOTH_BORDERS_NOT_FOUND,
554 SEW_VOLUMES_TO_SPLIT,
555 // for SewSideElements() only:
556 SEW_DIFF_NB_OF_ELEMENTS,
557 SEW_TOPO_DIFF_SETS_OF_ELEMENTS,
562 Sew_Error SewFreeBorders (in long FirstNodeID1,
563 in long SecondNodeID1,
565 in long FirstNodeID2,
566 in long SecondNodeID2,
567 in long LastNodeID2);
569 Sew_Error SewConformFreeBorders (in long FirstNodeID1,
570 in long SecondNodeID1,
572 in long FirstNodeID2,
573 in long SecondNodeID2);
575 Sew_Error SewBorderToSide (in long FirstNodeIDOnFreeBorder,
576 in long SecondNodeIDOnFreeBorder,
577 in long LastNodeIDOnFreeBorder,
578 in long FirstNodeIDOnSide,
579 in long LastNodeIDOnSide);
581 Sew_Error SewSideElements (in long_array IDsOfSide1Elements,
582 in long_array IDsOfSide2Elements,
583 in long NodeID1OfSide1ToMerge,
584 in long NodeID1OfSide2ToMerge,
585 in long NodeID2OfSide1ToMerge,
586 in long NodeID2OfSide2ToMerge);