_MEDlinkRd30.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 _MEDlinkRd30(int dummy, ...)
00028 {
00029 
00030 
00031   med_idt        _lid=0, _root=0;
00032   med_err        _ret=-1;
00033   char           _path[MED_TAILLE_LIENS+MED_NAME_SIZE+1]=MED_LIENS;
00034   med_int        _n=0;
00035   med_filter     _filter        = MED_FILTER_INIT;
00036 
00037 
00038   MED_VARGS_DECL(const, med_idt      , , fid        );
00039   MED_VARGS_DECL(const, char* , const  , meshname   );
00040   MED_VARGS_DECL(, char*, const  , link             );
00041   MED_VARGS_DECL(, med_err *          ,, fret       );
00042 
00043   va_list params;
00044   va_start(params,dummy);
00045 
00046   MED_VARGS_DEF(const, med_idt      , , fid        );
00047   MED_VARGS_DEF(const, char* , const  , meshname   );
00048   MED_VARGS_DEF(, char*, const  , link             );
00049   MED_VARGS_DEF(, med_err *          ,, fret       );
00050 
00051   /*
00052    * On inhibe le gestionnaire d'erreur HDF 5
00053    */
00054   _MEDmodeErreurVerrouiller();
00055 
00056 
00057   /*
00058    * Ouverture du DataGroup /LIENS/
00059    */
00060   if ((_root = _MEDdatagroupOuvrir(fid,_path)) < 0) {
00061       MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_path);
00062       goto ERROR;
00063     }
00064 
00065   /*
00066    * Ouverture du /LIENS/<meshname>
00067    */
00068   if ((_lid = _MEDdatagroupOuvrir(_root,meshname)) < 0) {
00069     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,meshname);
00070     SSCRUTE(_path);goto ERROR;
00071   }
00072 
00073   strcat(_path,meshname);
00074 
00075 
00076   /*
00077    * On lit <n> sous forme d'attribut
00078    */
00079   if (_MEDattrEntierLire(_lid,MED_NOM_NBR,&_n) < 0) {
00080     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_LINK_MSG);
00081     SSCRUTE(_path);SSCRUTE(MED_NOM_NBR);ISCRUTE(_n);
00082     goto ERROR;
00083   }
00084 
00085   /*
00086    * On lit le link dans un dataset
00087    */
00088   if ( MEDfilterEntityCr(fid,_n, 1, 1, MED_ALL_CONSTITUENT,
00089                          MED_NO_INTERLACE,MED_UNDEF_PFLMODE,
00090                          MED_NO_PROFILE, MED_UNDEF_SIZE, NULL, &_filter) < 0 ) {
00091     MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_FILTER,MED_ERR_INTERNAL_MSG);
00092     goto ERROR;
00093   }
00094 
00095   if ( _MEDdatasetRd(_lid,MED_NOM_LIE,MED_INTERNAL_CHAR,&_filter,(unsigned char *) link) < 0) {
00096     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_DATASET,MED_NOM_LIE);SSCRUTE(_path);
00097     goto ERROR;
00098   }
00099 
00100   if ( MEDfilterClose(&_filter) < 0 ) {
00101     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_FILTER,MED_ERR_LINK_MSG); SSCRUTE(_path);
00102     goto ERROR;
00103   }
00104 
00105 
00106   _ret = 0;
00107 
00108  ERROR:
00109 
00110   if (_lid>0)            if (_MEDdatagroupFermer(_lid) < 0) {
00111     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,meshname);
00112     ISCRUTE_id(_lid);
00113   }
00114 
00115   if (_root>0)            if (_MEDdatagroupFermer(_root) < 0) {
00116     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,MED_LIENS);
00117     ISCRUTE_id(_root);
00118   }
00119 
00120 
00121   va_end(params);
00122   *fret = _ret;
00123   return;
00124 }

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