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

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