# filterBlockOfentities.c

Aller à la documentation de ce fichier.

    00001 /*  This file is part of MED.
    00002  *
    00003  *  COPYRIGHT (C) 1999 - 2011  EDF R&D, CEA/DEN
    00004  *  MED is free software: you can redistribute it and/or modify
    00005  *  it under the terms of the GNU Lesser General Public License as published by
    00006  *  the Free Software Foundation, either version 3 of the License, or
    00007  *  (at your option) any later version.
    00008  *
    00009  *  MED is distributed in the hope that it will be useful,
    00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00012  *  GNU Lesser General Public License for more details.
    00013  *
    00014  *  You should have received a copy of the GNU Lesser General Public License
    00015  *  along with MED.  If not, see <http://www.gnu.org/licenses/>.
    00016  */
    00017
    00018 #define MAX(a,b) ((a) > (b) ? (a) : (b))
    00019
    00020 #define MED_HAVE_MPI
    00021
    00022 #include <med.h>
    00023 #define MESGERR 1
    00024 #include "med_utils.h"
    00025 #include "med_config.h"
    00026
    00027 #include <stdlib.h>
    00028 #include <string.h>
    00029 #include <assert.h>
    00030
    00031 #if TIME_WITH_SYS_TIME
    00032 # include <sys/time.h>
    00033 # include <time.h>
    00034 #else
    00035 # if HAVE_SYS_TIME_H
    00036 #  include <sys/time.h>
    00037 # else
    00038 #  include <time.h>
    00039 # endif
    00040 #endif
    00041
    00042 #ifndef HAVE_UNISTD_H
    00043 #error "unistd.h reuired."
    00044 #endif
    00045
    00046 #include "getBlocksOfEntitiesPartition.h"
    00047 #include "generateDatas.h"
    00048 #include "generateFilterArray.h"
    00049
    00050
    00051 #ifdef DEF_LECT_ECR
    00052 #define MODE_ACCES MED_ACC_RDWR
    00053 #elif DEF_LECT_AJOUT
    00054 #define MODE_ACCES MED_ACC_RDEXT
    00055 #else
    00056 #define MODE_ACCES MED_ACC_CREAT
    00057 #endif
    00058
    00059 /*Valeur de l'enum dans med.h.in*/
    00060 /* #define MED_NO_INTERLACE 2 */
    00061 /* #define MED_FULL_INTERLACE 1 */
    00062
    00063
    00064 /* #ifndef USER_INTERLACE */
    00065 /* #define USER_INTERLACE MED_FULL_INTERLACE */
    00066 /* #warning "Defining MED_FULL_INTERLACE mode..." */
    00067 /* #endif */
    00068
    00069 /* #if USER_INTERLACE == MED_NO_INTERLACE */
    00070 /* #define generateDatas generateNoIDatas */
    00071 /* #warning "Using generateNoIDatas..." */
    00072 /* #elif USER_INTERLACE == MED_FULL_INTERLACE */
    00073 /* #define generateDatas generateFullIDatas */
    00074 /* #warning "Using generateFullIDatas..." */
    00075 /* #else */
    00076 /* #error "The USER_INTERLACE macro value match neither MED_NO_INTERLACE nor MED_FULL_INTERLACE" */
    00077 /* #endif */
    00078
    00079 /* #define USER_MODE MED_COMPACT */
    00080
    00081
    00082 int main (int argc, char **argv)
    00083
    00084
    00085 {
    00086   med_err _ret=0;
    00087   med_idt _fid;
    00088
    00089   int mpi_size, mpi_rank;
    00090   MPI_Comm comm = MPI_COMM_WORLD;
    00091   MPI_Info info = MPI_INFO_NULL;
    00092
    00093   med_int    _nbofentitiesfiltered=0;
    00094   med_int    *_filterarray=NULL;
    00095
    00096
    00097   MPI_Init(&argc, &argv);
    00098   MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
    00099   MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
    00100
    00101
    00102   med_err generateFieldFile( const med_size nbofentities, const med_size nbofvaluesperentity, const med_size nbofconstituentpervalue,
    00103                              const med_switch_mode constituentmode,void (*getBlockOfEntities)(), const med_int nbblocksperproc, void (*generateDatas)(),
    00104                              const med_storage_mode storagemode, const med_size profilearraysize,  const char * const fieldnameprefix ) {
    00105
    00106 /*     static int   _fileno=0; */
    00107     med_err      _ret=-1;
    00108     char         _filename   [255]="";
    00109     char         _meshname[MED_NAME_SIZE+1]="Empty mesh";
    00110     med_int      _meshdim=3;
    00111     char         _meshcomponentname[3*MED_SNAME_SIZE+1] = "x               y               z               ";
    00112     char         _meshcomponentunit[3*MED_SNAME_SIZE+1] = "cm              cm              cm              ";
    00113     char         _fieldname  [MED_NAME_SIZE+1]="";
    00114     char         *componentname,*componentunit;
    00115     char         _profilename[MED_NAME_SIZE+1]=MED_NO_PROFILE;
    00116     med_int       *_profilearray=0;
    00117     int          _i=0,_j=0,_k=0, _lastusedrank=0;
    00118     med_size     _blocksize=0,_lastblocksize=0,_count=0,_stride=0,_start=0,_index=0;
    00119     med_float    *_arrayvalues;
    00120     med_filter   filter = MED_FILTER_INIT;
    00121     med_size     _nbofusedentities        = nbofentities;
    00122     med_size     _io_count                = nbblocksperproc;
    00123     med_idt      _fidseq;
    00124
    00125     /*TODO : EXTERNALISER CES DEFINITIONS ET GENERALISER LE PRINCIPE */
    00126     char         *_MED_MODE_SWITCH_MSG[3]={"MED_UNDEF_INTERLACE","MED_FULL_INTERLACE", "MED_NO_INTERLACE"};
    00127     char         *_MED_STORAGE_MODE_MSG[3]={"MED_NO_PFLMODE","MED_GLOBAL_PFLMODE", "MED_COMPACT_PFLMODE"};
    00128
    00129     med_geometry_type     _geotype       = MED_TRIA6;
    00130     med_int               _geodim        = _geotype/100;
    00131     med_int               _geonbofnodes  = _geotype%100;
    00132     char       _ipointname[MED_NAME_SIZE+1];
    00133     med_float* _ipointrefcoo = 0;
    00134     med_int    _ipoint       = nbofvaluesperentity;
    00135     med_float* _ipointcoo    = 0;
    00136     med_float* _ipointwg     = 0;
    00137
    00138     sprintf(_filename,"%s_CPU-%03d_@_%s_%s.med",fieldnameprefix,mpi_size,_MED_MODE_SWITCH_MSG[constituentmode],_MED_STORAGE_MODE_MSG[storagemode]);
    00139 /*     SSCRUTE(_filename); */
    00140     /* Ouverture du fichier en mode parallel */
    00141     if ((_fid = MEDparFileOpen(_filename, MODE_ACCES ,comm, info)) < 0){
    00142       MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_FILE,_filename);
    00143       goto ERROR;
    00144     }
    00145
    00146 /*     SSCRUTE(_meshname); */
    00147     if (MEDmeshCr( _fid,_meshname,_meshdim,_meshdim, MED_UNSTRUCTURED_MESH,
    00148                    "Un maillage pour le test parallel","s", MED_SORT_DTIT,
    00149                    MED_CARTESIAN, _meshcomponentname, _meshcomponentunit) < 0) {
    00150       MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_MESH,_meshname);
    00151       goto ERROR;
    00152     };
    00153
    00154     componentname = (char*) malloc((nbofconstituentpervalue*MED_SNAME_SIZE+1)*sizeof(char));
    00155     componentunit = (char*) malloc((nbofconstituentpervalue*MED_SNAME_SIZE+1)*sizeof(char));
    00156     /*TODO : Compléter le nom */
    00157     strcpy(componentname,"");
    00158     strcpy(componentunit,"");
    00159     strcpy(_fieldname,fieldnameprefix);
    00160     if ( MEDfieldCr(_fid,_fieldname,MED_FLOAT64,nbofconstituentpervalue,componentname,componentunit,"s",_meshname ) < 0) {
    00161       MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_FIELD,_fieldname);
    00162       goto ERROR;
    00163     };
    00164     free(componentname);
    00165     free(componentunit);
    00166
    00167
    00168     if ( _ipoint > 1 ) {
    00169
    00170       MESSAGE("Creating a localization of integration points...");
    00171       strcpy(_ipointname,_fieldname);
    00172       strcat(_ipointname,"_loc");
    00173
    00174       /*Attention ancienne spec*/
    00175       _ipointrefcoo = (med_float *) calloc(_geodim*_geonbofnodes,sizeof(med_float));
    00176       _ipointcoo    = (med_float *) calloc(_ipoint*_geodim,sizeof(med_float));
    00177       _ipointwg     = (med_float *) calloc(_ipoint,sizeof(med_float));
    00178
    00179       if (MEDlocalizationWr(_fid, _ipointname, _geotype, _geotype/100, _ipointrefcoo, constituentmode,
    00180                             _ipoint, _ipointcoo, _ipointwg, MED_NO_INTERPOLATION, MED_NO_MESH_SUPPORT ) < 0) {
    00181         MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_LOCALIZATION,_ipointname);
    00182         ISCRUTE_int(constituentmode);
    00183         goto ERROR;
    00184       }
    00185       free(_ipointrefcoo );
    00186       free(_ipointcoo    );
    00187       free(_ipointwg     );
    00188
    00189     } else {
    00190       strcpy(_ipointname,MED_NO_LOCALIZATION);
    00191     }
    00192
    00193     if (profilearraysize) {
    00194       MESSAGE("Creating a profile...");
    00195
    00196       strcpy(_profilename,_fieldname);strcat(_profilename,"_profile");
    00197
    00198       _profilearray = (med_int*) calloc(profilearraysize,sizeof(med_int));
    00199
    00200       for (_i=0; _i < profilearraysize; ++_i) _profilearray[_i]=_i;
    00201       if ( MEDprofileWr(_fid,_profilename,profilearraysize,_profilearray) < 0) {
    00202         MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_PROFILE,_profilename);
    00203         goto ERROR;
    00204       };
    00205       _nbofusedentities = profilearraysize;
    00206     } else {
    00207       strcpy(_profilename,MED_NO_PROFILE);
    00208     }
    00209
    00210
    00211     MESSAGE("Generating partition...");
    00212     getBlockOfEntities ( mpi_rank , mpi_size, _nbofusedentities,
    00213                          &_start, &_stride, &_io_count, &_blocksize,
    00214                          &_lastusedrank, &_lastblocksize);
    00215
    00216     _count=_io_count;
    00217     MESSAGE("Generating filter...");
    00218     if ( MEDfilterBlockOfEntityCr(_fid, nbofentities, nbofvaluesperentity, nbofconstituentpervalue,
    00219                                   MED_ALL_CONSTITUENT, constituentmode, storagemode, _profilename,
    00220                                   _start,_stride,_count,_blocksize,_lastblocksize,  &filter) < 0 ) {
    00221         MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_FILTER,"");
    00222         goto ERROR;
    00223     }
    00224
    00225     MESSAGE("Generating datas...");
    00226     generateDatas(mpi_rank, _lastusedrank, sizeof(med_float),
    00227                   storagemode, profilearraysize, _profilearray,
    00228                   _start, _stride, _count, _blocksize, _lastblocksize,
    00229                   nbofentities, nbofvaluesperentity, nbofconstituentpervalue,
    00230                   &_arrayvalues );
    00231
    00232     MESSAGE("Writing field...");
    00233     if ( MEDfieldValueAdvancedWr(_fid,_fieldname,MED_NO_DT,MED_NO_IT,0.0, MED_CELL, _geotype,
    00234                                  _ipointname, &filter, (unsigned char*)_arrayvalues ) < 0) {
    00235       MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_FIELD,_fieldname);
    00236       ISCRUTE(mpi_rank);
    00237       goto ERROR;
    00238     }
    00239
    00240     /* Test de lecture du même fichier avec filtre simple par un seul processeur */
    00241     /*TODO : Créer MEDflush */
    00242     H5Fflush(_fid, H5F_SCOPE_GLOBAL );
    00243
    00244     /*Le flush suffit pas besoin de synchroniser les processus : MPI_Barrier(MPI_COMM_WORLD); */
    00245     if (mpi_rank == 0 ) {
    00246       MESSAGE("Reading field...");
    00247
    00248
    00249       med_int    _nbofentitiesarrayvalues=0;
    00250       med_float  *_filteredarrayvalues=NULL;
    00251       med_filter filter2=MED_FILTER_INIT;
    00252       int        _ind=0;
    00253       FILE *     _asciifile;
    00254       char       _asciifilename[255]="";
    00255
    00256
    00257       if ((_fidseq = MEDfileOpen(_filename, MED_ACC_RDONLY )) < 0){
    00258         MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_FILE,_filename);
    00259         goto ERROR;
    00260       }
    00261
    00262       sprintf(_asciifilename,"%s_CPU-%03d_@_%s_%s.ascii",fieldnameprefix,mpi_size,_MED_MODE_SWITCH_MSG[constituentmode],_MED_STORAGE_MODE_MSG[storagemode]);
    00263       _asciifile=fopen(_asciifilename, "w");
    00264
    00265       /*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 */
    00266       /*TODO : Déplacer cette appel dans le main après avoir externaliser la génération du profile */
    00267       if (!_filterarray)
    00268         if ( generateFilterArray(  nbofentities,  nbofvaluesperentity, nbofconstituentpervalue,
    00269                                    profilearraysize, _profilearray,
    00270                                    &_nbofentitiesfiltered, &_filterarray ) < 0 ) {
    00271           goto ERROR;
    00272         }
    00273
    00274       ISCRUTE(_nbofentitiesfiltered);
    00275       /*Stocke le filtre utilisé dans le fichier .ascii*/
    00276       for (_i=0; _i < _nbofentitiesfiltered; ++_i ) {
    00277 /*      ISCRUTE(_filterarray[_i]); */
    00278         fprintf(_asciifile,"%d ",_filterarray[_i]) ;
    00279       }
    00280       fprintf(_asciifile,"\n") ;
    00281
    00282
    00283       /*Pas de profile possible (profilearraysize == 0) en MED_GLOBAL_PFLMODE sur un fichier géré en parallel */
    00284       if ( profilearraysize ) {
    00285         _nbofentitiesarrayvalues = profilearraysize;
    00286       } else {
    00287         _nbofentitiesarrayvalues = nbofentities;
    00288       }
    00289
    00290       _filteredarrayvalues = (med_float*) malloc(_nbofentitiesarrayvalues*
    00291                                                  nbofvaluesperentity*
    00292                                                  nbofconstituentpervalue*sizeof(med_float));
    00293
    00294       /* Permet de vérifier une erreur d'indiçage après la lecture */
    00295       for (_i=0;_i<_nbofentitiesarrayvalues*nbofvaluesperentity*nbofconstituentpervalue; ++_i)
    00296         _filteredarrayvalues[_i]=-_i;
    00297
    00298
    00299       /*Création d'un filtre de sélection simple, pour une lecture séquentielle par le processys 0*/
    00300       if ( MEDfilterEntityCr(_fidseq, nbofentities, nbofvaluesperentity, nbofconstituentpervalue,
    00301                              MED_ALL_CONSTITUENT, constituentmode, storagemode, _profilename,
    00302                              _nbofentitiesfiltered,_filterarray, &filter2) < 0 ) {
    00303         MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_FILTER,"");
    00304         goto ERROR;
    00305       }
    00306
    00307       if ( MEDfieldValueAdvancedRd(_fidseq,_fieldname,MED_NO_DT,MED_NO_IT, MED_CELL, _geotype,
    00308                                    &filter2, (unsigned char*)_filteredarrayvalues ) < 0) {
    00309         MED_ERR_(_ret,MED_ERR_READ,MED_ERR_FIELD,_fieldname);
    00310         ISCRUTE(mpi_rank);
    00311         goto ERROR;
    00312       }
    00313
    00314       /*AFFICHAGE TOUJOURS EN FULL INTERLACE QUELQUES SOIENT LES COMBINAISONS*/
    00315       /*TODO : Externaliser l'affichage*/
    00316       if ( storagemode == MED_GLOBAL_PFLMODE ) {
    00317         switch (constituentmode) {
    00318         case MED_FULL_INTERLACE:
    00319           for (_i=0; _i < _nbofentitiesfiltered; ++_i)
    00320             for (_j=0; _j < nbofvaluesperentity; ++_j)
    00321               for (_k=0; _k < nbofconstituentpervalue; ++_k) {
    00322                 _ind = (_filterarray[_i]-1)*nbofvaluesperentity*nbofconstituentpervalue+ _j*nbofconstituentpervalue+_k;
    00323 /*              fprintf(stdout,"%s%3d%s = %f\n","_filteredarrayvaluesFULLGLB[",_ind,"]",_filteredarrayvalues[_ind]) ; */
    00324                 fprintf(_asciifile,"%f\n",_filteredarrayvalues[_ind]) ;
    00325               }
    00326           break;
    00327         case MED_NO_INTERLACE:
    00328           for (_j=0; _j < _nbofentitiesfiltered; ++_j)
    00329             for (_k=0; _k < nbofvaluesperentity; ++_k)
    00330               for (_i=0; _i < nbofconstituentpervalue; ++_i) {
    00331                 _ind =_i*nbofentities*nbofvaluesperentity+ (_filterarray[_j]-1)*nbofvaluesperentity +_k;
    00332 /*              fprintf(stdout,"%s%3d%s = %f\n","_filteredarrayvaluesNOGLB[",_ind,"]",_filteredarrayvalues[_ind]); */
    00333                 fprintf(_asciifile,"%f\n",_filteredarrayvalues[_ind]);
    00334               }
    00335           break;
    00336         }
    00337       }  else
    00338         switch (constituentmode) {
    00339         case MED_FULL_INTERLACE:
    00340           for (_i=0; _i < _nbofentitiesfiltered; ++_i )
    00341             for (_j=0; _j < nbofvaluesperentity; ++_j)
    00342               for (_k=0; _k < nbofconstituentpervalue; ++_k) {
    00343                 _ind = (_filterarray[_i]-1)*nbofvaluesperentity*nbofconstituentpervalue+_j*nbofconstituentpervalue+_k;
    00344 /*              fprintf(stdout,"%s%3d%s = %f\n","_filteredarrayvaluesFULLCP[",_ind,"]",_filteredarrayvalues[_ind]) ; */
    00345                 fprintf(_asciifile,"%f\n",_filteredarrayvalues[_ind]) ;
    00346           }
    00347           break;
    00348         case MED_NO_INTERLACE:
    00349           for (_j=0; _j < _nbofentitiesfiltered; ++_j)
    00350             for (_k=0; _k < nbofvaluesperentity; ++_k)
    00351               for (_i=0; _i < nbofconstituentpervalue; ++_i) {
    00352                 _ind =_i*_nbofentitiesarrayvalues*nbofvaluesperentity+ (_filterarray[_j]-1)*nbofvaluesperentity +_k;
    00353 /*              fprintf(stdout,"%s%3d%s = %f\n","_filteredarrayvaluesNOCP[",_ind,"]",_filteredarrayvalues[_ind]); */
    00354                 fprintf(_asciifile,"%f\n",_filteredarrayvalues[_ind]);
    00355               }
    00356           break;
    00357         }
    00358
    00359
    00360       free(_filteredarrayvalues);
    00361
    00362       fclose(_asciifile);
    00363
    00364       if ( MEDfilterClose(&filter2) < 0 ) {
    00365         MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_FILTER,"");
    00366         goto ERROR;
    00367       }
    00368
    00369   }
    00370
    00371   if ( MEDfilterClose(&filter) < 0 ) {
    00372     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_FILTER,"");
    00373     goto ERROR;
    00374   }
    00375
    00376
    00377     _ret=0;
    00378   ERROR:
    00379     if (_arrayvalues)     free(_arrayvalues);
    00380     if (profilearraysize) free(_profilearray);
    00381
    00382     if (  MEDfileClose(_fid) < 0) {
    00383       MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_FILE,""); _ret = -1;
    00384     }
    00385
    00386     if (mpi_rank == 0 ) {
    00387       if (  MEDfileClose(_fidseq) < 0) {
    00388         MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_FILE,""); _ret = -1;
    00389       }
    00390     }
    00391
    00392     return _ret;
    00393   }
    00394
    00395
    00396
    00397
    00398   /* MAIN */
    00399   med_size            _nbblocksperproc    = 0;
    00400   int           _nbofentities             = 0;
    00401   int           _nbofvaluesperentity      = 0;
    00402   int           _nbofconstituentpervalue  = 0;
    00403
    00404   if (mpi_rank == 0 ) {
    00405
    00406     struct tm *_tm ;
    00407     time_t _tt=time(0);
    00408     _tm = localtime(&_tt);
    00409
    00410     srandom((*_tm).tm_sec * (*_tm).tm_min );
    00411     _nbblocksperproc         = 1 + (int) (mpi_size * (random() / (RAND_MAX + 1.0)));
    00412     _nbofentities            = 1 + (int) (1000.0 * (random() / (RAND_MAX + 1.0)));
    00413     _nbofvaluesperentity     = 1 + (int) (11.0 * (random() / (RAND_MAX + 1.0)));
    00414     _nbofconstituentpervalue = 1 + (int) (7.0 * (random() / (RAND_MAX + 1.0)));
    00415 /*     _nbblocksperproc         = 1 + (int) (mpi_size * (random() / (RAND_MAX + 1.0))); */
    00416 /*     _nbofentities            = 1 + (int) (5.0 * (random() / (RAND_MAX + 1.0))); */
    00417 /*     _nbofvaluesperentity     = 1 + (int) (3.0 * (random() / (RAND_MAX + 1.0))); */
    00418 /*     _nbofconstituentpervalue = 1 + (int) (3.0 * (random() / (RAND_MAX + 1.0))); */
    00419 /*     _nbblocksperproc         = 2; */
    00420 /*     _nbofentities            = 4; */
    00421 /*     _nbofvaluesperentity     = 1; */
    00422 /*     _nbofconstituentpervalue = 1; */
    00423
    00424   }
    00425
    00426   assert(sizeof(med_size) == (sizeof(MPI_LONG)));
    00427
    00428   MPI_Bcast(&_nbblocksperproc         , 1, MPI_LONG, 0, MPI_COMM_WORLD);
    00429   MPI_Bcast(&_nbofentities            , 1, MPI_LONG, 0, MPI_COMM_WORLD);
    00430   MPI_Bcast(&_nbofvaluesperentity     , 1, MPI_LONG, 0, MPI_COMM_WORLD);
    00431   MPI_Bcast(&_nbofconstituentpervalue , 1, MPI_LONG, 0, MPI_COMM_WORLD);
    00432
    00433   char                _fieldnameprefix[255] = "";
    00434
    00435   sprintf(_fieldnameprefix,"NENT-%03d_NVAL-%03d_NCST-%03d_NBL-%03llu",_nbofentities,_nbofvaluesperentity,
    00436           _nbofconstituentpervalue,_nbblocksperproc);
    00437
    00438   void (*generateDatas)() = 0;
    00439   med_switch_mode  _switchmode  = MED_UNDEF_INTERLACE;
    00440   med_storage_mode _storagemode = MED_UNDEF_PFLMODE;
    00441   med_int          _profilearraysize=0;
    00442 /*   med_int       _profilearraysize=_nbofentities/2; */
    00443
    00444   for (_switchmode = MED_FULL_INTERLACE ; _switchmode <= MED_NO_INTERLACE; ++_switchmode) {
    00445
    00446     if ( _switchmode == MED_FULL_INTERLACE ) generateDatas = generateFullIDatas;
    00447     else generateDatas = generateNoIDatas;
    00448
    00449     for (_storagemode = MED_GLOBAL_PFLMODE ; _storagemode <= MED_COMPACT_PFLMODE; ++_storagemode) {
    00450
    00451       if ( (_storagemode == MED_GLOBAL_PFLMODE ) && (_profilearraysize) ) _profilearraysize=0;
    00452
    00453       if ( generateFieldFile( _nbofentities,  _nbofvaluesperentity, _nbofconstituentpervalue,
    00454                               _switchmode, getCyclicBlocksOfEntities, _nbblocksperproc, generateDatas,
    00455                               _storagemode, _profilearraysize,  _fieldnameprefix ) < 0 ) {
    00456         MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_FIELD,_fieldnameprefix);
    00457         ISCRUTE(mpi_rank);
    00458         goto ERROR;
    00459       }
    00460
    00461     }
    00462   }
    00463
    00464
    00465   _ret = 0;
    00466  ERROR:
    00467
    00468   if (_filterarray) free(_filterarray);
    00469
    00470   /* MPI_Finalize must be called AFTER MEDclose which may use MPI calls */
    00471   MPI_Finalize();
    00472
    00473   return -1;
    00474   /* Catcher l'erreur en retour mpirun  et .sh*/
    00475   /*   return _ret; */
    00476 }
    00477
    00478
    00479
    00480