_MEDparameterInfoByName30.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 #include <string.h>
00023 
00024 
00025 void _MEDparameterInfoByName30(int dummy, ...) {
00026 
00027   va_list params;
00028   va_start(params,dummy);
00029 
00030   const med_idt              fid         = va_arg(params,const med_idt               );
00031   const char   *       const paramname   = va_arg(params,const char   *       const  );
00032   med_parameter_type * const paramtype   = va_arg(params,med_parameter_type * const  );
00033   char *               const description = va_arg(params,char *               const  );
00034   char *               const dtunit      = va_arg(params,char *               const  );
00035   med_int *            const nstep       = va_arg(params,med_int *            const  );
00036   med_err *                  fret         = va_arg(params,med_err *);
00037 
00038   med_err _ret = -1, _err = -1;
00039   med_int _paramtype = 0;
00040   med_idt _paramidt = 0;
00041   char    _parampath[MED_TAILLE_NUM_DATA+MED_NAME_SIZE+1]=MED_NUM_DATA;
00042   med_size _nstep=0;
00043 
00044   _MEDmodeErreurVerrouiller();
00045 
00046   /* On accede aux donnees */
00047   strcat(_parampath, paramname);
00048   if ((_paramidt = _MEDdatagroupOuvrir(fid,_parampath)) < 0) {
00049     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_parampath);
00050     goto ERROR;
00051   }
00052 
00053   /* on lit les infos : type, description, dtunit, nstep */
00054   if ( _MEDattrEntierLire(_paramidt,MED_NOM_TYP,&_paramtype) < 0) {
00055     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_PARAM_MSG);
00056     SSCRUTE(paramname);SSCRUTE(MED_NOM_TYP);
00057     goto ERROR;
00058   }
00059   *paramtype = (med_parameter_type) (_paramtype);
00060 
00061   if (_MEDattrStringLire(_paramidt,MED_NOM_DES,MED_COMMENT_SIZE, description) < 0) {
00062     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_PARAM_MSG);
00063     SSCRUTE(paramname);SSCRUTE(MED_NOM_DES);SSCRUTE(description);goto ERROR;
00064   }
00065 
00066   if (_MEDattrStringLire(_paramidt,MED_NOM_UNT,MED_SNAME_SIZE, dtunit) < 0) {
00067     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
00068     SSCRUTE(paramname);SSCRUTE(MED_NOM_UNT);
00069     SSCRUTE(dtunit);goto ERROR;
00070   }
00071 
00072   if ((_err=_MEDnObjects(_paramidt,".",&_nstep)) <0)
00073     if ( _err == (MED_ERR_COUNT + MED_ERR_DATAGROUP) ) {
00074       MED_ERR_(_ret,MED_ERR_COUNT,MED_ERR_DATAGROUP,paramname);
00075       goto ERROR;
00076     }
00077   *nstep = (med_int) _nstep;
00078 
00079   _ret = 0;
00080  ERROR:
00081 
00082   if (_paramidt > 0)            if (_MEDdatagroupFermer(_paramidt) < 0) {
00083     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_parampath);
00084     ISCRUTE_id(_paramidt);
00085   }
00086 
00087   va_end(params);
00088   *fret = _ret;
00089   return;
00090 }

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