1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // 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,
83 struct PointStruct { double x;
87 typedef sequence<PointStruct> nodes_array;
89 struct DirStruct { PointStruct PS ; } ; // analog to Occ Direction
91 struct AxisStruct { double x;
99 * Node location on a shape
101 struct NodePosition {
103 GEOM::shape_type shapeType;
104 double_array params; // [U] on EDGE, [U,V] on FACE, [] on the rest shapes
108 * Enumeration for element type, like in SMDS
121 * Enumeration for element geometry type, like in SMDS
138 * ElementOrder points out entities of what order are requested
141 ORDER_ANY, /*! entities of any order */
142 ORDER_LINEAR, /*! entities of 1st order */
143 ORDER_QUADRATIC /*! entities of 2nd order */
148 * Enumeration of entity type uses in mesh info array,
149 * and should be synchronised with enum in SMDS
158 Entity_Quad_Triangle,
160 Entity_Quad_Quadrangle,
172 Entity_Quad_Polyhedra,
178 * Enumeration for hypothesis status (used by AddHypothesis() and RemoveHypothesis() methods)
180 enum Hypothesis_Status // in the order of severity
183 HYP_MISSING, // algo misses a hypothesis
184 HYP_CONCURENT, // several applicable hypotheses
185 HYP_BAD_PARAMETER,// hypothesis has a bad parameter value
186 HYP_HIDDEN_ALGO, // an algo is hidden by an upper dim algo generating all-dim elements
187 HYP_HIDING_ALGO, // an algo hides lower dim algos by generating all-dim elements
188 HYP_UNKNOWN_FATAL,// --- all statuses below should be considered as fatal
189 // for Add/RemoveHypothesis operations
190 HYP_INCOMPATIBLE, // hypothesis does not fit algo
191 HYP_NOTCONFORM, // not conform mesh is produced appling a hypothesis
192 HYP_ALREADY_EXIST,// such hypothesis already exist
193 HYP_BAD_DIM, // bad dimension
194 HYP_BAD_SUBSHAPE, // shape is neither the main one, nor its subshape, nor a group
195 HYP_BAD_GEOMETRY, // geometry mismatches algorithm's expectation
196 HYP_NEED_SHAPE // algorithm can work on shape only
200 * Enumeration for DriverMED read status (used by ImportMEDFile() method)
202 enum DriverMED_ReadStatus // in the order of severity
205 DRS_EMPTY, // a MED file contains no mesh with the given name
206 DRS_WARN_RENUMBER, // a MED file has overlapped ranges of element numbers,
207 // so the numbers from the file are ignored
208 DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
209 DRS_FAIL // general failure (exception etc.)
213 * Enumeration for DriverMED (used by Perform() method)
215 enum MED_VERSION // in the order of severity
221 typedef sequence<log_block> log_array;
225 * Auxilary flags for advanced extrusion.
226 * BOUNDARY: create or not boundary for result of extrusion
227 * SEW: try to use existing nodes or create new nodes in any case
229 const long EXTRUSION_FLAG_BOUNDARY = 1;
230 const long EXTRUSION_FLAG_SEW = 2;
233 * Structure used in mesh edit preview data (MeshPreviewStruct)
235 struct ElementSubType { ElementType SMDS_ElementType;
237 long nbNodesInElement; };
239 typedef sequence<ElementSubType> types_array;
242 * Structure containing mesh edit preview data
244 struct MeshPreviewStruct { nodes_array nodesXYZ;
245 long_array elementConnectivities;
246 types_array elementTypes; };
248 interface SMESH_IDSource
251 * Returns a sequence of all element IDs
256 * Returns statistic of mesh elements
257 * Result array of number enityties
259 long_array GetMeshInfo();
262 interface SMESH_Group;
263 interface SMESH_GroupOnGeom;
264 interface SMESH_subMesh;
265 interface SMESH_MeshEditor;
267 typedef sequence<SMESH_subMesh> submesh_array;
268 typedef sequence<submesh_array> submesh_array_array;
270 interface SMESH_Mesh : SALOME::GenericObj, SMESH_IDSource
273 * Return true if there is a geometry to be meshed
275 boolean HasShapeToMesh()
276 raises (SALOME::SALOME_Exception);
279 * Get geom shape to mesh. A result sould not be nil. Use HasShapeToMesh()
280 * to know if a returned shape
282 GEOM::GEOM_Object GetShapeToMesh()
283 raises (SALOME::SALOME_Exception);
286 * Remove all nodes and elements
289 raises (SALOME::SALOME_Exception);
292 * Remove all nodes and elements of submesh
294 void ClearSubMesh(in long ShapeID)
295 raises (SALOME::SALOME_Exception);
298 * Get the subMesh object associated to a subShape. The subMesh object
299 * gives access to nodes and elements IDs.
300 * SubMesh will be used instead of SubShape in a next idl version to
301 * adress a specific subMesh...
303 SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
304 raises (SALOME::SALOME_Exception);
309 void RemoveSubMesh(in SMESH_subMesh aSubMesh)
310 raises (SALOME::SALOME_Exception);
316 SMESH_Group CreateGroup( in ElementType elem_type,
318 raises (SALOME::SALOME_Exception);
321 * Create a group from geometry group
323 SMESH_GroupOnGeom CreateGroupFromGEOM( in ElementType elem_type,
325 in GEOM::GEOM_Object theGeomObject )
326 raises (SALOME::SALOME_Exception);
331 void RemoveGroup(in SMESH_GroupBase aGroup)
332 raises (SALOME::SALOME_Exception);
335 * Remove group with its contents
337 void RemoveGroupWithContents( in SMESH_GroupBase aGroup )
338 raises (SALOME::SALOME_Exception);
341 * Get the list of groups existing in the mesh
343 ListOfGroups GetGroups()
344 raises (SALOME::SALOME_Exception);
347 * Get number of groups existing in the mesh
350 raises (SALOME::SALOME_Exception);
353 * Union of two groups
354 * New group is created. All mesh elements that are
355 * present in initial groups are added to the new one
357 SMESH_Group UnionGroups (in SMESH_GroupBase aGroup1,
358 in SMESH_GroupBase aGroup2,
360 raises (SALOME::SALOME_Exception);
363 * Union of list of groups
364 * New group is created. All mesh elements that are
365 * present in initial groups are added to the new one
367 SMESH_Group UnionListOfGroups (in ListOfGroups aListOfGroups,
369 raises (SALOME::SALOME_Exception);
372 * Intersection of two groups
373 * New group is created. All mesh elements that are
374 * present in both initial groups are added to the new one.
376 SMESH_Group IntersectGroups (in SMESH_GroupBase aGroup1,
377 in SMESH_GroupBase aGroup2,
379 raises (SALOME::SALOME_Exception);
382 * Intersection of list of groups
383 * New group is created. All mesh elements that are
384 * present in all initial groups simultaneously are added to the new one.
386 SMESH_Group IntersectListOfGroups (in ListOfGroups aListOfGroups,
388 raises (SALOME::SALOME_Exception);
392 * New group is created. All mesh elements that are present in
393 * main group but do not present in tool group are added to the new one
395 SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
396 in SMESH_GroupBase aToolGroup,
398 raises (SALOME::SALOME_Exception);
401 * Cut of lists of groups
402 * New group is created. All mesh elements that are present in
403 * main groups but do not present in tool groups are added to the new one
405 SMESH_Group CutListOfGroups (in ListOfGroups aMainGroups,
406 in ListOfGroups aToolGroups,
408 raises (SALOME::SALOME_Exception);
411 * Create groups of entities from existing groups of superior dimensions
412 * New group is created. System
413 * 1) extracts all nodes from each group,
414 * 2) combines all elements of specified dimension laying on these nodes.
416 SMESH_Group CreateDimGroup( in ListOfGroups aListOfGroups,
417 in ElementType anElemType,
419 raises (SALOME::SALOME_Exception);
422 * Convert group on geometry into standalone group
424 SMESH_Group ConvertToStandalone( in SMESH_GroupOnGeom theGeomGroup )
425 raises (SALOME::SALOME_Exception);
428 * Add hypothesis to the mesh, under a particular subShape
429 * (or the main shape itself)
430 * The Add method is only used to prepare the build of the mesh and store
431 * the algorithms and associated parameters.
432 * Actual job of mesh the shape is done by MESH_Gen.
434 * - aSubShape : subShape obtained by a shape explode in GEOM
436 * - anHyp : hypothesis object
438 * - OK if the hypothesis is compatible with the subShape
439 * (and all previous hypothesis on the subShape)
440 * - NOK if the hypothesis is not compatible with the subShape
441 * (or one previous hypothesis on the subShape)
442 * raises exception if hypothesis has not been created
444 Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
445 in SMESH_Hypothesis anHyp)
446 raises (SALOME::SALOME_Exception);
447 // boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
448 // raises (SALOME::SALOME_Exception);
451 * Remove an hypothesis previouly added with AddHypothesis.
453 Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject,
454 in SMESH_Hypothesis anHyp)
455 raises (SALOME::SALOME_Exception);
456 // boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
457 // in SMESH_Hypothesis anHyp)
458 // raises (SALOME::SALOME_Exception);
461 * Get the list of hypothesis added on a subShape
463 ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Object aSubObject)
464 raises (SALOME::SALOME_Exception);
465 // ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
466 // raises (SALOME::SALOME_Exception);
469 * Get the log of nodes and elements added or removed since previous
472 * - clearAfterGet : log is emptied after Get (safe if concurrents access)
474 // string_array GetLog(in boolean clearAfterGet)
475 // raises (SALOME::SALOME_Exception);
476 log_array GetLog(in boolean clearAfterGet)
477 raises (SALOME::SALOME_Exception);
480 * Clear the log of nodes and elements added or removed since previous
481 * clear. Must be used immediately after GetLog if clearAfterGet is false.
484 raises (SALOME::SALOME_Exception);
487 * Toggle auto color mode on the object.
489 * - theAutoColor : flag which toggles auto color mode.
491 void SetAutoColor(in boolean theAutoColor)
492 raises (SALOME::SALOME_Exception);
495 * Get flag of object's auto color mode.
497 boolean GetAutoColor()
498 raises (SALOME::SALOME_Exception);
501 * Get the internal Id
511 * Obtain instance of SMESH_MeshEditor
513 SMESH_MeshEditor GetMeshEditor()
514 raises (SALOME::SALOME_Exception);
517 * Return SMESH_MeshEditor that would not modify the mesh but
518 * fill MeshPreviewStruct
520 SMESH_MeshEditor GetMeshEditPreviewer()
521 raises (SALOME::SALOME_Exception);
523 /*! Check group names for duplications.
524 * Consider maximum group name length stored in MED file.
526 boolean HasDuplicatedGroupNamesMED();
529 * Export Mesh to different MED Formats
531 * - auto_groups : boolean parameter for creating/not creating
532 * the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
533 * the typical use is auto_groups=false.
534 * - theVersion : define the version of format of MED file, that will be created
535 * - overwrite : boolean parameter for overwriting/not overwriting the file, if it exists
537 void ExportToMEDX( in string file, in boolean auto_groups, in MED_VERSION theVersion, in boolean overwrite )
538 raises (SALOME::SALOME_Exception);
541 * Export Mesh to different MED Formats
542 * Works, just the same as ExportToMEDX, with overwrite parameter equal to true.
543 * The method is kept in order to support old functionality
545 void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
546 raises (SALOME::SALOME_Exception);
549 * Export Mesh to MED_V2_1 MED format
550 * Works, just the same as ExportToMEDX with MED_VERSION parameter equal to MED_V2_1
551 * and overwrite parameter equal to true
552 * The method is kept in order to support old functionality
554 void ExportMED( in string file, in boolean auto_groups )
555 raises (SALOME::SALOME_Exception);
558 * Return string representation of a MED file version comprising nbDigits
560 string GetVersionString(in MED_VERSION version, in short nbDigits);
563 * Export Mesh to DAT, UNV and STL Formats
564 * (UNV supported version is I-DEAS 10)
566 void ExportDAT( in string file )
567 raises (SALOME::SALOME_Exception);
568 void ExportUNV( in string file )
569 raises (SALOME::SALOME_Exception);
570 void ExportSTL( in string file, in boolean isascii )
571 raises (SALOME::SALOME_Exception);
576 SALOME_MED::MESH GetMEDMesh()
577 raises (SALOME::SALOME_Exception);
580 * Get informations about mesh contents
583 raises (SALOME::SALOME_Exception);
586 raises (SALOME::SALOME_Exception);
589 raises (SALOME::SALOME_Exception);
592 raises (SALOME::SALOME_Exception);
594 long NbEdgesOfOrder(in ElementOrder order)
595 raises (SALOME::SALOME_Exception);
598 raises (SALOME::SALOME_Exception);
600 long NbFacesOfOrder(in ElementOrder order)
601 raises (SALOME::SALOME_Exception);
604 raises (SALOME::SALOME_Exception);
606 long NbTrianglesOfOrder(in ElementOrder order)
607 raises (SALOME::SALOME_Exception);
610 raises (SALOME::SALOME_Exception);
612 long NbQuadranglesOfOrder(in ElementOrder order)
613 raises (SALOME::SALOME_Exception);
616 raises (SALOME::SALOME_Exception);
619 raises (SALOME::SALOME_Exception);
621 long NbVolumesOfOrder(in ElementOrder order)
622 raises (SALOME::SALOME_Exception);
625 raises (SALOME::SALOME_Exception);
627 long NbTetrasOfOrder(in ElementOrder order)
628 raises (SALOME::SALOME_Exception);
631 raises (SALOME::SALOME_Exception);
633 long NbHexasOfOrder(in ElementOrder order)
634 raises (SALOME::SALOME_Exception);
637 raises (SALOME::SALOME_Exception);
639 long NbPyramidsOfOrder(in ElementOrder order)
640 raises (SALOME::SALOME_Exception);
643 raises (SALOME::SALOME_Exception);
645 long NbPrismsOfOrder(in ElementOrder order)
646 raises (SALOME::SALOME_Exception);
649 raises (SALOME::SALOME_Exception);
652 raises (SALOME::SALOME_Exception);
654 long_array GetElementsId()
655 raises (SALOME::SALOME_Exception);
657 long_array GetElementsByType( in ElementType theType )
658 raises (SALOME::SALOME_Exception);
660 long_array GetNodesId()
661 raises (SALOME::SALOME_Exception);
664 * Returns type of mesh element
666 ElementType GetElementType( in long id, in boolean iselem )
667 raises (SALOME::SALOME_Exception);
669 EntityType GetElementGeomType( in long id )
670 raises (SALOME::SALOME_Exception);
672 long_array GetSubMeshElementsId(in long ShapeID)
673 raises (SALOME::SALOME_Exception);
675 long_array GetSubMeshNodesId(in long ShapeID, in boolean all )
676 raises (SALOME::SALOME_Exception);
678 ElementType GetSubMeshElementType(in long ShapeID)
679 raises (SALOME::SALOME_Exception);
683 * Methods to set meshing order of submeshes
687 * \brief Return submesh objects list in meshing order
689 submesh_array_array GetMeshOrder();
692 * \brief Set submesh object order
694 boolean SetMeshOrder(in submesh_array_array theSubMeshArray);
698 * Get mesh description
705 long long GetMeshPtr();
708 * Get XYZ coordinates of node as list of double
709 * If there is not node for given ID - returns empty list
711 double_array GetNodeXYZ(in long id);
714 * For given node returns list of IDs of inverse elements
715 * If there is not node for given ID - returns empty list
717 long_array GetNodeInverseElements(in long id);
720 * \brief Return position of a node on shape
722 NodePosition GetNodePosition(in long NodeID);
725 * If given element is node returns IDs of shape from position
726 * If there is not node for given ID - returns -1
728 long GetShapeID(in long id);
731 * For given element returns ID of result shape after
732 * ::FindShape() from SMESH_MeshEditor
733 * If there is not element for given ID - returns -1
735 long GetShapeIDForElem(in long id);
738 * Returns number of nodes for given element
739 * If there is not element for given ID - returns -1
741 long GetElemNbNodes(in long id);
744 * Returns IDs of nodes of given element
746 long_array GetElemNodes(in long id);
749 * Returns ID of node by given index for given element
750 * If there is not element for given ID - returns -1
751 * If there is not node for given index - returns -2
753 long GetElemNode(in long id, in long index);
756 * Returns true if given node is medium node
757 * in given quadratic element
759 boolean IsMediumNode(in long ide, in long idn);
762 * Returns true if given node is medium node
763 * in one of quadratic elements
765 boolean IsMediumNodeOfAnyElem(in long idn, in ElementType elem_type);
768 * Returns number of edges for given element
770 long ElemNbEdges(in long id);
773 * Returns number of faces for given element
775 long ElemNbFaces(in long id);
778 * Returns nodes of given face (counted from zero) for given volumic element.
780 long_array GetElemFaceNodes(in long elemId, in short faceIndex);
783 * Returns an element based on all given nodes.
785 long FindElementByNodes(in long_array nodes);
788 * Returns true if given element is polygon
790 boolean IsPoly(in long id);
793 * Returns true if given element is quadratic
795 boolean IsQuadratic(in long id);
798 * Returns XYZ coordinates of bary center for given element
800 * If there is not element for given ID - returns empty list
802 double_array BaryCenter(in long id);
804 /*! Gets information about imported MED file */
805 SALOME_MED::MedFileInfo GetMEDFileInfo();
808 * Sets list of notebook variables used for Mesh operations separated by ":" symbol
809 * \param theParameters is a string containing the notebook variables
811 void SetParameters (in string theParameters);
814 * Returns list of notebook variables used for Mesh operations separated by ":" symbol
816 string GetParameters();
819 * Returns list of notebook variables used for last Mesh operation
821 string_array GetLastParameters();
824 interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
829 long GetNumberOfElements()
830 raises (SALOME::SALOME_Exception);
835 long GetNumberOfNodes( in boolean all )
836 raises (SALOME::SALOME_Exception);
841 long_array GetElementsId()
842 raises (SALOME::SALOME_Exception);
847 long_array GetElementsByType( in ElementType theType )
848 raises (SALOME::SALOME_Exception);
851 * Return type of submesh element
853 ElementType GetElementType( in long id, in boolean iselem )
854 raises (SALOME::SALOME_Exception);
859 long_array GetNodesId()
860 raises (SALOME::SALOME_Exception);
863 * Get geom shape the submesh is dedicated to
865 GEOM::GEOM_Object GetSubShape()
866 raises (SALOME::SALOME_Exception);
869 * Get SMESH_Mesh which stores nodes coordinates & elements definition
871 SMESH_Mesh GetFather()
872 raises (SALOME::SALOME_Exception);
875 * Get the internal Id
882 SALOME_MED::FAMILY GetFamily()
883 raises (SALOME::SALOME_Exception);