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 ;
63 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 */
147 * Enumeration for hypothesis status (used by AddHypothesis() and RemoveHypothesis() methods)
149 enum Hypothesis_Status // in the order of severity
152 HYP_MISSING, // algo misses a hypothesis
153 HYP_CONCURENT, // several applicable hypotheses
154 HYP_BAD_PARAMETER,// hypothesis has a bad parameter value
155 HYP_HIDDEN_ALGO, // an algo is hidden by an upper dim algo generating all-dim elements
156 HYP_HIDING_ALGO, // an algo hides lower dim algos by generating all-dim elements
157 HYP_UNKNOWN_FATAL,// --- all statuses below should be considered as fatal
158 // for Add/RemoveHypothesis operations
159 HYP_INCOMPATIBLE, // hypothesis does not fit algo
160 HYP_NOTCONFORM, // not conform mesh is produced appling a hypothesis
161 HYP_ALREADY_EXIST,// such hypothesis already exist
162 HYP_BAD_DIM, // bad dimension
163 HYP_BAD_SUBSHAPE, // shape is neither the main one, nor its subshape, nor a group
164 HYP_BAD_GEOMETRY, // geometry mismatches algorithm's expectation
165 HYP_NEED_SHAPE // algorithm can work on shape only
169 * Enumeration for DriverMED read status (used by ImportMEDFile() method)
171 enum DriverMED_ReadStatus // in the order of severity
174 DRS_EMPTY, // a MED file contains no mesh with the given name
175 DRS_WARN_RENUMBER, // a MED file has overlapped ranges of element numbers,
176 // so the numbers from the file are ignored
177 DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
178 DRS_FAIL // general failure (exception etc.)
182 * Enumeration for DriverMED (used by Perform() method)
184 enum MED_VERSION // in the order of severity
190 typedef sequence<log_block> log_array;
194 * Auxilary flags for advanced extrusion.
195 * BOUNDARY: create or not boundary for result of extrusion
196 * SEW: try to use existing nodes or create new nodes in any case
198 const long EXTRUSION_FLAG_BOUNDARY = 1;
199 const long EXTRUSION_FLAG_SEW = 2;
202 * Structure used in mesh edit preview data (MeshPreviewStruct)
204 struct ElementSubType { ElementType SMDS_ElementType;
206 long nbNodesInElement; };
208 typedef sequence<ElementSubType> types_array;
211 * Structure containing mesh edit preview data
213 struct MeshPreviewStruct { nodes_array nodesXYZ;
214 long_array elementConnectivities;
215 types_array elementTypes; };
217 interface SMESH_IDSource
220 * Returns a sequence of all element IDs
225 interface SMESH_Group;
226 interface SMESH_GroupOnGeom;
227 interface SMESH_subMesh;
228 interface SMESH_MeshEditor;
229 interface SMESH_Mesh : SALOME::GenericObj, SMESH_IDSource
232 * Return true if there is a geometry to be meshed
234 boolean HasShapeToMesh()
235 raises (SALOME::SALOME_Exception);
238 * Get geom shape to mesh. A result sould not be nil. Use HasShapeToMesh()
239 * to know if a returned shape
241 GEOM::GEOM_Object GetShapeToMesh()
242 raises (SALOME::SALOME_Exception);
245 * Remove all nodes and elements
248 raises (SALOME::SALOME_Exception);
251 * Remove all nodes and elements of submesh
253 void ClearSubMesh(in long ShapeID)
254 raises (SALOME::SALOME_Exception);
257 * Get the subMesh object associated to a subShape. The subMesh object
258 * gives access to nodes and elements IDs.
259 * SubMesh will be used instead of SubShape in a next idl version to
260 * adress a specific subMesh...
262 SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
263 raises (SALOME::SALOME_Exception);
268 void RemoveSubMesh(in SMESH_subMesh aSubMesh)
269 raises (SALOME::SALOME_Exception);
275 SMESH_Group CreateGroup( in ElementType elem_type,
277 raises (SALOME::SALOME_Exception);
280 * Create a group from geometry group
282 SMESH_GroupOnGeom CreateGroupFromGEOM( in ElementType elem_type,
284 in GEOM::GEOM_Object theGeomObject )
285 raises (SALOME::SALOME_Exception);
290 void RemoveGroup(in SMESH_GroupBase aGroup)
291 raises (SALOME::SALOME_Exception);
294 * Remove group with its contents
296 void RemoveGroupWithContents( in SMESH_GroupBase aGroup )
297 raises (SALOME::SALOME_Exception);
300 * Get the list of groups existing in the mesh
302 ListOfGroups GetGroups()
303 raises (SALOME::SALOME_Exception);
306 * Get number of groups existing in the mesh
309 raises (SALOME::SALOME_Exception);
312 * Union of two groups
313 * New group is created. All mesh elements that are
314 * present in initial groups are added to the new one
316 SMESH_Group UnionGroups (in SMESH_GroupBase aGroup1,
317 in SMESH_GroupBase aGroup2,
319 raises (SALOME::SALOME_Exception);
322 * Union of list of groups
323 * New group is created. All mesh elements that are
324 * present in initial groups are added to the new one
326 SMESH_Group UnionListOfGroups (in ListOfGroups aListOfGroups,
328 raises (SALOME::SALOME_Exception);
331 * Intersection of two groups
332 * New group is created. All mesh elements that are
333 * present in both initial groups are added to the new one.
335 SMESH_Group IntersectGroups (in SMESH_GroupBase aGroup1,
336 in SMESH_GroupBase aGroup2,
338 raises (SALOME::SALOME_Exception);
341 * Intersection of list of groups
342 * New group is created. All mesh elements that are
343 * present in all initial groups simultaneously are added to the new one.
345 SMESH_Group IntersectListOfGroups (in ListOfGroups aListOfGroups,
347 raises (SALOME::SALOME_Exception);
351 * New group is created. All mesh elements that are present in
352 * main group but do not present in tool group are added to the new one
354 SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
355 in SMESH_GroupBase aToolGroup,
357 raises (SALOME::SALOME_Exception);
360 * Cut of lists of groups
361 * New group is created. All mesh elements that are present in
362 * main groups but do not present in tool groups are added to the new one
364 SMESH_Group CutListOfGroups (in ListOfGroups aMainGroups,
365 in ListOfGroups aToolGroups,
367 raises (SALOME::SALOME_Exception);
370 * Create groups of entities from existing groups of superior dimensions
371 * New group is created. System
372 * 1) extracts all nodes from each group,
373 * 2) combines all elements of specified dimension laying on these nodes.
375 SMESH_Group CreateDimGroup( in ListOfGroups aListOfGroups,
376 in ElementType anElemType,
378 raises (SALOME::SALOME_Exception);
381 * Convert group on geometry into standalone group
383 SMESH_Group ConvertToStandalone( in SMESH_GroupOnGeom theGeomGroup )
384 raises (SALOME::SALOME_Exception);
387 * Add hypothesis to the mesh, under a particular subShape
388 * (or the main shape itself)
389 * The Add method is only used to prepare the build of the mesh and store
390 * the algorithms and associated parameters.
391 * Actual job of mesh the shape is done by MESH_Gen.
393 * - aSubShape : subShape obtained by a shape explode in GEOM
395 * - anHyp : hypothesis object
397 * - OK if the hypothesis is compatible with the subShape
398 * (and all previous hypothesis on the subShape)
399 * - NOK if the hypothesis is not compatible with the subShape
400 * (or one previous hypothesis on the subShape)
401 * raises exception if hypothesis has not been created
403 Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
404 in SMESH_Hypothesis anHyp)
405 raises (SALOME::SALOME_Exception);
406 // boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
407 // raises (SALOME::SALOME_Exception);
410 * Remove an hypothesis previouly added with AddHypothesis.
412 Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject,
413 in SMESH_Hypothesis anHyp)
414 raises (SALOME::SALOME_Exception);
415 // boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
416 // in SMESH_Hypothesis anHyp)
417 // raises (SALOME::SALOME_Exception);
420 * Get the list of hypothesis added on a subShape
422 ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Object aSubObject)
423 raises (SALOME::SALOME_Exception);
424 // ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
425 // raises (SALOME::SALOME_Exception);
428 * Get the log of nodes and elements added or removed since previous
431 * - clearAfterGet : log is emptied after Get (safe if concurrents access)
433 // string_array GetLog(in boolean clearAfterGet)
434 // raises (SALOME::SALOME_Exception);
435 log_array GetLog(in boolean clearAfterGet)
436 raises (SALOME::SALOME_Exception);
439 * Clear the log of nodes and elements added or removed since previous
440 * clear. Must be used immediately after GetLog if clearAfterGet is false.
443 raises (SALOME::SALOME_Exception);
446 * Toggle auto color mode on the object.
448 * - theAutoColor : flag which toggles auto color mode.
450 void SetAutoColor(in boolean theAutoColor)
451 raises (SALOME::SALOME_Exception);
454 * Get flag of object's auto color mode.
456 boolean GetAutoColor()
457 raises (SALOME::SALOME_Exception);
460 * Get the internal Id
470 * Obtain instance of SMESH_MeshEditor
472 SMESH_MeshEditor GetMeshEditor()
473 raises (SALOME::SALOME_Exception);
476 * Return SMESH_MeshEditor that would not modify the mesh but
477 * fill MeshPreviewStruct
479 SMESH_MeshEditor GetMeshEditPreviewer()
480 raises (SALOME::SALOME_Exception);
482 /*! Check group names for duplications.
483 * Consider maximum group name length stored in MED file.
485 boolean HasDuplicatedGroupNamesMED();
488 * Export Mesh to different MED Formats
490 * - auto_groups : boolean parameter for creating/not creating
491 * the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
492 * the typical use is auto_groups=false.
493 * - theVersion : define the version of format of MED file, that will be created
495 void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
496 raises (SALOME::SALOME_Exception);
499 * Export Mesh to MED_V2_1 MED format
500 * Works, just the same as ExportToMED, with MED_VERSION parameter equal to MED_V2_1.
501 * The method is kept in order to support old functionality
503 void ExportMED( in string file, in boolean auto_groups )
504 raises (SALOME::SALOME_Exception);
507 * Return string representation of a MED file version comprising nbDigits
509 string GetVersionString(in MED_VERSION version, in short nbDigits);
512 * Export Mesh to DAT, UNV and STL Formats
513 * (UNV supported version is I-DEAS 10)
515 void ExportDAT( in string file )
516 raises (SALOME::SALOME_Exception);
517 void ExportUNV( in string file )
518 raises (SALOME::SALOME_Exception);
519 void ExportSTL( in string file, in boolean isascii )
520 raises (SALOME::SALOME_Exception);
525 SALOME_MED::MESH GetMEDMesh()
526 raises (SALOME::SALOME_Exception);
529 * Get informations about mesh contents
532 raises (SALOME::SALOME_Exception);
535 raises (SALOME::SALOME_Exception);
538 raises (SALOME::SALOME_Exception);
541 raises (SALOME::SALOME_Exception);
543 long NbEdgesOfOrder(in ElementOrder order)
544 raises (SALOME::SALOME_Exception);
547 raises (SALOME::SALOME_Exception);
549 long NbFacesOfOrder(in ElementOrder order)
550 raises (SALOME::SALOME_Exception);
553 raises (SALOME::SALOME_Exception);
555 long NbTrianglesOfOrder(in ElementOrder order)
556 raises (SALOME::SALOME_Exception);
559 raises (SALOME::SALOME_Exception);
561 long NbQuadranglesOfOrder(in ElementOrder order)
562 raises (SALOME::SALOME_Exception);
565 raises (SALOME::SALOME_Exception);
568 raises (SALOME::SALOME_Exception);
570 long NbVolumesOfOrder(in ElementOrder order)
571 raises (SALOME::SALOME_Exception);
574 raises (SALOME::SALOME_Exception);
576 long NbTetrasOfOrder(in ElementOrder order)
577 raises (SALOME::SALOME_Exception);
580 raises (SALOME::SALOME_Exception);
582 long NbHexasOfOrder(in ElementOrder order)
583 raises (SALOME::SALOME_Exception);
586 raises (SALOME::SALOME_Exception);
588 long NbPyramidsOfOrder(in ElementOrder order)
589 raises (SALOME::SALOME_Exception);
592 raises (SALOME::SALOME_Exception);
594 long NbPrismsOfOrder(in ElementOrder order)
595 raises (SALOME::SALOME_Exception);
598 raises (SALOME::SALOME_Exception);
601 raises (SALOME::SALOME_Exception);
603 long_array GetElementsId()
604 raises (SALOME::SALOME_Exception);
606 long_array GetElementsByType( in ElementType theType )
607 raises (SALOME::SALOME_Exception);
609 long_array GetNodesId()
610 raises (SALOME::SALOME_Exception);
613 * Returns type of mesh element
615 ElementType GetElementType( in long id, in boolean iselem )
616 raises (SALOME::SALOME_Exception);
618 long_array GetSubMeshElementsId(in long ShapeID)
619 raises (SALOME::SALOME_Exception);
621 long_array GetSubMeshNodesId(in long ShapeID, in boolean all )
622 raises (SALOME::SALOME_Exception);
624 ElementType GetSubMeshElementType(in long ShapeID)
625 raises (SALOME::SALOME_Exception);
628 * Get mesh description
635 long long GetMeshPtr();
638 * Get XYZ coordinates of node as list of double
639 * If there is not node for given ID - returns empty list
641 double_array GetNodeXYZ(in long id);
644 * For given node returns list of IDs of inverse elements
645 * If there is not node for given ID - returns empty list
647 long_array GetNodeInverseElements(in long id);
650 * \brief Return position of a node on shape
652 NodePosition GetNodePosition(in long NodeID);
655 * If given element is node returns IDs of shape from position
656 * If there is not node for given ID - returns -1
658 long GetShapeID(in long id);
661 * For given element returns ID of result shape after
662 * ::FindShape() from SMESH_MeshEditor
663 * If there is not element for given ID - returns -1
665 long GetShapeIDForElem(in long id);
668 * Returns number of nodes for given element
669 * If there is not element for given ID - returns -1
671 long GetElemNbNodes(in long id);
674 * Returns IDs of nodes of given element
676 long_array GetElemNodes(in long id);
679 * Returns ID of node by given index for given element
680 * If there is not element for given ID - returns -1
681 * If there is not node for given index - returns -2
683 long GetElemNode(in long id, in long index);
686 * Returns true if given node is medium node
687 * in given quadratic element
689 boolean IsMediumNode(in long ide, in long idn);
692 * Returns true if given node is medium node
693 * in one of quadratic elements
695 boolean IsMediumNodeOfAnyElem(in long idn, in ElementType elem_type);
698 * Returns number of edges for given element
700 long ElemNbEdges(in long id);
703 * Returns number of faces for given element
705 long ElemNbFaces(in long id);
708 * Returns true if given element is polygon
710 boolean IsPoly(in long id);
713 * Returns true if given element is quadratic
715 boolean IsQuadratic(in long id);
718 * Returns XYZ coordinates of bary center for given element
720 * If there is not element for given ID - returns empty list
722 double_array BaryCenter(in long id);
724 /*! Gets information about imported MED file */
725 SALOME_MED::MedFileInfo GetMEDFileInfo();
728 * Sets list of notebook variables used for Mesh operations separated by ":" symbol
729 * \param theParameters is a string containing the notebook variables
731 void SetParameters (in string theParameters);
734 * Returns list of notebook variables used for Mesh operations separated by ":" symbol
736 string GetParameters();
739 * Returns list of notebook variables used for last Mesh operation
741 string_array GetLastParameters();
744 interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
749 long GetNumberOfElements()
750 raises (SALOME::SALOME_Exception);
755 long GetNumberOfNodes( in boolean all )
756 raises (SALOME::SALOME_Exception);
761 long_array GetElementsId()
762 raises (SALOME::SALOME_Exception);
767 long_array GetElementsByType( in ElementType theType )
768 raises (SALOME::SALOME_Exception);
771 * Return type of submesh element
773 ElementType GetElementType( in long id, in boolean iselem )
774 raises (SALOME::SALOME_Exception);
779 long_array GetNodesId()
780 raises (SALOME::SALOME_Exception);
783 * Get geom shape the submesh is dedicated to
785 GEOM::GEOM_Object GetSubShape()
786 raises (SALOME::SALOME_Exception);
789 * Get SMESH_Mesh which stores nodes coordinates & elements definition
791 SMESH_Mesh GetFather()
792 raises (SALOME::SALOME_Exception);
795 * Get the internal Id
802 SALOME_MED::FAMILY GetFamily()
803 raises (SALOME::SALOME_Exception);