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,
82 struct PointStruct { double x;
86 typedef sequence<PointStruct> nodes_array;
88 struct DirStruct { PointStruct PS ; } ; // analog to Occ Direction
90 struct AxisStruct { double x;
98 * Node location on a shape
100 struct NodePosition {
102 GEOM::shape_type shapeType;
103 double_array params; // [U] on EDGE, [U,V] on FACE, [] on the rest shapes
107 * Enumeration for element type, like in SMDS
119 * ElementOrder points out entities of what order are requested
122 ORDER_ANY, /*! entities of any order */
123 ORDER_LINEAR, /*! entities of 1st order */
124 ORDER_QUADRATIC /*! entities of 2nd order */
128 * Enumeration for hypothesis status (used by AddHypothesis() and RemoveHypothesis() methods)
130 enum Hypothesis_Status // in the order of severity
133 HYP_MISSING, // algo misses a hypothesis
134 HYP_CONCURENT, // several applicable hypotheses
135 HYP_BAD_PARAMETER,// hypothesis has a bad parameter value
136 HYP_HIDDEN_ALGO, // an algo is hidden by an upper dim algo generating all-dim elements
137 HYP_HIDING_ALGO, // an algo hides lower dim algos by generating all-dim elements
138 HYP_UNKNOWN_FATAL,// --- all statuses below should be considered as fatal
139 // for Add/RemoveHypothesis operations
140 HYP_INCOMPATIBLE, // hypothesis does not fit algo
141 HYP_NOTCONFORM, // not conform mesh is produced appling a hypothesis
142 HYP_ALREADY_EXIST,// such hypothesis already exist
143 HYP_BAD_DIM, // bad dimension
144 HYP_BAD_SUBSHAPE, // shape is neither the main one, nor its subshape, nor a group
145 HYP_BAD_GEOMETRY, // geometry mismatches algorithm's expectation
146 HYP_NEED_SHAPE // algorithm can work on shape only
150 * Enumeration for DriverMED read status (used by ImportMEDFile() method)
152 enum DriverMED_ReadStatus // in the order of severity
155 DRS_EMPTY, // a MED file contains no mesh with the given name
156 DRS_WARN_RENUMBER, // a MED file has overlapped ranges of element numbers,
157 // so the numbers from the file are ignored
158 DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
159 DRS_FAIL // general failure (exception etc.)
163 * Enumeration for DriverMED (used by Perform() method)
165 enum MED_VERSION // in the order of severity
171 typedef sequence<log_block> log_array;
175 * Auxilary flags for advanced extrusion.
176 * BOUNDARY: create or not boundary for result of extrusion
177 * SEW: try to use existing nodes or create new nodes in any case
179 const long EXTRUSION_FLAG_BOUNDARY = 1;
180 const long EXTRUSION_FLAG_SEW = 2;
183 * Structure used in mesh edit preview data (MeshPreviewStruct)
185 struct ElementSubType { ElementType SMDS_ElementType;
187 long nbNodesInElement; };
189 typedef sequence<ElementSubType> types_array;
192 * Structure containing mesh edit preview data
194 struct MeshPreviewStruct { nodes_array nodesXYZ;
195 long_array elementConnectivities;
196 types_array elementTypes; };
198 interface SMESH_IDSource
201 * Returns a sequence of all element IDs
206 interface SMESH_Group;
207 interface SMESH_GroupOnGeom;
208 interface SMESH_subMesh;
209 interface SMESH_MeshEditor;
210 interface SMESH_Mesh : SALOME::GenericObj, SMESH_IDSource
213 * Return true if there is a geometry to be meshed
215 boolean HasShapeToMesh()
216 raises (SALOME::SALOME_Exception);
219 * Get geom shape to mesh. A result sould not be nil. Use HasShapeToMesh()
220 * to know if a returned shape
222 GEOM::GEOM_Object GetShapeToMesh()
223 raises (SALOME::SALOME_Exception);
226 * Remove all nodes and elements
229 raises (SALOME::SALOME_Exception);
232 * Get the subMesh object associated to a subShape. The subMesh object
233 * gives access to nodes and elements IDs.
234 * SubMesh will be used instead of SubShape in a next idl version to
235 * adress a specific subMesh...
237 SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
238 raises (SALOME::SALOME_Exception);
243 void RemoveSubMesh(in SMESH_subMesh aSubMesh)
244 raises (SALOME::SALOME_Exception);
250 SMESH_Group CreateGroup( in ElementType elem_type,
252 raises (SALOME::SALOME_Exception);
255 * Create a group from geometry group
257 SMESH_GroupOnGeom CreateGroupFromGEOM( in ElementType elem_type,
259 in GEOM::GEOM_Object theGeomObject )
260 raises (SALOME::SALOME_Exception);
265 void RemoveGroup(in SMESH_GroupBase aGroup)
266 raises (SALOME::SALOME_Exception);
269 * Remove group with its contents
271 void RemoveGroupWithContents( in SMESH_GroupBase aGroup )
272 raises (SALOME::SALOME_Exception);
275 * Get the list of groups existing in the mesh
277 ListOfGroups GetGroups()
278 raises (SALOME::SALOME_Exception);
281 * Get number of groups existing in the mesh
284 raises (SALOME::SALOME_Exception);
287 * Union of two groups
288 * New group is created. All mesh elements that are
289 * present in initial groups are added to the new one
291 SMESH_Group UnionGroups (in SMESH_GroupBase aGroup1,
292 in SMESH_GroupBase aGroup2,
294 raises (SALOME::SALOME_Exception);
297 * Intersection of two groups
298 * New group is created. All mesh elements that are
299 * present in both initial groups are added to the new one.
301 SMESH_Group IntersectGroups (in SMESH_GroupBase aGroup1,
302 in SMESH_GroupBase aGroup2,
304 raises (SALOME::SALOME_Exception);
308 * New group is created. All mesh elements that are present in
309 * main group but do not present in tool group are added to the new one
311 SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
312 in SMESH_GroupBase aToolGroup,
314 raises (SALOME::SALOME_Exception);
317 * Add hypothesis to the mesh, under a particular subShape
318 * (or the main shape itself)
319 * The Add method is only used to prepare the build of the mesh and store
320 * the algorithms and associated parameters.
321 * Actual job of mesh the shape is done by MESH_Gen.
323 * - aSubShape : subShape obtained by a shape explode in GEOM
325 * - anHyp : hypothesis object
327 * - OK if the hypothesis is compatible with the subShape
328 * (and all previous hypothesis on the subShape)
329 * - NOK if the hypothesis is not compatible with the subShape
330 * (or one previous hypothesis on the subShape)
331 * raises exception if hypothesis has not been created
333 Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
334 in SMESH_Hypothesis anHyp)
335 raises (SALOME::SALOME_Exception);
336 // boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
337 // raises (SALOME::SALOME_Exception);
340 * Remove an hypothesis previouly added with AddHypothesis.
342 Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject,
343 in SMESH_Hypothesis anHyp)
344 raises (SALOME::SALOME_Exception);
345 // boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
346 // in SMESH_Hypothesis anHyp)
347 // raises (SALOME::SALOME_Exception);
350 * Get the list of hypothesis added on a subShape
352 ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Object aSubObject)
353 raises (SALOME::SALOME_Exception);
354 // ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
355 // raises (SALOME::SALOME_Exception);
358 * Get the log of nodes and elements added or removed since previous
361 * - clearAfterGet : log is emptied after Get (safe if concurrents access)
363 // string_array GetLog(in boolean clearAfterGet)
364 // raises (SALOME::SALOME_Exception);
365 log_array GetLog(in boolean clearAfterGet)
366 raises (SALOME::SALOME_Exception);
369 * Clear the log of nodes and elements added or removed since previous
370 * clear. Must be used immediately after GetLog if clearAfterGet is false.
373 raises (SALOME::SALOME_Exception);
376 * Toggle auto color mode on the object.
378 * - theAutoColor : flag which toggles auto color mode.
380 void SetAutoColor(in boolean theAutoColor)
381 raises (SALOME::SALOME_Exception);
384 * Get flag of object's auto color mode.
386 boolean GetAutoColor()
387 raises (SALOME::SALOME_Exception);
390 * Get the internal Id
400 * Obtain instance of SMESH_MeshEditor
402 SMESH_MeshEditor GetMeshEditor()
403 raises (SALOME::SALOME_Exception);
406 * Return SMESH_MeshEditor that would not modify the mesh but
407 * fill MeshPreviewStruct
409 SMESH_MeshEditor GetMeshEditPreviewer()
410 raises (SALOME::SALOME_Exception);
412 /*! Check group names for duplications.
413 * Consider maximum group name length stored in MED file.
415 boolean HasDuplicatedGroupNamesMED();
418 * Export Mesh to different MED Formats
420 * - auto_groups : boolean parameter for creating/not creating
421 * the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
422 * the typical use is auto_groups=false.
423 * - theVersion : define the version of format of MED file, that will be created
425 void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
426 raises (SALOME::SALOME_Exception);
429 * Export Mesh to MED_V2_1 MED format
430 * Works, just the same as ExportToMED, with MED_VERSION parameter equal to MED_V2_1.
431 * The method is kept in order to support old functionality
433 void ExportMED( in string file, in boolean auto_groups )
434 raises (SALOME::SALOME_Exception);
437 * Return string representation of a MED file version comprising nbDigits
439 string GetVersionString(in MED_VERSION version, in short nbDigits);
442 * Export Mesh to DAT, UNV and STL Formats
443 * (UNV supported version is I-DEAS 10)
445 void ExportDAT( in string file )
446 raises (SALOME::SALOME_Exception);
447 void ExportUNV( in string file )
448 raises (SALOME::SALOME_Exception);
449 void ExportSTL( in string file, in boolean isascii )
450 raises (SALOME::SALOME_Exception);
455 SALOME_MED::MESH GetMEDMesh()
456 raises (SALOME::SALOME_Exception);
459 * Get informations about mesh contents
462 raises (SALOME::SALOME_Exception);
465 raises (SALOME::SALOME_Exception);
468 raises (SALOME::SALOME_Exception);
470 long NbEdgesOfOrder(in ElementOrder order)
471 raises (SALOME::SALOME_Exception);
474 raises (SALOME::SALOME_Exception);
476 long NbFacesOfOrder(in ElementOrder order)
477 raises (SALOME::SALOME_Exception);
480 raises (SALOME::SALOME_Exception);
482 long NbTrianglesOfOrder(in ElementOrder order)
483 raises (SALOME::SALOME_Exception);
486 raises (SALOME::SALOME_Exception);
488 long NbQuadranglesOfOrder(in ElementOrder order)
489 raises (SALOME::SALOME_Exception);
492 raises (SALOME::SALOME_Exception);
495 raises (SALOME::SALOME_Exception);
497 long NbVolumesOfOrder(in ElementOrder order)
498 raises (SALOME::SALOME_Exception);
501 raises (SALOME::SALOME_Exception);
503 long NbTetrasOfOrder(in ElementOrder order)
504 raises (SALOME::SALOME_Exception);
507 raises (SALOME::SALOME_Exception);
509 long NbHexasOfOrder(in ElementOrder order)
510 raises (SALOME::SALOME_Exception);
513 raises (SALOME::SALOME_Exception);
515 long NbPyramidsOfOrder(in ElementOrder order)
516 raises (SALOME::SALOME_Exception);
519 raises (SALOME::SALOME_Exception);
521 long NbPrismsOfOrder(in ElementOrder order)
522 raises (SALOME::SALOME_Exception);
525 raises (SALOME::SALOME_Exception);
528 raises (SALOME::SALOME_Exception);
530 long_array GetElementsId()
531 raises (SALOME::SALOME_Exception);
533 long_array GetElementsByType( in ElementType theType )
534 raises (SALOME::SALOME_Exception);
536 long_array GetNodesId()
537 raises (SALOME::SALOME_Exception);
540 * Returns type of mesh element
542 ElementType GetElementType( in long id, in boolean iselem )
543 raises (SALOME::SALOME_Exception);
545 long_array GetSubMeshElementsId(in long ShapeID)
546 raises (SALOME::SALOME_Exception);
548 long_array GetSubMeshNodesId(in long ShapeID, in boolean all )
549 raises (SALOME::SALOME_Exception);
551 ElementType GetSubMeshElementType(in long ShapeID)
552 raises (SALOME::SALOME_Exception);
555 * Get mesh description
562 long long GetMeshPtr();
565 * Get XYZ coordinates of node as list of double
566 * If there is not node for given ID - returns empty list
568 double_array GetNodeXYZ(in long id);
571 * For given node returns list of IDs of inverse elements
572 * If there is not node for given ID - returns empty list
574 long_array GetNodeInverseElements(in long id);
577 * \brief Return position of a node on shape
579 NodePosition GetNodePosition(in long NodeID);
582 * If given element is node returns IDs of shape from position
583 * If there is not node for given ID - returns -1
585 long GetShapeID(in long id);
588 * For given element returns ID of result shape after
589 * ::FindShape() from SMESH_MeshEditor
590 * If there is not element for given ID - returns -1
592 long GetShapeIDForElem(in long id);
595 * Returns number of nodes for given element
596 * If there is not element for given ID - returns -1
598 long GetElemNbNodes(in long id);
601 * Returns IDs of nodes of given element
603 long_array GetElemNodes(in long id);
606 * Returns ID of node by given index for given element
607 * If there is not element for given ID - returns -1
608 * If there is not node for given index - returns -2
610 long GetElemNode(in long id, in long index);
613 * Returns true if given node is medium node
614 * in given quadratic element
616 boolean IsMediumNode(in long ide, in long idn);
619 * Returns true if given node is medium node
620 * in one of quadratic elements
622 boolean IsMediumNodeOfAnyElem(in long idn, in ElementType elem_type);
625 * Returns number of edges for given element
627 long ElemNbEdges(in long id);
630 * Returns number of faces for given element
632 long ElemNbFaces(in long id);
635 * Returns true if given element is polygon
637 boolean IsPoly(in long id);
640 * Returns true if given element is quadratic
642 boolean IsQuadratic(in long id);
645 * Returns XYZ coordinates of bary center for given element
647 * If there is not element for given ID - returns empty list
649 double_array BaryCenter(in long id);
651 /*! Gets information about imported MED file */
652 SALOME_MED::MedFileInfo GetMEDFileInfo();
655 interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
660 long GetNumberOfElements()
661 raises (SALOME::SALOME_Exception);
666 long GetNumberOfNodes( in boolean all )
667 raises (SALOME::SALOME_Exception);
672 long_array GetElementsId()
673 raises (SALOME::SALOME_Exception);
678 long_array GetElementsByType( in ElementType theType )
679 raises (SALOME::SALOME_Exception);
682 * Return type of submesh element
684 ElementType GetElementType( in long id, in boolean iselem )
685 raises (SALOME::SALOME_Exception);
690 long_array GetNodesId()
691 raises (SALOME::SALOME_Exception);
694 * Get geom shape the submesh is dedicated to
696 GEOM::GEOM_Object GetSubShape()
697 raises (SALOME::SALOME_Exception);
700 * Get SMESH_Mesh which stores nodes coordinates & elements definition
702 SMESH_Mesh GetFather()
703 raises (SALOME::SALOME_Exception);
706 * Get the internal Id
713 SALOME_MED::FAMILY GetFamily()
714 raises (SALOME::SALOME_Exception);