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
120 * ElementOrder points out entities of what order are requested
123 ORDER_ANY, /*! entities of any order */
124 ORDER_LINEAR, /*! entities of 1st order */
125 ORDER_QUADRATIC /*! entities of 2nd order */
129 * Enumeration for hypothesis status (used by AddHypothesis() and RemoveHypothesis() methods)
131 enum Hypothesis_Status // in the order of severity
134 HYP_MISSING, // algo misses a hypothesis
135 HYP_CONCURENT, // several applicable hypotheses
136 HYP_BAD_PARAMETER,// hypothesis has a bad parameter value
137 HYP_HIDDEN_ALGO, // an algo is hidden by an upper dim algo generating all-dim elements
138 HYP_HIDING_ALGO, // an algo hides lower dim algos by generating all-dim elements
139 HYP_UNKNOWN_FATAL,// --- all statuses below should be considered as fatal
140 // for Add/RemoveHypothesis operations
141 HYP_INCOMPATIBLE, // hypothesis does not fit algo
142 HYP_NOTCONFORM, // not conform mesh is produced appling a hypothesis
143 HYP_ALREADY_EXIST,// such hypothesis already exist
144 HYP_BAD_DIM, // bad dimension
145 HYP_BAD_SUBSHAPE, // shape is neither the main one, nor its subshape, nor a group
146 HYP_BAD_GEOMETRY, // geometry mismatches algorithm's expectation
147 HYP_NEED_SHAPE // algorithm can work on shape only
151 * Enumeration for DriverMED read status (used by ImportMEDFile() method)
153 enum DriverMED_ReadStatus // in the order of severity
156 DRS_EMPTY, // a MED file contains no mesh with the given name
157 DRS_WARN_RENUMBER, // a MED file has overlapped ranges of element numbers,
158 // so the numbers from the file are ignored
159 DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
160 DRS_FAIL // general failure (exception etc.)
164 * Enumeration for DriverMED (used by Perform() method)
166 enum MED_VERSION // in the order of severity
172 typedef sequence<log_block> log_array;
176 * Auxilary flags for advanced extrusion.
177 * BOUNDARY: create or not boundary for result of extrusion
178 * SEW: try to use existing nodes or create new nodes in any case
180 const long EXTRUSION_FLAG_BOUNDARY = 1;
181 const long EXTRUSION_FLAG_SEW = 2;
184 * Structure used in mesh edit preview data (MeshPreviewStruct)
186 struct ElementSubType { ElementType SMDS_ElementType;
188 long nbNodesInElement; };
190 typedef sequence<ElementSubType> types_array;
193 * Structure containing mesh edit preview data
195 struct MeshPreviewStruct { nodes_array nodesXYZ;
196 long_array elementConnectivities;
197 types_array elementTypes; };
199 interface SMESH_IDSource
202 * Returns a sequence of all element IDs
207 interface SMESH_Group;
208 interface SMESH_GroupOnGeom;
209 interface SMESH_subMesh;
210 interface SMESH_MeshEditor;
211 interface SMESH_Mesh : SALOME::GenericObj, SMESH_IDSource
214 * Return true if there is a geometry to be meshed
216 boolean HasShapeToMesh()
217 raises (SALOME::SALOME_Exception);
220 * Get geom shape to mesh. A result sould not be nil. Use HasShapeToMesh()
221 * to know if a returned shape
223 GEOM::GEOM_Object GetShapeToMesh()
224 raises (SALOME::SALOME_Exception);
227 * Remove all nodes and elements
230 raises (SALOME::SALOME_Exception);
233 * Get the subMesh object associated to a subShape. The subMesh object
234 * gives access to nodes and elements IDs.
235 * SubMesh will be used instead of SubShape in a next idl version to
236 * adress a specific subMesh...
238 SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
239 raises (SALOME::SALOME_Exception);
244 void RemoveSubMesh(in SMESH_subMesh aSubMesh)
245 raises (SALOME::SALOME_Exception);
251 SMESH_Group CreateGroup( in ElementType elem_type,
253 raises (SALOME::SALOME_Exception);
256 * Create a group from geometry group
258 SMESH_GroupOnGeom CreateGroupFromGEOM( in ElementType elem_type,
260 in GEOM::GEOM_Object theGeomObject )
261 raises (SALOME::SALOME_Exception);
266 void RemoveGroup(in SMESH_GroupBase aGroup)
267 raises (SALOME::SALOME_Exception);
270 * Remove group with its contents
272 void RemoveGroupWithContents( in SMESH_GroupBase aGroup )
273 raises (SALOME::SALOME_Exception);
276 * Get the list of groups existing in the mesh
278 ListOfGroups GetGroups()
279 raises (SALOME::SALOME_Exception);
282 * Get number of groups existing in the mesh
285 raises (SALOME::SALOME_Exception);
288 * Union of two groups
289 * New group is created. All mesh elements that are
290 * present in initial groups are added to the new one
292 SMESH_Group UnionGroups (in SMESH_GroupBase aGroup1,
293 in SMESH_GroupBase aGroup2,
295 raises (SALOME::SALOME_Exception);
298 * Intersection of two groups
299 * New group is created. All mesh elements that are
300 * present in both initial groups are added to the new one.
302 SMESH_Group IntersectGroups (in SMESH_GroupBase aGroup1,
303 in SMESH_GroupBase aGroup2,
305 raises (SALOME::SALOME_Exception);
309 * New group is created. All mesh elements that are present in
310 * main group but do not present in tool group are added to the new one
312 SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
313 in SMESH_GroupBase aToolGroup,
315 raises (SALOME::SALOME_Exception);
318 * Add hypothesis to the mesh, under a particular subShape
319 * (or the main shape itself)
320 * The Add method is only used to prepare the build of the mesh and store
321 * the algorithms and associated parameters.
322 * Actual job of mesh the shape is done by MESH_Gen.
324 * - aSubShape : subShape obtained by a shape explode in GEOM
326 * - anHyp : hypothesis object
328 * - OK if the hypothesis is compatible with the subShape
329 * (and all previous hypothesis on the subShape)
330 * - NOK if the hypothesis is not compatible with the subShape
331 * (or one previous hypothesis on the subShape)
332 * raises exception if hypothesis has not been created
334 Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
335 in SMESH_Hypothesis anHyp)
336 raises (SALOME::SALOME_Exception);
337 // boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
338 // raises (SALOME::SALOME_Exception);
341 * Remove an hypothesis previouly added with AddHypothesis.
343 Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject,
344 in SMESH_Hypothesis anHyp)
345 raises (SALOME::SALOME_Exception);
346 // boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
347 // in SMESH_Hypothesis anHyp)
348 // raises (SALOME::SALOME_Exception);
351 * Get the list of hypothesis added on a subShape
353 ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Object aSubObject)
354 raises (SALOME::SALOME_Exception);
355 // ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
356 // raises (SALOME::SALOME_Exception);
359 * Get the log of nodes and elements added or removed since previous
362 * - clearAfterGet : log is emptied after Get (safe if concurrents access)
364 // string_array GetLog(in boolean clearAfterGet)
365 // raises (SALOME::SALOME_Exception);
366 log_array GetLog(in boolean clearAfterGet)
367 raises (SALOME::SALOME_Exception);
370 * Clear the log of nodes and elements added or removed since previous
371 * clear. Must be used immediately after GetLog if clearAfterGet is false.
374 raises (SALOME::SALOME_Exception);
377 * Toggle auto color mode on the object.
379 * - theAutoColor : flag which toggles auto color mode.
381 void SetAutoColor(in boolean theAutoColor)
382 raises (SALOME::SALOME_Exception);
385 * Get flag of object's auto color mode.
387 boolean GetAutoColor()
388 raises (SALOME::SALOME_Exception);
391 * Get the internal Id
401 * Obtain instance of SMESH_MeshEditor
403 SMESH_MeshEditor GetMeshEditor()
404 raises (SALOME::SALOME_Exception);
407 * Return SMESH_MeshEditor that would not modify the mesh but
408 * fill MeshPreviewStruct
410 SMESH_MeshEditor GetMeshEditPreviewer()
411 raises (SALOME::SALOME_Exception);
413 /*! Check group names for duplications.
414 * Consider maximum group name length stored in MED file.
416 boolean HasDuplicatedGroupNamesMED();
419 * Export Mesh to different MED Formats
421 * - auto_groups : boolean parameter for creating/not creating
422 * the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
423 * the typical use is auto_groups=false.
424 * - theVersion : define the version of format of MED file, that will be created
426 void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
427 raises (SALOME::SALOME_Exception);
430 * Export Mesh to MED_V2_1 MED format
431 * Works, just the same as ExportToMED, with MED_VERSION parameter equal to MED_V2_1.
432 * The method is kept in order to support old functionality
434 void ExportMED( in string file, in boolean auto_groups )
435 raises (SALOME::SALOME_Exception);
438 * Return string representation of a MED file version comprising nbDigits
440 string GetVersionString(in MED_VERSION version, in short nbDigits);
443 * Export Mesh to DAT, UNV and STL Formats
444 * (UNV supported version is I-DEAS 10)
446 void ExportDAT( in string file )
447 raises (SALOME::SALOME_Exception);
448 void ExportUNV( in string file )
449 raises (SALOME::SALOME_Exception);
450 void ExportSTL( in string file, in boolean isascii )
451 raises (SALOME::SALOME_Exception);
456 SALOME_MED::MESH GetMEDMesh()
457 raises (SALOME::SALOME_Exception);
460 * Get informations about mesh contents
463 raises (SALOME::SALOME_Exception);
466 raises (SALOME::SALOME_Exception);
469 raises (SALOME::SALOME_Exception);
471 long NbEdgesOfOrder(in ElementOrder order)
472 raises (SALOME::SALOME_Exception);
475 raises (SALOME::SALOME_Exception);
477 long NbFacesOfOrder(in ElementOrder order)
478 raises (SALOME::SALOME_Exception);
481 raises (SALOME::SALOME_Exception);
483 long NbTrianglesOfOrder(in ElementOrder order)
484 raises (SALOME::SALOME_Exception);
487 raises (SALOME::SALOME_Exception);
489 long NbQuadranglesOfOrder(in ElementOrder order)
490 raises (SALOME::SALOME_Exception);
493 raises (SALOME::SALOME_Exception);
496 raises (SALOME::SALOME_Exception);
498 long NbVolumesOfOrder(in ElementOrder order)
499 raises (SALOME::SALOME_Exception);
502 raises (SALOME::SALOME_Exception);
504 long NbTetrasOfOrder(in ElementOrder order)
505 raises (SALOME::SALOME_Exception);
508 raises (SALOME::SALOME_Exception);
510 long NbHexasOfOrder(in ElementOrder order)
511 raises (SALOME::SALOME_Exception);
514 raises (SALOME::SALOME_Exception);
516 long NbPyramidsOfOrder(in ElementOrder order)
517 raises (SALOME::SALOME_Exception);
520 raises (SALOME::SALOME_Exception);
522 long NbPrismsOfOrder(in ElementOrder order)
523 raises (SALOME::SALOME_Exception);
526 raises (SALOME::SALOME_Exception);
529 raises (SALOME::SALOME_Exception);
531 long_array GetElementsId()
532 raises (SALOME::SALOME_Exception);
534 long_array GetElementsByType( in ElementType theType )
535 raises (SALOME::SALOME_Exception);
537 long_array GetNodesId()
538 raises (SALOME::SALOME_Exception);
541 * Returns type of mesh element
543 ElementType GetElementType( in long id, in boolean iselem )
544 raises (SALOME::SALOME_Exception);
546 long_array GetSubMeshElementsId(in long ShapeID)
547 raises (SALOME::SALOME_Exception);
549 long_array GetSubMeshNodesId(in long ShapeID, in boolean all )
550 raises (SALOME::SALOME_Exception);
552 ElementType GetSubMeshElementType(in long ShapeID)
553 raises (SALOME::SALOME_Exception);
556 * Get mesh description
563 long long GetMeshPtr();
566 * Get XYZ coordinates of node as list of double
567 * If there is not node for given ID - returns empty list
569 double_array GetNodeXYZ(in long id);
572 * For given node returns list of IDs of inverse elements
573 * If there is not node for given ID - returns empty list
575 long_array GetNodeInverseElements(in long id);
578 * \brief Return position of a node on shape
580 NodePosition GetNodePosition(in long NodeID);
583 * If given element is node returns IDs of shape from position
584 * If there is not node for given ID - returns -1
586 long GetShapeID(in long id);
589 * For given element returns ID of result shape after
590 * ::FindShape() from SMESH_MeshEditor
591 * If there is not element for given ID - returns -1
593 long GetShapeIDForElem(in long id);
596 * Returns number of nodes for given element
597 * If there is not element for given ID - returns -1
599 long GetElemNbNodes(in long id);
602 * Returns IDs of nodes of given element
604 long_array GetElemNodes(in long id);
607 * Returns ID of node by given index for given element
608 * If there is not element for given ID - returns -1
609 * If there is not node for given index - returns -2
611 long GetElemNode(in long id, in long index);
614 * Returns true if given node is medium node
615 * in given quadratic element
617 boolean IsMediumNode(in long ide, in long idn);
620 * Returns true if given node is medium node
621 * in one of quadratic elements
623 boolean IsMediumNodeOfAnyElem(in long idn, in ElementType elem_type);
626 * Returns number of edges for given element
628 long ElemNbEdges(in long id);
631 * Returns number of faces for given element
633 long ElemNbFaces(in long id);
636 * Returns true if given element is polygon
638 boolean IsPoly(in long id);
641 * Returns true if given element is quadratic
643 boolean IsQuadratic(in long id);
646 * Returns XYZ coordinates of bary center for given element
648 * If there is not element for given ID - returns empty list
650 double_array BaryCenter(in long id);
652 /*! Gets information about imported MED file */
653 SALOME_MED::MedFileInfo GetMEDFileInfo();
656 interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
661 long GetNumberOfElements()
662 raises (SALOME::SALOME_Exception);
667 long GetNumberOfNodes( in boolean all )
668 raises (SALOME::SALOME_Exception);
673 long_array GetElementsId()
674 raises (SALOME::SALOME_Exception);
679 long_array GetElementsByType( in ElementType theType )
680 raises (SALOME::SALOME_Exception);
683 * Return type of submesh element
685 ElementType GetElementType( in long id, in boolean iselem )
686 raises (SALOME::SALOME_Exception);
691 long_array GetNodesId()
692 raises (SALOME::SALOME_Exception);
695 * Get geom shape the submesh is dedicated to
697 GEOM::GEOM_Object GetSubShape()
698 raises (SALOME::SALOME_Exception);
701 * Get SMESH_Mesh which stores nodes coordinates & elements definition
703 SMESH_Mesh GetFather()
704 raises (SALOME::SALOME_Exception);
707 * Get the internal Id
714 SALOME_MED::FAMILY GetFamily()
715 raises (SALOME::SALOME_Exception);