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 * Defines the mesh to be processed.
75 * \param pMeshName name of the mesh to be partitionned.
77 void setMesh(const char* pMeshName)
78 throw (SALOME::SALOME_Exception);
81 * Sets boxing parameters for decimation (100 by default).
82 * \param pBoxing number of cells along each axis of the grid (= acceleration structure) ; should be in [1..200].
84 void setBoxing(CORBA::Long pBoxing)
85 throw (SALOME::SALOME_Exception);
88 * Returns the list of meshes contained in the sequential MED file.
89 * Assumes this object encapsulates a sequential MED file.
90 * \return the list of meshes contained in the sequential MED file.
92 MULTIPR_ORB::string_array* getMeshes()
93 throw (SALOME::SALOME_Exception);
96 * Returns the list of fields contained in the sequential MED file.
97 * Assumes this object encapsulates a sequential MED file.
98 * \return the list of fields contained in the sequential MED file.
100 MULTIPR_ORB::string_array* getFields()
101 throw (SALOME::SALOME_Exception);
104 * Returns the number of timestamps for a given field.
105 * Assumes this object encapsulates a sequential MED file.
106 * \param pFieldName name of any field.
107 * \return the number of timestamps for a given field; 0 if field not found.
109 CORBA::Long getTimeStamps(const char* pFieldName)
110 throw (SALOME::SALOME_Exception);
113 * Returns the name of all partitions.
114 * Assumes this object encapsulates a distributed MED file.
115 * \return the name of all partitions.
117 MULTIPR_ORB::string_array* getParts()
118 throw (SALOME::SALOME_Exception);
121 * Returns all information abour a part.
122 * Assumes this object encapsulates a distributed MED file.
123 * \param pPartName name of the part.
124 * \return information about a part.
126 char* getPartInfo(const char* pPartName)
127 throw (SALOME::SALOME_Exception);
129 //---------------------------------------------------------------------
131 //---------------------------------------------------------------------
134 * Creates a distributed MED file (v2.3) by extracting all the groups from the current mesh of the current MED sequential MED file.
136 * - the file is in MED format and can be read using MED file v2.3.
137 * - the file is sequential (not a distributed MED).
138 * - the file only contains TETRA10 elements (dimension of space and mesh is 3).
139 * - the file have no profil.
140 * \return the name of each part.
142 MULTIPR_ORB::string_array* partitionneDomaine()
143 throw (SALOME::SALOME_Exception);
146 * Creates a distributed MED file (V2.3) by splitting a group of a MED file previously created by partitionneDomaine.
148 * - the file is a distributed MED file, previously created by partitionneDomaine()
149 * (=> each part only contain 1 mesh, TETRA10 elements only)
151 * \param pPartName name of the part to be splitted.
152 * \param pNbParts number of parts; must be > 1.
153 * \param pPartitionner use value 0=MULTIPR_METIS for Metis or 1=MULTIPR_SCOTCH for Scotch.
154 * \return the name of each part.
156 MULTIPR_ORB::string_array* partitionneGrain(
157 const char* pPartName,
158 CORBA::Long pNbParts,
159 CORBA::Long pPartitionner)
160 throw (SALOME::SALOME_Exception);
163 * Creates 3 resolutions of the given part of a distributed MED file (V2.3).
165 * - the file is a distributed MED file, previously created by partitionneDomaine() or partitionneGrain()
166 * (=> each part only contain 1 mesh, TETRA10 elements only)
167 * \param pPartName name of the part to be decimated.
168 * \param pFieldName name of the field used for decimation.
169 * \param pFieldIt iteration (time step) of the field.
170 * \param pFilterName name of the filter to be used.
171 * \param pTmed threshold used for medium resolution.
172 * \param pTlow threshold used for low resolution; tmed must be less than tlow
173 * \param pTadius radius used to determine the neighbourhood.
174 * \return the name of each part.
176 MULTIPR_ORB::string_array* decimePartition(
177 const char* pPartName,
178 const char* pFieldName,
179 CORBA::Long pFieldIt,
180 const char* pFilterName,
183 CORBA::Double pRadius)
184 throw (SALOME::SALOME_Exception);
187 * Returns useful information to configure decimation parameters.
188 * Depends on part, field and filter: generic operation.
189 * \param pPartName name of the part.
190 * \param pFieldName name of the field used for decimation.
191 * \param pFieldIt iteration (time step) of the field.
192 * \param pFilterName name of the filter to be used.
193 * \param pFilterParams params to be used with the filter (depends on filter; this string will be parsed).
195 char* evalDecimationParams(
196 const char* pPartName,
197 const char* pFieldName,
198 CORBA::Long pFieldIt,
199 const char* pFilterName,
200 const char* pFilterParams)
201 throw (SALOME::SALOME_Exception);
204 * Removes all the parts starting with "pPrefixPartName" from the distributed MED file.
205 * Example: if pPrefixPartName="PART_4" => remove "PART_4" and all sub-parts "PART_4_*", but not "PART41".
206 * Assume this object encapsulates a distributed MED file.
207 * \param pPrefixPartName name of the part.
209 void removeParts(const char* pPrefixPartName)
210 throw (SALOME::SALOME_Exception);
212 //---------------------------------------------------------------------
214 //---------------------------------------------------------------------
217 * Saves the associated MED file if necessary.
220 throw (SALOME::SALOME_Exception);
225 * The associated MULTIPR object.
230 * Boxing paremeter: number of cells along each axis.
231 * E.g. if mBoxing=10 then total number of cells = 10*10*10 = 1000.
232 * By default, mBoxing=100.
239 //*****************************************************************************
240 // Class MULTIPR_Gen_i
241 // C++ implementation of the MULTIPR_Gen CORBA interface
242 //*****************************************************************************
244 class MULTIPR_Gen_i :
245 public POA_MULTIPR_ORB::MULTIPR_Gen,
246 public Engines_Component_i
253 PortableServer::POA_ptr poa,
254 PortableServer::ObjectId* contId,
255 const char* instanceName,
256 const char* interfaceName);
258 virtual ~MULTIPR_Gen_i();
261 throw (SALOME::SALOME_Exception);
263 void partitionneDomaine(
264 const char* medFilename,
265 const char* meshName)
266 throw (SALOME::SALOME_Exception);
268 void partitionneGrain(
269 const char* medFilename,
270 const char* partName,
272 CORBA::Long partitionner)
273 throw (SALOME::SALOME_Exception);
275 void decimePartition(
276 const char* medFilename,
277 const char* partName,
278 const char* fieldName,
280 const char* filterName,
283 CORBA::Double radius,
285 throw (SALOME::SALOME_Exception);
287 MULTIPR_ORB::MULTIPR_Obj_ptr getObject(const char* medFilename)
288 throw (SALOME::SALOME_Exception);
292 extern "C" PortableServer::ObjectId* MULTIPREngine_factory(
294 PortableServer::POA_ptr poa,
295 PortableServer::ObjectId * contId,
296 const char* instanceName,
297 const char* interfaceName);
299 #endif // __MULTIPR_IMPLEMENTATION_CORBA__