1 // Copyright (C) 2007-2012 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
23 // File : SMESH_Mesh.idl
24 // 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;
40 interface SMESH_IDSource;
41 typedef sequence<SMESH_IDSource> ListOfIDSources;
43 typedef sequence<double > double_array ;
44 typedef sequence<long > long_array ;
45 typedef sequence<string > string_array ;
46 typedef sequence<long_array> array_of_long_array ;
64 CHANGE_POLYHEDRON_NODES,
75 ADD_BIQUAD_QUADRANGLE,
88 struct PointStruct { double x;
92 typedef sequence<PointStruct> nodes_array;
94 struct DirStruct { PointStruct PS ; } ; // analog to Occ Direction
96 struct AxisStruct { double x;
104 * Node location on a shape
106 struct NodePosition {
108 GEOM::shape_type shapeType;
109 double_array params; // [U] on EDGE, [U,V] on FACE, [] on the rest shapes
113 * Enumeration for element type, like in SMDS
124 typedef sequence<ElementType> array_of_ElementType ;
127 * Enumeration for element geometry type, like in SMDS
140 Geom_HEXAGONAL_PRISM,
145 * ElementOrder points out entities of what order are requested
148 ORDER_ANY, /*! entities of any order */
149 ORDER_LINEAR, /*! entities of 1st order */
150 ORDER_QUADRATIC /*! entities of 2nd order */
155 * Enumeration of entity type used in mesh info array,
156 * it should be synchronised with enum SMDSAbs_EntityType
165 Entity_Quad_Triangle,
167 Entity_Quad_Quadrangle,
168 Entity_BiQuad_Quadrangle,
180 Entity_Hexagonal_Prism,
182 Entity_Quad_Polyhedra,
188 * Enumeration for hypothesis status (used by AddHypothesis() and RemoveHypothesis() methods)
190 enum Hypothesis_Status // in the order of severity
193 HYP_MISSING, // algo misses a hypothesis
194 HYP_CONCURENT, // several applicable hypotheses
195 HYP_BAD_PARAMETER,// hypothesis has a bad parameter value
196 HYP_HIDDEN_ALGO, // an algo is hidden by an upper dim algo generating all-dim elements
197 HYP_HIDING_ALGO, // an algo hides lower dim algos by generating all-dim elements
198 HYP_UNKNOWN_FATAL,// --- all statuses below should be considered as fatal
199 // for Add/RemoveHypothesis operations
200 HYP_INCOMPATIBLE, // hypothesis does not fit algo
201 HYP_NOTCONFORM, // not conform mesh is produced appling a hypothesis
202 HYP_ALREADY_EXIST,// such hypothesis already exist
203 HYP_BAD_DIM, // bad dimension
204 HYP_BAD_SUBSHAPE, // shape is neither the main one, nor its sub-shape, nor a group
205 HYP_BAD_GEOMETRY, // geometry mismatches algorithm's expectation
206 HYP_NEED_SHAPE // algorithm can work on shape only
210 * Enumeration for DriverMED read status (used by ImportMEDFile() method)
212 enum DriverMED_ReadStatus // in the order of severity
215 DRS_EMPTY, // a MED file contains no mesh with the given name
216 DRS_WARN_RENUMBER, // a MED file has overlapped ranges of element numbers,
217 // so the numbers from the file are ignored
218 DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
219 DRS_FAIL // general failure (exception etc.)
223 * Enumeration for DriverMED (used by Perform() method)
225 enum MED_VERSION // in the order of severity
231 typedef sequence<log_block> log_array;
235 * Auxilary flags for advanced extrusion.
236 * BOUNDARY: create or not boundary for result of extrusion
237 * SEW: try to use existing nodes or create new nodes in any case
239 const long EXTRUSION_FLAG_BOUNDARY = 1;
240 const long EXTRUSION_FLAG_SEW = 2;
243 * Structure used in mesh edit preview data (MeshPreviewStruct)
245 struct ElementSubType { ElementType SMDS_ElementType;
247 long nbNodesInElement; };
249 typedef sequence<ElementSubType> types_array;
252 * Structure containing mesh edit preview data
254 struct MeshPreviewStruct { nodes_array nodesXYZ;
255 long_array elementConnectivities;
256 types_array elementTypes; };
258 interface SMESH_Mesh;
260 interface SMESH_IDSource
263 * Returns a sequence of all element IDs
268 * Returns statistic of mesh elements
269 * @return array of number enityties by index of EntityType
271 long_array GetMeshInfo();
274 * Returns types of elements it contains.
275 * It's empty if the SMESH_IDSource contains no IDs
277 array_of_ElementType GetTypes();
282 SMESH_Mesh GetMesh();
285 * Returns false if GetMeshInfo() returns incorrect information that may
286 * happen if mesh data is not yet fully loaded from the file of study.
288 boolean IsMeshInfoCorrect();
291 interface SMESH_Group;
292 interface SMESH_GroupOnGeom;
294 interface SMESH_GroupOnFilter;
295 interface SMESH_subMesh;
296 interface SMESH_MeshEditor;
298 typedef sequence<SMESH_subMesh> submesh_array;
299 typedef sequence<submesh_array> submesh_array_array;
301 interface SMESH_Mesh : SALOME::GenericObj, SMESH_IDSource
304 * Return true if there is a geometry to be meshed
306 boolean HasShapeToMesh()
307 raises (SALOME::SALOME_Exception);
310 * Get geom shape to mesh. A result sould not be nil. Use HasShapeToMesh()
311 * to know if a returned shape
313 GEOM::GEOM_Object GetShapeToMesh()
314 raises (SALOME::SALOME_Exception);
317 * Return false if the mesh is not yet fully loaded from the study file
320 raises (SALOME::SALOME_Exception);
323 * Load full mesh data from the study file
326 raises (SALOME::SALOME_Exception);
329 * Remove all nodes and elements
332 raises (SALOME::SALOME_Exception);
335 * Get the list of sub-meshes existing in the mesh
337 submesh_array GetSubMeshes()
338 raises (SALOME::SALOME_Exception);
341 * Remove all nodes and elements of submesh
343 void ClearSubMesh(in long ShapeID)
344 raises (SALOME::SALOME_Exception);
347 * Get the subMesh object associated to a Sub-shape. The subMesh object
348 * gives access to nodes and elements IDs.
349 * SubMesh will be used instead of Sub-shape in a next idl version to
350 * adress a specific subMesh...
352 SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
353 raises (SALOME::SALOME_Exception);
358 void RemoveSubMesh(in SMESH_subMesh aSubMesh)
359 raises (SALOME::SALOME_Exception);
365 SMESH_Group CreateGroup( in ElementType elem_type,
367 raises (SALOME::SALOME_Exception);
370 * Create a group from geometry
372 SMESH_GroupOnGeom CreateGroupFromGEOM( in ElementType elemType,
374 in GEOM::GEOM_Object geomObject )
375 raises (SALOME::SALOME_Exception);
378 * Create a group from filter
380 SMESH_GroupOnFilter CreateGroupFromFilter( in ElementType elemType,
382 in SMESH::Filter filter )
383 raises (SALOME::SALOME_Exception);
388 void RemoveGroup(in SMESH_GroupBase aGroup)
389 raises (SALOME::SALOME_Exception);
392 * Remove group with its contents
394 void RemoveGroupWithContents( in SMESH_GroupBase aGroup )
395 raises (SALOME::SALOME_Exception);
398 * Get the list of groups existing in the mesh
400 ListOfGroups GetGroups()
401 raises (SALOME::SALOME_Exception);
404 * Get number of groups existing in the mesh
407 raises (SALOME::SALOME_Exception);
410 * Union of two groups
411 * New group is created. All mesh elements that are
412 * present in initial groups are added to the new one
414 SMESH_Group UnionGroups (in SMESH_GroupBase aGroup1,
415 in SMESH_GroupBase aGroup2,
417 raises (SALOME::SALOME_Exception);
420 * Union of list of groups
421 * New group is created. All mesh elements that are
422 * present in initial groups are added to the new one
424 SMESH_Group UnionListOfGroups (in ListOfGroups aListOfGroups,
426 raises (SALOME::SALOME_Exception);
429 * Intersection of two groups
430 * New group is created. All mesh elements that are
431 * present in both initial groups are added to the new one.
433 SMESH_Group IntersectGroups (in SMESH_GroupBase aGroup1,
434 in SMESH_GroupBase aGroup2,
436 raises (SALOME::SALOME_Exception);
439 * Intersection of list of groups
440 * New group is created. All mesh elements that are
441 * present in all initial groups simultaneously are added to the new one.
443 SMESH_Group IntersectListOfGroups (in ListOfGroups aListOfGroups,
445 raises (SALOME::SALOME_Exception);
449 * New group is created. All mesh elements that are present in
450 * main group but do not present in tool group are added to the new one
452 SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
453 in SMESH_GroupBase aToolGroup,
455 raises (SALOME::SALOME_Exception);
458 * Cut of lists of groups
459 * New group is created. All mesh elements that are present in
460 * main groups but do not present in tool groups are added to the new one
462 SMESH_Group CutListOfGroups (in ListOfGroups aMainGroups,
463 in ListOfGroups aToolGroups,
465 raises (SALOME::SALOME_Exception);
468 * Create groups of entities from existing groups of superior dimensions
469 * New group is created. System
470 * 1) extracts all nodes from each group,
471 * 2) combines all elements of specified dimension laying on these nodes.
473 SMESH_Group CreateDimGroup( in ListOfGroups aListOfGroups,
474 in ElementType anElemType,
476 raises (SALOME::SALOME_Exception);
479 * Convert group on geometry or on filter into standalone group
481 SMESH_Group ConvertToStandalone( in SMESH_GroupBase theGroupOn )
482 raises (SALOME::SALOME_Exception);
485 * Add hypothesis to the mesh, under a particular Sub-shape
486 * (or the main shape itself)
487 * The Add method is only used to prepare the build of the mesh and store
488 * the algorithms and associated parameters.
489 * Actual job of mesh the shape is done by MESH_Gen.
491 * - aSubShape : sub-shape obtained by a shape explode in GEOM
493 * - anHyp : hypothesis object
495 * - OK if the hypothesis is compatible with the sub-shape
496 * (and all previous hypothesis on the sub-shape)
497 * - NOK if the hypothesis is not compatible with the sub-shape
498 * (or one previous hypothesis on the sub-shape)
499 * raises exception if hypothesis has not been created
501 Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
502 in SMESH_Hypothesis anHyp)
503 raises (SALOME::SALOME_Exception);
504 // boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
505 // raises (SALOME::SALOME_Exception);
508 * Remove an hypothesis previouly added with AddHypothesis.
510 Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject,
511 in SMESH_Hypothesis anHyp)
512 raises (SALOME::SALOME_Exception);
513 // boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
514 // in SMESH_Hypothesis anHyp)
515 // raises (SALOME::SALOME_Exception);
518 * Get the list of hypothesis added on a sub-shape
520 ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Object aSubObject)
521 raises (SALOME::SALOME_Exception);
522 // ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
523 // raises (SALOME::SALOME_Exception);
526 * Get the log of nodes and elements added or removed since previous
529 * - clearAfterGet : log is emptied after Get (safe if concurrents access)
531 // string_array GetLog(in boolean clearAfterGet)
532 // raises (SALOME::SALOME_Exception);
533 log_array GetLog(in boolean clearAfterGet)
534 raises (SALOME::SALOME_Exception);
537 * Clear the log of nodes and elements added or removed since previous
538 * clear. Must be used immediately after GetLog if clearAfterGet is false.
541 raises (SALOME::SALOME_Exception);
544 * Toggle auto color mode on the object.
546 * - theAutoColor : flag which toggles auto color mode.
548 void SetAutoColor(in boolean theAutoColor)
549 raises (SALOME::SALOME_Exception);
552 * Get flag of object's auto color mode.
554 boolean GetAutoColor()
555 raises (SALOME::SALOME_Exception);
558 * Get the internal Id
568 * Obtain instance of SMESH_MeshEditor
570 SMESH_MeshEditor GetMeshEditor()
571 raises (SALOME::SALOME_Exception);
574 * Return SMESH_MeshEditor that would not modify the mesh but
575 * fill MeshPreviewStruct
577 SMESH_MeshEditor GetMeshEditPreviewer()
578 raises (SALOME::SALOME_Exception);
581 * Return true if the mesh has been edited since a total re-compute
582 * and those modifications may prevent successful partial re-compute
584 boolean HasModificationsToDiscard()
585 raises (SALOME::SALOME_Exception);
587 /*! Check group names for duplications.
588 * Consider maximum group name length stored in MED file.
590 boolean HasDuplicatedGroupNamesMED();
593 * Export Mesh to different MED Formats
595 * - file : name of the MED file
596 * - auto_groups : boolean parameter for creating/not creating
597 * the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
598 * the typical use is auto_groups=false.
599 * - version : define the version of format of MED file, that will be created
600 * - overwrite : boolean parameter for overwriting/not overwriting the file, if it exists
602 void ExportToMEDX( in string file,
603 in boolean auto_groups,
604 in MED_VERSION version,
605 in boolean overwrite ) raises (SALOME::SALOME_Exception);
608 * Export a part of Mesh into a MED file
610 * - meshPart : a part of mesh to store
611 * - file : name of the MED file
612 * - version : define the version of format of MED file, that will be created
613 * - overwrite : boolean parameter for overwriting/not overwriting the file, if it exists
615 void ExportPartToMED( in SMESH_IDSource meshPart,
617 in boolean auto_groups,
618 in MED_VERSION version,
619 in boolean overwrite ) raises (SALOME::SALOME_Exception);
622 * Export Mesh to different MED Formats
623 * Works, just the same as ExportToMEDX, with overwrite parameter equal to true.
624 * The method is kept in order to support old functionality
626 void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
627 raises (SALOME::SALOME_Exception);
630 * Export Mesh to MED_V2_1 MED format
631 * Works, just the same as ExportToMEDX with MED_VERSION parameter equal to MED_V2_1
632 * and overwrite parameter equal to true
633 * The method is kept in order to support old functionality
635 void ExportMED( in string file, in boolean auto_groups )
636 raises (SALOME::SALOME_Exception);
639 * Export Mesh to SAUV formatted file
640 * Write a temporary med file and use med2sauv
642 void ExportSAUV( in string file, in boolean auto_groups )
643 raises (SALOME::SALOME_Exception);
646 * Return string representation of a MED file version comprising nbDigits
648 string GetVersionString(in MED_VERSION version, in short nbDigits);
651 * Export Mesh to DAT, UNV and STL Formats
652 * (UNV supported version is I-DEAS 10)
654 void ExportDAT( in string file ) raises (SALOME::SALOME_Exception);
655 void ExportUNV( in string file ) raises (SALOME::SALOME_Exception);
656 void ExportSTL( in string file,
657 in boolean isascii ) raises (SALOME::SALOME_Exception);
658 void ExportCGNS( in SMESH_IDSource meshPart,
660 in boolean overwrite ) raises (SALOME::SALOME_Exception);
661 void ExportPartToDAT( in SMESH_IDSource meshPart,
662 in string file ) raises (SALOME::SALOME_Exception);
663 void ExportPartToUNV( in SMESH_IDSource meshPart,
664 in string file ) raises (SALOME::SALOME_Exception);
665 void ExportPartToSTL( in SMESH_IDSource meshPart,
667 in boolean isascii ) raises (SALOME::SALOME_Exception);
672 SALOME_MED::MESH GetMEDMesh()
673 raises (SALOME::SALOME_Exception);
676 * Get informations about mesh contents
679 raises (SALOME::SALOME_Exception);
682 raises (SALOME::SALOME_Exception);
685 raises (SALOME::SALOME_Exception);
688 raises (SALOME::SALOME_Exception);
690 long NbEdgesOfOrder(in ElementOrder order)
691 raises (SALOME::SALOME_Exception);
694 raises (SALOME::SALOME_Exception);
696 long NbFacesOfOrder(in ElementOrder order)
697 raises (SALOME::SALOME_Exception);
700 raises (SALOME::SALOME_Exception);
702 long NbTrianglesOfOrder(in ElementOrder order)
703 raises (SALOME::SALOME_Exception);
706 raises (SALOME::SALOME_Exception);
708 long NbQuadranglesOfOrder(in ElementOrder order)
709 raises (SALOME::SALOME_Exception);
711 long NbBiQuadQuadrangles()
712 raises (SALOME::SALOME_Exception);
715 raises (SALOME::SALOME_Exception);
718 raises (SALOME::SALOME_Exception);
720 long NbVolumesOfOrder(in ElementOrder order)
721 raises (SALOME::SALOME_Exception);
724 raises (SALOME::SALOME_Exception);
726 long NbTetrasOfOrder(in ElementOrder order)
727 raises (SALOME::SALOME_Exception);
730 raises (SALOME::SALOME_Exception);
732 long NbHexasOfOrder(in ElementOrder order)
733 raises (SALOME::SALOME_Exception);
735 long NbTriQuadraticHexas()
736 raises (SALOME::SALOME_Exception);
739 raises (SALOME::SALOME_Exception);
741 long NbPyramidsOfOrder(in ElementOrder order)
742 raises (SALOME::SALOME_Exception);
745 raises (SALOME::SALOME_Exception);
747 long NbPrismsOfOrder(in ElementOrder order)
748 raises (SALOME::SALOME_Exception);
750 long NbHexagonalPrisms()
751 raises (SALOME::SALOME_Exception);
754 raises (SALOME::SALOME_Exception);
757 raises (SALOME::SALOME_Exception);
759 long_array GetElementsId()
760 raises (SALOME::SALOME_Exception);
762 long_array GetElementsByType( in ElementType theType )
763 raises (SALOME::SALOME_Exception);
765 long_array GetNodesId()
766 raises (SALOME::SALOME_Exception);
769 * Returns type of mesh element
771 ElementType GetElementType( in long id, in boolean iselem )
772 raises (SALOME::SALOME_Exception);
774 EntityType GetElementGeomType( in long id )
775 raises (SALOME::SALOME_Exception);
777 long_array GetSubMeshElementsId(in long ShapeID)
778 raises (SALOME::SALOME_Exception);
780 long_array GetSubMeshNodesId(in long ShapeID, in boolean all )
781 raises (SALOME::SALOME_Exception);
783 ElementType GetSubMeshElementType(in long ShapeID)
784 raises (SALOME::SALOME_Exception);
788 * Methods to set meshing order of submeshes
792 * \brief Return submesh objects list in meshing order
794 submesh_array_array GetMeshOrder();
797 * \brief Set submesh object order
799 boolean SetMeshOrder(in submesh_array_array theSubMeshArray);
803 * Get mesh description
810 long long GetMeshPtr();
813 * Get XYZ coordinates of node as list of double
814 * If there is not node for given ID - returns empty list
816 double_array GetNodeXYZ(in long id);
819 * For given node returns list of IDs of inverse elements
820 * If there is not node for given ID - returns empty list
822 long_array GetNodeInverseElements(in long id);
825 * \brief Return position of a node on shape
827 NodePosition GetNodePosition(in long NodeID);
830 * If given element is node returns IDs of shape from position
831 * If there is not node for given ID - returns -1
833 long GetShapeID(in long id);
836 * For given element returns ID of result shape after
837 * ::FindShape() from SMESH_MeshEditor
838 * If there is not element for given ID - returns -1
840 long GetShapeIDForElem(in long id);
843 * Returns number of nodes for given element
844 * If there is not element for given ID - returns -1
846 long GetElemNbNodes(in long id);
849 * Returns IDs of nodes of given element
851 long_array GetElemNodes(in long id);
854 * Returns ID of node by given index for given element
855 * If there is not element for given ID - returns -1
856 * If there is not node for given index - returns -2
858 long GetElemNode(in long id, in long index);
861 * Returns true if given node is medium node
862 * in given quadratic element
864 boolean IsMediumNode(in long ide, in long idn);
867 * Returns true if given node is medium node
868 * in one of quadratic elements
870 boolean IsMediumNodeOfAnyElem(in long idn, in ElementType elem_type);
873 * Returns number of edges for given element
875 long ElemNbEdges(in long id);
878 * Returns number of faces for given element
880 long ElemNbFaces(in long id);
883 * Returns nodes of given face (counted from zero) for given volumic element.
885 long_array GetElemFaceNodes(in long elemId, in short faceIndex);
888 * Returns an element based on all given nodes.
890 long FindElementByNodes(in long_array nodes);
893 * Returns true if given element is polygon
895 boolean IsPoly(in long id);
898 * Returns true if given element is quadratic
900 boolean IsQuadratic(in long id);
903 * Returns XYZ coordinates of bary center for given element
905 * If there is not element for given ID - returns empty list
907 double_array BaryCenter(in long id);
909 /*! Gets information about imported MED file */
910 SALOME_MED::MedFileInfo GetMEDFileInfo();
913 * Sets list of notebook variables used for Mesh operations separated by ":" symbol
914 * \param theParameters is a string containing the notebook variables
916 void SetParameters (in string theParameters);
919 * Returns list of notebook variables used for Mesh operations separated by ":" symbol
921 string GetParameters();
924 * Returns list of notebook variables used for last Mesh operation
926 string_array GetLastParameters();
929 interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
934 long GetNumberOfElements()
935 raises (SALOME::SALOME_Exception);
940 long GetNumberOfNodes( in boolean all )
941 raises (SALOME::SALOME_Exception);
946 long_array GetElementsId()
947 raises (SALOME::SALOME_Exception);
952 long_array GetElementsByType( in ElementType theType )
953 raises (SALOME::SALOME_Exception);
956 * Return type of submesh element
958 ElementType GetElementType( in long id, in boolean iselem )
959 raises (SALOME::SALOME_Exception);
964 long_array GetNodesId()
965 raises (SALOME::SALOME_Exception);
968 * Get geom shape the submesh is dedicated to
970 GEOM::GEOM_Object GetSubShape()
971 raises (SALOME::SALOME_Exception);
974 * Get SMESH_Mesh which stores nodes coordinates & elements definition
976 SMESH_Mesh GetFather()
977 raises (SALOME::SALOME_Exception);
980 * Get the internal Id
987 SALOME_MED::FAMILY GetFamily()
988 raises (SALOME::SALOME_Exception);