# filterBlockOfentities.c

Aller à la documentation de ce fichier.

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