Salome HOME
Merge from BR_V5_DEV 16Feb09
[modules/smesh.git] / idl / SMESH_Gen.idl
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  File   : SMESH_Gen.idl
23 //  Author : Paul RASCLE, EDF
24
25 #ifndef _SMESH_GEN_IDL_
26 #define _SMESH_GEN_IDL_
27
28 #include "SALOME_Exception.idl"
29 #include "SALOME_Component.idl"
30 #include "SALOMEDS.idl"
31
32 #include "GEOM_Gen.idl"
33
34 #include "SMESH_Mesh.idl"
35 #include "SMESH_Hypothesis.idl"
36
37 module SMESH
38 {
39   typedef sequence<GEOM::GEOM_Object> object_array;
40   typedef sequence<SMESH_Mesh>        mesh_array;
41
42   interface FilterManager;
43   interface SMESH_Pattern;
44
45   /*!
46    * Tags definition
47    */
48   // Top level
49   const long Tag_HypothesisRoot = 1; // hypotheses root
50   const long Tag_AlgorithmsRoot = 2; // algorithms root
51   const long Tag_FirstMeshRoot  = 3; // first mesh root
52   // Mesh/Submesh
53   const long Tag_RefOnShape             = 1; // references to shape
54   const long Tag_RefOnAppliedHypothesis = 2; // applied hypotheses root
55   const long Tag_RefOnAppliedAlgorithms = 3; // applied algorithms root
56   // Mesh only: sub-meshes roots by type
57   const long Tag_FirstSubMesh           =  4;
58   const long Tag_SubMeshOnVertex        =  4;
59   const long Tag_SubMeshOnEdge          =  5;
60   const long Tag_SubMeshOnWire          =  6;
61   const long Tag_SubMeshOnFace          =  7;
62   const long Tag_SubMeshOnShell         =  8;
63   const long Tag_SubMeshOnSolid         =  9;
64   const long Tag_SubMeshOnCompound      = 10;
65   const long Tag_LastSubMesh            = 10;
66   // Mesh only: group roots by type
67   const long Tag_FirstGroup             = 11;
68   const long Tag_NodeGroups             = 11;
69   const long Tag_EdgeGroups             = 12;
70   const long Tag_FaceGroups             = 13;
71   const long Tag_VolumeGroups           = 14;
72   const long Tag_LastGroup              = 14;
73
74   /*!
75    * Hypothesis definintion error
76    */
77   struct AlgoStateError 
78   {
79     Hypothesis_Status  state;
80     string             algoName;
81     long               algoDim;
82     boolean            isGlobalAlgo;
83   };
84   typedef sequence<AlgoStateError> algo_error_array;
85
86   /*!
87    * Mesh computation error
88    */
89   enum ComputeErrorName
90   {
91     COMPERR_OK            ,
92     COMPERR_BAD_INPUT_MESH,  // wrong mesh on lower submesh
93     COMPERR_STD_EXCEPTION ,  // some std exception raised
94     COMPERR_OCC_EXCEPTION ,  // OCC exception raised
95     COMPERR_SLM_EXCEPTION ,  // SALOME exception raised
96     COMPERR_EXCEPTION     ,  // other exception raised
97     COMPERR_MEMORY_PB     ,  // memory allocation problem
98     COMPERR_ALGO_FAILED   ,  // computation failed
99     COMPERR_BAD_SHAPE        // bad geometry
100   };
101   struct ComputeError
102   {
103     short   code;       // ComputeErrorName or, if negative, algo specific code
104     string  comment;    // textual problem description
105     string  algoName;
106     short   subShapeID; // id of subshape of a shape to mesh
107     boolean hasBadMesh; // there are elements preventing computation available for visualization
108   };
109   typedef sequence<ComputeError> compute_error_array;
110
111
112   interface SMESH_Gen : Engines::Component, SALOMEDS::Driver
113   {
114     //GEOM::GEOM_Gen SetGeomEngine( in string containerLoc );
115     void SetGeomEngine( in GEOM::GEOM_Gen geomcompo );
116
117     FilterManager CreateFilterManager();
118
119     SMESH_Pattern GetPattern();
120
121     /*!
122       Set the current mode
123      */
124     void SetEmbeddedMode( in boolean theMode );
125
126     /*!
127       Get the current mode
128      */
129     boolean IsEmbeddedMode();
130
131     /*!
132       Set the current study
133      */
134     void SetCurrentStudy( in SALOMEDS::Study theStudy );
135
136     /*!
137       Get the current study
138      */
139     SALOMEDS::Study GetCurrentStudy();
140
141     /*!
142      * Create a hypothesis that can be shared by differents parts of the mesh.
143      * An hypothesis is either:
144      * - a method used to generate or modify a part of the mesh (algorithm).
145      * - a parameter or a law used by an algorithm.
146      * Algorithms are 1D, 2D or 3D.
147      */
148     SMESH_Hypothesis CreateHypothesis( in string theHypName,
149                                        in string theLibName )
150       raises ( SALOME::SALOME_Exception );
151
152     /*!
153      * Return a hypothesis holding parameter values corresponding either to the mesh
154      * existing on the given geometry or to size of the geometry.
155      * The returned hypothesis may be the one existing in a study and used
156      * to compute the mesh, or a temporary one created just to pass parameter
157      * values.
158      */
159     SMESH_Hypothesis GetHypothesisParameterValues( in string            theHypName,
160                                                    in string            theLibName,
161                                                    in SMESH_Mesh        theMesh,
162                                                    in GEOM::GEOM_Object theGeom,
163                                                    in boolean           byMesh)
164       raises ( SALOME::SALOME_Exception );
165
166     /*!
167      * Sets number of segments per diagonal of boundary box of geometry by which
168      * default segment length of appropriate 1D hypotheses is defined
169      */
170     void SetBoundaryBoxSegmentation( in long theNbSegments ) raises ( SALOME::SALOME_Exception );
171     /*!
172      * \brief Sets default number of segments per edge
173      */
174     void SetDefaultNbSegments( in long theNbSegments) raises ( SALOME::SALOME_Exception );
175
176     /*!
177      * Set the object name
178      */
179     void SetName( in string theObjectIOR,
180                   in string theObjectName )
181       raises ( SALOME::SALOME_Exception );
182
183     /*!
184      * Create a Mesh object, given a geometry shape.
185      * Mesh is created empty (no points, no elements).
186      * Shape is explored via GEOM_Client to create local copies.
187      * of TopoDS_Shapes and bind CORBA references of shape & subshapes
188      * with TopoDS_Shapes
189      */
190     SMESH_Mesh CreateMesh( in GEOM::GEOM_Object theObject )
191       raises ( SALOME::SALOME_Exception );
192     
193     /*!
194      * Create an empty mesh object
195      */
196     SMESH_Mesh CreateEmptyMesh()
197       raises ( SALOME::SALOME_Exception );
198     
199     /*!
200      * Create Mesh object importing data from given UNV file
201      * (UNV supported version is I-DEAS 10)
202      */
203     SMESH_Mesh CreateMeshesFromUNV( in string theFileName )
204       raises ( SALOME::SALOME_Exception );
205
206     /*!
207      * Create Mesh object(s) importing data from given MED file
208      */
209      mesh_array CreateMeshesFromMED( in string theFileName,
210                                      out SMESH::DriverMED_ReadStatus theStatus )
211        raises ( SALOME::SALOME_Exception );
212
213     /*!
214      * Create Mesh object importing data from given STL file
215      */
216     SMESH_Mesh CreateMeshesFromSTL( in string theFileName )
217       raises ( SALOME::SALOME_Exception );
218
219     /*!
220      * Create a Mesh object, without a geometry shape reference
221      */
222 //      SMESH_Mesh NewEmpty()
223 //        raises ( SALOME::SALOME_Exception );
224
225     /*!
226      * Mesh a subShape. 
227      * First, verify list of hypothesis associated with the subShape,
228      * return NOK if hypothesis are not sufficient
229      */
230     boolean Compute( in SMESH_Mesh        theMesh, 
231                      in GEOM::GEOM_Object theSubObject )
232       raises ( SALOME::SALOME_Exception );
233
234     /*!
235      * Return true if hypotheses are defined well
236      */
237     boolean IsReadyToCompute( in SMESH_Mesh        theMesh, 
238                               in GEOM::GEOM_Object theSubObject )
239       raises ( SALOME::SALOME_Exception );
240
241     /*!
242      * Calculate Mesh as preview till indicated dimension
243      * First, verify list of hypothesis associated with the subShape.
244      * Return mesh preview structure
245      */
246     MeshPreviewStruct Precompute( in SMESH_Mesh        theMesh, 
247                                   in GEOM::GEOM_Object theSubObject,
248                                   in Dimension         theDimension,
249                                   inout long_array    theShapesId )
250       raises ( SALOME::SALOME_Exception );
251
252     /*!
253      * Return errors of hypotheses definintion
254      * algo_error_array is empty if everything is OK
255      */
256     algo_error_array GetAlgoState( in SMESH_Mesh        theMesh, 
257                                    in GEOM::GEOM_Object theSubObject )
258       raises ( SALOME::SALOME_Exception );
259
260     /*!
261      * Return errors of mesh computation
262      * compute_error_array is empty if everything is OK
263      */
264     compute_error_array GetComputeErrors( in SMESH_Mesh        theMesh, 
265                                           in GEOM::GEOM_Object theSubObject )
266       raises ( SALOME::SALOME_Exception );
267
268     /*!
269      * Return mesh elements preventing computation of a subshape
270      */
271     MeshPreviewStruct GetBadInputElements( in SMESH_Mesh theMesh,
272                                            in short      theSubShapeID )
273       raises ( SALOME::SALOME_Exception );
274
275     /*!
276      * Return indeces of faces, edges and vertices of given subshapes
277      * within theMainObject
278      */
279     long_array GetSubShapesId( in GEOM::GEOM_Object theMainObject,
280                                in object_array      theListOfSubObjects )
281        raises ( SALOME::SALOME_Exception );
282
283     /*!
284      * Return geometrical object the given element is built on.
285      * The returned geometrical object, if not nil, is either found in the 
286      * study or is published by this method with the given name
287      */
288     GEOM::GEOM_Object GetGeometryByMeshElement( in SMESH_Mesh  theMesh,
289                                                 in long        theElementID,
290                                                 in string      theGeomName)
291       raises ( SALOME::SALOME_Exception );
292
293     /*!
294      * Return geometrical object the given element is built on.
295      * The returned geometrical object not published in study by this method.
296      */
297     GEOM::GEOM_Object FindGeometryByMeshElement( in SMESH_Mesh  theMesh,
298                                                  in long        theElementID)
299       raises ( SALOME::SALOME_Exception );
300
301     /*!
302      * Concatenate the given meshes into one mesh.
303      * Union groups with the same name and type if
304      * theUniteIdenticalGroups flag is true.
305      * Merge coincident nodes and elements if 
306      * theMergeNodesAndElements flag is true.
307      */
308     SMESH_Mesh Concatenate(in mesh_array theMeshesArray, 
309                            in boolean    theUniteIdenticalGroups, 
310                            in boolean    theMergeNodesAndElements, 
311                            in double     theMergeTolerance)
312       raises ( SALOME::SALOME_Exception );
313
314     /*!
315      * Concatenate the given meshes into one mesh.
316      * Union groups with the same name and type if
317      * theUniteIdenticalGroups flag is true.
318      * Merge coincident nodes and elements if 
319      * theMergeNodesAndElements flag is true.
320      * Create the groups of all elements from initial meshes.
321      */
322     SMESH_Mesh ConcatenateWithGroups(in mesh_array theMeshesArray, 
323                                      in boolean    theUniteIdenticalGroups, 
324                                      in boolean    theMergeNodesAndElements, 
325                                      in double     theMergeTolerance)
326       raises ( SALOME::SALOME_Exception );
327
328     /*!
329      * \brief Return id of object, registered in current study context
330      *
331      * Can be used to check if the object was created in the same container, as this engine.
332      */
333     long GetObjectId(in Object theObject);
334   };
335
336 };
337
338 #endif