_MEDfilterEntityCr236.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 _MEDfilterEntityCr236(int dummy, ...)
00026 {
00027 
00028   med_err           _ret=-1;
00029   med_int           _profilearraysize=0;
00030   med_storage_mode  _storagemode;
00031   int               _i = 0;
00032 
00033   MED_VARGS_DECL(const, med_idt           , , fid                     );
00034   MED_VARGS_DECL(const, med_int           , , nbofentity              );
00035   MED_VARGS_DECL(const, med_int           , , nbofvaluesperentity     );
00036   MED_VARGS_DECL(const, med_int           , , nbofconstituentpervalue );
00037   MED_VARGS_DECL(const, med_int           , , constituentselect       );
00038   MED_VARGS_DECL(const, med_switch_mode   , , switchmode              );
00039   MED_VARGS_DECL(const, med_storage_mode  , , storagemode             );
00040   MED_VARGS_DECL(const, char * , const      , profilename             );
00041   MED_VARGS_DECL(const, med_int           , , filterarraysize         );
00042   MED_VARGS_DECL(const, med_int *         , , filterarray             );
00043   MED_VARGS_DECL(, med_filter*, const       , filter                  );
00044   MED_VARGS_DECL(, med_err *               ,, fret                    );
00045 
00046   va_list params;
00047   va_start(params,dummy);
00048 
00049   MED_VARGS_DEF(const, med_idt           , , fid                     );
00050   MED_VARGS_DEF(const, med_int           , , nbofentity              );
00051   MED_VARGS_DEF(const, med_int           , , nbofvaluesperentity     );
00052   MED_VARGS_DEF(const, med_int           , , nbofconstituentpervalue );
00053   MED_VARGS_DEF(const, med_int           , , constituentselect       );
00054   MED_VARGS_DEF(const, med_switch_mode   , , switchmode              );
00055   MED_VARGS_DEF(const, med_storage_mode  , , storagemode             );
00056   MED_VARGS_DEF(const, char * , const      , profilename             );
00057   MED_VARGS_DEF(const, med_int           , , filterarraysize         );
00058   MED_VARGS_DEF(const, med_int *         , , filterarray             );
00059   MED_VARGS_DEF(, med_filter*, const       , filter                  );
00060   MED_VARGS_DEF(, med_err *               ,, fret                    );
00061 
00062   _storagemode=storagemode;
00063 
00064   NOFINALBLANK(profilename,ERROR);
00065 
00066   if ( (filterarraysize <= 0) && (filterarray != NULL ) ) {
00067     MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,MED_ERR_ARRAY_MSG);
00068     ISCRUTE(filterarraysize);
00069     MESSAGE(MED_ERR_NULL_MSG);ISCRUTE_long((long int) filterarray);
00070     goto ERROR;
00071   }
00072 
00073   if ( strlen(profilename) ) {
00074     if ( filterarraysize != 0 ) {
00075       MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_FILTER,"");
00076       SSCRUTE(profilename);ISCRUTE(filterarraysize);
00077       goto ERROR;
00078     } else {
00079       _profilearraysize = MEDprofileSizeByName(fid,profilename);
00080       if ( filterarraysize > _profilearraysize  ) {
00081         MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,MED_ERR_GSIZE_MSG);ISCRUTE(filterarraysize);
00082         SSCRUTE(profilename);ISCRUTE(_profilearraysize);
00083         goto ERROR;
00084       }
00085     }
00086   }
00087 
00088   /* Verify constituentselect is between [0, nbofconstituentpervalue] ( 0 is MED_ALL_CONSTITUENT ) */
00089   if ( constituentselect > nbofconstituentpervalue) {
00090     MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,MED_ERR_VALUE_MSG);ISCRUTE(constituentselect);
00091     ISCRUTE(nbofconstituentpervalue);
00092     goto ERROR;
00093   }
00094 
00095   /* Verify nbofvaluesperentity > 0 */
00096   if ( nbofvaluesperentity  < 1 ) {
00097     MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,MED_ERR_VALUE_MSG);
00098     ISCRUTE(nbofvaluesperentity);
00099     goto ERROR;
00100   }
00101 
00102   if (  _MEDsetFilter(0,
00103                       NULL,
00104                       NULL,
00105                       nbofentity,
00106                       nbofvaluesperentity,
00107                       nbofconstituentpervalue,
00108                       constituentselect,
00109                       switchmode,
00110                       filterarraysize,
00111                       _profilearraysize,
00112                       storagemode,
00113                       profilename,
00114                       filter) < 0 ) {
00115     MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDsetFilter");
00116     goto ERROR;
00117   }
00118 
00119   /*TODO : Typer filterarray en med_size*/
00120   if ( filterarray && ( filterarraysize > 0 ) ) {
00121     (*filter).filterarray23v30 = (med_size *) malloc (sizeof(med_size)*filterarraysize);
00122     for (_i=0;_i< filterarraysize;++_i)
00123       (*filter).filterarray23v30[_i] = (med_size) (filterarray[_i]);
00124   }
00125 
00126   _ret = 0;
00127 
00128  ERROR:
00129 
00130   /*   if ( _memspace ) if ( (_ret = H5Sclose(_memspace)) < 0) { */
00131   /*     MESSAGE("Impossible de fermer le memspace : "); */
00132   /*     ISCRUTE(_memspace);  _ret = -1; */
00133   /*   } */
00134 
00135   va_end(params);
00136   *fret = _ret;
00137 
00138   return;
00139 }

Généré le Mon Nov 7 16:21:23 2011 pour MED fichier par  doxygen 1.6.1