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

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