Salome HOME
NPAL16198: EDF462: Submeshes creation duplicate algorithms and hypotheses. Refix.
[modules/smesh.git] / idl / SMESH_Gen.idl
1 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
3 // 
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. 
8 // 
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. 
13 // 
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 
17 // 
18 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 //
21 //
22 //  File   : SMESH_Gen.idl
23 //  Author : Paul RASCLE, EDF
24 //  $Header$
25
26 #ifndef _SMESH_GEN_IDL_
27 #define _SMESH_GEN_IDL_
28
29 #include "SALOME_Exception.idl"
30 #include "SALOME_Component.idl"
31 #include "SALOMEDS.idl"
32
33 #include "GEOM_Gen.idl"
34
35 #include "SMESH_Mesh.idl"
36 #include "SMESH_Hypothesis.idl"
37
38 module SMESH
39 {
40   typedef sequence<GEOM::GEOM_Object> object_array;
41   typedef sequence<SMESH_Mesh>        mesh_array;
42
43   interface FilterManager;
44   interface SMESH_Pattern;
45
46   /*!
47    * Tags definition
48    */
49   // Top level
50   const long Tag_HypothesisRoot = 1; // hypotheses root
51   const long Tag_AlgorithmsRoot = 2; // algorithms root
52   const long Tag_FirstMeshRoot  = 3; // first mesh root
53   // Mesh/Submesh
54   const long Tag_RefOnShape             = 1; // references to shape
55   const long Tag_RefOnAppliedHypothesis = 2; // applied hypotheses root
56   const long Tag_RefOnAppliedAlgorithms = 3; // applied algorithms root
57   // Mesh only: sub-meshes roots by type
58   const long Tag_FirstSubMesh           =  4;
59   const long Tag_SubMeshOnVertex        =  4;
60   const long Tag_SubMeshOnEdge          =  5;
61   const long Tag_SubMeshOnWire          =  6;
62   const long Tag_SubMeshOnFace          =  7;
63   const long Tag_SubMeshOnShell         =  8;
64   const long Tag_SubMeshOnSolid         =  9;
65   const long Tag_SubMeshOnCompound      = 10;
66   const long Tag_LastSubMesh            = 10;
67   // Mesh only: group roots by type
68   const long Tag_FirstGroup             = 11;
69   const long Tag_NodeGroups             = 11;
70   const long Tag_EdgeGroups             = 12;
71   const long Tag_FaceGroups             = 13;
72   const long Tag_VolumeGroups           = 14;
73   const long Tag_LastGroup              = 14;
74
75   /*!
76    * Hypothesis definintion error
77    */
78   struct AlgoStateError 
79   {
80     Hypothesis_Status  state;
81     string             algoName;
82     long               algoDim;
83     boolean            isGlobalAlgo;
84   };
85   typedef sequence<AlgoStateError> algo_error_array;
86
87   /*!
88    * Mesh computation error
89    */
90   enum ComputeErrorName
91   {
92     COMPERR_OK            ,
93     COMPERR_BAD_INPUT_MESH,  // wrong mesh on lower submesh
94     COMPERR_STD_EXCEPTION ,  // some std exception raised
95     COMPERR_OCC_EXCEPTION ,  // OCC exception raised
96     COMPERR_SLM_EXCEPTION ,  // SALOME exception raised
97     COMPERR_EXCEPTION     ,  // other exception raised
98     COMPERR_MEMORY_PB     ,  // memory allocation problem
99     COMPERR_ALGO_FAILED   ,  // computation failed
100     COMPERR_BAD_SHAPE        // bad geometry
101   };
102   struct ComputeError
103   {
104     short  code;       // ComputeErrorName or, if negative, algo specific code
105     string comment;    // textual problem description
106     string algoName;
107     short  subShapeID; // id of subshape of a shape to mesh
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 to the mesh
154      * existing on the given 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       raises ( SALOME::SALOME_Exception );
164
165     /*!
166      * Create a Mesh object, given a geometry shape.
167      * Mesh is created empty (no points, no elements).
168      * Shape is explored via GEOM_Client to create local copies.
169      * of TopoDS_Shapes and bind CORBA references of shape & subshapes
170      * with TopoDS_Shapes
171      */
172     SMESH_Mesh CreateMesh( in GEOM::GEOM_Object theObject )
173       raises ( SALOME::SALOME_Exception );
174     
175     /*!
176      * Create a empty mesh object
177      */
178     SMESH_Mesh CreateEmptyMesh()
179       raises ( SALOME::SALOME_Exception );
180     
181     /*!
182      * Create Mesh object importing data from given UNV file
183      * (UNV supported version is I-DEAS 10)
184      */
185     SMESH_Mesh CreateMeshesFromUNV( in string theFileName )
186       raises ( SALOME::SALOME_Exception );
187
188     /*!
189      * Create Mesh object(s) importing data from given MED file
190      */
191      mesh_array CreateMeshesFromMED( in string theFileName,
192                                      out SMESH::DriverMED_ReadStatus theStatus )
193        raises ( SALOME::SALOME_Exception );
194
195     /*!
196      * Create Mesh object importing data from given STL file
197      */
198     SMESH_Mesh CreateMeshesFromSTL( in string theFileName )
199       raises ( SALOME::SALOME_Exception );
200
201     /*!
202      * Create a Mesh object, without a geometry shape reference
203      */
204 //      SMESH_Mesh NewEmpty()
205 //        raises ( SALOME::SALOME_Exception );
206
207     /*!
208      * Mesh a subShape. 
209      * First, verify list of hypothesis associated with the subShape,
210      * return NOK if hypothesis are not sufficient
211      */
212     boolean Compute( in SMESH_Mesh        theMesh, 
213                      in GEOM::GEOM_Object theSubObject )
214       raises ( SALOME::SALOME_Exception );
215
216     /*!
217      * Return true if hypotheses are defined well
218      */
219     boolean IsReadyToCompute( in SMESH_Mesh        theMesh, 
220                               in GEOM::GEOM_Object theSubObject )
221       raises ( SALOME::SALOME_Exception );
222
223     /*!
224      * Return errors of hypotheses definintion
225      * algo_error_array is empty if everything is OK
226      */
227     algo_error_array GetAlgoState( in SMESH_Mesh        theMesh, 
228                                    in GEOM::GEOM_Object theSubObject )
229       raises ( SALOME::SALOME_Exception );
230
231     /*!
232      * Return errors of mesh computation
233      * compute_error_array is empty if everything is OK
234      */
235     compute_error_array GetComputeErrors( in SMESH_Mesh        theMesh, 
236                                           in GEOM::GEOM_Object theSubObject )
237       raises ( SALOME::SALOME_Exception );
238
239     /*!
240      * Return indeces of faces, edges and vertices of given subshapes
241      * within theMainObject
242      */
243     long_array GetSubShapesId( in GEOM::GEOM_Object theMainObject,
244                                in object_array      theListOfSubObjects )
245        raises ( SALOME::SALOME_Exception );
246
247     /*!
248      * Return geometrical object the given element is built on.
249      * The returned geometrical object, if not nil, is either found in the 
250      * study or is published by this method with the given name
251      */
252     GEOM::GEOM_Object GetGeometryByMeshElement( in SMESH_Mesh  theMesh,
253                                                 in long        theElementID,
254                                                 in string      theGeomName)
255       raises ( SALOME::SALOME_Exception );
256
257     /*!
258      * Return geometrical object the given element is built on.
259      * The returned geometrical object not published in study by this method.
260      */
261     GEOM::GEOM_Object FindGeometryByMeshElement( in SMESH_Mesh  theMesh,
262                                                  in long        theElementID)
263       raises ( SALOME::SALOME_Exception );
264
265     /*!
266      * Concatenate the given meshes into one mesh.
267      * Union groups with the same name and type if
268      * theUniteIdenticalGroups flag is true.
269      * Merge coincident nodes and elements if 
270      * theMergeNodesAndElements flag is true.
271      */
272     SMESH_Mesh Concatenate(in mesh_array theMeshesArray, 
273                            in boolean    theUniteIdenticalGroups, 
274                            in boolean    theMergeNodesAndElements, 
275                            in double     theMergeTolerance)
276       raises ( SALOME::SALOME_Exception );
277
278     /*!
279      * \brief Return id of object, registered in current study context
280      *
281      * Can be used to check if the object was created in the same container, as this engine.
282      */
283     long GetObjectId(in Object theObject);
284   };
285
286 };
287
288 #endif