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;
266 interface SMESH_Mesh : SALOME::GenericObj, SMESH_IDSource
269 * Return true if there is a geometry to be meshed
271 boolean HasShapeToMesh()
272 raises (SALOME::SALOME_Exception);
275 * Get geom shape to mesh. A result sould not be nil. Use HasShapeToMesh()
276 * to know if a returned shape
278 GEOM::GEOM_Object GetShapeToMesh()
279 raises (SALOME::SALOME_Exception);
282 * Remove all nodes and elements
285 raises (SALOME::SALOME_Exception);
288 * Remove all nodes and elements of submesh
290 void ClearSubMesh(in long ShapeID)
291 raises (SALOME::SALOME_Exception);
294 * Get the subMesh object associated to a subShape. The subMesh object
295 * gives access to nodes and elements IDs.
296 * SubMesh will be used instead of SubShape in a next idl version to
297 * adress a specific subMesh...
299 SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
300 raises (SALOME::SALOME_Exception);
305 void RemoveSubMesh(in SMESH_subMesh aSubMesh)
306 raises (SALOME::SALOME_Exception);
312 SMESH_Group CreateGroup( in ElementType elem_type,
314 raises (SALOME::SALOME_Exception);
317 * Create a group from geometry group
319 SMESH_GroupOnGeom CreateGroupFromGEOM( in ElementType elem_type,
321 in GEOM::GEOM_Object theGeomObject )
322 raises (SALOME::SALOME_Exception);
327 void RemoveGroup(in SMESH_GroupBase aGroup)
328 raises (SALOME::SALOME_Exception);
331 * Remove group with its contents
333 void RemoveGroupWithContents( in SMESH_GroupBase aGroup )
334 raises (SALOME::SALOME_Exception);
337 * Get the list of groups existing in the mesh
339 ListOfGroups GetGroups()
340 raises (SALOME::SALOME_Exception);
343 * Get number of groups existing in the mesh
346 raises (SALOME::SALOME_Exception);
349 * Union of two groups
350 * New group is created. All mesh elements that are
351 * present in initial groups are added to the new one
353 SMESH_Group UnionGroups (in SMESH_GroupBase aGroup1,
354 in SMESH_GroupBase aGroup2,
356 raises (SALOME::SALOME_Exception);
359 * Union of list of groups
360 * New group is created. All mesh elements that are
361 * present in initial groups are added to the new one
363 SMESH_Group UnionListOfGroups (in ListOfGroups aListOfGroups,
365 raises (SALOME::SALOME_Exception);
368 * Intersection of two groups
369 * New group is created. All mesh elements that are
370 * present in both initial groups are added to the new one.
372 SMESH_Group IntersectGroups (in SMESH_GroupBase aGroup1,
373 in SMESH_GroupBase aGroup2,
375 raises (SALOME::SALOME_Exception);
378 * Intersection of list of groups
379 * New group is created. All mesh elements that are
380 * present in all initial groups simultaneously are added to the new one.
382 SMESH_Group IntersectListOfGroups (in ListOfGroups aListOfGroups,
384 raises (SALOME::SALOME_Exception);
388 * New group is created. All mesh elements that are present in
389 * main group but do not present in tool group are added to the new one
391 SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
392 in SMESH_GroupBase aToolGroup,
394 raises (SALOME::SALOME_Exception);
397 * Cut of lists of groups
398 * New group is created. All mesh elements that are present in
399 * main groups but do not present in tool groups are added to the new one
401 SMESH_Group CutListOfGroups (in ListOfGroups aMainGroups,
402 in ListOfGroups aToolGroups,
404 raises (SALOME::SALOME_Exception);
407 * Create groups of entities from existing groups of superior dimensions
408 * New group is created. System
409 * 1) extracts all nodes from each group,
410 * 2) combines all elements of specified dimension laying on these nodes.
412 SMESH_Group CreateDimGroup( in ListOfGroups aListOfGroups,
413 in ElementType anElemType,
415 raises (SALOME::SALOME_Exception);
418 * Convert group on geometry into standalone group
420 SMESH_Group ConvertToStandalone( in SMESH_GroupOnGeom theGeomGroup )
421 raises (SALOME::SALOME_Exception);
424 * Add hypothesis to the mesh, under a particular subShape
425 * (or the main shape itself)
426 * The Add method is only used to prepare the build of the mesh and store
427 * the algorithms and associated parameters.
428 * Actual job of mesh the shape is done by MESH_Gen.
430 * - aSubShape : subShape obtained by a shape explode in GEOM
432 * - anHyp : hypothesis object
434 * - OK if the hypothesis is compatible with the subShape
435 * (and all previous hypothesis on the subShape)
436 * - NOK if the hypothesis is not compatible with the subShape
437 * (or one previous hypothesis on the subShape)
438 * raises exception if hypothesis has not been created
440 Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
441 in SMESH_Hypothesis anHyp)
442 raises (SALOME::SALOME_Exception);
443 // boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
444 // raises (SALOME::SALOME_Exception);
447 * Remove an hypothesis previouly added with AddHypothesis.
449 Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject,
450 in SMESH_Hypothesis anHyp)
451 raises (SALOME::SALOME_Exception);
452 // boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
453 // in SMESH_Hypothesis anHyp)
454 // raises (SALOME::SALOME_Exception);
457 * Get the list of hypothesis added on a subShape
459 ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Object aSubObject)
460 raises (SALOME::SALOME_Exception);
461 // ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
462 // raises (SALOME::SALOME_Exception);
465 * Get the log of nodes and elements added or removed since previous
468 * - clearAfterGet : log is emptied after Get (safe if concurrents access)
470 // string_array GetLog(in boolean clearAfterGet)
471 // raises (SALOME::SALOME_Exception);
472 log_array GetLog(in boolean clearAfterGet)
473 raises (SALOME::SALOME_Exception);
476 * Clear the log of nodes and elements added or removed since previous
477 * clear. Must be used immediately after GetLog if clearAfterGet is false.
480 raises (SALOME::SALOME_Exception);
483 * Toggle auto color mode on the object.
485 * - theAutoColor : flag which toggles auto color mode.
487 void SetAutoColor(in boolean theAutoColor)
488 raises (SALOME::SALOME_Exception);
491 * Get flag of object's auto color mode.
493 boolean GetAutoColor()
494 raises (SALOME::SALOME_Exception);
497 * Get the internal Id
507 * Obtain instance of SMESH_MeshEditor
509 SMESH_MeshEditor GetMeshEditor()
510 raises (SALOME::SALOME_Exception);
513 * Return SMESH_MeshEditor that would not modify the mesh but
514 * fill MeshPreviewStruct
516 SMESH_MeshEditor GetMeshEditPreviewer()
517 raises (SALOME::SALOME_Exception);
519 /*! Check group names for duplications.
520 * Consider maximum group name length stored in MED file.
522 boolean HasDuplicatedGroupNamesMED();
525 * Export Mesh to different MED Formats
527 * - auto_groups : boolean parameter for creating/not creating
528 * the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
529 * the typical use is auto_groups=false.
530 * - theVersion : define the version of format of MED file, that will be created
532 void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
533 raises (SALOME::SALOME_Exception);
536 * Export Mesh to MED_V2_1 MED format
537 * Works, just the same as ExportToMED, with MED_VERSION parameter equal to MED_V2_1.
538 * The method is kept in order to support old functionality
540 void ExportMED( in string file, in boolean auto_groups )
541 raises (SALOME::SALOME_Exception);
544 * Return string representation of a MED file version comprising nbDigits
546 string GetVersionString(in MED_VERSION version, in short nbDigits);
549 * Export Mesh to DAT, UNV and STL Formats
550 * (UNV supported version is I-DEAS 10)
552 void ExportDAT( in string file )
553 raises (SALOME::SALOME_Exception);
554 void ExportUNV( in string file )
555 raises (SALOME::SALOME_Exception);
556 void ExportSTL( in string file, in boolean isascii )
557 raises (SALOME::SALOME_Exception);
562 SALOME_MED::MESH GetMEDMesh()
563 raises (SALOME::SALOME_Exception);
566 * Get informations about mesh contents
569 raises (SALOME::SALOME_Exception);
572 raises (SALOME::SALOME_Exception);
575 raises (SALOME::SALOME_Exception);
578 raises (SALOME::SALOME_Exception);
580 long NbEdgesOfOrder(in ElementOrder order)
581 raises (SALOME::SALOME_Exception);
584 raises (SALOME::SALOME_Exception);
586 long NbFacesOfOrder(in ElementOrder order)
587 raises (SALOME::SALOME_Exception);
590 raises (SALOME::SALOME_Exception);
592 long NbTrianglesOfOrder(in ElementOrder order)
593 raises (SALOME::SALOME_Exception);
596 raises (SALOME::SALOME_Exception);
598 long NbQuadranglesOfOrder(in ElementOrder order)
599 raises (SALOME::SALOME_Exception);
602 raises (SALOME::SALOME_Exception);
605 raises (SALOME::SALOME_Exception);
607 long NbVolumesOfOrder(in ElementOrder order)
608 raises (SALOME::SALOME_Exception);
611 raises (SALOME::SALOME_Exception);
613 long NbTetrasOfOrder(in ElementOrder order)
614 raises (SALOME::SALOME_Exception);
617 raises (SALOME::SALOME_Exception);
619 long NbHexasOfOrder(in ElementOrder order)
620 raises (SALOME::SALOME_Exception);
623 raises (SALOME::SALOME_Exception);
625 long NbPyramidsOfOrder(in ElementOrder order)
626 raises (SALOME::SALOME_Exception);
629 raises (SALOME::SALOME_Exception);
631 long NbPrismsOfOrder(in ElementOrder order)
632 raises (SALOME::SALOME_Exception);
635 raises (SALOME::SALOME_Exception);
638 raises (SALOME::SALOME_Exception);
640 long_array GetElementsId()
641 raises (SALOME::SALOME_Exception);
643 long_array GetElementsByType( in ElementType theType )
644 raises (SALOME::SALOME_Exception);
646 long_array GetNodesId()
647 raises (SALOME::SALOME_Exception);
650 * Returns type of mesh element
652 ElementType GetElementType( in long id, in boolean iselem )
653 raises (SALOME::SALOME_Exception);
655 long_array GetSubMeshElementsId(in long ShapeID)
656 raises (SALOME::SALOME_Exception);
658 long_array GetSubMeshNodesId(in long ShapeID, in boolean all )
659 raises (SALOME::SALOME_Exception);
661 ElementType GetSubMeshElementType(in long ShapeID)
662 raises (SALOME::SALOME_Exception);
665 * Get mesh description
672 long long GetMeshPtr();
675 * Get XYZ coordinates of node as list of double
676 * If there is not node for given ID - returns empty list
678 double_array GetNodeXYZ(in long id);
681 * For given node returns list of IDs of inverse elements
682 * If there is not node for given ID - returns empty list
684 long_array GetNodeInverseElements(in long id);
687 * \brief Return position of a node on shape
689 NodePosition GetNodePosition(in long NodeID);
692 * If given element is node returns IDs of shape from position
693 * If there is not node for given ID - returns -1
695 long GetShapeID(in long id);
698 * For given element returns ID of result shape after
699 * ::FindShape() from SMESH_MeshEditor
700 * If there is not element for given ID - returns -1
702 long GetShapeIDForElem(in long id);
705 * Returns number of nodes for given element
706 * If there is not element for given ID - returns -1
708 long GetElemNbNodes(in long id);
711 * Returns IDs of nodes of given element
713 long_array GetElemNodes(in long id);
716 * Returns ID of node by given index for given element
717 * If there is not element for given ID - returns -1
718 * If there is not node for given index - returns -2
720 long GetElemNode(in long id, in long index);
723 * Returns true if given node is medium node
724 * in given quadratic element
726 boolean IsMediumNode(in long ide, in long idn);
729 * Returns true if given node is medium node
730 * in one of quadratic elements
732 boolean IsMediumNodeOfAnyElem(in long idn, in ElementType elem_type);
735 * Returns number of edges for given element
737 long ElemNbEdges(in long id);
740 * Returns number of faces for given element
742 long ElemNbFaces(in long id);
745 * Returns true if given element is polygon
747 boolean IsPoly(in long id);
750 * Returns true if given element is quadratic
752 boolean IsQuadratic(in long id);
755 * Returns XYZ coordinates of bary center for given element
757 * If there is not element for given ID - returns empty list
759 double_array BaryCenter(in long id);
761 /*! Gets information about imported MED file */
762 SALOME_MED::MedFileInfo GetMEDFileInfo();
765 * Sets list of notebook variables used for Mesh operations separated by ":" symbol
766 * \param theParameters is a string containing the notebook variables
768 void SetParameters (in string theParameters);
771 * Returns list of notebook variables used for Mesh operations separated by ":" symbol
773 string GetParameters();
776 * Returns list of notebook variables used for last Mesh operation
778 string_array GetLastParameters();
781 interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
786 long GetNumberOfElements()
787 raises (SALOME::SALOME_Exception);
792 long GetNumberOfNodes( in boolean all )
793 raises (SALOME::SALOME_Exception);
798 long_array GetElementsId()
799 raises (SALOME::SALOME_Exception);
804 long_array GetElementsByType( in ElementType theType )
805 raises (SALOME::SALOME_Exception);
808 * Return type of submesh element
810 ElementType GetElementType( in long id, in boolean iselem )
811 raises (SALOME::SALOME_Exception);
816 long_array GetNodesId()
817 raises (SALOME::SALOME_Exception);
820 * Get geom shape the submesh is dedicated to
822 GEOM::GEOM_Object GetSubShape()
823 raises (SALOME::SALOME_Exception);
826 * Get SMESH_Mesh which stores nodes coordinates & elements definition
828 SMESH_Mesh GetFather()
829 raises (SALOME::SALOME_Exception);
832 * Get the internal Id
839 SALOME_MED::FAMILY GetFamily()
840 raises (SALOME::SALOME_Exception);