# MEDfilterBlockOfEntityCr.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
    00019 #include <med.h>
    00020 #include <med_config.h>
    00021 #include <med_outils.h>
    00022 #include <hdf5.h>
    00023 #include <string.h>
    00024
    00050 med_err MEDfilterBlockOfEntityCr(const med_idt          fid,
    00051                                  const med_int          nbofentity,
    00052                                  const med_int          nbofvaluesperentity,
    00053                                  const med_int          nbofconstituentpervalue,
    00054                                  const med_int          constituentselect,
    00055                                  const med_switch_mode  switchmode,
    00056                                  const med_storage_mode storagemode,
    00057                                  const char * const     profilename,
    00058                                  const med_size         start,
    00059                                  const med_size         stride,
    00060                                  const med_size         count,
    00061                                  const med_size         blocksize,
    00062                                  const med_size         lastblocksize,
    00063                                  med_filter*    const   filter) {
    00064
    00065
    00066   med_int    _profilearraysize=0,_maxentitynum=0;
    00067   med_err    _ret=-1;
    00068   med_size   _start=start-1;
    00069
    00070   /* TRUC BIZZARD AVEC LES ANCIENS PROFILS, A VERIFIER */
    00071   NOFINALBLANK(profilename,ERROR);
    00072
    00073   if ( start == 0) {
    00074     MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,"");
    00075     ISCRUTE_size(start);
    00076     goto ERROR;
    00077   }
    00078
    00079   _maxentitynum=_start+(count-1)*(stride);
    00080
    00081   if ( strlen(profilename) ) {
    00082     _profilearraysize = MEDprofileSizeByName(fid,profilename);
    00083     if ( _maxentitynum  > _profilearraysize  ) {
    00084       MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,MED_ERR_GSIZE_MSG);ISCRUTE(_maxentitynum);
    00085       SSCRUTE(profilename);ISCRUTE(_profilearraysize);
    00086       ISCRUTE_size(start);ISCRUTE_size(stride);ISCRUTE_size(count);ISCRUTE_size(blocksize);
    00087       goto ERROR;
    00088     }
    00089   }
    00090
    00091   /* Verify constituentselect is between [0, nbofconstituentpervalue] ( 0 is MED_ALL_CONSTITUENT ) */
    00092   if ( constituentselect > nbofconstituentpervalue) {
    00093     MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,MED_ERR_VALUE_MSG);ISCRUTE(constituentselect);
    00094     ISCRUTE(nbofconstituentpervalue);
    00095     goto ERROR;
    00096   }
    00097
    00098   switch(switchmode) {
    00099   case MED_FULL_INTERLACE :
    00100
    00101
    00102     switch(storagemode) {  /* switch Interlace */
    00103     case MED_GLOBAL_PFLMODE :
    00104
    00105       if ( _MEDfilterBlockOfEntityFullIGlobalCr(fid,nbofentity,nbofvaluesperentity,nbofconstituentpervalue,constituentselect,
    00106                                                 storagemode,profilename,start,stride,count,blocksize,lastblocksize,filter) < 0 ) {
    00107         MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
    00108         MESSAGE("MED_FULL_INTERLACE, MED_GLOBAL_PFLMODE");
    00109         goto ERROR;
    00110       }
    00111       break;
    00112     case MED_COMPACT_PFLMODE :
    00113       if ( _MEDfilterBlockOfEntityFullICompactCr(fid,nbofentity,nbofvaluesperentity,nbofconstituentpervalue,constituentselect,
    00114                                                  storagemode,profilename,start,stride,count,blocksize,lastblocksize,filter) < 0 ) {
    00115         MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
    00116         MESSAGE("MED_FULL_INTERLACE, MED_COMPACT_PFLMODE");
    00117         goto ERROR;
    00118       }
    00119       break;
    00120     default:
    00121       MED_ERR_(_ret,MED_ERR_INIT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
    00122       MESSAGE("MED_UNDEF_PFLMODE");
    00123       MESSAGE("MED_FULL_INTERLACE");
    00124       SSCRUTE(profilename);
    00125       ISCRUTE_int(storagemode);
    00126       ISCRUTE(_profilearraysize);
    00127       goto ERROR;
    00128       break;
    00129     }
    00130
    00131     break;
    00132   case MED_NO_INTERLACE :
    00133
    00134     switch(storagemode) {
    00135
    00136     case MED_GLOBAL_PFLMODE :
    00137
    00138       if ( _MEDfilterBlockOfEntityNoIGlobalCr(fid,nbofentity,nbofvaluesperentity,nbofconstituentpervalue,constituentselect,
    00139                                               storagemode,profilename,start,stride,count,blocksize,lastblocksize,filter) < 0 ) {
    00140         MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
    00141         MESSAGE("MED_NO_INTERLACE, MED_GLOBAL_PFLMODE");
    00142         goto ERROR;
    00143       }
    00144       break;
    00145
    00146     case MED_COMPACT_PFLMODE :
    00147       if ( _MEDfilterBlockOfEntityNoICompactCr(fid,nbofentity,nbofvaluesperentity,nbofconstituentpervalue,constituentselect,
    00148                                                storagemode,profilename,start,stride,count,blocksize,lastblocksize,filter) < 0 ) {
    00149         MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
    00150         MESSAGE("MED_NO_INTERLACE, MED_COMPACT_PFLMODE");
    00151         goto ERROR;
    00152       }
    00153       break;
    00154
    00155     default:
    00156       MED_ERR_(_ret,MED_ERR_INIT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
    00157       MESSAGE("MED_UNDEF_PFLMODE");
    00158       MESSAGE("MED_NO_INTERLACE");
    00159       SSCRUTE(profilename);
    00160       ISCRUTE_int(storagemode);
    00161       ISCRUTE(_profilearraysize);
    00162       goto ERROR;
    00163       break;
    00164     }
    00165
    00166     break;
    00167
    00168   default:
    00169     MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_INTERLACINGMODE,MED_ERR_VALUE_MSG);
    00170     ISCRUTE_int(switchmode);
    00171     goto ERROR;
    00172   }
    00173
    00174   _ret = 0;
    00175
    00176  ERROR:
    00177
    00178   /*   if ( _memspace ) if ( (_ret = H5Sclose(_memspace)) < 0) { */
    00179   /*     MESSAGE("Impossible de fermer le memspace : "); */
    00180   /*     ISCRUTE(_memspace);  _ret = -1; */
    00181   /*   } */
    00182
    00183   return _ret;
    00184 }