# _MEDequivalenceComputingStepInfo30.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 #include <string.h>
    00023 #include <stdlib.h>
    00024
    00025 void _MEDequivalenceComputingStepInfo30(int dummy, ...) {
    00026
    00027
    00028   med_err  _ret=-1,_err=-1;
    00029   med_idt  _eqid=0,_datagroup1=0;
    00030   int      _num;
    00031   char     _cstppath[MED_TAILLE_EQS+2*MED_NAME_SIZE+2+2*MED_MAX_PARA+1]=MED_EQS;
    00032   char     _cstpname[2*MED_MAX_PARA+1]="";
    00033   med_size _ncorrespondence=0;
    00034
    00035   MED_VARGS_DECL(const, med_idt      , , fid                    );
    00036   MED_VARGS_DECL(const, char * , const , meshname               );
    00037   MED_VARGS_DECL(const, char * , const , equivname              );
    00038   MED_VARGS_DECL(const, int          , , csit                   );
    00039   MED_VARGS_DECL(, med_int *, const    , numdt                  );
    00040   MED_VARGS_DECL(, med_int *, const    , numit                  );
    00041   MED_VARGS_DECL(, med_int *, const    , nocstpncorrespondence  );
    00042   MED_VARGS_DECL(, med_err *                  ,, fret          );
    00043
    00044   va_list params;
    00045   va_start(params,dummy);
    00046
    00047   MED_VARGS_DEF(const, med_idt      , , fid                    );
    00048   MED_VARGS_DEF(const, char * , const , meshname               );
    00049   MED_VARGS_DEF(const, char * , const , equivname              );
    00050   MED_VARGS_DEF(const, int          , , csit                   );
    00051   MED_VARGS_DEF(, med_int *, const    , numdt                  );
    00052   MED_VARGS_DEF(, med_int *, const    , numit                  );
    00053   MED_VARGS_DEF(, med_int *, const    , nocstpncorrespondence  );
    00054   MED_VARGS_DEF(, med_err *                  ,, fret          );
    00055
    00056   _num = csit -1;
    00057
    00058   /*
    00059    * On inhibe le gestionnaire d'erreur
    00060    */
    00061   _MEDmodeErreurVerrouiller();
    00062
    00063   strcat( _cstppath, meshname);
    00064   strcat( _cstppath, "/");
    00065   strcat( _cstppath, equivname);
    00066
    00067   if ((_eqid = _MEDdatagroupOuvrir(fid,_cstppath)) < 0) {
    00068     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_cstppath);
    00069     ISCRUTE_id(_eqid);goto ERROR;
    00070   }
    00071
    00072   strcat( _cstppath, "/");
    00073   /*
    00074    * On recupere le nom de l'~tape de calcul
    00075    */
    00076   if ( _MEDobjectGetName(fid, _cstppath ,_num, &_cstppath[strlen(_cstppath)]) < 0 ) {
    00077     MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,_cstppath);ISCRUTE_int(csit);
    00078     goto ERROR;
    00079   }
    00080
    00081   if ( (_datagroup1 = _MEDdatagroupOuvrir(fid,_cstppath)) < 0 ) {
    00082     MED_ERR_(_ret,MED_ERR_DOESNTEXIST,MED_ERR_COMPUTINGSTEP,_cstppath);
    00083     SSCRUTE(_cstppath);goto ERROR;
    00084   }
    00085
    00086   /*Cree ou ouvre l'attribut MED_NOM_NDT pour lecture */
    00087   if ( _MEDattrEntierLire(_datagroup1,MED_NOM_NDT,numdt) < 0 ) {
    00088     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_EQUIVALENCE_MSG);
    00089     SSCRUTE(equivname);SSCRUTE(_cstppath);SSCRUTE(MED_NOM_NDT);
    00090     ISCRUTE(*numdt);goto ERROR;
    00091   }
    00092
    00093
    00094   /*Cree ou ouvre l'attribut MED_NOM_PDT pour lecture */
    00095 /*   if ( _MEDattrFloatLire(_datagroup1,MED_NOM_PDT,dt) < 0) { */
    00096 /*     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); */
    00097 /*     SSCRUTE(equivname);SSCRUTE(_cstppath);SSCRUTE(MED_NOM_PDT); */
    00098 /*     RSCRUTE(*dt);goto ERROR; */
    00099 /*   } */
    00100
    00101   /*Cree ou ouvre l'attribut MED_NOM_NOR pour lecture */
    00102   if ( _MEDattrEntierLire(_datagroup1,MED_NOM_NOR,numit) < 0) {
    00103     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_EQUIVALENCE_MSG);
    00104     SSCRUTE(equivname);SSCRUTE(_cstppath);SSCRUTE(MED_NOM_NOR);
    00105     ISCRUTE(*numit); goto ERROR;
    00106   }
    00107
    00108   /*
    00109    * Nombre de tableau d'~quivalence
    00110    */
    00111   if ((_err=_MEDnObjects(_datagroup1,".",&_ncorrespondence)) <0)
    00112     if ( _err == (MED_ERR_COUNT + MED_ERR_DATAGROUP) ) {
    00113       MED_ERR_(_ret,MED_ERR_COUNT,MED_ERR_DATAGROUP,equivname);
    00114       goto ERROR;
    00115     }
    00116
    00117   *nocstpncorrespondence = (med_int) _ncorrespondence;
    00118
    00119   _ret = 0;
    00120  ERROR:
    00121
    00122   if (_datagroup1>0)     if (_MEDdatagroupFermer(_datagroup1) < 0) {
    00123     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_cstppath);
    00124     ISCRUTE_id(_datagroup1);
    00125   }
    00126
    00127   if (_eqid>0)     if (_MEDdatagroupFermer(_eqid) < 0) {
    00128     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,meshname);
    00129     ISCRUTE_id(_eqid);
    00130   }
    00131
    00132   va_end(params);
    00133   *fret = _ret;
    00134   return;
    00135 }