_MEDfieldValueAdvancedRd236.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_config.h>
00020 #include <med.h>
00021 #include <med_outils.h>
00022 
00023 #include <string.h>
00024 #include <stdlib.h>
00025 
00026 #include <2.3.6/med23v30.h>
00027 #include <2.3.6/med23v30_proto.h>
00028 #include "2.3.6/med23v30_misc.h"
00029 
00030 
00031 void _MEDfieldValueAdvancedRd236(int dummy,...) {
00032   va_list params;
00033   va_start(params,dummy);
00034 
00035   const med_idt               fid              = va_arg(params, const  med_idt);
00036   const char * const          fieldname        = va_arg(params, const  char * const );
00037   const med_int               numdt            = va_arg(params, const  med_int);
00038   const med_int               numit            = va_arg(params, const  med_int);
00039   const med_entity_type       entitytype       = va_arg(params, const  med_entity_type);
00040   const med_geometry_type     geotype          = va_arg(params, const  med_geometry_type);
00041   const char * const          meshname         = va_arg(params, const  char * const );
00042   const med_storage_mode      storagemode      = va_arg(params, const  med_storage_mode);
00043   const char * const          profilename      = va_arg(params, const  char * const );
00044   const med_switch_mode       switchmode       = va_arg(params, const  med_switch_mode);
00045   const med_int               componentselect  = va_arg(params, const  med_int);
00046   const med_filter* const     filter           = va_arg(params, const  med_filter* const );
00047   unsigned char* const        value            = va_arg(params,        unsigned char * const );
00048   med_err *                   fret             = va_arg(params, med_err *);
00049 
00050   med_err               _ret=-1;
00051 /*   med_int               _nbofconstituentpervalue=0,_nbofvaluesperentityfromloc=0; */
00052 /*   med_int               _nbofvaluesperentity=0,_profilearraysize=0; */
00053   med_bool              _filterparameterexist=MED_FALSE;
00054 
00055   char _localizationname   [MED_NAME_SIZE+1]=""; /*TODO DEFAULT? */
00056   char _profilename        [MED_NAME_SIZE+1]=""; /*TODO DEFAULT? */
00057   char _geotypename[MED_TAILLE_NOM_ENTITE+1]="";
00058   char _pfltmp             [MED_NAME_SIZE+1]="";
00059   med_filter *               _filter           = NULL;
00060   med_filter                 _tmpfilter        = MED_FILTER_INIT;
00061   med_filter                 _paramfilter      = MED_FILTER_INIT;
00062 
00063   if (filter) {
00064     _filter=(med_filter*)(filter); _filterparameterexist=MED_TRUE;
00065   }
00066   else {
00067     _filter=&_tmpfilter;
00068 /*   (*_filter).nbofentity              = nbofentity; */
00069 /*   (*_filter).nbofvaluesperentity     = nbofvaluesperentity; */
00070 /*   (*_filter).nbofconstituentpervalue = nbofconstituentpervalue; */
00071     (*_filter).constituentselect       = componentselect;
00072     (*_filter).switchmode              = switchmode;
00073     (*_filter).storagemode             = storagemode;
00074     strcpy((*_filter).profilename,profilename);
00075 /*   (*_filter).profilearraysize        = profilearraysize; */
00076   }
00077 
00078 
00079   /*
00080    * On inhibe le gestionnaire d'erreur HDF 5
00081    */
00082   _MEDmodeErreurVerrouiller();
00083 
00084   /*
00085    * Il n'existe pas de possibilité de filtrage par n° d'entité sur les champs en 2.3.6
00086    */
00087   if (_filterparameterexist) 
00088     if ( (*_filter).filterarraysize ) {
00089       MED_ERR_(_ret,MED_ERR_NULL,MED_ERR_FILTER,MED_ERR_VALUE_MSG);
00090       ISCRUTE((*_filter).filterarraysize);
00091       goto ERROR;
00092     }
00093 
00094   NOFINALBLANK(profilename,ERROR);
00095 
00096   if ( strlen((*_filter).profilename) == 0 ) {  /* idem MED_NOPFL*/
00097 
00098     _profilename[0]='\0';
00099 /*     _profilearraysize = MED_UNDEF_SIZE; */
00100   } else {
00101     strncpy(_profilename,(*_filter).profilename,MED_NAME_SIZE+1);
00102     _profilename[MED_NAME_SIZE]='\0'; /*On tronque les eventuels noms trop long*/
00103 
00104     /* Le paramètre (*_filter).profilearraysize est positionné dans  _MEDfilterEntityCr236 */
00105     /* Il est donc inutile de vérifier sa valeur  */
00106   }
00107 
00108 
00109   /*Pour vérifier les paramètres nbofvaluesperentity et nbofconstituentpervalue, il faudrait 
00110    appeler _MEDfieldnValue236 mais qui effectue aussi un check */
00111 /*   if ( _nbofvaluesperentityfromloc != _nbofvaluesperentity ) { */
00112 /*     MED_ERR_(_ret,MED_ERR_NOTEQUAL,MED_ERR_ATTRIBUTE,MED_ERR_LOCALIZATION_MSG); */
00113 /*     SSCRUTE(_localizationname);SSCRUTE(MED_NOM_GEO);ISCRUTE(_nbofvaluesperentityfromloc); */
00114 /*     ISCRUTE(_nbofvaluesperentity);goto ERROR; */
00115 /*   } */
00116 
00117 /*   if (!_filterparameterexist) (*_filter).nbofvaluesperentity=_nbofvaluesperentity; */
00118 
00119 #ifdef _DEBUG_
00120     ISCRUTE((*_filter).nbofentity              );
00121     ISCRUTE((*_filter).nbofvaluesperentity     );
00122     ISCRUTE((*_filter).nbofconstituentpervalue );
00123     ISCRUTE((*_filter).constituentselect       );
00124     ISCRUTE_int((*_filter).switchmode              );
00125     ISCRUTE((*_filter).filterarraysize         );
00126     ISCRUTE((*_filter).profilearraysize        );
00127     ISCRUTE_int((*_filter).storagemode             );
00128     SSCRUTE((*_filter).profilename             );
00129 #endif
00130   /*
00131    * Lecture du champ
00132    */
00133 
00134     if ( MEDchampLire( fid, (char *) meshname, (char *) fieldname, (unsigned char *) value,
00135                        (*_filter).switchmode, (*_filter).constituentselect,
00136                        _localizationname, _pfltmp,
00137                        (*_filter).storagemode,
00138                        entitytype, geotype, numdt, numit) < 0 ) {
00139       MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDchampLire");
00140       SSCRUTE(fieldname);SSCRUTE(_profilename);
00141       goto ERROR;
00142     }
00143 
00144     if (strcmp(_profilename,_pfltmp)) {
00145       MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_PROFILE,MED_ERR_NAME_MSG);
00146       SSCRUTE(_profilename);SSCRUTE(_pfltmp);
00147       goto ERROR;
00148     }
00149 
00150     /*
00151      * On ferme tout
00152      */
00153 
00154     _ret = 0;
00155 
00156   ERROR:
00157 
00158 /*   if ( pfluse ) { free(pfltab); free(pfltabtmp);} */
00159     
00160   va_end(params);
00161   *fret = _ret;
00162   return;
00163   }
00164   
00165 
00166 
00167 

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