# _MEDlocalizationInfoByName236.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 _MEDlocalizationInfoByName236(int dummy, ...) {
    00028
    00029
    00030   med_idt _lzid=0;
    00031   med_err _ret=-1;
    00032   char    _path[MED_TAILLE_GAUSS+MED_NAME_SIZE+1]=MED_GAUSS;
    00033   med_int _intgeotype = -1;
    00034
    00035
    00036   MED_VARGS_DECL(const, med_idt                   , , fid                 );
    00037   MED_VARGS_DECL(const, char        * , const       , localizationname    );
    00038   MED_VARGS_DECL(, med_geometry_type *, const , geotype                   );
    00039   MED_VARGS_DECL(, med_int           *, const , spacedimension            );
    00040   MED_VARGS_DECL(, med_int           *, const , nbofipoint                );
    00041   MED_VARGS_DECL(, char        *, const       , geointerpname             );
    00042   MED_VARGS_DECL(, char        *, const       , sectionmeshname           );
    00043   MED_VARGS_DECL(, med_int     *, const       , nsectionmeshcell          );
    00044   MED_VARGS_DECL(, med_geometry_type *, const , sectiongeotype            );
    00045   MED_VARGS_DECL(, med_err *                 ,, fret                      );
    00046
    00047   va_list params;
    00048   va_start(params,dummy);
    00049
    00050   MED_VARGS_DEF(const, med_idt                   , , fid                 );
    00051   MED_VARGS_DEF(const, char        * , const       , localizationname    );
    00052   MED_VARGS_DEF(, med_geometry_type *, const , geotype                   );
    00053   MED_VARGS_DEF(, med_int           *, const , spacedimension            );
    00054   MED_VARGS_DEF(, med_int           *, const , nbofipoint                );
    00055   MED_VARGS_DEF(, char        *, const       , geointerpname             );
    00056   MED_VARGS_DEF(, char        *, const       , sectionmeshname           );
    00057   MED_VARGS_DEF(, med_int     *, const       , nsectionmeshcell          );
    00058   MED_VARGS_DEF(, med_geometry_type *, const , sectiongeotype            );
    00059   MED_VARGS_DEF(, med_err *                 ,, fret                      );
    00060
    00061   /*
    00062    * On inhibe le gestionnaire d'erreur HDF 5
    00063    */
    00064   _MEDmodeErreurVerrouiller();
    00065
    00066
    00067   /*
    00068    * ouverture du groupe /GAUSS/"nom"
    00069    */
    00070   strcat(_path,localizationname);
    00071   if ((_lzid = _MEDdatagroupOuvrir(fid,_path)) < 0) {
    00072     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_LOCALIZATION_MSG);
    00073     SSCRUTE(_path);
    00074     goto ERROR;
    00075   }
    00076
    00077   /*
    00078    * Lecture de l'attribut MED_NOM_NBR
    00079    */
    00080   if (_MEDattrEntierLire(_lzid,MED_NOM_NBR,nbofipoint) < 0) {
    00081     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_LOCALIZATION_MSG);
    00082     SSCRUTE(_path);SSCRUTE(MED_NOM_NBR);ISCRUTE(*nbofipoint);
    00083     goto ERROR;
    00084   }
    00085
    00086
    00087   /*
    00088    * On lit <typgeo> sous forme d'attribut
    00089    */
    00090   /* sizeof(enum) tjrs = sizeof(int) en C, or
    00091      sur machines 64 bits par défaut med_int==long,
    00092      du coup sur  machines 64 bits _MEDattributeIntWr utilise
    00093      le type hdf NATIVE_LONG, ce qui pose un problème qd on passe
    00094      un enum.
    00095   */
    00096   if (_MEDattrEntierLire(_lzid,MED_NOM_GEO,&_intgeotype) < 0) {
    00097     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_LOCALIZATION_MSG);
    00098     SSCRUTE(localizationname);SSCRUTE(MED_NOM_GEO);ISCRUTE(_intgeotype);
    00099     goto ERROR;
    00100   };
    00101   *geotype = (med_geometry_type) _intgeotype;
    00102
    00103   *spacedimension = (_intgeotype/100);
    00104
    00105   sectionmeshname[0]='\0';
    00106   geointerpname[0]='\0';
    00107   *nsectionmeshcell=0;
    00108   *sectiongeotype=MED_UNDEF_GEOTYPE;
    00109
    00110   _ret = 0;
    00111  ERROR:
    00112
    00113   if ( _lzid > 0 ) if ( _MEDdatagroupFermer(_lzid) < 0) {
    00114     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,MED_GAUSS);
    00115     ISCRUTE_id(_lzid);
    00116   }
    00117
    00118   va_end(params);
    00119   *fret = _ret;
    00120   return;
    00121   }