1 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // 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 * ElementOrder points out entities of what order are requested
122 ORDER_ANY, /*! entities of any order */
123 ORDER_LINEAR, /*! entities of 1st order */
124 ORDER_QUADRATIC /*! entities of 2nd order */
128 * Enumeration for hypothesis status (used by AddHypothesis() and RemoveHypothesis() methods)
130 enum Hypothesis_Status // in the order of severity
133 HYP_MISSING, // algo misses a hypothesis
134 HYP_CONCURENT, // several applicable hypotheses
135 HYP_BAD_PARAMETER,// hypothesis has a bad parameter value
136 HYP_HIDDEN_ALGO, // an algo is hidden by an upper dim algo generating all-dim elements
137 HYP_HIDING_ALGO, // an algo hides lower dim algos by generating all-dim elements
138 HYP_UNKNOWN_FATAL,// --- all statuses below should be considered as fatal
139 // for Add/RemoveHypothesis operations
140 HYP_INCOMPATIBLE, // hypothesis does not fit algo
141 HYP_NOTCONFORM, // not conform mesh is produced appling a hypothesis
142 HYP_ALREADY_EXIST,// such hypothesis already exist
143 HYP_BAD_DIM, // bad dimension
144 HYP_BAD_SUBSHAPE, // shape is neither the main one, nor its subshape, nor a group
145 HYP_BAD_GEOMETRY, // geometry mismatches algorithm's expectation
146 HYP_NEED_SHAPE // algorithm can work on shape only
150 * Enumeration for DriverMED read status (used by ImportMEDFile() method)
152 enum DriverMED_ReadStatus // in the order of severity
155 DRS_EMPTY, // a MED file contains no mesh with the given name
156 DRS_WARN_RENUMBER, // a MED file has overlapped ranges of element numbers,
157 // so the numbers from the file are ignored
158 DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
159 DRS_FAIL // general failure (exception etc.)
163 * Enumeration for DriverMED (used by Perform() method)
165 enum MED_VERSION // in the order of severity
171 typedef sequence<log_block> log_array;
175 * Auxilary flags for advanced extrusion.
176 * BOUNDARY: create or not boundary for result of extrusion
177 * SEW: try to use existing nodes or create new nodes in any case
179 const long EXTRUSION_FLAG_BOUNDARY = 1;
180 const long EXTRUSION_FLAG_SEW = 2;
183 * Structure used in mesh edit preview data (MeshPreviewStruct)
185 struct ElementSubType { ElementType SMDS_ElementType;
187 long nbNodesInElement; };
189 typedef sequence<ElementSubType> types_array;
192 * Structure containing mesh edit preview data
194 struct MeshPreviewStruct { nodes_array nodesXYZ;
195 long_array elementConnectivities;
196 types_array elementTypes; };
198 interface SMESH_IDSource
201 * Returns a sequence of all element IDs
206 interface SMESH_Group;
207 interface SMESH_GroupOnGeom;
208 interface SMESH_subMesh;
209 interface SMESH_MeshEditor;
210 interface SMESH_Mesh : SALOME::GenericObj, SMESH_IDSource
213 * Return true if there is a geometry to be meshed
215 boolean HasShapeToMesh()
216 raises (SALOME::SALOME_Exception);
219 * Get geom shape to mesh. A result sould not be nil. Use HasShapeToMesh()
220 * to know if a returned shape
222 GEOM::GEOM_Object GetShapeToMesh()
223 raises (SALOME::SALOME_Exception);
226 * Remove all nodes and elements
229 raises (SALOME::SALOME_Exception);
232 * Remove all nodes and elements of submesh
234 void ClearSubMesh(in long ShapeID)
235 raises (SALOME::SALOME_Exception);
238 * Get the subMesh object associated to a subShape. The subMesh object
239 * gives access to nodes and elements IDs.
240 * SubMesh will be used instead of SubShape in a next idl version to
241 * adress a specific subMesh...
243 SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
244 raises (SALOME::SALOME_Exception);
249 void RemoveSubMesh(in SMESH_subMesh aSubMesh)
250 raises (SALOME::SALOME_Exception);
256 SMESH_Group CreateGroup( in ElementType elem_type,
258 raises (SALOME::SALOME_Exception);
261 * Create a group from geometry group
263 SMESH_GroupOnGeom CreateGroupFromGEOM( in ElementType elem_type,
265 in GEOM::GEOM_Object theGeomObject )
266 raises (SALOME::SALOME_Exception);
271 void RemoveGroup(in SMESH_GroupBase aGroup)
272 raises (SALOME::SALOME_Exception);
275 * Remove group with its contents
277 void RemoveGroupWithContents( in SMESH_GroupBase aGroup )
278 raises (SALOME::SALOME_Exception);
281 * Get the list of groups existing in the mesh
283 ListOfGroups GetGroups()
284 raises (SALOME::SALOME_Exception);
287 * Get number of groups existing in the mesh
290 raises (SALOME::SALOME_Exception);
293 * Union of two groups
294 * New group is created. All mesh elements that are
295 * present in initial groups are added to the new one
297 SMESH_Group UnionGroups (in SMESH_GroupBase aGroup1,
298 in SMESH_GroupBase aGroup2,
300 raises (SALOME::SALOME_Exception);
303 * Union of list of groups
304 * New group is created. All mesh elements that are
305 * present in initial groups are added to the new one
307 SMESH_Group UnionListOfGroups (in ListOfGroups aListOfGroups,
309 raises (SALOME::SALOME_Exception);
312 * Intersection of two groups
313 * New group is created. All mesh elements that are
314 * present in both initial groups are added to the new one.
316 SMESH_Group IntersectGroups (in SMESH_GroupBase aGroup1,
317 in SMESH_GroupBase aGroup2,
319 raises (SALOME::SALOME_Exception);
322 * Intersection of list of groups
323 * New group is created. All mesh elements that are
324 * present in all initial groups simultaneously are added to the new one.
326 SMESH_Group IntersectListOfGroups (in ListOfGroups aListOfGroups,
328 raises (SALOME::SALOME_Exception);
332 * New group is created. All mesh elements that are present in
333 * main group but do not present in tool group are added to the new one
335 SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
336 in SMESH_GroupBase aToolGroup,
338 raises (SALOME::SALOME_Exception);
341 * Cut of lists of groups
342 * New group is created. All mesh elements that are present in
343 * main groups but do not present in tool groups are added to the new one
345 SMESH_Group CutListOfGroups (in ListOfGroups aMainGroups,
346 in ListOfGroups aToolGroups,
348 raises (SALOME::SALOME_Exception);
351 * Create groups of entities from existing groups of superior dimensions
352 * New group is created. System
353 * 1) extract all nodes from each group,
354 * 2) combine all elements of specified dimension laying on these nodes.
356 SMESH_Group CreateDimGroup( in ListOfGroups aListOfGroups,
357 in ElementType anElemType,
359 raises (SALOME::SALOME_Exception);
362 * Add hypothesis to the mesh, under a particular subShape
363 * (or the main shape itself)
364 * The Add method is only used to prepare the build of the mesh and store
365 * the algorithms and associated parameters.
366 * Actual job of mesh the shape is done by MESH_Gen.
368 * - aSubShape : subShape obtained by a shape explode in GEOM
370 * - anHyp : hypothesis object
372 * - OK if the hypothesis is compatible with the subShape
373 * (and all previous hypothesis on the subShape)
374 * - NOK if the hypothesis is not compatible with the subShape
375 * (or one previous hypothesis on the subShape)
376 * raises exception if hypothesis has not been created
378 Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
379 in SMESH_Hypothesis anHyp)
380 raises (SALOME::SALOME_Exception);
381 // boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
382 // raises (SALOME::SALOME_Exception);
385 * Remove an hypothesis previouly added with AddHypothesis.
387 Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject,
388 in SMESH_Hypothesis anHyp)
389 raises (SALOME::SALOME_Exception);
390 // boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
391 // in SMESH_Hypothesis anHyp)
392 // raises (SALOME::SALOME_Exception);
395 * Get the list of hypothesis added on a subShape
397 ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Object aSubObject)
398 raises (SALOME::SALOME_Exception);
399 // ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
400 // raises (SALOME::SALOME_Exception);
403 * Get the log of nodes and elements added or removed since previous
406 * - clearAfterGet : log is emptied after Get (safe if concurrents access)
408 // string_array GetLog(in boolean clearAfterGet)
409 // raises (SALOME::SALOME_Exception);
410 log_array GetLog(in boolean clearAfterGet)
411 raises (SALOME::SALOME_Exception);
414 * Clear the log of nodes and elements added or removed since previous
415 * clear. Must be used immediately after GetLog if clearAfterGet is false.
418 raises (SALOME::SALOME_Exception);
421 * Toggle auto color mode on the object.
423 * - theAutoColor : flag which toggles auto color mode.
425 void SetAutoColor(in boolean theAutoColor)
426 raises (SALOME::SALOME_Exception);
429 * Get flag of object's auto color mode.
431 boolean GetAutoColor()
432 raises (SALOME::SALOME_Exception);
435 * Get the internal Id
445 * Obtain instance of SMESH_MeshEditor
447 SMESH_MeshEditor GetMeshEditor()
448 raises (SALOME::SALOME_Exception);
451 * Return SMESH_MeshEditor that would not modify the mesh but
452 * fill MeshPreviewStruct
454 SMESH_MeshEditor GetMeshEditPreviewer()
455 raises (SALOME::SALOME_Exception);
457 /*! Check group names for duplications.
458 * Consider maximum group name length stored in MED file.
460 boolean HasDuplicatedGroupNamesMED();
463 * Export Mesh to different MED Formats
465 * - auto_groups : boolean parameter for creating/not creating
466 * the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
467 * the typical use is auto_groups=false.
468 * - theVersion : define the version of format of MED file, that will be created
470 void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
471 raises (SALOME::SALOME_Exception);
474 * Export Mesh to MED_V2_1 MED format
475 * Works, just the same as ExportToMED, with MED_VERSION parameter equal to MED_V2_1.
476 * The method is kept in order to support old functionality
478 void ExportMED( in string file, in boolean auto_groups )
479 raises (SALOME::SALOME_Exception);
482 * Return string representation of a MED file version comprising nbDigits
484 string GetVersionString(in MED_VERSION version, in short nbDigits);
487 * Export Mesh to DAT, UNV and STL Formats
488 * (UNV supported version is I-DEAS 10)
490 void ExportDAT( in string file )
491 raises (SALOME::SALOME_Exception);
492 void ExportUNV( in string file )
493 raises (SALOME::SALOME_Exception);
494 void ExportSTL( in string file, in boolean isascii )
495 raises (SALOME::SALOME_Exception);
500 SALOME_MED::MESH GetMEDMesh()
501 raises (SALOME::SALOME_Exception);
504 * Get informations about mesh contents
507 raises (SALOME::SALOME_Exception);
510 raises (SALOME::SALOME_Exception);
513 raises (SALOME::SALOME_Exception);
515 long NbEdgesOfOrder(in ElementOrder order)
516 raises (SALOME::SALOME_Exception);
519 raises (SALOME::SALOME_Exception);
521 long NbFacesOfOrder(in ElementOrder order)
522 raises (SALOME::SALOME_Exception);
525 raises (SALOME::SALOME_Exception);
527 long NbTrianglesOfOrder(in ElementOrder order)
528 raises (SALOME::SALOME_Exception);
531 raises (SALOME::SALOME_Exception);
533 long NbQuadranglesOfOrder(in ElementOrder order)
534 raises (SALOME::SALOME_Exception);
537 raises (SALOME::SALOME_Exception);
540 raises (SALOME::SALOME_Exception);
542 long NbVolumesOfOrder(in ElementOrder order)
543 raises (SALOME::SALOME_Exception);
546 raises (SALOME::SALOME_Exception);
548 long NbTetrasOfOrder(in ElementOrder order)
549 raises (SALOME::SALOME_Exception);
552 raises (SALOME::SALOME_Exception);
554 long NbHexasOfOrder(in ElementOrder order)
555 raises (SALOME::SALOME_Exception);
558 raises (SALOME::SALOME_Exception);
560 long NbPyramidsOfOrder(in ElementOrder order)
561 raises (SALOME::SALOME_Exception);
564 raises (SALOME::SALOME_Exception);
566 long NbPrismsOfOrder(in ElementOrder order)
567 raises (SALOME::SALOME_Exception);
570 raises (SALOME::SALOME_Exception);
573 raises (SALOME::SALOME_Exception);
575 long_array GetElementsId()
576 raises (SALOME::SALOME_Exception);
578 long_array GetElementsByType( in ElementType theType )
579 raises (SALOME::SALOME_Exception);
581 long_array GetNodesId()
582 raises (SALOME::SALOME_Exception);
585 * Returns type of mesh element
587 ElementType GetElementType( in long id, in boolean iselem )
588 raises (SALOME::SALOME_Exception);
590 long_array GetSubMeshElementsId(in long ShapeID)
591 raises (SALOME::SALOME_Exception);
593 long_array GetSubMeshNodesId(in long ShapeID, in boolean all )
594 raises (SALOME::SALOME_Exception);
596 ElementType GetSubMeshElementType(in long ShapeID)
597 raises (SALOME::SALOME_Exception);
600 * Get mesh description
607 long long GetMeshPtr();
610 * Get XYZ coordinates of node as list of double
611 * If there is not node for given ID - returns empty list
613 double_array GetNodeXYZ(in long id);
616 * For given node returns list of IDs of inverse elements
617 * If there is not node for given ID - returns empty list
619 long_array GetNodeInverseElements(in long id);
622 * \brief Return position of a node on shape
624 NodePosition GetNodePosition(in long NodeID);
627 * If given element is node returns IDs of shape from position
628 * If there is not node for given ID - returns -1
630 long GetShapeID(in long id);
633 * For given element returns ID of result shape after
634 * ::FindShape() from SMESH_MeshEditor
635 * If there is not element for given ID - returns -1
637 long GetShapeIDForElem(in long id);
640 * Returns number of nodes for given element
641 * If there is not element for given ID - returns -1
643 long GetElemNbNodes(in long id);
646 * Returns IDs of nodes of given element
648 long_array GetElemNodes(in long id);
651 * Returns ID of node by given index for given element
652 * If there is not element for given ID - returns -1
653 * If there is not node for given index - returns -2
655 long GetElemNode(in long id, in long index);
658 * Returns true if given node is medium node
659 * in given quadratic element
661 boolean IsMediumNode(in long ide, in long idn);
664 * Returns true if given node is medium node
665 * in one of quadratic elements
667 boolean IsMediumNodeOfAnyElem(in long idn, in ElementType elem_type);
670 * Returns number of edges for given element
672 long ElemNbEdges(in long id);
675 * Returns number of faces for given element
677 long ElemNbFaces(in long id);
680 * Returns true if given element is polygon
682 boolean IsPoly(in long id);
685 * Returns true if given element is quadratic
687 boolean IsQuadratic(in long id);
690 * Returns XYZ coordinates of bary center for given element
692 * If there is not element for given ID - returns empty list
694 double_array BaryCenter(in long id);
696 /*! Gets information about imported MED file */
697 SALOME_MED::MedFileInfo GetMEDFileInfo();
700 interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
705 long GetNumberOfElements()
706 raises (SALOME::SALOME_Exception);
711 long GetNumberOfNodes( in boolean all )
712 raises (SALOME::SALOME_Exception);
717 long_array GetElementsId()
718 raises (SALOME::SALOME_Exception);
723 long_array GetElementsByType( in ElementType theType )
724 raises (SALOME::SALOME_Exception);
727 * Return type of submesh element
729 ElementType GetElementType( in long id, in boolean iselem )
730 raises (SALOME::SALOME_Exception);
735 long_array GetNodesId()
736 raises (SALOME::SALOME_Exception);
739 * Get geom shape the submesh is dedicated to
741 GEOM::GEOM_Object GetSubShape()
742 raises (SALOME::SALOME_Exception);
745 * Get SMESH_Mesh which stores nodes coordinates & elements definition
747 SMESH_Mesh GetFather()
748 raises (SALOME::SALOME_Exception);
751 * Get the internal Id
758 SALOME_MED::FAMILY GetFamily()
759 raises (SALOME::SALOME_Exception);