_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   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   int               _i = 0;
00048 
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 int) filterarray);
00055     goto ERROR;
00056   }
00057 
00058   if ( strlen(profilename) ) {
00059     if ( filterarraysize != 0 ) {
00060       MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_FILTER,"");
00061       SSCRUTE(profilename);ISCRUTE(filterarraysize);
00062       goto ERROR;
00063     } else {
00064       _profilearraysize = MEDprofileSizeByName(fid,profilename);
00065       if ( filterarraysize > _profilearraysize  ) {
00066         MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,MED_ERR_GSIZE_MSG);ISCRUTE(filterarraysize);
00067         SSCRUTE(profilename);ISCRUTE(_profilearraysize);
00068         goto ERROR;
00069       }
00070     }
00071   }
00072 
00073   /* Verify constituentselect is between [0, nbofconstituentpervalue] ( 0 is MED_ALL_CONSTITUENT ) */
00074   if ( constituentselect > nbofconstituentpervalue) {
00075     MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,MED_ERR_VALUE_MSG);ISCRUTE(constituentselect);
00076     ISCRUTE(nbofconstituentpervalue);
00077     goto ERROR;
00078   }
00079 
00080   /* Verify nbofvaluesperentity > 0 */
00081   if ( nbofvaluesperentity  < 1 ) {
00082     MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,MED_ERR_VALUE_MSG);
00083     ISCRUTE(nbofvaluesperentity);
00084     goto ERROR;
00085   }
00086 
00087   if (  _MEDsetFilter(0,
00088                       NULL,
00089                       NULL,
00090                       nbofentity,
00091                       nbofvaluesperentity,
00092                       nbofconstituentpervalue,
00093                       constituentselect,
00094                       switchmode,
00095                       filterarraysize,
00096                       _profilearraysize,
00097                       storagemode,
00098                       profilename,
00099                       filter) < 0 ) {
00100     MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDsetFilter");
00101     goto ERROR;
00102   }
00103 
00104   /*TODO : Typer filterarray en med_size*/
00105   if ( filterarray && ( filterarraysize > 0 ) ) {
00106     (*filter).filterarray23v30 = (med_size *) malloc (sizeof(med_size)*filterarraysize);
00107     for (_i=0;_i< filterarraysize;++_i)
00108       (*filter).filterarray23v30[_i] = (med_size) (filterarray[_i]);
00109   }
00110 
00111   _ret = 0;
00112 
00113  ERROR:
00114 
00115   /*   if ( _memspace ) if ( (_ret = H5Sclose(_memspace)) < 0) { */
00116   /*     MESSAGE("Impossible de fermer le memspace : "); */
00117   /*     ISCRUTE(_memspace);  _ret = -1; */
00118   /*   } */
00119 
00120   va_end(params);
00121   *fret = _ret;
00122 
00123   return;
00124 }

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