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

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