_MEDprofileRd30.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 _MEDprofileRd30(int dummy, ...) {
00027 
00028 
00029 
00030   med_idt        _pfid=0;
00031   med_err        _ret=-1;
00032   char           _path[MED_TAILLE_PROFILS+MED_NAME_SIZE+1]=MED_PROFILS;
00033   med_filter     _filter        = MED_FILTER_INIT;
00034   med_int        _nentity=0;
00035 
00036 
00037   MED_VARGS_DECL(const, med_idt         , , fid          );
00038   MED_VARGS_DECL(const, char    * , const , profilename  );
00039   MED_VARGS_DECL(, med_int *, const , profilearray       );
00040   MED_VARGS_DECL(, med_err *       ,, fret               );
00041 
00042   va_list params;
00043   va_start(params,dummy);
00044 
00045   MED_VARGS_DEF(const, med_idt         , , fid          );
00046   MED_VARGS_DEF(const, char    * , const , profilename  );
00047   MED_VARGS_DEF(, med_int *, const , profilearray       );
00048   MED_VARGS_DEF(, med_err *       ,, fret               );
00049 
00050   /*
00051    * On inhibe le gestionnaire d'erreur HDF 5
00052    */
00053   _MEDmodeErreurVerrouiller();
00054 
00055   /*
00056    * ouverture du groupe /PROFILS/"nom"
00057    */
00058   strcat(_path,profilename);
00059 
00060   if ((_pfid = _MEDdatagroupOuvrir(fid,_path)) < 0) {
00061     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_PROFILS);
00062     SSCRUTE(_path); goto ERROR;
00063   }
00064 
00065   /*
00066    * Lecture de l'attribut MED_NOM_NBR
00067    */
00068   if (_MEDattrEntierLire(_pfid,MED_NOM_NBR,&_nentity) < 0) {
00069     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_PROFILE_MSG);
00070     SSCRUTE(_path);SSCRUTE(MED_NOM_NBR);ISCRUTE(_nentity);
00071     goto ERROR;
00072   }
00073 
00074 
00075   /*
00076    * Lecture du profil
00077    */
00078   if ( MEDfilterEntityCr(fid, _nentity, 1, 1, MED_ALL_CONSTITUENT,
00079                          MED_NO_INTERLACE,MED_UNDEF_PFLMODE,
00080                          MED_NO_PROFILE, MED_UNDEF_SIZE, NULL, &_filter) < 0 ) {
00081     MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_FILTER,MED_ERR_INTERNAL_MSG);
00082     goto ERROR;
00083   }
00084 
00085   if ( _MEDdatasetRd(_pfid,MED_NOM_PFL,MED_INTERNAL_INT,&_filter, (unsigned char * const ) profilearray) < 0) {
00086     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_DATASET,MED_NOM_PFL);SSCRUTE(_path);
00087     goto ERROR;
00088   }
00089 
00090   if ( MEDfilterClose(&_filter) < 0 ) {
00091     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_FILTER,MED_ERR_PROFILE_MSG); SSCRUTE(_path);
00092     goto ERROR;
00093   }
00094 
00095   _ret = 0;
00096  ERROR:
00097 
00098   if ( _pfid > 0 ) if ( _MEDdatagroupFermer(_pfid) < 0) {
00099     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,MED_PROFILS);
00100     ISCRUTE_id(_pfid);
00101   }
00102 
00103   va_end(params);
00104   *fret = _ret;
00105 
00106   return;
00107 }

Généré le Mon Nov 7 16:21:23 2011 pour MED fichier par  doxygen 1.6.1