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