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 "SALOME_Notebook.idl"
32 #include "GEOM_Gen.idl"
37 interface SMESH_Hypothesis;
38 typedef sequence<SMESH_Hypothesis> ListOfHypothesis;
39 interface SMESH_GroupBase;
40 typedef sequence<SMESH_GroupBase> ListOfGroups;
42 typedef sequence<double > double_array ;
43 typedef sequence<long > long_array ;
44 typedef sequence<string > string_array ;
45 typedef sequence<long_array> array_of_long_array ;
63 CHANGE_POLYHEDRON_NODES,
84 struct PointStruct { double x;
88 typedef sequence<PointStruct> nodes_array;
90 struct DirStruct { PointStruct PS ; } ; // analog to Occ Direction
92 struct AxisStruct { double x;
100 * Node location on a shape
102 struct NodePosition {
104 GEOM::shape_type shapeType;
105 double_array params; // [U] on EDGE, [U,V] on FACE, [] on the rest shapes
109 * Enumeration for element type, like in SMDS
122 * Enumeration for element geometry type, like in SMDS
139 * ElementOrder points out entities of what order are requested
142 ORDER_ANY, /*! entities of any order */
143 ORDER_LINEAR, /*! entities of 1st order */
144 ORDER_QUADRATIC /*! entities of 2nd order */
149 * Enumeration of entity type uses in mesh info array,
150 * and should be synchronised with enum in SMDS
159 Entity_Quad_Triangle,
161 Entity_Quad_Quadrangle,
173 Entity_Quad_Polyhedra,
179 * Enumeration for hypothesis status (used by AddHypothesis() and RemoveHypothesis() methods)
181 enum Hypothesis_Status // in the order of severity
184 HYP_MISSING, // algo misses a hypothesis
185 HYP_CONCURENT, // several applicable hypotheses
186 HYP_BAD_PARAMETER,// hypothesis has a bad parameter value
187 HYP_HIDDEN_ALGO, // an algo is hidden by an upper dim algo generating all-dim elements
188 HYP_HIDING_ALGO, // an algo hides lower dim algos by generating all-dim elements
189 HYP_UNKNOWN_FATAL,// --- all statuses below should be considered as fatal
190 // for Add/RemoveHypothesis operations
191 HYP_INCOMPATIBLE, // hypothesis does not fit algo
192 HYP_NOTCONFORM, // not conform mesh is produced appling a hypothesis
193 HYP_ALREADY_EXIST,// such hypothesis already exist
194 HYP_BAD_DIM, // bad dimension
195 HYP_BAD_SUBSHAPE, // shape is neither the main one, nor its subshape, nor a group
196 HYP_BAD_GEOMETRY, // geometry mismatches algorithm's expectation
197 HYP_NEED_SHAPE // algorithm can work on shape only
201 * Enumeration for DriverMED read status (used by ImportMEDFile() method)
203 enum DriverMED_ReadStatus // in the order of severity
206 DRS_EMPTY, // a MED file contains no mesh with the given name
207 DRS_WARN_RENUMBER, // a MED file has overlapped ranges of element numbers,
208 // so the numbers from the file are ignored
209 DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
210 DRS_FAIL // general failure (exception etc.)
214 * Enumeration for DriverMED (used by Perform() method)
216 enum MED_VERSION // in the order of severity
222 typedef sequence<log_block> log_array;
226 * Auxilary flags for advanced extrusion.
227 * BOUNDARY: create or not boundary for result of extrusion
228 * SEW: try to use existing nodes or create new nodes in any case
230 const long EXTRUSION_FLAG_BOUNDARY = 1;
231 const long EXTRUSION_FLAG_SEW = 2;
234 * Structure used in mesh edit preview data (MeshPreviewStruct)
236 struct ElementSubType { ElementType SMDS_ElementType;
238 long nbNodesInElement; };
240 typedef sequence<ElementSubType> types_array;
243 * Structure containing mesh edit preview data
245 struct MeshPreviewStruct { nodes_array nodesXYZ;
246 long_array elementConnectivities;
247 types_array elementTypes; };
249 interface SMESH_IDSource
252 * Returns a sequence of all element IDs
257 * Returns statistic of mesh elements
258 * Result array of number enityties
260 long_array GetMeshInfo();
263 interface SMESH_Group;
264 interface SMESH_GroupOnGeom;
265 interface SMESH_subMesh;
266 interface SMESH_MeshEditor;
267 interface SMESH_Mesh : SALOME::ParameterizedObject, SMESH_IDSource
270 * Return true if there is a geometry to be meshed
272 boolean HasShapeToMesh()
273 raises (SALOME::SALOME_Exception);
276 * Get geom shape to mesh. A result sould not be nil. Use HasShapeToMesh()
277 * to know if a returned shape
279 GEOM::GEOM_Object GetShapeToMesh()
280 raises (SALOME::SALOME_Exception);
283 * Remove all nodes and elements
286 raises (SALOME::SALOME_Exception);
289 * Remove all nodes and elements of submesh
291 void ClearSubMesh(in long ShapeID)
292 raises (SALOME::SALOME_Exception);
295 * Get the subMesh object associated to a subShape. The subMesh object
296 * gives access to nodes and elements IDs.
297 * SubMesh will be used instead of SubShape in a next idl version to
298 * adress a specific subMesh...
300 SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
301 raises (SALOME::SALOME_Exception);
306 void RemoveSubMesh(in SMESH_subMesh aSubMesh)
307 raises (SALOME::SALOME_Exception);
313 SMESH_Group CreateGroup( in ElementType elem_type,
315 raises (SALOME::SALOME_Exception);
318 * Create a group from geometry group
320 SMESH_GroupOnGeom CreateGroupFromGEOM( in ElementType elem_type,
322 in GEOM::GEOM_Object theGeomObject )
323 raises (SALOME::SALOME_Exception);
328 void RemoveGroup(in SMESH_GroupBase aGroup)
329 raises (SALOME::SALOME_Exception);
332 * Remove group with its contents
334 void RemoveGroupWithContents( in SMESH_GroupBase aGroup )
335 raises (SALOME::SALOME_Exception);
338 * Get the list of groups existing in the mesh
340 ListOfGroups GetGroups()
341 raises (SALOME::SALOME_Exception);
344 * Get number of groups existing in the mesh
347 raises (SALOME::SALOME_Exception);
350 * Union of two groups
351 * New group is created. All mesh elements that are
352 * present in initial groups are added to the new one
354 SMESH_Group UnionGroups (in SMESH_GroupBase aGroup1,
355 in SMESH_GroupBase aGroup2,
357 raises (SALOME::SALOME_Exception);
360 * Union of list of groups
361 * New group is created. All mesh elements that are
362 * present in initial groups are added to the new one
364 SMESH_Group UnionListOfGroups (in ListOfGroups aListOfGroups,
366 raises (SALOME::SALOME_Exception);
369 * Intersection of two groups
370 * New group is created. All mesh elements that are
371 * present in both initial groups are added to the new one.
373 SMESH_Group IntersectGroups (in SMESH_GroupBase aGroup1,
374 in SMESH_GroupBase aGroup2,
376 raises (SALOME::SALOME_Exception);
379 * Intersection of list of groups
380 * New group is created. All mesh elements that are
381 * present in all initial groups simultaneously are added to the new one.
383 SMESH_Group IntersectListOfGroups (in ListOfGroups aListOfGroups,
385 raises (SALOME::SALOME_Exception);
389 * New group is created. All mesh elements that are present in
390 * main group but do not present in tool group are added to the new one
392 SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
393 in SMESH_GroupBase aToolGroup,
395 raises (SALOME::SALOME_Exception);
398 * Cut of lists of groups
399 * New group is created. All mesh elements that are present in
400 * main groups but do not present in tool groups are added to the new one
402 SMESH_Group CutListOfGroups (in ListOfGroups aMainGroups,
403 in ListOfGroups aToolGroups,
405 raises (SALOME::SALOME_Exception);
408 * Create groups of entities from existing groups of superior dimensions
409 * New group is created. System
410 * 1) extracts all nodes from each group,
411 * 2) combines all elements of specified dimension laying on these nodes.
413 SMESH_Group CreateDimGroup( in ListOfGroups aListOfGroups,
414 in ElementType anElemType,
416 raises (SALOME::SALOME_Exception);
419 * Convert group on geometry into standalone group
421 SMESH_Group ConvertToStandalone( in SMESH_GroupOnGeom theGeomGroup )
422 raises (SALOME::SALOME_Exception);
425 * Add hypothesis to the mesh, under a particular subShape
426 * (or the main shape itself)
427 * The Add method is only used to prepare the build of the mesh and store
428 * the algorithms and associated parameters.
429 * Actual job of mesh the shape is done by MESH_Gen.
431 * - aSubShape : subShape obtained by a shape explode in GEOM
433 * - anHyp : hypothesis object
435 * - OK if the hypothesis is compatible with the subShape
436 * (and all previous hypothesis on the subShape)
437 * - NOK if the hypothesis is not compatible with the subShape
438 * (or one previous hypothesis on the subShape)
439 * raises exception if hypothesis has not been created
441 Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
442 in SMESH_Hypothesis anHyp)
443 raises (SALOME::SALOME_Exception);
444 // boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
445 // raises (SALOME::SALOME_Exception);
448 * Remove an hypothesis previouly added with AddHypothesis.
450 Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject,
451 in SMESH_Hypothesis anHyp)
452 raises (SALOME::SALOME_Exception);
453 // boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
454 // in SMESH_Hypothesis anHyp)
455 // raises (SALOME::SALOME_Exception);
458 * Get the list of hypothesis added on a subShape
460 ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Object aSubObject)
461 raises (SALOME::SALOME_Exception);
462 // ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
463 // raises (SALOME::SALOME_Exception);
466 * Get the log of nodes and elements added or removed since previous
469 * - clearAfterGet : log is emptied after Get (safe if concurrents access)
471 // string_array GetLog(in boolean clearAfterGet)
472 // raises (SALOME::SALOME_Exception);
473 log_array GetLog(in boolean clearAfterGet)
474 raises (SALOME::SALOME_Exception);
477 * Clear the log of nodes and elements added or removed since previous
478 * clear. Must be used immediately after GetLog if clearAfterGet is false.
481 raises (SALOME::SALOME_Exception);
484 * Toggle auto color mode on the object.
486 * - theAutoColor : flag which toggles auto color mode.
488 void SetAutoColor(in boolean theAutoColor)
489 raises (SALOME::SALOME_Exception);
492 * Get flag of object's auto color mode.
494 boolean GetAutoColor()
495 raises (SALOME::SALOME_Exception);
498 * Get the internal Id
508 * Obtain instance of SMESH_MeshEditor
510 SMESH_MeshEditor GetMeshEditor()
511 raises (SALOME::SALOME_Exception);
514 * Return SMESH_MeshEditor that would not modify the mesh but
515 * fill MeshPreviewStruct
517 SMESH_MeshEditor GetMeshEditPreviewer()
518 raises (SALOME::SALOME_Exception);
520 /*! Check group names for duplications.
521 * Consider maximum group name length stored in MED file.
523 boolean HasDuplicatedGroupNamesMED();
526 * Export Mesh to different MED Formats
528 * - auto_groups : boolean parameter for creating/not creating
529 * the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
530 * the typical use is auto_groups=false.
531 * - theVersion : define the version of format of MED file, that will be created
533 void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
534 raises (SALOME::SALOME_Exception);
537 * Export Mesh to MED_V2_1 MED format
538 * Works, just the same as ExportToMED, with MED_VERSION parameter equal to MED_V2_1.
539 * The method is kept in order to support old functionality
541 void ExportMED( in string file, in boolean auto_groups )
542 raises (SALOME::SALOME_Exception);
545 * Return string representation of a MED file version comprising nbDigits
547 string GetVersionString(in MED_VERSION version, in short nbDigits);
550 * Export Mesh to DAT, UNV and STL Formats
551 * (UNV supported version is I-DEAS 10)
553 void ExportDAT( in string file )
554 raises (SALOME::SALOME_Exception);
555 void ExportUNV( in string file )
556 raises (SALOME::SALOME_Exception);
557 void ExportSTL( in string file, in boolean isascii )
558 raises (SALOME::SALOME_Exception);
563 SALOME_MED::MESH GetMEDMesh()
564 raises (SALOME::SALOME_Exception);
567 * Get informations about mesh contents
570 raises (SALOME::SALOME_Exception);
573 raises (SALOME::SALOME_Exception);
576 raises (SALOME::SALOME_Exception);
579 raises (SALOME::SALOME_Exception);
581 long NbEdgesOfOrder(in ElementOrder order)
582 raises (SALOME::SALOME_Exception);
585 raises (SALOME::SALOME_Exception);
587 long NbFacesOfOrder(in ElementOrder order)
588 raises (SALOME::SALOME_Exception);
591 raises (SALOME::SALOME_Exception);
593 long NbTrianglesOfOrder(in ElementOrder order)
594 raises (SALOME::SALOME_Exception);
597 raises (SALOME::SALOME_Exception);
599 long NbQuadranglesOfOrder(in ElementOrder order)
600 raises (SALOME::SALOME_Exception);
603 raises (SALOME::SALOME_Exception);
606 raises (SALOME::SALOME_Exception);
608 long NbVolumesOfOrder(in ElementOrder order)
609 raises (SALOME::SALOME_Exception);
612 raises (SALOME::SALOME_Exception);
614 long NbTetrasOfOrder(in ElementOrder order)
615 raises (SALOME::SALOME_Exception);
618 raises (SALOME::SALOME_Exception);
620 long NbHexasOfOrder(in ElementOrder order)
621 raises (SALOME::SALOME_Exception);
624 raises (SALOME::SALOME_Exception);
626 long NbPyramidsOfOrder(in ElementOrder order)
627 raises (SALOME::SALOME_Exception);
630 raises (SALOME::SALOME_Exception);
632 long NbPrismsOfOrder(in ElementOrder order)
633 raises (SALOME::SALOME_Exception);
636 raises (SALOME::SALOME_Exception);
639 raises (SALOME::SALOME_Exception);
641 long_array GetElementsId()
642 raises (SALOME::SALOME_Exception);
644 long_array GetElementsByType( in ElementType theType )
645 raises (SALOME::SALOME_Exception);
647 long_array GetNodesId()
648 raises (SALOME::SALOME_Exception);
651 * Returns type of mesh element
653 ElementType GetElementType( in long id, in boolean iselem )
654 raises (SALOME::SALOME_Exception);
656 long_array GetSubMeshElementsId(in long ShapeID)
657 raises (SALOME::SALOME_Exception);
659 long_array GetSubMeshNodesId(in long ShapeID, in boolean all )
660 raises (SALOME::SALOME_Exception);
662 ElementType GetSubMeshElementType(in long ShapeID)
663 raises (SALOME::SALOME_Exception);
666 * Get mesh description
673 long long GetMeshPtr();
676 * Get XYZ coordinates of node as list of double
677 * If there is not node for given ID - returns empty list
679 double_array GetNodeXYZ(in long id);
682 * For given node returns list of IDs of inverse elements
683 * If there is not node for given ID - returns empty list
685 long_array GetNodeInverseElements(in long id);
688 * \brief Return position of a node on shape
690 NodePosition GetNodePosition(in long NodeID);
693 * If given element is node returns IDs of shape from position
694 * If there is not node for given ID - returns -1
696 long GetShapeID(in long id);
699 * For given element returns ID of result shape after
700 * ::FindShape() from SMESH_MeshEditor
701 * If there is not element for given ID - returns -1
703 long GetShapeIDForElem(in long id);
706 * Returns number of nodes for given element
707 * If there is not element for given ID - returns -1
709 long GetElemNbNodes(in long id);
712 * Returns IDs of nodes of given element
714 long_array GetElemNodes(in long id);
717 * Returns ID of node by given index for given element
718 * If there is not element for given ID - returns -1
719 * If there is not node for given index - returns -2
721 long GetElemNode(in long id, in long index);
724 * Returns true if given node is medium node
725 * in given quadratic element
727 boolean IsMediumNode(in long ide, in long idn);
730 * Returns true if given node is medium node
731 * in one of quadratic elements
733 boolean IsMediumNodeOfAnyElem(in long idn, in ElementType elem_type);
736 * Returns number of edges for given element
738 long ElemNbEdges(in long id);
741 * Returns number of faces for given element
743 long ElemNbFaces(in long id);
746 * Returns true if given element is polygon
748 boolean IsPoly(in long id);
751 * Returns true if given element is quadratic
753 boolean IsQuadratic(in long id);
756 * Returns XYZ coordinates of bary center for given element
758 * If there is not element for given ID - returns empty list
760 double_array BaryCenter(in long id);
762 /*! Gets information about imported MED file */
763 SALOME_MED::MedFileInfo GetMEDFileInfo();
766 interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
771 long GetNumberOfElements()
772 raises (SALOME::SALOME_Exception);
777 long GetNumberOfNodes( in boolean all )
778 raises (SALOME::SALOME_Exception);
783 long_array GetElementsId()
784 raises (SALOME::SALOME_Exception);
789 long_array GetElementsByType( in ElementType theType )
790 raises (SALOME::SALOME_Exception);
793 * Return type of submesh element
795 ElementType GetElementType( in long id, in boolean iselem )
796 raises (SALOME::SALOME_Exception);
801 long_array GetNodesId()
802 raises (SALOME::SALOME_Exception);
805 * Get geom shape the submesh is dedicated to
807 GEOM::GEOM_Object GetSubShape()
808 raises (SALOME::SALOME_Exception);
811 * Get SMESH_Mesh which stores nodes coordinates & elements definition
813 SMESH_Mesh GetFather()
814 raises (SALOME::SALOME_Exception);
817 * Get the internal Id
824 SALOME_MED::FAMILY GetFamily()
825 raises (SALOME::SALOME_Exception);