filterBlockOfentities.c
Aller à la documentation de ce fichier.
/* This file is part of MED.
*
* COPYRIGHT (C) 1999 - 2021 EDF R&D, CEA/DEN
* MED is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MED is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MED. If not, see <http://www.gnu.org/licenses/>.
*/
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#include <med.h>
#define MESGERR 1
#include "med_utils.h"
#include "med_config.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#ifdef PPRO_NT_CALL
// Windows Header Files:
# include <windows.h>
# include <Lmcons.h>
# include <sys/timeb.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# endif
#include <time.h>
#ifndef HAVE_UNISTD_H
#error "unistd.h required."
#endif
#endif
#include "getBlocksOfEntitiesPartition.h"
#include "generateDatas.h"
#include "generateFilterArray.h"
#ifdef DEF_LECT_ECR
#define MODE_ACCES MED_ACC_RDWR
#elif DEF_LECT_AJOUT
#define MODE_ACCES MED_ACC_RDEXT
#else
#define MODE_ACCES MED_ACC_CREAT
#endif
/*Valeur de l'enum dans med.h.in*/
/* #define MED_NO_INTERLACE 2 */
/* #define MED_FULL_INTERLACE 1 */
/* #ifndef USER_INTERLACE */
/* #define USER_INTERLACE MED_FULL_INTERLACE */
/* #warning "Defining MED_FULL_INTERLACE mode..." */
/* #endif */
/* #if USER_INTERLACE == MED_NO_INTERLACE */
/* #define generateDatas generateNoIDatas */
/* #warning "Using generateNoIDatas..." */
/* #elif USER_INTERLACE == MED_FULL_INTERLACE */
/* #define generateDatas generateFullIDatas */
/* #warning "Using generateFullIDatas..." */
/* #else */
/* #error "The USER_INTERLACE macro value match neither MED_NO_INTERLACE nor MED_FULL_INTERLACE" */
/* #endif */
/* #define USER_MODE MED_COMPACT */
typedef struct {
MPI_Info info;
MPI_Comm comm;
int mpi_size;
int mpi_rank;
med_int nentitiesfiltered;
med_int *filterarray;
} COM_info;
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 ) {
/* static int _fileno=0; */
med_err _ret=-1;
char _filename [255]="";
char _meshname[MED_NAME_SIZE+1]="Empty mesh";
med_int _meshdim=3;
char _meshcomponentname[3*MED_SNAME_SIZE+1] = "x y z ";
char _meshcomponentunit[3*MED_SNAME_SIZE+1] = "cm cm cm ";
char _fieldname [MED_NAME_SIZE+1]="";
char *componentname,*componentunit;
char _profilename[MED_NAME_SIZE+1]=MED_NO_PROFILE;
med_int *_profilearray=0;
int _i=0,_j=0,_k=0, _lastusedrank=0;
med_size _blocksize=0,_lastblocksize=0,_count=0,_stride=0,_start=0,_index=0;
med_float *_arrayvalues;
med_filter filter = MED_FILTER_INIT;
med_size _nusedentities = nentities;
med_size _io_count = nbblocksperproc;
med_idt _fidseq,_fid;
MPI_Info info = cominfo->info;
MPI_Comm comm = cominfo->comm;
int mpi_size = cominfo->mpi_size;
int mpi_rank = cominfo->mpi_rank;
char *_MED_MODE_SWITCH_MSG[3]={"MED_FULL_INTERLACE", "MED_NO_INTERLACE","MED_UNDEF_INTERLACE",};
char *_MED_STORAGE_MODE_MSG[3]={"MED_NO_STMODE","MED_GLOBAL_STMODE", "MED_COMPACT_STMODE"};
med_geometry_type _geotype = MED_TRIA6;
med_int _geodim = _geotype/100;
med_int _geonnodes = _geotype%100;
char _ipointname[MED_NAME_SIZE+1];
med_float* _ipointrefcoo = 0;
med_int _ipoint = nvaluesperentity;
med_float* _ipointcoo = 0;
med_float* _ipointwg = 0;
sprintf(_filename,"%s_CPU-%03d_@_%s_%s.med",fieldnameprefix,mpi_size,_MED_MODE_SWITCH_MSG[constituentmode],_MED_STORAGE_MODE_MSG[storagemode]);
/* SSCRUTE(_filename); */
/* Ouverture du fichier en mode parallel */
if ((_fid = MEDparFileOpen(_filename, MODE_ACCES ,comm, info)) < 0){
MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_FILE,_filename);
goto ERROR;
}
/* SSCRUTE(_meshname); */
if (MEDmeshCr( _fid,_meshname,_meshdim,_meshdim, MED_UNSTRUCTURED_MESH,
"Un maillage pour le test parallel","s", MED_SORT_DTIT,
MED_CARTESIAN, _meshcomponentname, _meshcomponentunit) < 0) {
MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_MESH,_meshname);
goto ERROR;
};
componentname = (char*) malloc((nconstituentpervalue*MED_SNAME_SIZE+1)*sizeof(char));
componentunit = (char*) malloc((nconstituentpervalue*MED_SNAME_SIZE+1)*sizeof(char));
/*TODO : Compléter le nom */
strcpy(componentname,"");
strcpy(componentunit,"");
strcpy(_fieldname,fieldnameprefix);
if ( MEDfieldCr(_fid,_fieldname,MED_FLOAT64,nconstituentpervalue,componentname,componentunit,"s",_meshname ) < 0) {
MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_FIELD,_fieldname);
goto ERROR;
};
free(componentname);
free(componentunit);
if ( _ipoint > 1 ) {
MESSAGE("Creating a localization of integration points...");
strcpy(_ipointname,_fieldname);
strcat(_ipointname,"_loc");
/*Attention ancienne spec*/
_ipointrefcoo = (med_float *) calloc(_geodim*_geonnodes,sizeof(med_float));
_ipointcoo = (med_float *) calloc(_ipoint*_geodim,sizeof(med_float));
_ipointwg = (med_float *) calloc(_ipoint,sizeof(med_float));
if (MEDlocalizationWr(_fid, _ipointname, _geotype, _geotype/100, _ipointrefcoo, constituentmode,
_ipoint, _ipointcoo, _ipointwg, MED_NO_INTERPOLATION, MED_NO_MESH_SUPPORT ) < 0) {
MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_LOCALIZATION,_ipointname);
ISCRUTE_int(constituentmode);
goto ERROR;
}
free(_ipointrefcoo );
free(_ipointcoo );
free(_ipointwg );
} else {
strcpy(_ipointname,MED_NO_LOCALIZATION);
}
if (profilearraysize) {
MESSAGE("Creating a profile...");
strcpy(_profilename,_fieldname);strcat(_profilename,"_profile");
_profilearray = (med_int*) calloc(profilearraysize,sizeof(med_int));
for (_i=0; _i < profilearraysize; ++_i) _profilearray[_i]=_i;
if ( MEDprofileWr(_fid,_profilename,profilearraysize,_profilearray) < 0) {
MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_PROFILE,_profilename);
goto ERROR;
};
_nusedentities = profilearraysize;
} else {
strcpy(_profilename,MED_NO_PROFILE);
}
MESSAGE("Generating partition...");
getBlockOfEntities ( mpi_rank , mpi_size, _nusedentities,
&_start, &_stride, &_io_count, &_blocksize,
&_lastusedrank, &_lastblocksize);
_count=_io_count;
MESSAGE("Generating filter...");
if ( MEDfilterBlockOfEntityCr(_fid, nentities, nvaluesperentity, nconstituentpervalue,
MED_ALL_CONSTITUENT, constituentmode, storagemode, _profilename,
_start,_stride,_count,_blocksize,_lastblocksize, &filter) < 0 ) {
MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_FILTER,"");
goto ERROR;
}
MESSAGE("Generating datas...");
generateDatas(mpi_rank, _lastusedrank, sizeof(med_float),
storagemode, profilearraysize, _profilearray,
_start, _stride, _count, _blocksize, _lastblocksize,
nentities, nvaluesperentity, nconstituentpervalue,
&_arrayvalues );
MESSAGE("Writing field...");
if ( MEDfieldValueAdvancedWr(_fid,_fieldname,MED_NO_DT,MED_NO_IT,0.0, MED_CELL, _geotype,
_ipointname, &filter, (unsigned char*)_arrayvalues ) < 0) {
MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_FIELD,_fieldname);
ISCRUTE(mpi_rank);
goto ERROR;
}
/* Test de lecture du même fichier avec filtre simple par un seul processeur */
/* TODO : Créer MEDflush */
H5Fflush(_fid, H5F_SCOPE_GLOBAL );
/*Le flush suffit pas besoin de synchroniser les processus : MPI_Barrier(MPI_COMM_WORLD); */
if (mpi_rank == 0 ) {
MESSAGE("Reading field...");
med_int _nentitiesarrayvalues=0;
med_float *_filteredarrayvalues=NULL;
med_filter filter2=MED_FILTER_INIT;
int _ind=0;
FILE * _asciifile;
char _asciifilename[255]="";
if ((_fidseq = MEDfileOpen(_filename, MED_ACC_RDONLY )) < 0){
MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_FILE,_filename);
goto ERROR;
}
sprintf(_asciifilename,"%s_CPU-%03d_@_%s_%s.ascii",fieldnameprefix,mpi_size,_MED_MODE_SWITCH_MSG[constituentmode],_MED_STORAGE_MODE_MSG[storagemode]);
_asciifile=fopen(_asciifilename, "w");
/*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 */
/*TODO : Déplacer cette appel dans le main après avoir externaliser la génération du profile */
if (!(cominfo->filterarray))
if ( generateFilterArray( nentities, nvaluesperentity, nconstituentpervalue,
profilearraysize, _profilearray,
&(cominfo->nentitiesfiltered), &(cominfo->filterarray) ) < 0 ) {
goto ERROR;
}
ISCRUTE(cominfo->nentitiesfiltered);
/*Stocke le filtre utilisé dans le fichier .ascii*/
for (_i=0; _i < cominfo->nentitiesfiltered; ++_i ) {
/* ISCRUTE(cominfo->filterarray[_i]); */
fprintf(_asciifile,"%d ",cominfo->filterarray[_i]) ;
}
fprintf(_asciifile,"\n") ;
/*Pas de profile possible (profilearraysize == 0) en MED_GLOBAL_STMODE sur un fichier géré en parallel */
if ( profilearraysize ) {
_nentitiesarrayvalues = profilearraysize;
} else {
_nentitiesarrayvalues = nentities;
}
/*Attention allocation mémoire potentiellement grosse car réalisée uniquement par le processus 0
qui rassemble les données.*/
/* C'est une taille maxi qui ne prend pas en compte le COMPACT+filter */
/* TODO : Ajuster la taille au storage_mode*/
_filteredarrayvalues = (med_float*) malloc(_nentitiesarrayvalues*
nvaluesperentity*
nconstituentpervalue*sizeof(med_float));
/* Permet de vérifier une erreur d'indiçage après la lecture */
for (_i=0;_i<_nentitiesarrayvalues*nvaluesperentity*nconstituentpervalue; ++_i)
_filteredarrayvalues[_i]=-_i;
/*Création d'un filtre de sélection simple, pour une lecture séquentielle par le processys 0*/
if ( MEDfilterEntityCr(_fidseq, nentities, nvaluesperentity, nconstituentpervalue,
MED_ALL_CONSTITUENT, constituentmode, storagemode, _profilename,
cominfo->nentitiesfiltered,cominfo->filterarray, &filter2) < 0 ) {
MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_FILTER,"");
goto ERROR;
}
if ( MEDfieldValueAdvancedRd(_fidseq,_fieldname,MED_NO_DT,MED_NO_IT, MED_CELL, _geotype,
&filter2, (unsigned char*)_filteredarrayvalues ) < 0) {
MED_ERR_(_ret,MED_ERR_READ,MED_ERR_FIELD,_fieldname);
ISCRUTE(mpi_rank);
goto ERROR;
}
/*AFFICHAGE TOUJOURS EN FULL INTERLACE QUELQUES SOIENT LES COMBINAISONS*/
/*TODO : Externaliser l'affichage*/
if ( storagemode == MED_GLOBAL_STMODE ) {
switch (constituentmode) {
case MED_FULL_INTERLACE:
for (_i=0; _i < cominfo->nentitiesfiltered; ++_i)
for (_j=0; _j < nvaluesperentity; ++_j)
for (_k=0; _k < nconstituentpervalue; ++_k) {
_ind = (cominfo->filterarray[_i]-1)*nvaluesperentity*nconstituentpervalue+ _j*nconstituentpervalue+_k;
/* fprintf(stdout,"%s%3d%s = %f\n","_filteredarrayvaluesFULLGLB[",_ind,"]",_filteredarrayvalues[_ind]) ; */
fprintf(_asciifile,"%f\n",_filteredarrayvalues[_ind]) ;
}
break;
case MED_NO_INTERLACE:
for (_j=0; _j < cominfo->nentitiesfiltered; ++_j)
for (_k=0; _k < nvaluesperentity; ++_k)
for (_i=0; _i < nconstituentpervalue; ++_i) {
_ind =_i*nentities*nvaluesperentity+ (cominfo->filterarray[_j]-1)*nvaluesperentity +_k;
/* fprintf(stdout,"%s%3d%s = %f\n","_filteredarrayvaluesNOGLB[",_ind,"]",_filteredarrayvalues[_ind]); */
fprintf(_asciifile,"%f\n",_filteredarrayvalues[_ind]);
}
break;
}
} else
switch (constituentmode) {
case MED_FULL_INTERLACE:
for (_i=0; _i < cominfo->nentitiesfiltered; ++_i )
for (_j=0; _j < nvaluesperentity; ++_j)
for (_k=0; _k < nconstituentpervalue; ++_k) {
_ind = _i*nvaluesperentity*nconstituentpervalue+_j*nconstituentpervalue+_k;
/* fprintf(stdout,"%s%3d%s = %f\n","_filteredarrayvaluesFULLCP[",_ind,"]",_filteredarrayvalues[_ind]) ; */
fprintf(_asciifile,"%f\n",_filteredarrayvalues[_ind]) ;
}
break;
case MED_NO_INTERLACE:
for (_j=0; _j < cominfo->nentitiesfiltered; ++_j)
for (_k=0; _k < nvaluesperentity; ++_k)
for (_i=0; _i < nconstituentpervalue; ++_i) {
_ind =_i*cominfo->nentitiesfiltered*nvaluesperentity+ _j*nvaluesperentity +_k;
/* _ind =_i*_nentitiesarrayvalues*nvaluesperentity+ (_filterarray[_j]-1)*nvaluesperentity +_k; */
/* fprintf(stdout,"%s%3d%s = %f\n","_filteredarrayvaluesNOCP[",_ind,"]",_filteredarrayvalues[_ind]); */
fprintf(_asciifile,"%f\n",_filteredarrayvalues[_ind]);
}
break;
}
free(_filteredarrayvalues);
fclose(_asciifile);
if ( MEDfilterClose(&filter2) < 0 ) {
MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_FILTER,"");
goto ERROR;
}
} /*fin if (mpi_rank == 0) */
if ( MEDfilterClose(&filter) < 0 ) {
MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_FILTER,"");
goto ERROR;
}
_ret=0;
ERROR:
if (_arrayvalues) free(_arrayvalues);
if (profilearraysize) free(_profilearray);
if ( MEDfileClose(_fid) < 0) {
MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_FILE,""); _ret = -1;
}
if (mpi_rank == 0 ) {
if ( MEDfileClose(_fidseq) < 0) {
MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_FILE,""); _ret = -1;
}
}
return _ret;
}
int main (int argc, char **argv)
{
med_err _ret=0;
COM_info _cominfo;
_cominfo.comm = MPI_COMM_WORLD;
_cominfo.info = MPI_INFO_NULL;
_cominfo.nentitiesfiltered=0;
_cominfo.filterarray =NULL;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &(_cominfo.mpi_size));
MPI_Comm_rank(MPI_COMM_WORLD, &(_cominfo.mpi_rank));
med_size _nbblocksperproc = 0;
int _nentities = 0;
int _nvaluesperentity = 0;
int _nconstituentpervalue = 0;
if (_cominfo.mpi_rank == 0 ) {
struct tm *_tm ;
time_t _tt=time(0);
_tm = localtime(&_tt);
srandom((*_tm).tm_sec * (*_tm).tm_min );
_nbblocksperproc = 1 + (int) (_cominfo.mpi_size * (random() / (RAND_MAX + 1.0)));
_nentities = 1 + (int) (1000.0 * (random() / (RAND_MAX + 1.0)));
_nvaluesperentity = 1 + (int) (11.0 * (random() / (RAND_MAX + 1.0)));
_nconstituentpervalue = 1 + (int) (7.0 * (random() / (RAND_MAX + 1.0)));
/* _nbblocksperproc = 1 + (int) (mpi_size * (random() / (RAND_MAX + 1.0))); */
/* _nentities = 1 + (int) (5.0 * (random() / (RAND_MAX + 1.0))); */
/* _nvaluesperentity = 1 + (int) (3.0 * (random() / (RAND_MAX + 1.0))); */
/* _nconstituentpervalue = 1 + (int) (3.0 * (random() / (RAND_MAX + 1.0))); */
/* _nbblocksperproc = 2; */
/* _nentities = 4; */
/* _nvaluesperentity = 1; */
/* _nconstituentpervalue = 1; */
}
if ( (sizeof(med_size)%(sizeof(MPI_LONG)))==0 ) {
MPI_Bcast(&_nbblocksperproc , sizeof(med_size)/sizeof(MPI_LONG), MPI_LONG, 0, MPI_COMM_WORLD);
MPI_Bcast(&_nentities , sizeof(med_size)/sizeof(MPI_LONG), MPI_LONG, 0, MPI_COMM_WORLD);
MPI_Bcast(&_nvaluesperentity , sizeof(med_size)/sizeof(MPI_LONG), MPI_LONG, 0, MPI_COMM_WORLD);
MPI_Bcast(&_nconstituentpervalue , sizeof(med_size)/sizeof(MPI_LONG), MPI_LONG, 0, MPI_COMM_WORLD);
} else {
assert(sizeof(med_size) == (sizeof(MPI_LONG)));
}
char _fieldnameprefix[256] = "";
sprintf(_fieldnameprefix,"NENT-%03d_NVAL-%03d_NCST-%03d_NBL-%03llu",_nentities,_nvaluesperentity,
_nconstituentpervalue,_nbblocksperproc);
GenerateDataType generateDatas = 0;
med_switch_mode _switchmode = MED_UNDEF_INTERLACE;
med_storage_mode _storagemode = MED_UNDEF_STMODE;
/*Pour que les 4 fichiers générés soient identiques, on désactive l'utilisation des profils
qui n'est pas utilisable en mode GLOBAL+// */
med_int _profilearraysize=0;
/* med_int _profilearraysize=_nentities/2; */
for (_switchmode = MED_FULL_INTERLACE ; _switchmode <= MED_NO_INTERLACE; ++_switchmode) {
if ( _switchmode == MED_FULL_INTERLACE ) generateDatas = generateFullIDatas;
else generateDatas = generateNoIDatas;
for (_storagemode = MED_GLOBAL_STMODE ; _storagemode <= MED_COMPACT_STMODE; ++_storagemode) {
if ( (_storagemode == MED_GLOBAL_STMODE ) && (_profilearraysize) ) _profilearraysize=0;
if ( generateFieldFile( _nentities, _nvaluesperentity, _nconstituentpervalue,
_switchmode, getCyclicBlocksOfEntities, _nbblocksperproc, generateDatas,
_storagemode, _profilearraysize, _fieldnameprefix, & _cominfo) < 0 ) {
MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_FIELD,_fieldnameprefix);
ISCRUTE(_cominfo.mpi_rank);
goto ERROR;
}
}
}
_ret = 0;
ERROR:
if ( _cominfo.filterarray = NULL ) free( _cominfo.filterarray );
/*pour arch. BLueGene : Sync entre GPFS et LSF : sleep(360) */
/* MPI_Finalize must be called AFTER MEDclose which may use MPI calls */
MPI_Finalize();
/* Catcher l'erreur en retour mpirun et .sh*/
return _ret;
}
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