MEDfilterBlockOfEntityCr.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/>.
*/
#include <med.h>
#include <med_config.h>
#include <med_outils.h>
#include <hdf5.h>
#include <string.h>
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) {
med_int _profilearraysize=0,_maxentitynum=0;
med_err _ret=-1;
med_size _start=start-1;
NOFINALBLANK(profilename,ERROR);
if ( start == 0) {
MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,"");
ISCRUTE_size(start);
goto ERROR;
}
_maxentitynum=_start+(count-1)*(stride);
if ( strlen(profilename) ) {
_profilearraysize = MEDprofileSizeByName(fid,profilename);
if ( _maxentitynum > _profilearraysize ) {
MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,MED_ERR_GSIZE_MSG);ISCRUTE(_maxentitynum);
SSCRUTE(profilename);ISCRUTE(_profilearraysize);
ISCRUTE_size(start);ISCRUTE_size(stride);ISCRUTE_size(count);ISCRUTE_size(blocksize);
goto ERROR;
}
}
/* Verify constituentselect is between [0, nconstituentpervalue] ( 0 is MED_ALL_CONSTITUENT ) */
if ( constituentselect > nconstituentpervalue) {
MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,MED_ERR_VALUE_MSG);ISCRUTE(constituentselect);
ISCRUTE(nconstituentpervalue);
goto ERROR;
}
switch(switchmode) {
case MED_FULL_INTERLACE :
switch(storagemode) { /* switch Interlace */
case MED_GLOBAL_STMODE :
if ( _MEDfilterBlockOfEntityFullIGlobalCr(fid,nentity,nvaluesperentity,nconstituentpervalue,constituentselect,
storagemode,profilename,start,stride,count,blocksize,lastblocksize,filter) < 0 ) {
MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
MESSAGE("MED_FULL_INTERLACE, MED_GLOBAL_STMODE");
goto ERROR;
}
break;
case MED_COMPACT_STMODE :
if ( _MEDfilterBlockOfEntityFullICompactCr(fid,nentity,nvaluesperentity,nconstituentpervalue,constituentselect,
storagemode,profilename,start,stride,count,blocksize,lastblocksize,filter) < 0 ) {
MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
MESSAGE("MED_FULL_INTERLACE, MED_COMPACT_STMODE");
goto ERROR;
}
break;
default:
MED_ERR_(_ret,MED_ERR_INIT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
MESSAGE("MED_UNDEF_STMODE");
MESSAGE("MED_FULL_INTERLACE");
SSCRUTE(profilename);
ISCRUTE_int(storagemode);
ISCRUTE(_profilearraysize);
goto ERROR;
break;
}
break;
case MED_NO_INTERLACE :
switch(storagemode) {
case MED_GLOBAL_STMODE :
if ( _MEDfilterBlockOfEntityNoIGlobalCr(fid,nentity,nvaluesperentity,nconstituentpervalue,constituentselect,
storagemode,profilename,start,stride,count,blocksize,lastblocksize,filter) < 0 ) {
MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
MESSAGE("MED_NO_INTERLACE, MED_GLOBAL_STMODE");
goto ERROR;
}
break;
case MED_COMPACT_STMODE :
if ( _MEDfilterBlockOfEntityNoICompactCr(fid,nentity,nvaluesperentity,nconstituentpervalue,constituentselect,
storagemode,profilename,start,stride,count,blocksize,lastblocksize,filter) < 0 ) {
MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
MESSAGE("MED_NO_INTERLACE, MED_COMPACT_STMODE");
goto ERROR;
}
break;
default:
MED_ERR_(_ret,MED_ERR_INIT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
MESSAGE("MED_UNDEF_STMODE");
MESSAGE("MED_NO_INTERLACE");
SSCRUTE(profilename);
ISCRUTE_int(storagemode);
ISCRUTE(_profilearraysize);
goto ERROR;
break;
}
break;
default:
MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_INTERLACINGMODE,MED_ERR_VALUE_MSG);
ISCRUTE_int(switchmode);
goto ERROR;
}
_ret = 0;
ERROR:
/* if ( _memspace ) if ( (_ret = H5Sclose(_memspace)) < 0) { */
/* MESSAGE("Impossible de fermer le memspace : "); */
/* ISCRUTE(_memspace); _ret = -1; */
/* } */
return _ret;
}
MED_FULL_INTERLACE
Definition: med.h:96
med_filter
Filtre de sélection.
Definition: med.h:355
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
MED_ERR_MODE_MSG
#define MED_ERR_MODE_MSG
Definition: med_err.h:190
med_err
herr_t med_err
Definition: med.h:332
MEDfilterBlockOfEntityCr
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_ERR_VALUE_MSG
#define MED_ERR_VALUE_MSG
Definition: med_err.h:184
MED_ERR_FILTER
#define MED_ERR_FILTER
Definition: med_err.h:93
MESSAGE
#define MESSAGE(chaine)
Definition: med_utils.h:324
_MEDfilterBlockOfEntityFullIGlobalCr
MEDC_EXPORT med_err _MEDfilterBlockOfEntityFullIGlobalCr(const med_idt fid, const med_int nentity, const med_int nvaluesperentity, const med_int nconstituentpervalue, const med_int constituentselect, 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)
med_int
int med_int
Definition: med.h:342
med.h
ISCRUTE
#define ISCRUTE(entier)
Definition: med_utils.h:313
MED_ERR_INTERLACINGMODE
#define MED_ERR_INTERLACINGMODE
Definition: med_err.h:102
_MEDfilterBlockOfEntityNoICompactCr
MEDC_EXPORT med_err _MEDfilterBlockOfEntityNoICompactCr(const med_idt fid, const med_int nentity, const med_int nvaluesperentity, const med_int nconstituentpervalue, const med_int constituentselect, 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)
MEDprofileSizeByName
MEDC_EXPORT med_int MEDprofileSizeByName(const med_idt fid, const char *const profilename)
Cette routine permet de lire la taille d'un profil dont on connait le nom.
Definition: MEDprofileSizeByName.c:37
_MEDfilterBlockOfEntityFullICompactCr
MEDC_EXPORT med_err _MEDfilterBlockOfEntityFullICompactCr(const med_idt fid, const med_int nentity, const med_int nvaluesperentity, const med_int nconstituentpervalue, const med_int constituentselect, 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)
SSCRUTE
#define SSCRUTE(chaine)
Definition: med_utils.h:323
MED_GLOBAL_STMODE
Definition: med.h:109
med_switch_mode
med_switch_mode
Definition: med.h:96
med_outils.h
med_config.h
_MEDfilterBlockOfEntityNoIGlobalCr
MEDC_EXPORT med_err _MEDfilterBlockOfEntityNoIGlobalCr(const med_idt fid, const med_int nentity, const med_int nvaluesperentity, const med_int nconstituentpervalue, const med_int constituentselect, 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)
MED_COMPACT_STMODE
Definition: med.h:110
MED_NO_INTERLACE
Definition: med.h:98
ISCRUTE_size
#define ISCRUTE_size(entier)
Definition: med_utils.h:318
MED_ERR_RANGE
#define MED_ERR_RANGE
Definition: med_err.h:34
MED_ERR_GSIZE_MSG
#define MED_ERR_GSIZE_MSG
Definition: med_err.h:186
NOFINALBLANK
#define NOFINALBLANK(chaine, label)
Definition: med_utils.h:311
med_storage_mode
med_storage_mode
Definition: med.h:108
MED_ERR_INIT
#define MED_ERR_INIT
Definition: med_err.h:33
MED_ERR_SELECT
#define MED_ERR_SELECT
Definition: med_err.h:32