# _MEDequivalenceCorrespondenceSizeInfo30.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 _MEDequivalenceCorrespondenceSizeInfo30( int dummy, ...) {
    00026
    00027
    00028   med_err  _ret=-1;
    00029   med_idt  _eqid=0,_datagroup1=0,_dataset=0;
    00030   int      _num;
    00031   char     _path[MED_TAILLE_EQS+2*MED_NAME_SIZE+2+2*MED_MAX_PARA+1+2*MED_TAILLE_NOM_ENTITE+2]=MED_EQS;
    00032   char     _datagroupname1[2*MED_TAILLE_NOM_ENTITE+2]="";
    00033   char     _cstpname[2*MED_MAX_PARA+1]="";
    00034   med_size _nequivarray=0;
    00035   med_sorting_type  _sortingtype=0;
    00036   med_int   _intentitytype;
    00037   med_int   _intgeotype;
    00038
    00039
    00040   MED_VARGS_DECL(const, med_idt              , , fid      );
    00041   MED_VARGS_DECL(const, char * , const         , meshname );
    00042   MED_VARGS_DECL(const, char * , const         , equivname);
    00043   MED_VARGS_DECL(const, med_int              , , numdt    );
    00044   MED_VARGS_DECL(const, med_int              , , numit    );
    00045   MED_VARGS_DECL(const, int                  , , corit    );
    00046   MED_VARGS_DECL(, med_entity_type *, const    , entitype );
    00047   MED_VARGS_DECL(, med_geometry_type*, const   , geotype  );
    00048   MED_VARGS_DECL(, med_int *, const            , nentity  );
    00049   MED_VARGS_DECL(, med_err *                  ,, fret     );
    00050
    00051   va_list params;
    00052   va_start(params,dummy);
    00053
    00054   MED_VARGS_DEF(const, med_idt              , , fid      );
    00055   MED_VARGS_DEF(const, char * , const         , meshname );
    00056   MED_VARGS_DEF(const, char * , const         , equivname);
    00057   MED_VARGS_DEF(const, med_int              , , numdt    );
    00058   MED_VARGS_DEF(const, med_int              , , numit    );
    00059   MED_VARGS_DEF(const, int                  , , corit    );
    00060   MED_VARGS_DEF(, med_entity_type *, const    , entitype );
    00061   MED_VARGS_DEF(, med_geometry_type*, const   , geotype  );
    00062   MED_VARGS_DEF(, med_int *, const            , nentity  );
    00063   MED_VARGS_DEF(, med_err *                  ,, fret     );
    00064
    00065   _num = corit -1;
    00066
    00067   /*
    00068    * On inhibe le gestionnaire d'erreur
    00069    */
    00070
    00071   _MEDmodeErreurVerrouiller();
    00072
    00073
    00074   if ( MEDmeshSortingTypeRd(fid,meshname,&_sortingtype) < 0 ) {
    00075     MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API," MEDmeshSortingTypeRd");
    00076     SSCRUTE(meshname);ISCRUTE_int(_sortingtype);goto ERROR;
    00077   }
    00078
    00079
    00080   strcat( _path, meshname);
    00081   strcat( _path, "/");
    00082   strcat( _path, equivname);
    00083   strcat( _path, "/");
    00084   _MEDgetComputationStepName(_sortingtype,numdt,numit,&_path[strlen(_path)]);
    00085   strcat( _path, "/");
    00086
    00087   /*
    00088    * On recupere le nom de <entitype>[.<geotype>]
    00089    */
    00090   if ( _MEDobjectGetName(fid, _path ,_num, &_path[strlen(_path)]) < 0 ) {
    00091     MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,_path);ISCRUTE_int(corit);
    00092     goto ERROR;
    00093   }
    00094
    00095   if ( (_datagroup1 = _MEDdatagroupOuvrir(fid,_path)) < 0 ) {
    00096     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_path);
    00097     goto ERROR;
    00098   }
    00099
    00100   /*lecture typent et geotype */
    00101   if (_MEDattrEntierLire(_datagroup1,MED_NOM_ENT,&_intentitytype) < 0) {
    00102     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_ENT);
    00103     ISCRUTE(_intentitytype);goto ERROR;
    00104   }
    00105   *entitype = (med_entity_type) _intentitytype;
    00106
    00107   if (_MEDattrEntierLire(_datagroup1,MED_NOM_GEO,&_intgeotype) < 0) {
    00108     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_GEO);
    00109     ISCRUTE(_intgeotype);goto ERROR;
    00110   }
    00111   *geotype = (med_geometry_type) _intgeotype;
    00112
    00113   if ((_dataset = _MEDdatasetOuvrir(_datagroup1,MED_NOM_COR)) < 0) {
    00114     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATASET,MED_NOM_COR);
    00115     SSCRUTE(_path);
    00116     goto ERROR;
    00117   }
    00118
    00119   if ( _MEDattrEntierLire(_dataset,MED_NOM_NBR,nentity) < 0) {
    00120     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_EQUIVALENCE_MSG);
    00121     SSCRUTE(_path);SSCRUTE(MED_NOM_NBR);ISCRUTE(*nentity);
    00122     goto ERROR;
    00123   }
    00124
    00125   _ret = 0;
    00126  ERROR:
    00127
    00128   if (_dataset>0)     if (_MEDdatasetFermer(_dataset) < 0) {
    00129     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATASET,MED_NOM_COR);
    00130     ISCRUTE_id(_dataset);
    00131   }
    00132
    00133   if (_datagroup1>0)     if (_MEDdatagroupFermer(_datagroup1) < 0) {
    00134     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_path);
    00135     ISCRUTE_id(_datagroup1);
    00136   }
    00137
    00138
    00139   va_end(params);
    00140   *fret = _ret;
    00141
    00142   return;
    00143 }