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