_MEDfilterEntityCr30.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 
00025 void _MEDfilterEntityCr30(int dummy, ...)
00026 {
00027 
00028   va_list params;
00029   va_start(params,dummy);
00030 
00031   const med_idt           fid                     = va_arg(params,const med_idt           );
00032   const med_int           nbofentity              = va_arg(params,const med_int           );
00033   const med_int           nbofvaluesperentity     = va_arg(params,const med_int           );
00034   const med_int           nbofconstituentpervalue = va_arg(params,const med_int           );
00035   const med_int           constituentselect       = va_arg(params,const med_int           );
00036   const med_switch_mode   switchmode              = va_arg(params,const med_switch_mode   );
00037   const med_storage_mode  storagemode             = va_arg(params,const med_storage_mode  );
00038   const char * const      profilename             = va_arg(params,const char * const      );
00039   const med_int           filterarraysize         = va_arg(params,const med_int           );
00040   const med_int *         filterarray             = va_arg(params,const med_int *         );
00041   med_filter* const       filter                  = va_arg(params,      med_filter* const );
00042   med_err *               fret                    = va_arg(params,      med_err *         );
00043 
00044   med_err    _ret=-1;
00045   med_int    _profilearraysize=0;
00046   med_storage_mode  _storagemode=storagemode;
00047 
00048   /* TRUC BIZZARD AVEC LES ANCIENS PROFILS, A VERIFIER */
00049   NOFINALBLANK(profilename,ERROR);
00050 
00051   if ( (filterarraysize <= 0) && (filterarray != NULL ) ) {
00052     MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,MED_ERR_ARRAY_MSG);
00053     ISCRUTE(filterarraysize);
00054     MESSAGE(MED_ERR_NULL_MSG);ISCRUTE_long((long)filterarray);
00055     goto ERROR;
00056   }
00057 
00058   if ( strlen(profilename) ) {
00059     _profilearraysize = MEDprofileSizeByName(fid,profilename);
00060     if ( filterarraysize > _profilearraysize  ) {
00061       MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,MED_ERR_GSIZE_MSG);ISCRUTE(filterarraysize);
00062       SSCRUTE(profilename);ISCRUTE(_profilearraysize);
00063       goto ERROR;
00064     }
00065   } else {
00066     /*Faux si un filterarray est présent !*/
00067 /*     _storagemode = MED_GLOBAL_PFLMODE; */
00068   }
00069 
00070   /* Verify constituentselect is between [0, nbofconstituentpervalue] ( 0 is MED_ALL_CONSTITUENT ) */
00071   if ( constituentselect > nbofconstituentpervalue) {
00072     MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,MED_ERR_VALUE_MSG);ISCRUTE(constituentselect);
00073     ISCRUTE(nbofconstituentpervalue);
00074     goto ERROR;
00075   }
00076 
00077   /* Verify nbofvaluesperentity > 0 */
00078   if ( nbofvaluesperentity  < 1 ) {
00079     MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,MED_ERR_VALUE_MSG);
00080     ISCRUTE(nbofvaluesperentity);
00081     goto ERROR;
00082   }
00083 
00084   switch(switchmode) {
00085   case MED_FULL_INTERLACE :
00086 
00087     if ( (!strlen(profilename)) && (filterarraysize == MED_NO_FILTER_SIZE)  ) {
00088 
00089       if ( _MEDselectAllEntitiesFullI(fid, nbofentity, nbofvaluesperentity, nbofconstituentpervalue,
00090                                  constituentselect, filter) < 0) {
00091         MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
00092         MESSAGE("MED_FULL_INTERLACE, MED_NO_PROFILE, MED_NO_FILTER");
00093         goto ERROR;
00094       }
00095 
00096     } else {
00097 
00098       switch(_storagemode) {
00099       case MED_GLOBAL_PFLMODE :
00100 
00101         if ( _MEDfilterEntityFullIGlobalCr(fid,nbofentity,nbofvaluesperentity,nbofconstituentpervalue,constituentselect,
00102                                            _storagemode,profilename,filterarraysize,filterarray,filter) < 0 ) {
00103           MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
00104           MESSAGE("MED_FULL_INTERLACE, MED_GLOBAL_PFLMODE");
00105           goto ERROR;
00106         }
00107         break;
00108       case MED_COMPACT_PFLMODE :
00109         if ( _MEDfilterEntityFullICompactCr(fid,nbofentity,nbofvaluesperentity,nbofconstituentpervalue,constituentselect,
00110                                             _storagemode,profilename,filterarraysize,filterarray,filter) < 0 ) {
00111           MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
00112           MESSAGE("MED_FULL_INTERLACE, MED_COMPACT_PFLMODE");
00113           goto ERROR;
00114         }
00115         break;
00116       default:
00117         MED_ERR_(_ret,MED_ERR_INIT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
00118         MESSAGE("MED_UNDEF_PFLMODE");
00119         MESSAGE("MED_FULL_INTERLACE");
00120         SSCRUTE(profilename);
00121         ISCRUTE_int(_storagemode);
00122         ISCRUTE(_profilearraysize);
00123         goto ERROR;
00124         break;
00125       }
00126     }
00127     break;
00128   case MED_NO_INTERLACE :
00129 
00130     if ( (!strlen(profilename)) && (filterarraysize == MED_NO_FILTER_SIZE)  ) {
00131 
00132       if ( _MEDselectAllEntitiesNoI(fid, nbofentity, nbofvaluesperentity, nbofconstituentpervalue,
00133                                       constituentselect, filter) < 0) {
00134         MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
00135         MESSAGE("MED_NO_INTERLACE, MED_NO_PROFILE, MED_NO_FILTER");
00136         goto ERROR;
00137       }
00138 
00139     } else {
00140 
00141       switch(_storagemode) {
00142 
00143       case MED_GLOBAL_PFLMODE :
00144 
00145         if ( _MEDfilterEntityNoIGlobalCr(fid,nbofentity,nbofvaluesperentity,nbofconstituentpervalue,constituentselect,
00146                                            _storagemode,profilename,filterarraysize,filterarray,filter) < 0 ) {
00147           MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
00148           MESSAGE("MED_NO_INTERLACE, MED_GLOBAL_PFLMODE");
00149           goto ERROR;
00150         }
00151         break;
00152 
00153       case MED_COMPACT_PFLMODE :
00154         if ( _MEDfilterEntityNoICompactCr(fid,nbofentity,nbofvaluesperentity,nbofconstituentpervalue,constituentselect,
00155                                             _storagemode,profilename,filterarraysize,filterarray,filter) < 0 ) {
00156           MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
00157           MESSAGE("MED_NO_INTERLACE, MED_COMPACT_PFLMODE");
00158           goto ERROR;
00159         }
00160         break;
00161 
00162       default:
00163         MED_ERR_(_ret,MED_ERR_INIT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
00164         MESSAGE("MED_UNDEF_PFLMODE");
00165         MESSAGE("MED_NO_INTERLACE");
00166         SSCRUTE(profilename);
00167         ISCRUTE_int(_storagemode);
00168         ISCRUTE(_profilearraysize);
00169         goto ERROR;
00170         break;
00171       }
00172 
00173     }
00174     break;
00175 
00176   default:
00177     MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_INTERLACINGMODE,MED_ERR_VALUE_MSG);
00178     ISCRUTE_int(switchmode);
00179     goto ERROR;
00180   }
00181 
00182   _ret = 0;
00183 
00184  ERROR:
00185 
00186   /*   if ( _memspace ) if ( (_ret = H5Sclose(_memspace)) < 0) { */
00187   /*     MESSAGE("Impossible de fermer le memspace : "); */
00188   /*     ISCRUTE(_memspace);  _ret = -1; */
00189   /*   } */
00190 
00191   va_end(params);
00192   *fret = _ret;
00193 
00194   return;
00195 }

Généré le Mon May 16 17:10:22 2011 pour MED fichier par  doxygen 1.6.1