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,
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 * Enumeration for element geometry type, like in SMDS
136 * ElementOrder points out entities of what order are requested
139 ORDER_ANY, /*! entities of any order */
140 ORDER_LINEAR, /*! entities of 1st order */
141 ORDER_QUADRATIC /*! entities of 2nd order */
145 * Enumeration for hypothesis status (used by AddHypothesis() and RemoveHypothesis() methods)
147 enum Hypothesis_Status // in the order of severity
150 HYP_MISSING, // algo misses a hypothesis
151 HYP_CONCURENT, // several applicable hypotheses
152 HYP_BAD_PARAMETER,// hypothesis has a bad parameter value
153 HYP_HIDDEN_ALGO, // an algo is hidden by an upper dim algo generating all-dim elements
154 HYP_HIDING_ALGO, // an algo hides lower dim algos by generating all-dim elements
155 HYP_UNKNOWN_FATAL,// --- all statuses below should be considered as fatal
156 // for Add/RemoveHypothesis operations
157 HYP_INCOMPATIBLE, // hypothesis does not fit algo
158 HYP_NOTCONFORM, // not conform mesh is produced appling a hypothesis
159 HYP_ALREADY_EXIST,// such hypothesis already exist
160 HYP_BAD_DIM, // bad dimension
161 HYP_BAD_SUBSHAPE, // shape is neither the main one, nor its subshape, nor a group
162 HYP_BAD_GEOMETRY, // geometry mismatches algorithm's expectation
163 HYP_NEED_SHAPE // algorithm can work on shape only
167 * Enumeration for DriverMED read status (used by ImportMEDFile() method)
169 enum DriverMED_ReadStatus // in the order of severity
172 DRS_EMPTY, // a MED file contains no mesh with the given name
173 DRS_WARN_RENUMBER, // a MED file has overlapped ranges of element numbers,
174 // so the numbers from the file are ignored
175 DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
176 DRS_FAIL // general failure (exception etc.)
180 * Enumeration for DriverMED (used by Perform() method)
182 enum MED_VERSION // in the order of severity
188 typedef sequence<log_block> log_array;
192 * Auxilary flags for advanced extrusion.
193 * BOUNDARY: create or not boundary for result of extrusion
194 * SEW: try to use existing nodes or create new nodes in any case
196 const long EXTRUSION_FLAG_BOUNDARY = 1;
197 const long EXTRUSION_FLAG_SEW = 2;
200 * Structure used in mesh edit preview data (MeshPreviewStruct)
202 struct ElementSubType { ElementType SMDS_ElementType;
204 long nbNodesInElement; };
206 typedef sequence<ElementSubType> types_array;
209 * Structure containing mesh edit preview data
211 struct MeshPreviewStruct { nodes_array nodesXYZ;
212 long_array elementConnectivities;
213 types_array elementTypes; };
215 interface SMESH_IDSource
218 * Returns a sequence of all element IDs
223 interface SMESH_Group;
224 interface SMESH_GroupOnGeom;
225 interface SMESH_subMesh;
226 interface SMESH_MeshEditor;
227 interface SMESH_Mesh : SALOME::GenericObj, SMESH_IDSource
230 * Return true if there is a geometry to be meshed
232 boolean HasShapeToMesh()
233 raises (SALOME::SALOME_Exception);
236 * Get geom shape to mesh. A result sould not be nil. Use HasShapeToMesh()
237 * to know if a returned shape
239 GEOM::GEOM_Object GetShapeToMesh()
240 raises (SALOME::SALOME_Exception);
243 * Remove all nodes and elements
246 raises (SALOME::SALOME_Exception);
249 * Remove all nodes and elements of submesh
251 void ClearSubMesh(in long ShapeID)
252 raises (SALOME::SALOME_Exception);
255 * Get the subMesh object associated to a subShape. The subMesh object
256 * gives access to nodes and elements IDs.
257 * SubMesh will be used instead of SubShape in a next idl version to
258 * adress a specific subMesh...
260 SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
261 raises (SALOME::SALOME_Exception);
266 void RemoveSubMesh(in SMESH_subMesh aSubMesh)
267 raises (SALOME::SALOME_Exception);
273 SMESH_Group CreateGroup( in ElementType elem_type,
275 raises (SALOME::SALOME_Exception);
278 * Create a group from geometry group
280 SMESH_GroupOnGeom CreateGroupFromGEOM( in ElementType elem_type,
282 in GEOM::GEOM_Object theGeomObject )
283 raises (SALOME::SALOME_Exception);
288 void RemoveGroup(in SMESH_GroupBase aGroup)
289 raises (SALOME::SALOME_Exception);
292 * Remove group with its contents
294 void RemoveGroupWithContents( in SMESH_GroupBase aGroup )
295 raises (SALOME::SALOME_Exception);
298 * Get the list of groups existing in the mesh
300 ListOfGroups GetGroups()
301 raises (SALOME::SALOME_Exception);
304 * Get number of groups existing in the mesh
307 raises (SALOME::SALOME_Exception);
310 * Union of two groups
311 * New group is created. All mesh elements that are
312 * present in initial groups are added to the new one
314 SMESH_Group UnionGroups (in SMESH_GroupBase aGroup1,
315 in SMESH_GroupBase aGroup2,
317 raises (SALOME::SALOME_Exception);
320 * Union of list of groups
321 * New group is created. All mesh elements that are
322 * present in initial groups are added to the new one
324 SMESH_Group UnionListOfGroups (in ListOfGroups aListOfGroups,
326 raises (SALOME::SALOME_Exception);
329 * Intersection of two groups
330 * New group is created. All mesh elements that are
331 * present in both initial groups are added to the new one.
333 SMESH_Group IntersectGroups (in SMESH_GroupBase aGroup1,
334 in SMESH_GroupBase aGroup2,
336 raises (SALOME::SALOME_Exception);
339 * Intersection of list of groups
340 * New group is created. All mesh elements that are
341 * present in all initial groups simultaneously are added to the new one.
343 SMESH_Group IntersectListOfGroups (in ListOfGroups aListOfGroups,
345 raises (SALOME::SALOME_Exception);
349 * New group is created. All mesh elements that are present in
350 * main group but do not present in tool group are added to the new one
352 SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
353 in SMESH_GroupBase aToolGroup,
355 raises (SALOME::SALOME_Exception);
358 * Cut of lists of groups
359 * New group is created. All mesh elements that are present in
360 * main groups but do not present in tool groups are added to the new one
362 SMESH_Group CutListOfGroups (in ListOfGroups aMainGroups,
363 in ListOfGroups aToolGroups,
365 raises (SALOME::SALOME_Exception);
368 * Create groups of entities from existing groups of superior dimensions
369 * New group is created. System
370 * 1) extracts all nodes from each group,
371 * 2) combines all elements of specified dimension laying on these nodes.
373 SMESH_Group CreateDimGroup( in ListOfGroups aListOfGroups,
374 in ElementType anElemType,
376 raises (SALOME::SALOME_Exception);
379 * Convert group on geometry into standalone group
381 SMESH_Group ConvertToStandalone( in SMESH_GroupOnGeom theGeomGroup )
382 raises (SALOME::SALOME_Exception);
385 * Add hypothesis to the mesh, under a particular subShape
386 * (or the main shape itself)
387 * The Add method is only used to prepare the build of the mesh and store
388 * the algorithms and associated parameters.
389 * Actual job of mesh the shape is done by MESH_Gen.
391 * - aSubShape : subShape obtained by a shape explode in GEOM
393 * - anHyp : hypothesis object
395 * - OK if the hypothesis is compatible with the subShape
396 * (and all previous hypothesis on the subShape)
397 * - NOK if the hypothesis is not compatible with the subShape
398 * (or one previous hypothesis on the subShape)
399 * raises exception if hypothesis has not been created
401 Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
402 in SMESH_Hypothesis anHyp)
403 raises (SALOME::SALOME_Exception);
404 // boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
405 // raises (SALOME::SALOME_Exception);
408 * Remove an hypothesis previouly added with AddHypothesis.
410 Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject,
411 in SMESH_Hypothesis anHyp)
412 raises (SALOME::SALOME_Exception);
413 // boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
414 // in SMESH_Hypothesis anHyp)
415 // raises (SALOME::SALOME_Exception);
418 * Get the list of hypothesis added on a subShape
420 ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Object aSubObject)
421 raises (SALOME::SALOME_Exception);
422 // ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
423 // raises (SALOME::SALOME_Exception);
426 * Get the log of nodes and elements added or removed since previous
429 * - clearAfterGet : log is emptied after Get (safe if concurrents access)
431 // string_array GetLog(in boolean clearAfterGet)
432 // raises (SALOME::SALOME_Exception);
433 log_array GetLog(in boolean clearAfterGet)
434 raises (SALOME::SALOME_Exception);
437 * Clear the log of nodes and elements added or removed since previous
438 * clear. Must be used immediately after GetLog if clearAfterGet is false.
441 raises (SALOME::SALOME_Exception);
444 * Toggle auto color mode on the object.
446 * - theAutoColor : flag which toggles auto color mode.
448 void SetAutoColor(in boolean theAutoColor)
449 raises (SALOME::SALOME_Exception);
452 * Get flag of object's auto color mode.
454 boolean GetAutoColor()
455 raises (SALOME::SALOME_Exception);
458 * Get the internal Id
468 * Obtain instance of SMESH_MeshEditor
470 SMESH_MeshEditor GetMeshEditor()
471 raises (SALOME::SALOME_Exception);
474 * Return SMESH_MeshEditor that would not modify the mesh but
475 * fill MeshPreviewStruct
477 SMESH_MeshEditor GetMeshEditPreviewer()
478 raises (SALOME::SALOME_Exception);
480 /*! Check group names for duplications.
481 * Consider maximum group name length stored in MED file.
483 boolean HasDuplicatedGroupNamesMED();
486 * Export Mesh to different MED Formats
488 * - auto_groups : boolean parameter for creating/not creating
489 * the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
490 * the typical use is auto_groups=false.
491 * - theVersion : define the version of format of MED file, that will be created
493 void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
494 raises (SALOME::SALOME_Exception);
497 * Export Mesh to MED_V2_1 MED format
498 * Works, just the same as ExportToMED, with MED_VERSION parameter equal to MED_V2_1.
499 * The method is kept in order to support old functionality
501 void ExportMED( in string file, in boolean auto_groups )
502 raises (SALOME::SALOME_Exception);
505 * Return string representation of a MED file version comprising nbDigits
507 string GetVersionString(in MED_VERSION version, in short nbDigits);
510 * Export Mesh to DAT, UNV and STL Formats
511 * (UNV supported version is I-DEAS 10)
513 void ExportDAT( in string file )
514 raises (SALOME::SALOME_Exception);
515 void ExportUNV( in string file )
516 raises (SALOME::SALOME_Exception);
517 void ExportSTL( in string file, in boolean isascii )
518 raises (SALOME::SALOME_Exception);
523 SALOME_MED::MESH GetMEDMesh()
524 raises (SALOME::SALOME_Exception);
527 * Get informations about mesh contents
530 raises (SALOME::SALOME_Exception);
533 raises (SALOME::SALOME_Exception);
536 raises (SALOME::SALOME_Exception);
538 long NbEdgesOfOrder(in ElementOrder order)
539 raises (SALOME::SALOME_Exception);
542 raises (SALOME::SALOME_Exception);
544 long NbFacesOfOrder(in ElementOrder order)
545 raises (SALOME::SALOME_Exception);
548 raises (SALOME::SALOME_Exception);
550 long NbTrianglesOfOrder(in ElementOrder order)
551 raises (SALOME::SALOME_Exception);
554 raises (SALOME::SALOME_Exception);
556 long NbQuadranglesOfOrder(in ElementOrder order)
557 raises (SALOME::SALOME_Exception);
560 raises (SALOME::SALOME_Exception);
563 raises (SALOME::SALOME_Exception);
565 long NbVolumesOfOrder(in ElementOrder order)
566 raises (SALOME::SALOME_Exception);
569 raises (SALOME::SALOME_Exception);
571 long NbTetrasOfOrder(in ElementOrder order)
572 raises (SALOME::SALOME_Exception);
575 raises (SALOME::SALOME_Exception);
577 long NbHexasOfOrder(in ElementOrder order)
578 raises (SALOME::SALOME_Exception);
581 raises (SALOME::SALOME_Exception);
583 long NbPyramidsOfOrder(in ElementOrder order)
584 raises (SALOME::SALOME_Exception);
587 raises (SALOME::SALOME_Exception);
589 long NbPrismsOfOrder(in ElementOrder order)
590 raises (SALOME::SALOME_Exception);
593 raises (SALOME::SALOME_Exception);
596 raises (SALOME::SALOME_Exception);
598 long_array GetElementsId()
599 raises (SALOME::SALOME_Exception);
601 long_array GetElementsByType( in ElementType theType )
602 raises (SALOME::SALOME_Exception);
604 long_array GetNodesId()
605 raises (SALOME::SALOME_Exception);
608 * Returns type of mesh element
610 ElementType GetElementType( in long id, in boolean iselem )
611 raises (SALOME::SALOME_Exception);
613 long_array GetSubMeshElementsId(in long ShapeID)
614 raises (SALOME::SALOME_Exception);
616 long_array GetSubMeshNodesId(in long ShapeID, in boolean all )
617 raises (SALOME::SALOME_Exception);
619 ElementType GetSubMeshElementType(in long ShapeID)
620 raises (SALOME::SALOME_Exception);
623 * Get mesh description
630 long long GetMeshPtr();
633 * Get XYZ coordinates of node as list of double
634 * If there is not node for given ID - returns empty list
636 double_array GetNodeXYZ(in long id);
639 * For given node returns list of IDs of inverse elements
640 * If there is not node for given ID - returns empty list
642 long_array GetNodeInverseElements(in long id);
645 * \brief Return position of a node on shape
647 NodePosition GetNodePosition(in long NodeID);
650 * If given element is node returns IDs of shape from position
651 * If there is not node for given ID - returns -1
653 long GetShapeID(in long id);
656 * For given element returns ID of result shape after
657 * ::FindShape() from SMESH_MeshEditor
658 * If there is not element for given ID - returns -1
660 long GetShapeIDForElem(in long id);
663 * Returns number of nodes for given element
664 * If there is not element for given ID - returns -1
666 long GetElemNbNodes(in long id);
669 * Returns IDs of nodes of given element
671 long_array GetElemNodes(in long id);
674 * Returns ID of node by given index for given element
675 * If there is not element for given ID - returns -1
676 * If there is not node for given index - returns -2
678 long GetElemNode(in long id, in long index);
681 * Returns true if given node is medium node
682 * in given quadratic element
684 boolean IsMediumNode(in long ide, in long idn);
687 * Returns true if given node is medium node
688 * in one of quadratic elements
690 boolean IsMediumNodeOfAnyElem(in long idn, in ElementType elem_type);
693 * Returns number of edges for given element
695 long ElemNbEdges(in long id);
698 * Returns number of faces for given element
700 long ElemNbFaces(in long id);
703 * Returns true if given element is polygon
705 boolean IsPoly(in long id);
708 * Returns true if given element is quadratic
710 boolean IsQuadratic(in long id);
713 * Returns XYZ coordinates of bary center for given element
715 * If there is not element for given ID - returns empty list
717 double_array BaryCenter(in long id);
719 /*! Gets information about imported MED file */
720 SALOME_MED::MedFileInfo GetMEDFileInfo();
723 * Sets list of notebook variables used for Mesh operations separated by ":" symbol
724 * \param theParameters is a string containing the notebook variables
726 void SetParameters (in string theParameters);
729 * Returns list of notebook variables used for Mesh operations separated by ":" symbol
731 string GetParameters();
734 * Returns list of notebook variables used for last Mesh operation
736 string_array GetLastParameters();
739 interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
744 long GetNumberOfElements()
745 raises (SALOME::SALOME_Exception);
750 long GetNumberOfNodes( in boolean all )
751 raises (SALOME::SALOME_Exception);
756 long_array GetElementsId()
757 raises (SALOME::SALOME_Exception);
762 long_array GetElementsByType( in ElementType theType )
763 raises (SALOME::SALOME_Exception);
766 * Return type of submesh element
768 ElementType GetElementType( in long id, in boolean iselem )
769 raises (SALOME::SALOME_Exception);
774 long_array GetNodesId()
775 raises (SALOME::SALOME_Exception);
778 * Get geom shape the submesh is dedicated to
780 GEOM::GEOM_Object GetSubShape()
781 raises (SALOME::SALOME_Exception);
784 * Get SMESH_Mesh which stores nodes coordinates & elements definition
786 SMESH_Mesh GetFather()
787 raises (SALOME::SALOME_Exception);
790 * Get the internal Id
797 SALOME_MED::FAMILY GetFamily()
798 raises (SALOME::SALOME_Exception);