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.salome-platform.org/ or email : webmaster.salome@opencascade.com
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"
31 #include "GEOM_Gen.idl"
36 interface SMESH_Hypothesis;
37 typedef sequence<SMESH_Hypothesis> ListOfHypothesis;
38 interface SMESH_GroupBase;
39 typedef sequence<SMESH_GroupBase> ListOfGroups;
41 typedef sequence<double > double_array ;
42 typedef sequence<long > long_array ;
43 typedef sequence<string > string_array ;
44 typedef sequence<long_array> array_of_long_array ;
62 CHANGE_POLYHEDRON_NODES,
81 struct PointStruct { double x;
85 typedef sequence<PointStruct> nodes_array;
87 struct DirStruct { PointStruct PS ; } ; // analog to Occ Direction
89 struct AxisStruct { double x;
97 * Node location on a shape
101 GEOM::shape_type shapeType;
102 double_array params; // [U] on EDGE, [U,V] on FACE, [] on the rest shapes
106 * Enumeration for element type, like in SMDS
118 * ElementOrder points out entities of what order are requested
121 ORDER_ANY, /*! entities of any order */
122 ORDER_LINEAR, /*! entities of 1st order */
123 ORDER_QUADRATIC /*! entities of 2nd order */
127 * Enumeration for hypothesis status (used by AddHypothesis() and RemoveHypothesis() methods)
129 enum Hypothesis_Status // in the order of severity
132 HYP_MISSING, // algo misses a hypothesis
133 HYP_CONCURENT, // several applicable hypotheses
134 HYP_BAD_PARAMETER,// hypothesis has a bad parameter value
135 HYP_HIDDEN_ALGO, // an algo is hidden by an upper dim algo generating all-dim elements
136 HYP_HIDING_ALGO, // an algo hides lower dim algos by generating all-dim elements
137 HYP_UNKNOWN_FATAL,// --- all statuses below should be considered as fatal
138 // for Add/RemoveHypothesis operations
139 HYP_INCOMPATIBLE, // hypothesis does not fit algo
140 HYP_NOTCONFORM, // not conform mesh is produced appling a hypothesis
141 HYP_ALREADY_EXIST,// such hypothesis already exist
142 HYP_BAD_DIM, // bad dimension
143 HYP_BAD_SUBSHAPE, // shape is neither the main one, nor its subshape, nor a group
144 HYP_BAD_GEOMETRY // geometry mismatches algorithm's expectation
148 * Enumeration for DriverMED read status (used by ImportMEDFile() method)
150 enum DriverMED_ReadStatus // in the order of severity
153 DRS_EMPTY, // a MED file contains no mesh with the given name
154 DRS_WARN_RENUMBER, // a MED file has overlapped ranges of element numbers,
155 // so the numbers from the file are ignored
156 DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
157 DRS_FAIL // general failure (exception etc.)
161 * Enumeration for DriverMED (used by Perform() method)
163 enum MED_VERSION // in the order of severity
169 typedef sequence<log_block> log_array;
173 * Auxilary flags for advanced extrusion.
174 * BOUNDARY: create or not boundary for result of extrusion
175 * SEW: try to use existing nodes or create new nodes in any case
177 const long EXTRUSION_FLAG_BOUNDARY = 1;
178 const long EXTRUSION_FLAG_SEW = 2;
180 interface SMESH_IDSource
183 * Returns a sequence of all element IDs
188 interface SMESH_Group;
189 interface SMESH_GroupOnGeom;
190 interface SMESH_subMesh;
191 interface SMESH_MeshEditor;
192 interface SMESH_Mesh : SALOME::GenericObj, SMESH_IDSource
195 * Return true if there is a geometry to be meshed
197 boolean HasShapeToMesh()
198 raises (SALOME::SALOME_Exception);
201 * Get geom shape to mesh. A result sould not be nil. Use HasShapeToMesh()
202 * to know if a returned shape
204 GEOM::GEOM_Object GetShapeToMesh()
205 raises (SALOME::SALOME_Exception);
209 * Get the subMesh object associated to a subShape. The subMesh object
210 * gives access to nodes and elements IDs.
211 * SubMesh will be used instead of SubShape in a next idl version to
212 * adress a specific subMesh...
214 SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
215 raises (SALOME::SALOME_Exception);
220 void RemoveSubMesh(in SMESH_subMesh aSubMesh)
221 raises (SALOME::SALOME_Exception);
227 SMESH_Group CreateGroup( in ElementType elem_type,
229 raises (SALOME::SALOME_Exception);
232 * Create a group from geometry group
234 SMESH_GroupOnGeom CreateGroupFromGEOM( in ElementType elem_type,
236 in GEOM::GEOM_Object theGeomObject )
237 raises (SALOME::SALOME_Exception);
242 void RemoveGroup(in SMESH_GroupBase aGroup)
243 raises (SALOME::SALOME_Exception);
246 * Remove group with its contents
248 void RemoveGroupWithContents( in SMESH_GroupBase aGroup )
249 raises (SALOME::SALOME_Exception);
252 * Get the list of groups existing in the mesh
254 ListOfGroups GetGroups()
255 raises (SALOME::SALOME_Exception);
258 * Get number of groups existing in the mesh
261 raises (SALOME::SALOME_Exception);
264 * Union of two groups
265 * New group is created. All mesh elements that are
266 * present in initial groups are added to the new one
268 SMESH_Group UnionGroups (in SMESH_GroupBase aGroup1,
269 in SMESH_GroupBase aGroup2,
271 raises (SALOME::SALOME_Exception);
274 * Intersection of two groups
275 * New group is created. All mesh elements that are
276 * present in both initial groups are added to the new one.
278 SMESH_Group IntersectGroups (in SMESH_GroupBase aGroup1,
279 in SMESH_GroupBase aGroup2,
281 raises (SALOME::SALOME_Exception);
285 * New group is created. All mesh elements that are present in
286 * main group but do not present in tool group are added to the new one
288 SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
289 in SMESH_GroupBase aToolGroup,
291 raises (SALOME::SALOME_Exception);
294 * Add hypothesis to the mesh, under a particular subShape
295 * (or the main shape itself)
296 * The Add method is only used to prepare the build of the mesh and store
297 * the algorithms and associated parameters.
298 * Actual job of mesh the shape is done by MESH_Gen.
300 * - aSubShape : subShape obtained by a shape explode in GEOM
302 * - anHyp : hypothesis object
304 * - OK if the hypothesis is compatible with the subShape
305 * (and all previous hypothesis on the subShape)
306 * - NOK if the hypothesis is not compatible with the subShape
307 * (or one previous hypothesis on the subShape)
308 * raises exception if hypothesis has not been created
310 Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
311 in SMESH_Hypothesis anHyp)
312 raises (SALOME::SALOME_Exception);
313 // boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
314 // raises (SALOME::SALOME_Exception);
317 * Remove an hypothesis previouly added with AddHypothesis.
319 Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject,
320 in SMESH_Hypothesis anHyp)
321 raises (SALOME::SALOME_Exception);
322 // boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
323 // in SMESH_Hypothesis anHyp)
324 // raises (SALOME::SALOME_Exception);
327 * Get the list of hypothesis added on a subShape
329 ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Object aSubObject)
330 raises (SALOME::SALOME_Exception);
331 // ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
332 // raises (SALOME::SALOME_Exception);
335 * Get the log of nodes and elements added or removed since previous
338 * - clearAfterGet : log is emptied after Get (safe if concurrents access)
340 // string_array GetLog(in boolean clearAfterGet)
341 // raises (SALOME::SALOME_Exception);
342 log_array GetLog(in boolean clearAfterGet)
343 raises (SALOME::SALOME_Exception);
346 * Clear the log of nodes and elements added or removed since previous
347 * clear. Must be used immediately after GetLog if clearAfterGet is false.
350 raises (SALOME::SALOME_Exception);
353 * Get the internal Id
363 * Obtain instance of SMESH_MeshEditor
365 SMESH_MeshEditor GetMeshEditor()
366 raises (SALOME::SALOME_Exception);
369 * Return SMESH_MeshEditor that would not modify the mesh but
370 * fill MeshPreviewStruct
372 SMESH_MeshEditor GetMeshEditPreviewer()
373 raises (SALOME::SALOME_Exception);
375 /*! Check group names for duplications.
376 * Consider maximum group name length stored in MED file.
378 boolean HasDuplicatedGroupNamesMED();
381 * Export Mesh to different MED Formats
383 * - auto_groups : boolean parameter for creating/not creating
384 * the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
385 * the typical use is auto_groups=false.
386 * - theVersion : define the version of format of MED file, that will be created
388 void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
389 raises (SALOME::SALOME_Exception);
392 * Export Mesh to MED_V2_1 MED format
393 * Works, just the same as ExportToMED, with MED_VERSION parameter equal to MED_V2_1.
394 * The method is kept in order to support old functionality
396 void ExportMED( in string file, in boolean auto_groups )
397 raises (SALOME::SALOME_Exception);
400 * Return string representation of a MED file version comprising nbDigits
402 string GetVersionString(in MED_VERSION version, in short nbDigits);
405 * Export Mesh to DAT, UNV and STL Formats
406 * (UNV supported version is I-DEAS 10)
408 void ExportDAT( in string file )
409 raises (SALOME::SALOME_Exception);
410 void ExportUNV( in string file )
411 raises (SALOME::SALOME_Exception);
412 void ExportSTL( in string file, in boolean isascii )
413 raises (SALOME::SALOME_Exception);
418 SALOME_MED::MESH GetMEDMesh()
419 raises (SALOME::SALOME_Exception);
422 * Get informations about mesh contents
425 raises (SALOME::SALOME_Exception);
428 raises (SALOME::SALOME_Exception);
431 raises (SALOME::SALOME_Exception);
433 long NbEdgesOfOrder(in ElementOrder order)
434 raises (SALOME::SALOME_Exception);
437 raises (SALOME::SALOME_Exception);
439 long NbFacesOfOrder(in ElementOrder order)
440 raises (SALOME::SALOME_Exception);
443 raises (SALOME::SALOME_Exception);
445 long NbTrianglesOfOrder(in ElementOrder order)
446 raises (SALOME::SALOME_Exception);
449 raises (SALOME::SALOME_Exception);
451 long NbQuadranglesOfOrder(in ElementOrder order)
452 raises (SALOME::SALOME_Exception);
455 raises (SALOME::SALOME_Exception);
458 raises (SALOME::SALOME_Exception);
460 long NbVolumesOfOrder(in ElementOrder order)
461 raises (SALOME::SALOME_Exception);
464 raises (SALOME::SALOME_Exception);
466 long NbTetrasOfOrder(in ElementOrder order)
467 raises (SALOME::SALOME_Exception);
470 raises (SALOME::SALOME_Exception);
472 long NbHexasOfOrder(in ElementOrder order)
473 raises (SALOME::SALOME_Exception);
476 raises (SALOME::SALOME_Exception);
478 long NbPyramidsOfOrder(in ElementOrder order)
479 raises (SALOME::SALOME_Exception);
482 raises (SALOME::SALOME_Exception);
484 long NbPrismsOfOrder(in ElementOrder order)
485 raises (SALOME::SALOME_Exception);
488 raises (SALOME::SALOME_Exception);
491 raises (SALOME::SALOME_Exception);
493 long_array GetElementsId()
494 raises (SALOME::SALOME_Exception);
496 long_array GetElementsByType( in ElementType theType )
497 raises (SALOME::SALOME_Exception);
499 long_array GetNodesId()
500 raises (SALOME::SALOME_Exception);
503 * Returns type of mesh element
505 ElementType GetElementType( in long id, in boolean iselem )
506 raises (SALOME::SALOME_Exception);
508 long_array GetSubMeshElementsId(in long ShapeID)
509 raises (SALOME::SALOME_Exception);
511 long_array GetSubMeshNodesId(in long ShapeID, in boolean all )
512 raises (SALOME::SALOME_Exception);
514 ElementType GetSubMeshElementType(in long ShapeID)
515 raises (SALOME::SALOME_Exception);
518 * Get mesh description
525 long long GetMeshPtr();
528 * Get XYZ coordinates of node as list of double
529 * If there is not node for given ID - returns empty list
531 double_array GetNodeXYZ(in long id);
534 * For given node returns list of IDs of inverse elements
535 * If there is not node for given ID - returns empty list
537 long_array GetNodeInverseElements(in long id);
540 * \brief Return position of a node on shape
542 NodePosition GetNodePosition(in long NodeID);
545 * If given element is node returns IDs of shape from position
546 * If there is not node for given ID - returns -1
548 long GetShapeID(in long id);
551 * For given element returns ID of result shape after
552 * ::FindShape() from SMESH_MeshEditor
553 * If there is not element for given ID - returns -1
555 long GetShapeIDForElem(in long id);
558 * Returns number of nodes for given element
559 * If there is not element for given ID - returns -1
561 long GetElemNbNodes(in long id);
564 * Returns IDs of nodes of given element
566 long_array GetElemNodes(in long id);
569 * Returns ID of node by given index for given element
570 * If there is not element for given ID - returns -1
571 * If there is not node for given index - returns -2
573 long GetElemNode(in long id, in long index);
576 * Returns true if given node is medium node
577 * in given quadratic element
579 boolean IsMediumNode(in long ide, in long idn);
582 * Returns true if given node is medium node
583 * in one of quadratic elements
585 boolean IsMediumNodeOfAnyElem(in long idn, in ElementType elem_type);
588 * Returns number of edges for given element
590 long ElemNbEdges(in long id);
593 * Returns number of faces for given element
595 long ElemNbFaces(in long id);
598 * Returns true if given element is polygon
600 boolean IsPoly(in long id);
603 * Returns true if given element is quadratic
605 boolean IsQuadratic(in long id);
608 * Returns XYZ coordinates of bary center for given element
610 * If there is not element for given ID - returns empty list
612 double_array BaryCenter(in long id);
616 interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
621 long GetNumberOfElements()
622 raises (SALOME::SALOME_Exception);
627 long GetNumberOfNodes( in boolean all )
628 raises (SALOME::SALOME_Exception);
633 long_array GetElementsId()
634 raises (SALOME::SALOME_Exception);
639 long_array GetElementsByType( in ElementType theType )
640 raises (SALOME::SALOME_Exception);
643 * Return type of submesh element
645 ElementType GetElementType( in long id, in boolean iselem )
646 raises (SALOME::SALOME_Exception);
651 long_array GetNodesId()
652 raises (SALOME::SALOME_Exception);
655 * Get geom shape the submesh is dedicated to
657 GEOM::GEOM_Object GetSubShape()
658 raises (SALOME::SALOME_Exception);
661 * Get SMESH_Mesh which stores nodes coordinates & elements definition
663 SMESH_Mesh GetFather()
664 raises (SALOME::SALOME_Exception);
667 * Get the internal Id
674 SALOME_MED::FAMILY GetFamily()
675 raises (SALOME::SALOME_Exception);