1 // Project MULTIPR, IOLS WP1.2.1 - EDF/CS
2 // Partitioning/decimation module for the SALOME v3.2 platform
7 * \brief C++ implementation of the CORBA interface of the MULTIPR module.
9 * \author Olivier LE ROUX - CS, Virtual Reality Dpt
15 //*****************************************************************************
17 //*****************************************************************************
19 #ifndef __MULTIPR_IMPLEMENTATION_CORBA__
20 #define __MULTIPR_IMPLEMENTATION_CORBA__
22 #include <SALOMEconfig.h>
23 #include CORBA_SERVER_HEADER(MULTIPR)
24 #include "SALOME_Component_i.hxx"
25 #include "Utils_CorbaException.hxx"
27 #include "MULTIPR_Obj.hxx"
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 //*****************************************************************************
37 public POA_MULTIPR_ORB::MULTIPR_Obj
44 * Associate a MED file (sequential or distributed) with this object.
45 * \param pMEDFilename MED file to be associated with this object.
47 MULTIPR_Obj_i(const char* pMEDFilename)
48 throw (SALOME::SALOME_Exception);
53 virtual ~MULTIPR_Obj_i();
55 //---------------------------------------------------------------------
56 // Basic accessors/mutators
57 //--------------------------------------------------------------------
60 * Returns true iff this obj represents a valid sequential MED file.
61 * \return true iff this obj represents a valid sequential MED file.
63 CORBA::Boolean isValidSequentialMEDFile()
64 throw (SALOME::SALOME_Exception);
67 * Returns true iff this obj represents a valid distributed MED file.
68 * \return true iff this obj represents a valid distributed MED file.
70 CORBA::Boolean isValidDistributedMEDFile()
71 throw (SALOME::SALOME_Exception);
74 * Returns the name of the associated MED file.
75 * \return the name of the associated MED file.
78 throw (SALOME::SALOME_Exception);
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).
84 char* getSeqFilename()
85 throw (SALOME::SALOME_Exception);
87 * Defines the mesh to be processed.
88 * \param pMeshName name of the mesh to be partitionned.
90 void setMesh(const char* pMeshName)
91 throw (SALOME::SALOME_Exception);
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].
97 void setBoxing(CORBA::Long pBoxing)
98 throw (SALOME::SALOME_Exception);
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.
105 MULTIPR_ORB::string_array* getMeshes()
106 throw (SALOME::SALOME_Exception);
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.
113 MULTIPR_ORB::string_array* getFields()
114 throw (SALOME::SALOME_Exception);
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.
122 CORBA::Long getTimeStamps(const char* pFieldName)
123 throw (SALOME::SALOME_Exception);
126 * Returns the name of all partitions.
127 * Assumes this object encapsulates a distributed MED file.
128 * \return the name of all partitions.
130 MULTIPR_ORB::string_array* getParts()
131 throw (SALOME::SALOME_Exception);
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.
139 char* getPartInfo(const char* pPartName)
140 throw (SALOME::SALOME_Exception);
142 //---------------------------------------------------------------------
144 //---------------------------------------------------------------------
147 * Creates a distributed MED file (v2.3) by extracting all the groups from the current mesh of the current MED sequential MED file.
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.
155 MULTIPR_ORB::string_array* partitionneDomaine()
156 throw (SALOME::SALOME_Exception);
159 * Creates a distributed MED file (V2.3) by splitting a group of a MED file previously created by partitionneDomaine.
161 * - the file is a distributed MED file, previously created by partitionneDomaine()
162 * (=> each part only contain 1 mesh, TETRA10 elements only)
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.
169 MULTIPR_ORB::string_array* partitionneGrain(
170 const char* pPartName,
171 CORBA::Long pNbParts,
172 CORBA::Long pPartitionner)
173 throw (SALOME::SALOME_Exception);
176 * Creates 3 resolutions of the given part of a distributed MED file (V2.3).
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.
189 MULTIPR_ORB::string_array* decimePartition(
190 const char* pPartName,
191 const char* pFieldName,
192 CORBA::Long pFieldIt,
193 const char* pFilterName,
196 CORBA::Double pRadius)
197 throw (SALOME::SALOME_Exception);
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).
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);
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.
222 void removeParts(const char* pPrefixPartName)
223 throw (SALOME::SALOME_Exception);
225 //---------------------------------------------------------------------
227 //---------------------------------------------------------------------
230 * Saves the associated MED file if necessary.
231 * \param pPath path where to save the file.
233 void save(const char* pPath)
234 throw (SALOME::SALOME_Exception);
239 * The associated MULTIPR object.
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.
253 //*****************************************************************************
254 // Class MULTIPR_Gen_i
255 // C++ implementation of the MULTIPR_Gen CORBA interface
256 //*****************************************************************************
258 class MULTIPR_Gen_i :
259 public POA_MULTIPR_ORB::MULTIPR_Gen,
260 public Engines_Component_i
267 PortableServer::POA_ptr poa,
268 PortableServer::ObjectId* contId,
269 const char* instanceName,
270 const char* interfaceName);
272 virtual ~MULTIPR_Gen_i();
275 throw (SALOME::SALOME_Exception);
277 void partitionneDomaine(
278 const char* medFilename,
279 const char* meshName)
280 throw (SALOME::SALOME_Exception);
282 void partitionneGrain(
283 const char* medFilename,
284 const char* partName,
286 CORBA::Long partitionner)
287 throw (SALOME::SALOME_Exception);
289 void decimePartition(
290 const char* medFilename,
291 const char* partName,
292 const char* fieldName,
294 const char* filterName,
297 CORBA::Double radius,
299 throw (SALOME::SALOME_Exception);
301 MULTIPR_ORB::MULTIPR_Obj_ptr getObject(const char* medFilename)
302 throw (SALOME::SALOME_Exception);
306 extern "C" PortableServer::ObjectId* MULTIPREngine_factory(
308 PortableServer::POA_ptr poa,
309 PortableServer::ObjectId * contId,
310 const char* instanceName,
311 const char* interfaceName);
313 #endif // __MULTIPR_IMPLEMENTATION_CORBA__