1 // Copyright (C) 2007-2011 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 subshape, 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 interface SMESH_Group;
286 interface SMESH_GroupOnGeom;
288 interface SMESH_GroupOnFilter;
289 interface SMESH_subMesh;
290 interface SMESH_MeshEditor;
292 typedef sequence<SMESH_subMesh> submesh_array;
293 typedef sequence<submesh_array> submesh_array_array;
295 interface SMESH_Mesh : SALOME::GenericObj, SMESH_IDSource
298 * Return true if there is a geometry to be meshed
300 boolean HasShapeToMesh()
301 raises (SALOME::SALOME_Exception);
304 * Get geom shape to mesh. A result sould not be nil. Use HasShapeToMesh()
305 * to know if a returned shape
307 GEOM::GEOM_Object GetShapeToMesh()
308 raises (SALOME::SALOME_Exception);
311 * Remove all nodes and elements
314 raises (SALOME::SALOME_Exception);
317 * Get the list of sub-meshes existing in the mesh
319 submesh_array GetSubMeshes()
320 raises (SALOME::SALOME_Exception);
323 * Remove all nodes and elements of submesh
325 void ClearSubMesh(in long ShapeID)
326 raises (SALOME::SALOME_Exception);
329 * Get the subMesh object associated to a subShape. The subMesh object
330 * gives access to nodes and elements IDs.
331 * SubMesh will be used instead of SubShape in a next idl version to
332 * adress a specific subMesh...
334 SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
335 raises (SALOME::SALOME_Exception);
340 void RemoveSubMesh(in SMESH_subMesh aSubMesh)
341 raises (SALOME::SALOME_Exception);
347 SMESH_Group CreateGroup( in ElementType elem_type,
349 raises (SALOME::SALOME_Exception);
352 * Create a group from geometry
354 SMESH_GroupOnGeom CreateGroupFromGEOM( in ElementType elemType,
356 in GEOM::GEOM_Object geomObject )
357 raises (SALOME::SALOME_Exception);
360 * Create a group from filter
362 SMESH_GroupOnFilter CreateGroupFromFilter( in ElementType elemType,
364 in SMESH::Filter filter )
365 raises (SALOME::SALOME_Exception);
370 void RemoveGroup(in SMESH_GroupBase aGroup)
371 raises (SALOME::SALOME_Exception);
374 * Remove group with its contents
376 void RemoveGroupWithContents( in SMESH_GroupBase aGroup )
377 raises (SALOME::SALOME_Exception);
380 * Get the list of groups existing in the mesh
382 ListOfGroups GetGroups()
383 raises (SALOME::SALOME_Exception);
386 * Get number of groups existing in the mesh
389 raises (SALOME::SALOME_Exception);
392 * Union of two groups
393 * New group is created. All mesh elements that are
394 * present in initial groups are added to the new one
396 SMESH_Group UnionGroups (in SMESH_GroupBase aGroup1,
397 in SMESH_GroupBase aGroup2,
399 raises (SALOME::SALOME_Exception);
402 * Union of list of groups
403 * New group is created. All mesh elements that are
404 * present in initial groups are added to the new one
406 SMESH_Group UnionListOfGroups (in ListOfGroups aListOfGroups,
408 raises (SALOME::SALOME_Exception);
411 * Intersection of two groups
412 * New group is created. All mesh elements that are
413 * present in both initial groups are added to the new one.
415 SMESH_Group IntersectGroups (in SMESH_GroupBase aGroup1,
416 in SMESH_GroupBase aGroup2,
418 raises (SALOME::SALOME_Exception);
421 * Intersection of list of groups
422 * New group is created. All mesh elements that are
423 * present in all initial groups simultaneously are added to the new one.
425 SMESH_Group IntersectListOfGroups (in ListOfGroups aListOfGroups,
427 raises (SALOME::SALOME_Exception);
431 * New group is created. All mesh elements that are present in
432 * main group but do not present in tool group are added to the new one
434 SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
435 in SMESH_GroupBase aToolGroup,
437 raises (SALOME::SALOME_Exception);
440 * Cut of lists of groups
441 * New group is created. All mesh elements that are present in
442 * main groups but do not present in tool groups are added to the new one
444 SMESH_Group CutListOfGroups (in ListOfGroups aMainGroups,
445 in ListOfGroups aToolGroups,
447 raises (SALOME::SALOME_Exception);
450 * Create groups of entities from existing groups of superior dimensions
451 * New group is created. System
452 * 1) extracts all nodes from each group,
453 * 2) combines all elements of specified dimension laying on these nodes.
455 SMESH_Group CreateDimGroup( in ListOfGroups aListOfGroups,
456 in ElementType anElemType,
458 raises (SALOME::SALOME_Exception);
461 * Convert group on geometry or on filter into standalone group
463 SMESH_Group ConvertToStandalone( in SMESH_GroupBase theGroupOn )
464 raises (SALOME::SALOME_Exception);
467 * Add hypothesis to the mesh, under a particular subShape
468 * (or the main shape itself)
469 * The Add method is only used to prepare the build of the mesh and store
470 * the algorithms and associated parameters.
471 * Actual job of mesh the shape is done by MESH_Gen.
473 * - aSubShape : subShape obtained by a shape explode in GEOM
475 * - anHyp : hypothesis object
477 * - OK if the hypothesis is compatible with the subShape
478 * (and all previous hypothesis on the subShape)
479 * - NOK if the hypothesis is not compatible with the subShape
480 * (or one previous hypothesis on the subShape)
481 * raises exception if hypothesis has not been created
483 Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
484 in SMESH_Hypothesis anHyp)
485 raises (SALOME::SALOME_Exception);
486 // boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
487 // raises (SALOME::SALOME_Exception);
490 * Remove an hypothesis previouly added with AddHypothesis.
492 Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject,
493 in SMESH_Hypothesis anHyp)
494 raises (SALOME::SALOME_Exception);
495 // boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
496 // in SMESH_Hypothesis anHyp)
497 // raises (SALOME::SALOME_Exception);
500 * Get the list of hypothesis added on a subShape
502 ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Object aSubObject)
503 raises (SALOME::SALOME_Exception);
504 // ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
505 // raises (SALOME::SALOME_Exception);
508 * Get the log of nodes and elements added or removed since previous
511 * - clearAfterGet : log is emptied after Get (safe if concurrents access)
513 // string_array GetLog(in boolean clearAfterGet)
514 // raises (SALOME::SALOME_Exception);
515 log_array GetLog(in boolean clearAfterGet)
516 raises (SALOME::SALOME_Exception);
519 * Clear the log of nodes and elements added or removed since previous
520 * clear. Must be used immediately after GetLog if clearAfterGet is false.
523 raises (SALOME::SALOME_Exception);
526 * Toggle auto color mode on the object.
528 * - theAutoColor : flag which toggles auto color mode.
530 void SetAutoColor(in boolean theAutoColor)
531 raises (SALOME::SALOME_Exception);
534 * Get flag of object's auto color mode.
536 boolean GetAutoColor()
537 raises (SALOME::SALOME_Exception);
540 * Get the internal Id
550 * Obtain instance of SMESH_MeshEditor
552 SMESH_MeshEditor GetMeshEditor()
553 raises (SALOME::SALOME_Exception);
556 * Return SMESH_MeshEditor that would not modify the mesh but
557 * fill MeshPreviewStruct
559 SMESH_MeshEditor GetMeshEditPreviewer()
560 raises (SALOME::SALOME_Exception);
563 * Return true if the mesh has been edited since a total re-compute
564 * and those modifications may prevent successful partial re-compute
566 boolean HasModificationsToDiscard()
567 raises (SALOME::SALOME_Exception);
569 /*! Check group names for duplications.
570 * Consider maximum group name length stored in MED file.
572 boolean HasDuplicatedGroupNamesMED();
575 * Export Mesh to different MED Formats
577 * - file : name of the MED file
578 * - auto_groups : boolean parameter for creating/not creating
579 * the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
580 * the typical use is auto_groups=false.
581 * - version : define the version of format of MED file, that will be created
582 * - overwrite : boolean parameter for overwriting/not overwriting the file, if it exists
584 void ExportToMEDX( in string file,
585 in boolean auto_groups,
586 in MED_VERSION version,
587 in boolean overwrite ) raises (SALOME::SALOME_Exception);
590 * Export a part of Mesh into a MED file
592 * - meshPart : a part of mesh to store
593 * - file : name of the MED file
594 * - version : define the version of format of MED file, that will be created
595 * - overwrite : boolean parameter for overwriting/not overwriting the file, if it exists
597 void ExportPartToMED( in SMESH_IDSource meshPart,
599 in boolean auto_groups,
600 in MED_VERSION version,
601 in boolean overwrite ) raises (SALOME::SALOME_Exception);
604 * Export Mesh to different MED Formats
605 * Works, just the same as ExportToMEDX, with overwrite parameter equal to true.
606 * The method is kept in order to support old functionality
608 void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
609 raises (SALOME::SALOME_Exception);
612 * Export Mesh to MED_V2_1 MED format
613 * Works, just the same as ExportToMEDX with MED_VERSION parameter equal to MED_V2_1
614 * and overwrite parameter equal to true
615 * The method is kept in order to support old functionality
617 void ExportMED( in string file, in boolean auto_groups )
618 raises (SALOME::SALOME_Exception);
621 * Export Mesh to SAUV formatted file
622 * Write a temporary med file and use med2sauv
624 void ExportSAUV( in string file, in boolean auto_groups )
625 raises (SALOME::SALOME_Exception);
628 * Return string representation of a MED file version comprising nbDigits
630 string GetVersionString(in MED_VERSION version, in short nbDigits);
633 * Export Mesh to DAT, UNV and STL Formats
634 * (UNV supported version is I-DEAS 10)
636 void ExportDAT( in string file ) raises (SALOME::SALOME_Exception);
637 void ExportUNV( in string file ) raises (SALOME::SALOME_Exception);
638 void ExportSTL( in string file,
639 in boolean isascii ) raises (SALOME::SALOME_Exception);
640 void ExportCGNS( in SMESH_IDSource meshPart,
642 in boolean overwrite ) raises (SALOME::SALOME_Exception);
643 void ExportPartToDAT( in SMESH_IDSource meshPart,
644 in string file ) raises (SALOME::SALOME_Exception);
645 void ExportPartToUNV( in SMESH_IDSource meshPart,
646 in string file ) raises (SALOME::SALOME_Exception);
647 void ExportPartToSTL( in SMESH_IDSource meshPart,
649 in boolean isascii ) raises (SALOME::SALOME_Exception);
654 SALOME_MED::MESH GetMEDMesh()
655 raises (SALOME::SALOME_Exception);
658 * Get informations about mesh contents
661 raises (SALOME::SALOME_Exception);
664 raises (SALOME::SALOME_Exception);
667 raises (SALOME::SALOME_Exception);
670 raises (SALOME::SALOME_Exception);
672 long NbEdgesOfOrder(in ElementOrder order)
673 raises (SALOME::SALOME_Exception);
676 raises (SALOME::SALOME_Exception);
678 long NbFacesOfOrder(in ElementOrder order)
679 raises (SALOME::SALOME_Exception);
682 raises (SALOME::SALOME_Exception);
684 long NbTrianglesOfOrder(in ElementOrder order)
685 raises (SALOME::SALOME_Exception);
688 raises (SALOME::SALOME_Exception);
690 long NbQuadranglesOfOrder(in ElementOrder order)
691 raises (SALOME::SALOME_Exception);
693 long NbBiQuadQuadrangles()
694 raises (SALOME::SALOME_Exception);
697 raises (SALOME::SALOME_Exception);
700 raises (SALOME::SALOME_Exception);
702 long NbVolumesOfOrder(in ElementOrder order)
703 raises (SALOME::SALOME_Exception);
706 raises (SALOME::SALOME_Exception);
708 long NbTetrasOfOrder(in ElementOrder order)
709 raises (SALOME::SALOME_Exception);
712 raises (SALOME::SALOME_Exception);
714 long NbHexasOfOrder(in ElementOrder order)
715 raises (SALOME::SALOME_Exception);
717 long NbTriQuadraticHexas()
718 raises (SALOME::SALOME_Exception);
721 raises (SALOME::SALOME_Exception);
723 long NbPyramidsOfOrder(in ElementOrder order)
724 raises (SALOME::SALOME_Exception);
727 raises (SALOME::SALOME_Exception);
729 long NbPrismsOfOrder(in ElementOrder order)
730 raises (SALOME::SALOME_Exception);
732 long NbHexagonalPrisms()
733 raises (SALOME::SALOME_Exception);
736 raises (SALOME::SALOME_Exception);
739 raises (SALOME::SALOME_Exception);
741 long_array GetElementsId()
742 raises (SALOME::SALOME_Exception);
744 long_array GetElementsByType( in ElementType theType )
745 raises (SALOME::SALOME_Exception);
747 long_array GetNodesId()
748 raises (SALOME::SALOME_Exception);
751 * Returns type of mesh element
753 ElementType GetElementType( in long id, in boolean iselem )
754 raises (SALOME::SALOME_Exception);
756 EntityType GetElementGeomType( in long id )
757 raises (SALOME::SALOME_Exception);
759 long_array GetSubMeshElementsId(in long ShapeID)
760 raises (SALOME::SALOME_Exception);
762 long_array GetSubMeshNodesId(in long ShapeID, in boolean all )
763 raises (SALOME::SALOME_Exception);
765 ElementType GetSubMeshElementType(in long ShapeID)
766 raises (SALOME::SALOME_Exception);
770 * Methods to set meshing order of submeshes
774 * \brief Return submesh objects list in meshing order
776 submesh_array_array GetMeshOrder();
779 * \brief Set submesh object order
781 boolean SetMeshOrder(in submesh_array_array theSubMeshArray);
785 * Get mesh description
792 long long GetMeshPtr();
795 * Get XYZ coordinates of node as list of double
796 * If there is not node for given ID - returns empty list
798 double_array GetNodeXYZ(in long id);
801 * For given node returns list of IDs of inverse elements
802 * If there is not node for given ID - returns empty list
804 long_array GetNodeInverseElements(in long id);
807 * \brief Return position of a node on shape
809 NodePosition GetNodePosition(in long NodeID);
812 * If given element is node returns IDs of shape from position
813 * If there is not node for given ID - returns -1
815 long GetShapeID(in long id);
818 * For given element returns ID of result shape after
819 * ::FindShape() from SMESH_MeshEditor
820 * If there is not element for given ID - returns -1
822 long GetShapeIDForElem(in long id);
825 * Returns number of nodes for given element
826 * If there is not element for given ID - returns -1
828 long GetElemNbNodes(in long id);
831 * Returns IDs of nodes of given element
833 long_array GetElemNodes(in long id);
836 * Returns ID of node by given index for given element
837 * If there is not element for given ID - returns -1
838 * If there is not node for given index - returns -2
840 long GetElemNode(in long id, in long index);
843 * Returns true if given node is medium node
844 * in given quadratic element
846 boolean IsMediumNode(in long ide, in long idn);
849 * Returns true if given node is medium node
850 * in one of quadratic elements
852 boolean IsMediumNodeOfAnyElem(in long idn, in ElementType elem_type);
855 * Returns number of edges for given element
857 long ElemNbEdges(in long id);
860 * Returns number of faces for given element
862 long ElemNbFaces(in long id);
865 * Returns nodes of given face (counted from zero) for given volumic element.
867 long_array GetElemFaceNodes(in long elemId, in short faceIndex);
870 * Returns an element based on all given nodes.
872 long FindElementByNodes(in long_array nodes);
875 * Returns true if given element is polygon
877 boolean IsPoly(in long id);
880 * Returns true if given element is quadratic
882 boolean IsQuadratic(in long id);
885 * Returns XYZ coordinates of bary center for given element
887 * If there is not element for given ID - returns empty list
889 double_array BaryCenter(in long id);
891 /*! Gets information about imported MED file */
892 SALOME_MED::MedFileInfo GetMEDFileInfo();
895 * Sets list of notebook variables used for Mesh operations separated by ":" symbol
896 * \param theParameters is a string containing the notebook variables
898 void SetParameters (in string theParameters);
901 * Returns list of notebook variables used for Mesh operations separated by ":" symbol
903 string GetParameters();
906 * Returns list of notebook variables used for last Mesh operation
908 string_array GetLastParameters();
911 interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
916 long GetNumberOfElements()
917 raises (SALOME::SALOME_Exception);
922 long GetNumberOfNodes( in boolean all )
923 raises (SALOME::SALOME_Exception);
928 long_array GetElementsId()
929 raises (SALOME::SALOME_Exception);
934 long_array GetElementsByType( in ElementType theType )
935 raises (SALOME::SALOME_Exception);
938 * Return type of submesh element
940 ElementType GetElementType( in long id, in boolean iselem )
941 raises (SALOME::SALOME_Exception);
946 long_array GetNodesId()
947 raises (SALOME::SALOME_Exception);
950 * Get geom shape the submesh is dedicated to
952 GEOM::GEOM_Object GetSubShape()
953 raises (SALOME::SALOME_Exception);
956 * Get SMESH_Mesh which stores nodes coordinates & elements definition
958 SMESH_Mesh GetFather()
959 raises (SALOME::SALOME_Exception);
962 * Get the internal Id
969 SALOME_MED::FAMILY GetFamily()
970 raises (SALOME::SALOME_Exception);