MED fichier: Fichier source de filterBlockOfentities.c

MED fichier

filterBlockOfentities.c
Aller à la documentation de ce fichier.
1 /* This file is part of MED.
2 *
3 * COPYRIGHT (C) 1999 - 2021 EDF R&D, CEA/DEN
4 * MED is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * MED 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
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with MED. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #define MAX(a,b) ((a) > (b) ? (a) : (b))
19
20 #include <med.h>
21 #define MESGERR 1
22 #include "med_utils.h"
23 #include "med_config.h"
24
25 #include <stdlib.h>
26 #include <string.h>
27 #include <assert.h>
28
29 #ifdef PPRO_NT_CALL
30 // Windows Header Files:
31 # include <windows.h>
32 # include <Lmcons.h>
33 # include <sys/timeb.h>
34 # include <time.h>
35 #else
36
37 # if HAVE_SYS_TIME_H
38 # include <sys/time.h>
39 # endif
40
41 #include <time.h>
42
43 #ifndef HAVE_UNISTD_H
44 #error "unistd.h required."
45 #endif
46
47 #endif
48
49 #include "getBlocksOfEntitiesPartition.h"
50 #include "generateDatas.h"
51 #include "generateFilterArray.h"
52
53
54 #ifdef DEF_LECT_ECR
55 #define MODE_ACCES MED_ACC_RDWR
56 #elif DEF_LECT_AJOUT
57 #define MODE_ACCES MED_ACC_RDEXT
58 #else
59 #define MODE_ACCES MED_ACC_CREAT
60 #endif
61
62 /*Valeur de l'enum dans med.h.in*/
63 /* #define MED_NO_INTERLACE 2 */
64 /* #define MED_FULL_INTERLACE 1 */
65
66
67 /* #ifndef USER_INTERLACE */
68 /* #define USER_INTERLACE MED_FULL_INTERLACE */
69 /* #warning "Defining MED_FULL_INTERLACE mode..." */
70 /* #endif */
71
72 /* #if USER_INTERLACE == MED_NO_INTERLACE */
73 /* #define generateDatas generateNoIDatas */
74 /* #warning "Using generateNoIDatas..." */
75 /* #elif USER_INTERLACE == MED_FULL_INTERLACE */
76 /* #define generateDatas generateFullIDatas */
77 /* #warning "Using generateFullIDatas..." */
78 /* #else */
79 /* #error "The USER_INTERLACE macro value match neither MED_NO_INTERLACE nor MED_FULL_INTERLACE" */
80 /* #endif */
81
82 /* #define USER_MODE MED_COMPACT */
83
84 typedef struct {
85 MPI_Info info;
86 MPI_Comm comm;
87 int mpi_size;
88 int mpi_rank;
89 med_int nentitiesfiltered;
90 med_int *filterarray;
91 } COM_info;
92
93
94
95 med_err generateFieldFile( const med_size nentities, const med_size nvaluesperentity, const med_size nconstituentpervalue,
96 const med_switch_mode constituentmode,GetBlocksOfEntitiesType getBlockOfEntities, const med_int nbblocksperproc,
97 GenerateDataType generateDatas,
98 const med_storage_mode storagemode, const med_size profilearraysize, const char * const fieldnameprefix, COM_info * const cominfo ) {
99
100 /* static int _fileno=0; */
101 med_err _ret=-1;
102 char _filename [255]="";
103 char _meshname[MED_NAME_SIZE+1]="Empty mesh";
104 med_int _meshdim=3;
105 char _meshcomponentname[3*MED_SNAME_SIZE+1] = "x y z ";
106 char _meshcomponentunit[3*MED_SNAME_SIZE+1] = "cm cm cm ";
107 char _fieldname [MED_NAME_SIZE+1]="";
108 char *componentname,*componentunit;
109 char _profilename[MED_NAME_SIZE+1]=MED_NO_PROFILE;
110 med_int *_profilearray=0;
111 int _i=0,_j=0,_k=0, _lastusedrank=0;
112 med_size _blocksize=0,_lastblocksize=0,_count=0,_stride=0,_start=0,_index=0;
113 med_float *_arrayvalues;
114 med_filter filter = MED_FILTER_INIT;
115 med_size _nusedentities = nentities;
116 med_size _io_count = nbblocksperproc;
117 med_idt _fidseq,_fid;
118
119 MPI_Info info = cominfo->info;
120 MPI_Comm comm = cominfo->comm;
121 int mpi_size = cominfo->mpi_size;
122 int mpi_rank = cominfo->mpi_rank;
123
124 char *_MED_MODE_SWITCH_MSG[3]={"MED_FULL_INTERLACE", "MED_NO_INTERLACE","MED_UNDEF_INTERLACE",};
125 char *_MED_STORAGE_MODE_MSG[3]={"MED_NO_STMODE","MED_GLOBAL_STMODE", "MED_COMPACT_STMODE"};
126
127 med_geometry_type _geotype = MED_TRIA6;
128 med_int _geodim = _geotype/100;
129 med_int _geonnodes = _geotype%100;
130 char _ipointname[MED_NAME_SIZE+1];
131 med_float* _ipointrefcoo = 0;
132 med_int _ipoint = nvaluesperentity;
133 med_float* _ipointcoo = 0;
134 med_float* _ipointwg = 0;
135
136 sprintf(_filename,"%s_CPU-%03d_@_%s_%s.med",fieldnameprefix,mpi_size,_MED_MODE_SWITCH_MSG[constituentmode],_MED_STORAGE_MODE_MSG[storagemode]);
137 /* SSCRUTE(_filename); */
138 /* Ouverture du fichier en mode parallel */
139 if ((_fid = MEDparFileOpen(_filename, MODE_ACCES ,comm, info)) < 0){
140 MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_FILE,_filename);
141 goto ERROR;
142 }
143
144 /* SSCRUTE(_meshname); */
145 if (MEDmeshCr( _fid,_meshname,_meshdim,_meshdim, MED_UNSTRUCTURED_MESH,
146 "Un maillage pour le test parallel","s", MED_SORT_DTIT,
147 MED_CARTESIAN, _meshcomponentname, _meshcomponentunit) < 0) {
148 MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_MESH,_meshname);
149 goto ERROR;
150 };
151
152 componentname = (char*) malloc((nconstituentpervalue*MED_SNAME_SIZE+1)*sizeof(char));
153 componentunit = (char*) malloc((nconstituentpervalue*MED_SNAME_SIZE+1)*sizeof(char));
154 /*TODO : Compléter le nom */
155 strcpy(componentname,"");
156 strcpy(componentunit,"");
157 strcpy(_fieldname,fieldnameprefix);
158 if ( MEDfieldCr(_fid,_fieldname,MED_FLOAT64,nconstituentpervalue,componentname,componentunit,"s",_meshname ) < 0) {
159 MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_FIELD,_fieldname);
160 goto ERROR;
161 };
162 free(componentname);
163 free(componentunit);
164
165
166 if ( _ipoint > 1 ) {
167
168 MESSAGE("Creating a localization of integration points...");
169 strcpy(_ipointname,_fieldname);
170 strcat(_ipointname,"_loc");
171
172 /*Attention ancienne spec*/
173 _ipointrefcoo = (med_float *) calloc(_geodim*_geonnodes,sizeof(med_float));
174 _ipointcoo = (med_float *) calloc(_ipoint*_geodim,sizeof(med_float));
175 _ipointwg = (med_float *) calloc(_ipoint,sizeof(med_float));
176
177 if (MEDlocalizationWr(_fid, _ipointname, _geotype, _geotype/100, _ipointrefcoo, constituentmode,
178 _ipoint, _ipointcoo, _ipointwg, MED_NO_INTERPOLATION, MED_NO_MESH_SUPPORT ) < 0) {
179 MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_LOCALIZATION,_ipointname);
180 ISCRUTE_int(constituentmode);
181 goto ERROR;
182 }
183 free(_ipointrefcoo );
184 free(_ipointcoo );
185 free(_ipointwg );
186
187 } else {
188 strcpy(_ipointname,MED_NO_LOCALIZATION);
189 }
190
191 if (profilearraysize) {
192 MESSAGE("Creating a profile...");
193
194 strcpy(_profilename,_fieldname);strcat(_profilename,"_profile");
195
196 _profilearray = (med_int*) calloc(profilearraysize,sizeof(med_int));
197
198 for (_i=0; _i < profilearraysize; ++_i) _profilearray[_i]=_i;
199 if ( MEDprofileWr(_fid,_profilename,profilearraysize,_profilearray) < 0) {
200 MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_PROFILE,_profilename);
201 goto ERROR;
202 };
203 _nusedentities = profilearraysize;
204 } else {
205 strcpy(_profilename,MED_NO_PROFILE);
206 }
207
208
209 MESSAGE("Generating partition...");
210 getBlockOfEntities ( mpi_rank , mpi_size, _nusedentities,
211 &_start, &_stride, &_io_count, &_blocksize,
212 &_lastusedrank, &_lastblocksize);
213
214 _count=_io_count;
215 MESSAGE("Generating filter...");
216 if ( MEDfilterBlockOfEntityCr(_fid, nentities, nvaluesperentity, nconstituentpervalue,
217 MED_ALL_CONSTITUENT, constituentmode, storagemode, _profilename,
218 _start,_stride,_count,_blocksize,_lastblocksize, &filter) < 0 ) {
219 MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_FILTER,"");
220 goto ERROR;
221 }
222
223 MESSAGE("Generating datas...");
224 generateDatas(mpi_rank, _lastusedrank, sizeof(med_float),
225 storagemode, profilearraysize, _profilearray,
226 _start, _stride, _count, _blocksize, _lastblocksize,
227 nentities, nvaluesperentity, nconstituentpervalue,
228 &_arrayvalues );
229
230 MESSAGE("Writing field...");
231 if ( MEDfieldValueAdvancedWr(_fid,_fieldname,MED_NO_DT,MED_NO_IT,0.0, MED_CELL, _geotype,
232 _ipointname, &filter, (unsigned char*)_arrayvalues ) < 0) {
233 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_FIELD,_fieldname);
234 ISCRUTE(mpi_rank);
235 goto ERROR;
236 }
237
238 /* Test de lecture du même fichier avec filtre simple par un seul processeur */
239 /* TODO : Créer MEDflush */
240 H5Fflush(_fid, H5F_SCOPE_GLOBAL );
241
242 /*Le flush suffit pas besoin de synchroniser les processus : MPI_Barrier(MPI_COMM_WORLD); */
243 if (mpi_rank == 0 ) {
244 MESSAGE("Reading field...");
245
246
247 med_int _nentitiesarrayvalues=0;
248 med_float *_filteredarrayvalues=NULL;
249 med_filter filter2=MED_FILTER_INIT;
250 int _ind=0;
251 FILE * _asciifile;
252 char _asciifilename[255]="";
253
254
255 if ((_fidseq = MEDfileOpen(_filename, MED_ACC_RDONLY )) < 0){
256 MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_FILE,_filename);
257 goto ERROR;
258 }
259
260 sprintf(_asciifilename,"%s_CPU-%03d_@_%s_%s.ascii",fieldnameprefix,mpi_size,_MED_MODE_SWITCH_MSG[constituentmode],_MED_STORAGE_MODE_MSG[storagemode]);
261 _asciifile=fopen(_asciifilename, "w");
262
263 /*Génère un filtre de selection simple s'il n'a pas déjà été généré lors d'un précédent appel */
264 /*TODO : Déplacer cette appel dans le main après avoir externaliser la génération du profile */
265 if (!(cominfo->filterarray))
266 if ( generateFilterArray( nentities, nvaluesperentity, nconstituentpervalue,
267 profilearraysize, _profilearray,
268 &(cominfo->nentitiesfiltered), &(cominfo->filterarray) ) < 0 ) {
269 goto ERROR;
270 }
271
272 ISCRUTE(cominfo->nentitiesfiltered);
273 /*Stocke le filtre utilisé dans le fichier .ascii*/
274 for (_i=0; _i < cominfo->nentitiesfiltered; ++_i ) {
275 /* ISCRUTE(cominfo->filterarray[_i]); */
276 fprintf(_asciifile,"%d ",cominfo->filterarray[_i]) ;
277 }
278 fprintf(_asciifile,"\n") ;
279
280
281 /*Pas de profile possible (profilearraysize == 0) en MED_GLOBAL_STMODE sur un fichier géré en parallel */
282 if ( profilearraysize ) {
283 _nentitiesarrayvalues = profilearraysize;
284 } else {
285 _nentitiesarrayvalues = nentities;
286 }
287
288 /*Attention allocation mémoire potentiellement grosse car réalisée uniquement par le processus 0
289 qui rassemble les données.*/
290 /* C'est une taille maxi qui ne prend pas en compte le COMPACT+filter */
291 /* TODO : Ajuster la taille au storage_mode*/
292 _filteredarrayvalues = (med_float*) malloc(_nentitiesarrayvalues*
293 nvaluesperentity*
294 nconstituentpervalue*sizeof(med_float));
295
296 /* Permet de vérifier une erreur d'indiçage après la lecture */
297 for (_i=0;_i<_nentitiesarrayvalues*nvaluesperentity*nconstituentpervalue; ++_i)
298 _filteredarrayvalues[_i]=-_i;
299
300
301 /*Création d'un filtre de sélection simple, pour une lecture séquentielle par le processys 0*/
302 if ( MEDfilterEntityCr(_fidseq, nentities, nvaluesperentity, nconstituentpervalue,
303 MED_ALL_CONSTITUENT, constituentmode, storagemode, _profilename,
304 cominfo->nentitiesfiltered,cominfo->filterarray, &filter2) < 0 ) {
305 MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_FILTER,"");
306 goto ERROR;
307 }
308
309 if ( MEDfieldValueAdvancedRd(_fidseq,_fieldname,MED_NO_DT,MED_NO_IT, MED_CELL, _geotype,
310 &filter2, (unsigned char*)_filteredarrayvalues ) < 0) {
311 MED_ERR_(_ret,MED_ERR_READ,MED_ERR_FIELD,_fieldname);
312 ISCRUTE(mpi_rank);
313 goto ERROR;
314 }
315
316 /*AFFICHAGE TOUJOURS EN FULL INTERLACE QUELQUES SOIENT LES COMBINAISONS*/
317 /*TODO : Externaliser l'affichage*/
318 if ( storagemode == MED_GLOBAL_STMODE ) {
319 switch (constituentmode) {
320 case MED_FULL_INTERLACE:
321 for (_i=0; _i < cominfo->nentitiesfiltered; ++_i)
322 for (_j=0; _j < nvaluesperentity; ++_j)
323 for (_k=0; _k < nconstituentpervalue; ++_k) {
324 _ind = (cominfo->filterarray[_i]-1)*nvaluesperentity*nconstituentpervalue+ _j*nconstituentpervalue+_k;
325 /* fprintf(stdout,"%s%3d%s = %f\n","_filteredarrayvaluesFULLGLB[",_ind,"]",_filteredarrayvalues[_ind]) ; */
326 fprintf(_asciifile,"%f\n",_filteredarrayvalues[_ind]) ;
327 }
328 break;
329 case MED_NO_INTERLACE:
330 for (_j=0; _j < cominfo->nentitiesfiltered; ++_j)
331 for (_k=0; _k < nvaluesperentity; ++_k)
332 for (_i=0; _i < nconstituentpervalue; ++_i) {
333 _ind =_i*nentities*nvaluesperentity+ (cominfo->filterarray[_j]-1)*nvaluesperentity +_k;
334 /* fprintf(stdout,"%s%3d%s = %f\n","_filteredarrayvaluesNOGLB[",_ind,"]",_filteredarrayvalues[_ind]); */
335 fprintf(_asciifile,"%f\n",_filteredarrayvalues[_ind]);
336 }
337 break;
338 }
339 } else
340 switch (constituentmode) {
341 case MED_FULL_INTERLACE:
342 for (_i=0; _i < cominfo->nentitiesfiltered; ++_i )
343 for (_j=0; _j < nvaluesperentity; ++_j)
344 for (_k=0; _k < nconstituentpervalue; ++_k) {
345 _ind = _i*nvaluesperentity*nconstituentpervalue+_j*nconstituentpervalue+_k;
346 /* fprintf(stdout,"%s%3d%s = %f\n","_filteredarrayvaluesFULLCP[",_ind,"]",_filteredarrayvalues[_ind]) ; */
347 fprintf(_asciifile,"%f\n",_filteredarrayvalues[_ind]) ;
348 }
349 break;
350 case MED_NO_INTERLACE:
351 for (_j=0; _j < cominfo->nentitiesfiltered; ++_j)
352 for (_k=0; _k < nvaluesperentity; ++_k)
353 for (_i=0; _i < nconstituentpervalue; ++_i) {
354 _ind =_i*cominfo->nentitiesfiltered*nvaluesperentity+ _j*nvaluesperentity +_k;
355 /* _ind =_i*_nentitiesarrayvalues*nvaluesperentity+ (_filterarray[_j]-1)*nvaluesperentity +_k; */
356 /* fprintf(stdout,"%s%3d%s = %f\n","_filteredarrayvaluesNOCP[",_ind,"]",_filteredarrayvalues[_ind]); */
357 fprintf(_asciifile,"%f\n",_filteredarrayvalues[_ind]);
358 }
359 break;
360 }
361
362
363 free(_filteredarrayvalues);
364
365 fclose(_asciifile);
366
367 if ( MEDfilterClose(&filter2) < 0 ) {
368 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_FILTER,"");
369 goto ERROR;
370 }
371
372 } /*fin if (mpi_rank == 0) */
373
374 if ( MEDfilterClose(&filter) < 0 ) {
375 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_FILTER,"");
376 goto ERROR;
377 }
378
379
380 _ret=0;
381 ERROR:
382 if (_arrayvalues) free(_arrayvalues);
383 if (profilearraysize) free(_profilearray);
384
385 if ( MEDfileClose(_fid) < 0) {
386 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_FILE,""); _ret = -1;
387 }
388
389 if (mpi_rank == 0 ) {
390 if ( MEDfileClose(_fidseq) < 0) {
391 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_FILE,""); _ret = -1;
392 }
393 }
394
395 return _ret;
396 }
397
398
399
400 int main (int argc, char **argv)
401
402
403 {
404 med_err _ret=0;
405 COM_info _cominfo;
406 _cominfo.comm = MPI_COMM_WORLD;
407 _cominfo.info = MPI_INFO_NULL;
408 _cominfo.nentitiesfiltered=0;
409 _cominfo.filterarray =NULL;
410
411
412
413 MPI_Init(&argc, &argv);
414 MPI_Comm_size(MPI_COMM_WORLD, &(_cominfo.mpi_size));
415 MPI_Comm_rank(MPI_COMM_WORLD, &(_cominfo.mpi_rank));
416
417 med_size _nbblocksperproc = 0;
418 int _nentities = 0;
419 int _nvaluesperentity = 0;
420 int _nconstituentpervalue = 0;
421
422 if (_cominfo.mpi_rank == 0 ) {
423
424 struct tm *_tm ;
425 time_t _tt=time(0);
426 _tm = localtime(&_tt);
427
428 srandom((*_tm).tm_sec * (*_tm).tm_min );
429 _nbblocksperproc = 1 + (int) (_cominfo.mpi_size * (random() / (RAND_MAX + 1.0)));
430 _nentities = 1 + (int) (1000.0 * (random() / (RAND_MAX + 1.0)));
431 _nvaluesperentity = 1 + (int) (11.0 * (random() / (RAND_MAX + 1.0)));
432 _nconstituentpervalue = 1 + (int) (7.0 * (random() / (RAND_MAX + 1.0)));
433 /* _nbblocksperproc = 1 + (int) (mpi_size * (random() / (RAND_MAX + 1.0))); */
434 /* _nentities = 1 + (int) (5.0 * (random() / (RAND_MAX + 1.0))); */
435 /* _nvaluesperentity = 1 + (int) (3.0 * (random() / (RAND_MAX + 1.0))); */
436 /* _nconstituentpervalue = 1 + (int) (3.0 * (random() / (RAND_MAX + 1.0))); */
437 /* _nbblocksperproc = 2; */
438 /* _nentities = 4; */
439 /* _nvaluesperentity = 1; */
440 /* _nconstituentpervalue = 1; */
441
442 }
443
444 if ( (sizeof(med_size)%(sizeof(MPI_LONG)))==0 ) {
445
446 MPI_Bcast(&_nbblocksperproc , sizeof(med_size)/sizeof(MPI_LONG), MPI_LONG, 0, MPI_COMM_WORLD);
447 MPI_Bcast(&_nentities , sizeof(med_size)/sizeof(MPI_LONG), MPI_LONG, 0, MPI_COMM_WORLD);
448 MPI_Bcast(&_nvaluesperentity , sizeof(med_size)/sizeof(MPI_LONG), MPI_LONG, 0, MPI_COMM_WORLD);
449 MPI_Bcast(&_nconstituentpervalue , sizeof(med_size)/sizeof(MPI_LONG), MPI_LONG, 0, MPI_COMM_WORLD);
450 } else {
451 assert(sizeof(med_size) == (sizeof(MPI_LONG)));
452 }
453
454 char _fieldnameprefix[256] = "";
455
456 sprintf(_fieldnameprefix,"NENT-%03d_NVAL-%03d_NCST-%03d_NBL-%03llu",_nentities,_nvaluesperentity,
457 _nconstituentpervalue,_nbblocksperproc);
458
459 GenerateDataType generateDatas = 0;
460 med_switch_mode _switchmode = MED_UNDEF_INTERLACE;
461 med_storage_mode _storagemode = MED_UNDEF_STMODE;
462 /*Pour que les 4 fichiers générés soient identiques, on désactive l'utilisation des profils
463 qui n'est pas utilisable en mode GLOBAL+// */
464 med_int _profilearraysize=0;
465 /* med_int _profilearraysize=_nentities/2; */
466
467 for (_switchmode = MED_FULL_INTERLACE ; _switchmode <= MED_NO_INTERLACE; ++_switchmode) {
468
469 if ( _switchmode == MED_FULL_INTERLACE ) generateDatas = generateFullIDatas;
470 else generateDatas = generateNoIDatas;
471
472 for (_storagemode = MED_GLOBAL_STMODE ; _storagemode <= MED_COMPACT_STMODE; ++_storagemode) {
473
474 if ( (_storagemode == MED_GLOBAL_STMODE ) && (_profilearraysize) ) _profilearraysize=0;
475
476 if ( generateFieldFile( _nentities, _nvaluesperentity, _nconstituentpervalue,
477 _switchmode, getCyclicBlocksOfEntities, _nbblocksperproc, generateDatas,
478 _storagemode, _profilearraysize, _fieldnameprefix, & _cominfo) < 0 ) {
479 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_FIELD,_fieldnameprefix);
480 ISCRUTE(_cominfo.mpi_rank);
481 goto ERROR;
482 }
483
484 }
485 }
486
487
488 _ret = 0;
489 ERROR:
490
491 if ( _cominfo.filterarray = NULL ) free( _cominfo.filterarray );
492
493 /*pour arch. BLueGene : Sync entre GPFS et LSF : sleep(360) */
494
495 /* MPI_Finalize must be called AFTER MEDclose which may use MPI calls */
496 MPI_Finalize();
497
498 /* Catcher l'erreur en retour mpirun et .sh*/
499 return _ret;
500 }
501
502
503
504
generateFullIDatas
void generateFullIDatas(const int myrank, const int lastrank, const int sizeoftype, const med_storage_mode profilemode, const med_size profilesize, const med_int *const profilearray, const med_size start, const med_size stride, const med_size count, const med_size blocksize, const med_size lastblocksize, const int nentities, const int nvaluesperentity, const int nconstituentpervalue, med_float **valuesarray)
Definition: generateDatas.c:31
MED_ERR_CREATE
#define MED_ERR_CREATE
Definition: med_err.h:27
MEDfilterEntityCr
MEDC_EXPORT med_err MEDfilterEntityCr(const med_idt fid, const med_int nentity, const med_int nvaluesperentity, const med_int nconstituentpervalue, const med_int constituentselect, const med_switch_mode switchmode, const med_storage_mode storagemode, const char *const profilename, const med_int filterarraysize, const med_int *const filterarray, med_filter *const filter)
Definition: MEDfilterEntityCr.c:55
MED_CARTESIAN
Definition: med.h:258
MEDfieldCr
MEDC_EXPORT med_err MEDfieldCr(const med_idt fid, const char *const fieldname, const med_field_type fieldtype, const med_int ncomponent, const char *const componentname, const char *const componentunit, const char *const dtunit, const char *const meshname)
Cette fonction crée un champ dans un fichier.
Definition: MEDfieldCr.c:44
MED_FULL_INTERLACE
Definition: med.h:96
MED_SORT_DTIT
Definition: med.h:309
MED_ERR_FIELD
#define MED_ERR_FIELD
Definition: med_err.h:91
MEDfieldValueAdvancedWr
MEDC_EXPORT med_err MEDfieldValueAdvancedWr(const med_idt fid, const char *const fieldname, const med_int numdt, const med_int numit, const med_float dt, const med_entity_type entitype, const med_geometry_type geotype, const char *const localizationname, const med_filter *const filter, const unsigned char *const value)
Cette fonction permet d'écire les valeurs d'un champ définies sur des entités d'un maillage pour une ...
Definition: MEDfieldValueAdvancedWr.c:46
generateFieldFile
med_err generateFieldFile(const med_size nentities, const med_size nvaluesperentity, const med_size nconstituentpervalue, const med_switch_mode constituentmode, GetBlocksOfEntitiesType getBlockOfEntities, const med_int nbblocksperproc, GenerateDataType generateDatas, const med_storage_mode storagemode, const med_size profilearraysize, const char *const fieldnameprefix, COM_info *const cominfo)
Definition: filterBlockOfentities.c:95
med_filter
Filtre de sélection.
Definition: med.h:355
MED_FILTER_INIT
#define MED_FILTER_INIT
Definition: med.h:374
MED_ERR_LOCALIZATION
#define MED_ERR_LOCALIZATION
Definition: med_err.h:89
MEDmeshCr
MEDC_EXPORT med_err MEDmeshCr(const med_idt fid, const char *const meshname, const med_int spacedim, const med_int meshdim, const med_mesh_type meshtype, const char *const description, const char *const dtunit, const med_sorting_type sortingtype, const med_axis_type axistype, const char *const axisname, const char *const axisunit)
Cette routine permet de créer un maillage dans un fichier.
Definition: MEDmeshCr.c:45
MEDfileOpen
MEDC_EXPORT med_idt MEDfileOpen(const char *const filename, const med_access_mode accessmode)
Ouverture d'un fichier MED.
Definition: MEDfileOpen.c:42
med_geometry_type
int med_geometry_type
Definition: med.h:194
GenerateDataType
void(* GenerateDataType)(const int myrank, const int lastrank, const int sizeoftype, const med_storage_mode profilemode, const med_size profilesize, const med_int *const profilearray, const med_size start, const med_size stride, const med_size count, const med_size blocksize, const med_size lastblocksize, const int nentities, const int nvaluesperentity, const int nconstituentpervalue, med_float **valuesarray)
Definition: generateDatas.h:27
MED_SNAME_SIZE
#define MED_SNAME_SIZE
Definition: med.h:82
ISCRUTE_int
#define ISCRUTE_int(entier)
Definition: med_utils.h:314
med_size
hsize_t med_size
Definition: med.h:329
med_idt
hid_t med_idt
Definition: med.h:331
MED_ERR_
#define MED_ERR_(rt, r1, r2, r3)
Definition: med_utils.h:160
MEDfieldValueAdvancedRd
MEDC_EXPORT med_err MEDfieldValueAdvancedRd(const med_idt fid, const char *const fieldname, const med_int numdt, const med_int numit, const med_entity_type entitype, const med_geometry_type geotype, const med_filter *const filter, unsigned char *const value)
Cette fonction permet de lire les valeurs d'un champ définies sur des entités d'un maillage pour une ...
Definition: MEDfieldValueAdvancedRd.c:43
MED_ACC_RDONLY
Definition: med.h:120
MED_UNDEF_STMODE
Definition: med.h:108
generateNoIDatas
void generateNoIDatas(const int myrank, const int lastrank, const int sizeoftype, const med_storage_mode storagemode, const med_size profilearraysize, const med_int *const profilearray, const med_size start, const med_size stride, const med_size count, const med_size blocksize, const med_size lastblocksize, const int nentities, const int nvaluesperentity, const int nconstituentpervalue, med_float **valuesarray)
Definition: generateDatas.c:103
COM_info::filterarray
med_int * filterarray
Definition: filterBlockOfentities.c:90
med_err
herr_t med_err
Definition: med.h:332
MEDfilterBlockOfEntityCr
MEDC_EXPORT med_err MEDfilterBlockOfEntityCr(const med_idt fid, const med_int nentity, const med_int nvaluesperentity, const med_int nconstituentpervalue, const med_int constituentselect, const med_switch_mode switchmode, const med_storage_mode storagemode, const char *const profilename, const med_size start, const med_size stride, const med_size count, const med_size blocksize, const med_size lastblocksize, med_filter *const filter)
Crée un filtre en selectionnant par blocs les entités pour lesquelles on veut lire/écrire des valeurs...
Definition: MEDfilterBlockOfEntityCr.c:52
MED_NO_LOCALIZATION
#define MED_NO_LOCALIZATION
Definition: med.h:275
getBlocksOfEntitiesPartition.h
MED_ERR_CLOSE
#define MED_ERR_CLOSE
Definition: med_err.h:30
MED_ERR_OPEN
#define MED_ERR_OPEN
Definition: med_err.h:37
MED_CELL
Definition: med.h:143
COM_info::comm
MPI_Comm comm
Definition: filterBlockOfentities.c:86
MED_ERR_FILTER
#define MED_ERR_FILTER
Definition: med_err.h:93
MESSAGE
#define MESSAGE(chaine)
Definition: med_utils.h:324
med_int
int med_int
Definition: med.h:342
MED_NO_MESH_SUPPORT
#define MED_NO_MESH_SUPPORT
Definition: med.h:273
MED_ERR_FILE
#define MED_ERR_FILE
Definition: med_err.h:82
MED_ERR_WRITE
#define MED_ERR_WRITE
Definition: med_err.h:29
med.h
ISCRUTE
#define ISCRUTE(entier)
Definition: med_utils.h:313
med_float
double med_float
Definition: med.h:336
MED_ERR_READ
#define MED_ERR_READ
Definition: med_err.h:28
COM_info::mpi_rank
int mpi_rank
Definition: filterBlockOfentities.c:88
MED_NO_DT
#define MED_NO_DT
Definition: med.h:320
MEDparFileOpen
med_idt MEDparFileOpen(const char *const filename, const med_access_mode accessmode, const MPI_Comm comm, const MPI_Info info)
Ouverture d'un fichier MED pour une utilisation parallèle.
Definition: MEDparFileOpen.c:49
MEDfilterClose
MEDC_EXPORT med_err MEDfilterClose(med_filter *const filter)
Désalloue les ressources hdf détenues par un filtre.
Definition: MEDfilterClose.c:35
COM_info::info
MPI_Info info
Definition: filterBlockOfentities.c:85
generateFilterArray.h
MED_UNDEF_INTERLACE
Definition: med.h:100
generateFilterArray
med_err generateFilterArray(const med_size nentities, const med_size nvaluesperentity, const med_size nconstituentpervalue, const med_size profilearraysize, const med_int *const profilearray, med_int *const nentitiesfiltered, med_int **filterarray)
Definition: generateFilterArray.c:30
getCyclicBlocksOfEntities
void getCyclicBlocksOfEntities(const int myrank, const int nproc, const int nentities, med_size *const start, med_size *const stride, med_size *const io_count, med_size *blocksize, int *const lastusedrank, med_size *const lastblocksize)
Definition: getBlocksOfEntitiesPartition.c:79
MED_GLOBAL_STMODE
Definition: med.h:109
med_switch_mode
med_switch_mode
Definition: med.h:96
MEDprofileWr
MEDC_EXPORT med_err MEDprofileWr(const med_idt fid, const char *const profilename, const med_int profilesize, const med_int *const profilearray)
Cette routine permet d'écrire un profil dans un fichier MED.
Definition: MEDprofileWr.c:40
MED_NAME_SIZE
#define MED_NAME_SIZE
Definition: med.h:81
MED_UNSTRUCTURED_MESH
Definition: med.h:131
generateDatas.h
MEDfileClose
MEDC_EXPORT med_err MEDfileClose(med_idt fid)
Fermeture d'un fichier MED.
Definition: MEDfileClose.c:30
main
int main(int argc, char **argv)
Definition: filterBlockOfentities.c:400
med_config.h
MED_ALL_CONSTITUENT
#define MED_ALL_CONSTITUENT
Definition: med.h:299
MED_COMPACT_STMODE
Definition: med.h:110
MED_NO_PROFILE
#define MED_NO_PROFILE
Definition: med.h:281
MED_NO_INTERLACE
Definition: med.h:98
COM_info
Definition: filterBlockOfentities.c:84
COM_info::mpi_size
int mpi_size
Definition: filterBlockOfentities.c:87
GetBlocksOfEntitiesType
void(* GetBlocksOfEntitiesType)(const int myrank, const int nproc, const int nentities, med_size *const start, med_size *const stride, med_size *const count, med_size *blocksize, int *const lastusedrank, med_size *const lastblocksize)
Definition: getBlocksOfEntitiesPartition.h:28
MED_FLOAT64
Definition: med.h:166
MODE_ACCES
#define MODE_ACCES
Definition: filterBlockOfentities.c:59
MED_NO_IT
#define MED_NO_IT
Definition: med.h:321
med_storage_mode
med_storage_mode
Definition: med.h:108
COM_info::nentitiesfiltered
med_int nentitiesfiltered
Definition: filterBlockOfentities.c:89
MED_NO_INTERPOLATION
#define MED_NO_INTERPOLATION
Definition: med.h:277
MED_ERR_PROFILE
#define MED_ERR_PROFILE
Definition: med_err.h:94
MEDlocalizationWr
MEDC_EXPORT med_err MEDlocalizationWr(const med_idt fid, const char *const localizationname, const med_geometry_type geotype, const med_int spacedimension, const med_float *const elementcoordinate, const med_switch_mode switchmode, const med_int nipoint, const med_float *const ipointcoordinate, const med_float *const weight, const char *const geointerpname, const char *const ipointstructmeshname)
Cette routine permet l'écriture d'une localisation localizationname de points d'intégration dans/auto...
Definition: MEDlocalizationWr.c:49
med_utils.h
MED_TRIA6
#define MED_TRIA6
Definition: med.h:205
MED_ERR_MESH
#define MED_ERR_MESH
Definition: med_err.h:83