MEDfilterBlockOfEntityCr.c
Aller à la documentation de ce fichier.
/* This file is part of MED.
*
* COPYRIGHT (C) 1999 - 2020 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_switch_mode
med_switch_mode
Definition build.python3.12/include/med.h:96
MED_NO_INTERLACE
@ MED_NO_INTERLACE
Definition build.python3.12/include/med.h:98
MED_FULL_INTERLACE
@ MED_FULL_INTERLACE
Definition build.python3.12/include/med.h:96
med_storage_mode
med_storage_mode
Definition build.python3.12/include/med.h:108
MED_GLOBAL_STMODE
@ MED_GLOBAL_STMODE
Definition build.python3.12/include/med.h:109
MED_COMPACT_STMODE
@ MED_COMPACT_STMODE
Definition build.python3.12/include/med.h:110
med_int
int med_int
Definition build.python3.12/include/med.h:333
med_size
hsize_t med_size
Definition build.python3.12/include/med.h:320
med_err
herr_t med_err
Definition build.python3.12/include/med.h:323
med_idt
hid_t med_idt
Definition build.python3.12/include/med.h:322
MED_ERR_
#define MED_ERR_(rt, r1, r2, r3)
Definition build.python3.12/include/med_utils.h:160
SSCRUTE
#define SSCRUTE(chaine)
Definition build.python3.12/include/med_utils.h:323
MESSAGE
#define MESSAGE(chaine)
Definition build.python3.12/include/med_utils.h:324
ISCRUTE_size
#define ISCRUTE_size(entier)
Definition build.python3.12/include/med_utils.h:318
ISCRUTE
#define ISCRUTE(entier)
Definition build.python3.12/include/med_utils.h:313
NOFINALBLANK
#define NOFINALBLANK(chaine, label)
Definition build.python3.12/include/med_utils.h:311
ISCRUTE_int
#define ISCRUTE_int(entier)
Definition build.python3.12/include/med_utils.h:314
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
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
MED_ERR_SELECT
#define MED_ERR_SELECT
Definition med_err.h:32
MED_ERR_INIT
#define MED_ERR_INIT
Definition med_err.h:33
MED_ERR_FILTER
#define MED_ERR_FILTER
Definition med_err.h:93
MED_ERR_INTERLACINGMODE
#define MED_ERR_INTERLACINGMODE
Definition med_err.h:102
MED_ERR_GSIZE_MSG
#define MED_ERR_GSIZE_MSG
Definition med_err.h:186
MED_ERR_MODE_MSG
#define MED_ERR_MODE_MSG
Definition med_err.h:190
MED_ERR_VALUE_MSG
#define MED_ERR_VALUE_MSG
Definition med_err.h:184
MED_ERR_RANGE
#define MED_ERR_RANGE
Definition med_err.h:34
_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)
_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)
_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)
_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)
med_outils.h
med_filter
Filtre de sélection.
Definition build.python3.12/include/med.h:346