]> SALOME platform Git repositories - modules/multipr.git/blob - src/MULTIPR/MULTIPR_i.hxx
Salome HOME
*** empty log message ***
[modules/multipr.git] / src / MULTIPR / MULTIPR_i.hxx
1 // Project MULTIPR, IOLS WP1.2.1 - EDF/CS
2 // Partitioning/decimation module for the SALOME v3.2 platform
3
4 /**
5  * \file    MULTIPR_i.hxx
6  *
7  * \brief   C++ implementation of the CORBA interface of the MULTIPR module.
8  *
9  * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
10  * 
11  * \date    01/2007
12  */
13
14   
15 //*****************************************************************************
16 // Includes section
17 //*****************************************************************************
18  
19 #ifndef __MULTIPR_IMPLEMENTATION_CORBA__
20 #define __MULTIPR_IMPLEMENTATION_CORBA__
21
22 #include <SALOMEconfig.h>
23 #include CORBA_SERVER_HEADER(MULTIPR)
24 #include "SALOME_Component_i.hxx"
25 #include "Utils_CorbaException.hxx"
26
27 #include "MULTIPR_Obj.hxx"
28
29
30 //*****************************************************************************
31 // Class MULTIPR_Obj_i
32 // C++ implementation of the MULTIPR_Obj CORBA interface
33 // This class is a wrapper to encapsulate MULTIPR_Obj
34 //*****************************************************************************
35
36 class MULTIPR_Obj_i :
37     public POA_MULTIPR_ORB::MULTIPR_Obj
38 {
39
40 public:
41
42     /**
43      * Constructor.
44      * Associate a MED file (sequential or distributed) with this object.
45      * \param  pMEDFilename MED file to be associated with this object.
46      */
47     MULTIPR_Obj_i(const char* pMEDFilename)
48         throw (SALOME::SALOME_Exception);
49         
50     /**
51      * Destructor.
52      */
53     virtual ~MULTIPR_Obj_i();
54     
55     //---------------------------------------------------------------------
56     // Basic accessors/mutators
57     //--------------------------------------------------------------------
58     
59     /**
60      * Returns true iff this obj represents a valid sequential MED file.
61      * \return true iff this obj represents a valid sequential MED file.
62      */
63     CORBA::Boolean isValidSequentialMEDFile()
64         throw (SALOME::SALOME_Exception);
65     
66     /**
67      * Returns true iff this obj represents a valid distributed MED file.
68      * \return true iff this obj represents a valid distributed  MED file.
69      */
70     CORBA::Boolean isValidDistributedMEDFile()
71         throw (SALOME::SALOME_Exception);
72     
73     /**
74      * Returns the name of the associated MED file.
75      * \return the name of the associated MED file.
76      */
77     char* getFilename()
78         throw (SALOME::SALOME_Exception);
79     
80     /**
81      * Returns the name of the associated sequential MED file (for a distributed MED file).
82      * \return the name of the associated sequential MED file (for a distributed MED file).
83      */     
84     char* getSeqFilename()
85         throw (SALOME::SALOME_Exception);
86     /**
87      * Defines the mesh to be processed.
88      * \param  pMeshName name of the mesh to be partitionned.
89      */
90     void setMesh(const char* pMeshName)
91         throw (SALOME::SALOME_Exception);
92     
93     /**
94      * Sets boxing parameters for decimation (100 by default).
95      * \param  pBoxing number of cells along each axis of the grid (= acceleration structure) ; should be in [1..200].
96      */
97     void setBoxing(CORBA::Long pBoxing)
98         throw (SALOME::SALOME_Exception);
99
100     /**
101      * Returns the list of meshes contained in the sequential MED file.
102      * Assumes this object encapsulates a sequential MED file.
103      * \return the list of meshes contained in the sequential MED file.
104      */
105     MULTIPR_ORB::string_array* getMeshes() 
106         throw (SALOME::SALOME_Exception);
107
108     /**
109      * Returns the list of fields contained in the sequential MED file.
110      * Assumes this object encapsulates a sequential MED file.
111      * \return the list of fields contained in the sequential MED file.
112      */
113     MULTIPR_ORB::string_array* getFields() 
114         throw (SALOME::SALOME_Exception);
115     
116     /**
117      * Returns the number of timestamps for a given field.
118      * Assumes this object encapsulates a sequential MED file.
119      * \param  pFieldName name of any field.
120      * \return the number of timestamps for a given field; 0 if field not found.
121      */
122     CORBA::Long getTimeStamps(const char* pFieldName)
123         throw (SALOME::SALOME_Exception);
124     
125     /**
126      * Returns the name of all partitions.
127      * Assumes this object encapsulates a distributed MED file.
128      * \return the name of all partitions.
129      */
130     MULTIPR_ORB::string_array* getParts()
131         throw (SALOME::SALOME_Exception);
132
133     /**
134      * Returns all information abour a part.
135      * Assumes this object encapsulates a distributed MED file.
136      * \param  pPartName name of the part.
137      * \return information about a part.
138      */
139     char* getPartInfo(const char* pPartName)
140         throw (SALOME::SALOME_Exception);
141     
142     //---------------------------------------------------------------------
143     // Algorithms
144     //---------------------------------------------------------------------
145     
146     /**
147      * Creates a distributed MED file (v2.3) by extracting all the groups from the current mesh of the current MED sequential MED file.
148      *         Assumes:
149      *         - the file is in MED format and can be read using MED file v2.3.
150      *         - the file is sequential (not a distributed MED).
151      *         - the file only contains TETRA10 elements (dimension of space and mesh is 3).
152      *         - the file have no profil.
153      * \return the name of each part.
154      */
155     MULTIPR_ORB::string_array* partitionneDomaine()
156         throw (SALOME::SALOME_Exception);
157     
158     /** 
159      * Creates a distributed MED file (V2.3) by splitting a group of a MED file previously created by partitionneDomaine.
160      *         Assumes:
161      *         - the file is a distributed MED file, previously created by partitionneDomaine()
162      *           (=> each part only contain 1 mesh, TETRA10 elements only)
163      *         - nbPart > 1
164      * \param  pPartName     name of the part to be splitted.
165      * \param  pNbParts      number of parts; must be > 1.
166      * \param  pPartitionner use value 0=MULTIPR_METIS for Metis or 1=MULTIPR_SCOTCH for Scotch.
167      * \return the name of each part.
168      */
169     MULTIPR_ORB::string_array* partitionneGrain(
170         const char* pPartName, 
171         CORBA::Long pNbParts, 
172         CORBA::Long pPartitionner)
173         throw (SALOME::SALOME_Exception);
174     
175     /**
176      * Creates 3 resolutions of the given part of a distributed MED file (V2.3).
177      *         Assumes:
178      *         - the file is a distributed MED file, previously created by partitionneDomaine() or partitionneGrain()
179      *           (=> each part only contain 1 mesh, TETRA10 elements only)
180      * \param  pPartName    name of the part to be decimated.
181      * \param  pFieldName   name of the field used for decimation.
182      * \param  pFieldIt     iteration (time step) of the field.
183      * \param  pFilterName  name of the filter to be used.
184      * \param  pTmed        threshold used for medium resolution.
185      * \param  pTlow        threshold used for low resolution; tmed must be less than tlow
186      * \param  pTadius      radius used to determine the neighbourhood.
187      * \return the name of each part.
188      */
189     MULTIPR_ORB::string_array* decimePartition(
190         const char*   pPartName,
191         const char*   pFieldName,
192         CORBA::Long   pFieldIt,
193         const char*   pFilterName,
194         CORBA::Double pTmed,
195         CORBA::Double pTlow,
196         CORBA::Double pRadius)
197         throw (SALOME::SALOME_Exception);
198         
199     /**
200      * Returns useful information to configure decimation parameters.
201      * Depends on part, field and filter: generic operation.
202      * \param  pPartName     name of the part.
203      * \param  pFieldName    name of the field used for decimation.
204      * \param  pFieldIt      iteration (time step) of the field.
205      * \param  pFilterName   name of the filter to be used.
206      * \param  pFilterParams params to be used with the filter (depends on filter; this string will be parsed).
207      */
208     char* evalDecimationParams(
209         const char* pPartName, 
210         const char* pFieldName, 
211         CORBA::Long pFieldIt, 
212         const char* pFilterName,
213         const char* pFilterParams)
214         throw (SALOME::SALOME_Exception);
215         
216     /*!
217      * Removes all the parts starting with "pPrefixPartName" from the distributed MED file.
218      * Example: if pPrefixPartName="PART_4" => remove "PART_4" and all sub-parts "PART_4_*", but not "PART41".
219      * Assume this object encapsulates a distributed MED file.
220      * \param  pPrefixPartName name of the part.
221      */
222     void removeParts(const char* pPrefixPartName)
223         throw (SALOME::SALOME_Exception);
224     
225     //---------------------------------------------------------------------
226     // I/O
227     //---------------------------------------------------------------------
228     
229     /**
230      * Saves the associated MED file if necessary.
231      * \param  pPath path where to save the file.
232      */
233     void save(const char* pPath)
234         throw (SALOME::SALOME_Exception);
235     
236 private:
237
238     /**
239      * The associated MULTIPR object.
240      */
241     multipr::Obj* mObj;
242     
243     /**
244      * Boxing paremeter: number of cells along each axis.
245      * E.g. if mBoxing=10 then total number of cells = 10*10*10 = 1000.
246      * By default, mBoxing=100.
247      */
248     int mBoxing;
249     
250 };
251
252
253 //*****************************************************************************
254 // Class MULTIPR_Gen_i
255 // C++ implementation of the MULTIPR_Gen CORBA interface
256 //*****************************************************************************
257
258 class MULTIPR_Gen_i :
259     public POA_MULTIPR_ORB::MULTIPR_Gen,
260     public Engines_Component_i 
261 {
262
263 public:
264
265     MULTIPR_Gen_i(
266         CORBA::ORB_ptr orb,
267         PortableServer::POA_ptr poa,
268         PortableServer::ObjectId* contId, 
269         const char* instanceName, 
270         const char* interfaceName);
271     
272     virtual ~MULTIPR_Gen_i();
273     
274     char* getVersion()
275         throw (SALOME::SALOME_Exception);
276     
277     void partitionneDomaine(
278         const char* medFilename, 
279         const char* meshName)
280         throw (SALOME::SALOME_Exception);
281     
282     void partitionneGrain(
283         const char* medFilename, 
284         const char* partName, 
285         CORBA::Long nbParts, 
286         CORBA::Long partitionner)
287         throw (SALOME::SALOME_Exception);
288     
289     void decimePartition(
290         const char*   medFilename, 
291         const char*   partName, 
292         const char*   fieldName,
293         CORBA::Long   fieldIt,
294         const char*   filterName,
295         CORBA::Double tmed,
296         CORBA::Double tlow,
297         CORBA::Double radius,
298         CORBA::Long   boxing)
299         throw (SALOME::SALOME_Exception);
300  
301     MULTIPR_ORB::MULTIPR_Obj_ptr getObject(const char* medFilename)
302         throw (SALOME::SALOME_Exception);
303 };
304
305
306 extern "C" PortableServer::ObjectId* MULTIPREngine_factory(
307     CORBA::ORB_ptr orb,
308     PortableServer::POA_ptr poa,
309     PortableServer::ObjectId * contId,
310     const char* instanceName,
311     const char* interfaceName);
312
313 #endif // __MULTIPR_IMPLEMENTATION_CORBA__
314
315 // EOF
316