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,
81 struct PointStruct { double x;
85 typedef sequence<PointStruct> nodes_array;
87 struct DirStruct { PointStruct PS ; } ; // analog to Occ Direction
89 struct AxisStruct { double x;
98 * Enumeration for element type, like in SMDS
110 * ElementOrder points out entities of what order are requested
113 ORDER_ANY, /*! entities of any order */
114 ORDER_LINEAR, /*! entities of 1st order */
115 ORDER_QUADRATIC /*! entities of 2nd order */
119 * Enumeration for hypothesis status (used by AddHypothesis() and RemoveHypothesis() methods)
121 enum Hypothesis_Status // in the order of severity
124 HYP_MISSING, // algo misses a hypothesis
125 HYP_CONCURENT, // several applicable hypotheses
126 HYP_BAD_PARAMETER,// hypothesis has a bad parameter value
127 HYP_HIDDEN_ALGO, // an algo is hidden by an upper dim algo generating all-dim elements
128 HYP_HIDING_ALGO, // an algo hides lower dim algos by generating all-dim elements
129 HYP_UNKNOWN_FATAL,// --- all statuses below should be considered as fatal
130 // for Add/RemoveHypothesis operations
131 HYP_INCOMPATIBLE, // hypothesis does not fit algo
132 HYP_NOTCONFORM, // not conform mesh is produced appling a hypothesis
133 HYP_ALREADY_EXIST,// such hypothesis already exist
134 HYP_BAD_DIM, // bad dimension
135 HYP_BAD_SUBSHAPE, // shape is neither the main one, nor its subshape, nor a group
136 HYP_BAD_GEOMETRY // geometry mismatches algorithm's expectation
140 * Enumeration for DriverMED read status (used by ImportMEDFile() method)
142 enum DriverMED_ReadStatus // in the order of severity
145 DRS_EMPTY, // a MED file contains no mesh with the given name
146 DRS_WARN_RENUMBER, // a MED file has overlapped ranges of element numbers,
147 // so the numbers from the file are ignored
148 DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
149 DRS_FAIL // general failure (exception etc.)
153 * Enumeration for DriverMED (used by Perform() method)
155 enum MED_VERSION // in the order of severity
161 typedef sequence<log_block> log_array;
165 * Auxilary flags for advanced extrusion.
166 * BOUNDARY: create or not boundary for result of extrusion
167 * SEW: try to use existing nodes or create new nodes in any case
169 const long EXTRUSION_FLAG_BOUNDARY = 1;
170 const long EXTRUSION_FLAG_SEW = 2;
172 interface SMESH_IDSource
175 * Returns a sequence of all element IDs
180 interface SMESH_Group;
181 interface SMESH_GroupOnGeom;
182 interface SMESH_subMesh;
183 interface SMESH_MeshEditor;
184 interface SMESH_Mesh : SALOME::GenericObj, SMESH_IDSource
187 * Return true if there is a geometry to be meshed
189 boolean HasShapeToMesh()
190 raises (SALOME::SALOME_Exception);
193 * Get geom shape to mesh. A result sould not be nil. Use HasShapeToMesh()
194 * to know if a returned shape
196 GEOM::GEOM_Object GetShapeToMesh()
197 raises (SALOME::SALOME_Exception);
201 * Get the subMesh object associated to a subShape. The subMesh object
202 * gives access to nodes and elements IDs.
203 * SubMesh will be used instead of SubShape in a next idl version to
204 * adress a specific subMesh...
206 SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
207 raises (SALOME::SALOME_Exception);
212 void RemoveSubMesh(in SMESH_subMesh aSubMesh)
213 raises (SALOME::SALOME_Exception);
219 SMESH_Group CreateGroup( in ElementType elem_type,
221 raises (SALOME::SALOME_Exception);
224 * Create a group from geometry group
226 SMESH_GroupOnGeom CreateGroupFromGEOM( in ElementType elem_type,
228 in GEOM::GEOM_Object theGeomObject )
229 raises (SALOME::SALOME_Exception);
234 void RemoveGroup(in SMESH_GroupBase aGroup)
235 raises (SALOME::SALOME_Exception);
238 * Remove group with its contents
240 void RemoveGroupWithContents( in SMESH_GroupBase aGroup )
241 raises (SALOME::SALOME_Exception);
244 * Get the list of groups existing in the mesh
246 ListOfGroups GetGroups()
247 raises (SALOME::SALOME_Exception);
250 * Union of two groups
251 * New group is created. All mesh elements that are
252 * present in initial groups are added to the new one
254 SMESH_Group UnionGroups (in SMESH_GroupBase aGroup1,
255 in SMESH_GroupBase aGroup2,
257 raises (SALOME::SALOME_Exception);
260 * Intersection of two groups
261 * New group is created. All mesh elements that are
262 * present in both initial groups are added to the new one.
264 SMESH_Group IntersectGroups (in SMESH_GroupBase aGroup1,
265 in SMESH_GroupBase aGroup2,
267 raises (SALOME::SALOME_Exception);
271 * New group is created. All mesh elements that are present in
272 * main group but do not present in tool group are added to the new one
274 SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
275 in SMESH_GroupBase aToolGroup,
277 raises (SALOME::SALOME_Exception);
280 * Add hypothesis to the mesh, under a particular subShape
281 * (or the main shape itself)
282 * The Add method is only used to prepare the build of the mesh and store
283 * the algorithms and associated parameters.
284 * Actual job of mesh the shape is done by MESH_Gen.
286 * - aSubShape : subShape obtained by a shape explode in GEOM
288 * - anHyp : hypothesis object
290 * - OK if the hypothesis is compatible with the subShape
291 * (and all previous hypothesis on the subShape)
292 * - NOK if the hypothesis is not compatible with the subShape
293 * (or one previous hypothesis on the subShape)
294 * raises exception if hypothesis has not been created
296 Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
297 in SMESH_Hypothesis anHyp)
298 raises (SALOME::SALOME_Exception);
299 // boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
300 // raises (SALOME::SALOME_Exception);
303 * Remove an hypothesis previouly added with AddHypothesis.
305 Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject,
306 in SMESH_Hypothesis anHyp)
307 raises (SALOME::SALOME_Exception);
308 // boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
309 // in SMESH_Hypothesis anHyp)
310 // raises (SALOME::SALOME_Exception);
313 * Get the list of hypothesis added on a subShape
315 ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Object aSubObject)
316 raises (SALOME::SALOME_Exception);
317 // ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
318 // raises (SALOME::SALOME_Exception);
321 * Get the log of nodes and elements added or removed since previous
324 * - clearAfterGet : log is emptied after Get (safe if concurrents access)
326 // string_array GetLog(in boolean clearAfterGet)
327 // raises (SALOME::SALOME_Exception);
328 log_array GetLog(in boolean clearAfterGet)
329 raises (SALOME::SALOME_Exception);
332 * Clear the log of nodes and elements added or removed since previous
333 * clear. Must be used immediately after GetLog if clearAfterGet is false.
336 raises (SALOME::SALOME_Exception);
339 * Get the internal Id
349 * Obtain instance of SMESH_MeshEditor
351 SMESH_MeshEditor GetMeshEditor()
352 raises (SALOME::SALOME_Exception);
355 * Return SMESH_MeshEditor that would not modify the mesh but
356 * fill MeshPreviewStruct
358 SMESH_MeshEditor GetMeshEditPreviewer()
359 raises (SALOME::SALOME_Exception);
361 /*! Check group names for duplications.
362 * Consider maximum group name length stored in MED file.
364 boolean HasDuplicatedGroupNamesMED();
367 * Export Mesh to different MED Formats
369 * - auto_groups : boolean parameter for creating/not creating
370 * the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
371 * the typical use is auto_groups=false.
372 * - theVersion : define the version of format of MED file, that will be created
374 void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
375 raises (SALOME::SALOME_Exception);
378 * Export Mesh to MED_V2_1 MED format
379 * Works, just the same as ExportToMED, with MED_VERSION parameter equal to MED_V2_1.
380 * The method is kept in order to support old functionality
382 void ExportMED( in string file, in boolean auto_groups )
383 raises (SALOME::SALOME_Exception);
386 * Export Mesh to DAT, UNV and STL Formats
387 * (UNV supported version is I-DEAS 10)
389 void ExportDAT( in string file )
390 raises (SALOME::SALOME_Exception);
391 void ExportUNV( in string file )
392 raises (SALOME::SALOME_Exception);
393 void ExportSTL( in string file, in boolean isascii )
394 raises (SALOME::SALOME_Exception);
399 SALOME_MED::MESH GetMEDMesh()
400 raises (SALOME::SALOME_Exception);
403 * Get informations about mesh contents
406 raises (SALOME::SALOME_Exception);
409 raises (SALOME::SALOME_Exception);
412 raises (SALOME::SALOME_Exception);
414 long NbEdgesOfOrder(in ElementOrder order)
415 raises (SALOME::SALOME_Exception);
418 raises (SALOME::SALOME_Exception);
420 long NbFacesOfOrder(in ElementOrder order)
421 raises (SALOME::SALOME_Exception);
424 raises (SALOME::SALOME_Exception);
426 long NbTrianglesOfOrder(in ElementOrder order)
427 raises (SALOME::SALOME_Exception);
430 raises (SALOME::SALOME_Exception);
432 long NbQuadranglesOfOrder(in ElementOrder order)
433 raises (SALOME::SALOME_Exception);
436 raises (SALOME::SALOME_Exception);
439 raises (SALOME::SALOME_Exception);
441 long NbVolumesOfOrder(in ElementOrder order)
442 raises (SALOME::SALOME_Exception);
445 raises (SALOME::SALOME_Exception);
447 long NbTetrasOfOrder(in ElementOrder order)
448 raises (SALOME::SALOME_Exception);
451 raises (SALOME::SALOME_Exception);
453 long NbHexasOfOrder(in ElementOrder order)
454 raises (SALOME::SALOME_Exception);
457 raises (SALOME::SALOME_Exception);
459 long NbPyramidsOfOrder(in ElementOrder order)
460 raises (SALOME::SALOME_Exception);
463 raises (SALOME::SALOME_Exception);
465 long NbPrismsOfOrder(in ElementOrder order)
466 raises (SALOME::SALOME_Exception);
469 raises (SALOME::SALOME_Exception);
472 raises (SALOME::SALOME_Exception);
474 long_array GetElementsId()
475 raises (SALOME::SALOME_Exception);
477 long_array GetElementsByType( in ElementType theType )
478 raises (SALOME::SALOME_Exception);
480 long_array GetNodesId()
481 raises (SALOME::SALOME_Exception);
484 * Returns type of mesh element
486 ElementType GetElementType( in long id, in boolean iselem )
487 raises (SALOME::SALOME_Exception);
489 long_array GetSubMeshElementsId(in long ShapeID)
490 raises (SALOME::SALOME_Exception);
492 long_array GetSubMeshNodesId(in long ShapeID, in boolean all )
493 raises (SALOME::SALOME_Exception);
495 ElementType GetSubMeshElementType(in long ShapeID)
496 raises (SALOME::SALOME_Exception);
499 * Get mesh description
506 long long GetMeshPtr();
509 * Get XYZ coordinates of node as list of double
510 * If there is not node for given ID - returns empty list
512 double_array GetNodeXYZ(in long id);
515 * For given node returns list of IDs of inverse elements
516 * If there is not node for given ID - returns empty list
518 long_array GetNodeInverseElements(in long id);
521 * If given element is node returns IDs of shape from position
522 * If there is not node for given ID - returns -1
524 long GetShapeID(in long id);
527 * For given element returns ID of result shape after
528 * ::FindShape() from SMESH_MeshEditor
529 * If there is not element for given ID - returns -1
531 long GetShapeIDForElem(in long id);
534 * Returns number of nodes for given element
535 * If there is not element for given ID - returns -1
537 long GetElemNbNodes(in long id);
540 * Returns IDs of nodes of given element
542 long_array GetElemNodes(in long id);
545 * Returns ID of node by given index for given element
546 * If there is not element for given ID - returns -1
547 * If there is not node for given index - returns -2
549 long GetElemNode(in long id, in long index);
552 * Returns true if given node is medium node
553 * in given quadratic element
555 boolean IsMediumNode(in long ide, in long idn);
558 * Returns true if given node is medium node
559 * in one of quadratic elements
561 boolean IsMediumNodeOfAnyElem(in long idn, in ElementType elem_type);
564 * Returns number of edges for given element
566 long ElemNbEdges(in long id);
569 * Returns number of faces for given element
571 long ElemNbFaces(in long id);
574 * Returns true if given element is polygon
576 boolean IsPoly(in long id);
579 * Returns true if given element is quadratic
581 boolean IsQuadratic(in long id);
584 * Returns XYZ coordinates of bary center for given element
586 * If there is not element for given ID - returns empty list
588 double_array BaryCenter(in long id);
592 interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
597 long GetNumberOfElements()
598 raises (SALOME::SALOME_Exception);
603 long GetNumberOfNodes( in boolean all )
604 raises (SALOME::SALOME_Exception);
609 long_array GetElementsId()
610 raises (SALOME::SALOME_Exception);
615 long_array GetElementsByType( in ElementType theType )
616 raises (SALOME::SALOME_Exception);
619 * Return type of submesh element
621 ElementType GetElementType( in long id, in boolean iselem )
622 raises (SALOME::SALOME_Exception);
627 long_array GetNodesId()
628 raises (SALOME::SALOME_Exception);
631 * Get geom shape the submesh is dedicated to
633 GEOM::GEOM_Object GetSubShape()
634 raises (SALOME::SALOME_Exception);
637 * Get SMESH_Mesh which stores nodes coordinates & elements definition
639 SMESH_Mesh GetFather()
640 raises (SALOME::SALOME_Exception);
643 * Get the internal Id
650 SALOME_MED::FAMILY GetFamily()
651 raises (SALOME::SALOME_Exception);