# _MEDequivalenceInfo30.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
    00023 #include <string.h>
    00024 #include <stdlib.h>
    00025
    00026 void
    00027 _MEDequivalenceInfo30(int dummy, ...)
    00028 {
    00029
    00030
    00031   med_idt  _eqid=0;
    00032   med_err  _ret=-1,_err=-1;
    00033   char     _path[MED_TAILLE_EQS+2*MED_NAME_SIZE+2]=MED_EQS;
    00034   char     _cstpname[2*MED_MAX_PARA+1]="";
    00035   int      _num;
    00036   int      _pathreflen=0;
    00037   med_size _nstep=0,_nocstpncorrespondence=0;
    00038
    00039
    00040   MED_VARGS_DECL(const, med_idt      , , fid                    );
    00041   MED_VARGS_DECL(const, char * , const , meshname               );
    00042   MED_VARGS_DECL(const, int          , , equivit                );
    00043   MED_VARGS_DECL(, char *, const       , equivname              );
    00044   MED_VARGS_DECL(, char *, const       , equivdescription       );
    00045   MED_VARGS_DECL(, med_int *, const    , nstep                  );
    00046   MED_VARGS_DECL(, med_int *, const    , nocstpncorrespondence  );
    00047   MED_VARGS_DECL(, med_err *                     ,, fret        );
    00048
    00049   va_list params;
    00050   va_start(params,dummy);
    00051
    00052   MED_VARGS_DEF(const, med_idt      , , fid                    );
    00053   MED_VARGS_DEF(const, char * , const , meshname               );
    00054   MED_VARGS_DEF(const, int          , , equivit                );
    00055   MED_VARGS_DEF(, char *, const       , equivname              );
    00056   MED_VARGS_DEF(, char *, const       , equivdescription       );
    00057   MED_VARGS_DEF(, med_int *, const    , nstep                  );
    00058   MED_VARGS_DEF(, med_int *, const    , nocstpncorrespondence  );
    00059   MED_VARGS_DEF(, med_err *                     ,, fret        );
    00060
    00061   _num=equivit-1;
    00062
    00063   /*
    00064    * On inhibe le gestionnaire d'erreur HDF 5
    00065    */
    00066   _MEDmodeErreurVerrouiller();
    00067
    00068   /*
    00069    * On recupere le nom de l'equivalence
    00070    */
    00071   strcat(_path,meshname);
    00072   _pathreflen=strlen(_path);
    00073   if ( _MEDobjectGetName(fid, _path ,_num, equivname) < 0 ) {
    00074     MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,_path);ISCRUTE_int(equivit);
    00075     goto ERROR;
    00076   }
    00077
    00078   _path[_pathreflen]='/';
    00079   strncpy(&_path[_pathreflen+1],equivname,MED_NAME_SIZE+1);
    00080   if ((_eqid = _MEDdatagroupOuvrir(fid,_path)) < 0) {
    00081     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_EQUIVALENCE_MSG);
    00082     SSCRUTE(_path);
    00083     goto ERROR;
    00084   }
    00085
    00086
    00087   /*
    00088    * L'attribut DES
    00089    */
    00090   if ( _MEDattrStringLire(_eqid,MED_NOM_DES,MED_COMMENT_SIZE,equivdescription) < 0) {
    00091       MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_EQUIVALENCE_MSG);
    00092       SSCRUTE(equivname);SSCRUTE(_path);SSCRUTE(MED_NOM_DES);
    00093       goto ERROR;
    00094   }
    00095
    00096   /*
    00097    * Nombre d'$(0!;(Btapes de calcul
    00098    */
    00099   if (_MEDnObjects(_eqid,".",&_nstep) <0) {
    00100     MED_ERR_(_ret,MED_ERR_COUNT,MED_ERR_DATAGROUP,_path);
    00101     goto ERROR;
    00102   }
    00103   *nstep = (med_int) _nstep;
    00104
    00105
    00106   /*
    00107    * Nombre de correspondence pour <MED_NO_DT,MED_NO_IT>
    00108    */
    00109
    00110   _MEDgetComputationStepName(MED_SORT_DTIT,MED_NO_DT,MED_NO_IT,_cstpname);
    00111
    00112
    00113   if ( (_err=_MEDnObjects(_eqid, _cstpname, &_nocstpncorrespondence)) < 0 )
    00114     if ( _err == (MED_ERR_COUNT + MED_ERR_DATAGROUP) ) {
    00115       MED_ERR_(_ret,MED_ERR_COUNT,MED_ERR_DATAGROUP,_cstpname);
    00116       goto ERROR;
    00117     }
    00118
    00119   *nocstpncorrespondence = (med_int) _nocstpncorrespondence;
    00120
    00121
    00122  _ret = 0;
    00123
    00124  ERROR:
    00125
    00126
    00127  if (_eqid>0)         if (_MEDdatagroupFermer(_eqid) < 0) {
    00128    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,&_path[_pathreflen]);
    00129    ISCRUTE_id(_eqid);
    00130  }
    00131
    00132   va_end(params);
    00133   *fret = _ret;
    00134
    00135   return;
    00136 }
    00137
    00138