MEDfilterBlockOfEntityCr.c

Aller à la documentation de ce fichier.
00001 /*  This file is part of MED.
00002  *
00003  *  COPYRIGHT (C) 1999 - 2015  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          nentity,
00052                                  const med_int          nvaluesperentity,
00053                                  const med_int          nconstituentpervalue,
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   NOFINALBLANK(profilename,ERROR);
00071 
00072   if ( start == 0) {
00073     MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,"");
00074     ISCRUTE_size(start);
00075     goto ERROR;
00076   }
00077 
00078   _maxentitynum=_start+(count-1)*(stride);
00079 
00080   if ( strlen(profilename) ) {
00081     _profilearraysize = MEDprofileSizeByName(fid,profilename);
00082     if ( _maxentitynum  > _profilearraysize  ) {
00083       MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,MED_ERR_GSIZE_MSG);ISCRUTE(_maxentitynum);
00084       SSCRUTE(profilename);ISCRUTE(_profilearraysize);
00085       ISCRUTE_size(start);ISCRUTE_size(stride);ISCRUTE_size(count);ISCRUTE_size(blocksize);
00086       goto ERROR;
00087     }
00088   }
00089 
00090   /* Verify constituentselect is between [0, nconstituentpervalue] ( 0 is MED_ALL_CONSTITUENT ) */
00091   if ( constituentselect > nconstituentpervalue) {
00092     MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,MED_ERR_VALUE_MSG);ISCRUTE(constituentselect);
00093     ISCRUTE(nconstituentpervalue);
00094     goto ERROR;
00095   }
00096 
00097   switch(switchmode) {
00098   case MED_FULL_INTERLACE :
00099 
00100 
00101     switch(storagemode) {  /* switch Interlace */
00102     case MED_GLOBAL_PFLMODE :
00103 
00104       if ( _MEDfilterBlockOfEntityFullIGlobalCr(fid,nentity,nvaluesperentity,nconstituentpervalue,constituentselect,
00105                                                 storagemode,profilename,start,stride,count,blocksize,lastblocksize,filter) < 0 ) {
00106         MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
00107         MESSAGE("MED_FULL_INTERLACE, MED_GLOBAL_PFLMODE");
00108         goto ERROR;
00109       }
00110       break;
00111     case MED_COMPACT_PFLMODE :
00112       if ( _MEDfilterBlockOfEntityFullICompactCr(fid,nentity,nvaluesperentity,nconstituentpervalue,constituentselect,
00113                                                  storagemode,profilename,start,stride,count,blocksize,lastblocksize,filter) < 0 ) {
00114         MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
00115         MESSAGE("MED_FULL_INTERLACE, MED_COMPACT_PFLMODE");
00116         goto ERROR;
00117       }
00118       break;
00119     default:
00120       MED_ERR_(_ret,MED_ERR_INIT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
00121       MESSAGE("MED_UNDEF_PFLMODE");
00122       MESSAGE("MED_FULL_INTERLACE");
00123       SSCRUTE(profilename);
00124       ISCRUTE_int(storagemode);
00125       ISCRUTE(_profilearraysize);
00126       goto ERROR;
00127       break;
00128     }
00129 
00130     break;
00131   case MED_NO_INTERLACE :
00132 
00133     switch(storagemode) {
00134 
00135     case MED_GLOBAL_PFLMODE :
00136 
00137       if ( _MEDfilterBlockOfEntityNoIGlobalCr(fid,nentity,nvaluesperentity,nconstituentpervalue,constituentselect,
00138                                               storagemode,profilename,start,stride,count,blocksize,lastblocksize,filter) < 0 ) {
00139         MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
00140         MESSAGE("MED_NO_INTERLACE, MED_GLOBAL_PFLMODE");
00141         goto ERROR;
00142       }
00143       break;
00144 
00145     case MED_COMPACT_PFLMODE :
00146       if ( _MEDfilterBlockOfEntityNoICompactCr(fid,nentity,nvaluesperentity,nconstituentpervalue,constituentselect,
00147                                                storagemode,profilename,start,stride,count,blocksize,lastblocksize,filter) < 0 ) {
00148         MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
00149         MESSAGE("MED_NO_INTERLACE, MED_COMPACT_PFLMODE");
00150         goto ERROR;
00151       }
00152       break;
00153 
00154     default:
00155       MED_ERR_(_ret,MED_ERR_INIT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
00156       MESSAGE("MED_UNDEF_PFLMODE");
00157       MESSAGE("MED_NO_INTERLACE");
00158       SSCRUTE(profilename);
00159       ISCRUTE_int(storagemode);
00160       ISCRUTE(_profilearraysize);
00161       goto ERROR;
00162       break;
00163     }
00164 
00165     break;
00166 
00167   default:
00168     MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_INTERLACINGMODE,MED_ERR_VALUE_MSG);
00169     ISCRUTE_int(switchmode);
00170     goto ERROR;
00171   }
00172 
00173   _ret = 0;
00174 
00175  ERROR:
00176 
00177   /*   if ( _memspace ) if ( (_ret = H5Sclose(_memspace)) < 0) { */
00178   /*     MESSAGE("Impossible de fermer le memspace : "); */
00179   /*     ISCRUTE(_memspace);  _ret = -1; */
00180   /*   } */
00181 
00182   return _ret;
00183 }

Généré le Thu Oct 8 14:26:16 2015 pour MED fichier par  doxygen 1.6.1