# MEDinterpInfoByName.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 #include <hdf5.h>
    00023 #include <string.h>
    00024
    00040 med_err
    00041 MEDinterpInfoByName(const med_idt                   fid,
    00042                     const char*               const interpname,
    00043                            med_geometry_type*       geotype,
    00044                            med_bool*          const cellnode,
    00045                            med_int*           const nbofbasisfunc,
    00046                            med_int*           const nbofvariable,
    00047                            med_int*           const maxdegree,
    00048                            med_int*           const nmaxcoef
    00049             )
    00050 {
    00051   med_idt           _interpid=0;
    00052   med_int           _err=-1;
    00053   med_err           _ret=-1;
    00054   char              _path[MED_TAILLE_INTERP+MED_NAME_SIZE+1]=MED_INTERP;
    00055   med_int           _cellnode = 0;
    00056   med_size          _tmpn=0;
    00057   med_int           _medintgeotype=MED_UNDEF_GEOTYPE;
    00058
    00059   /*
    00060    * On inhibe le gestionnaire d'erreur
    00061    */
    00062   _MEDmodeErreurVerrouiller();
    00063
    00064
    00065   NOFINALBLANK(interpname,ERROR);
    00066   strcat(_path,interpname);
    00067   /*
    00068    * Ouverture du  DataGroup /INTERP/<interpname>
    00069    */
    00070   if ((_interpid = _MEDdatagroupOpen(fid,_path)) < 0) {
    00071     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,interpname);
    00072     SSCRUTE(_path);goto ERROR;
    00073   }
    00074
    00075   /*
    00076    * Lecture de l'attribut MED_NOM_GEO
    00077    */
    00078   if ( _MEDattrEntierLire(_interpid,MED_NOM_GEO,&_medintgeotype) < 0 ) {
    00079     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,_path);
    00080     SSCRUTE(MED_NOM_GEO);ISCRUTE(_medintgeotype);
    00081     goto ERROR;
    00082   }
    00083   *geotype=(med_geometry_type) _medintgeotype;
    00084
    00085   /*
    00086    * Lecture de l'attribut MED_NOM_NBV
    00087    */
    00088   if ( _MEDattrEntierLire(_interpid,MED_NOM_NBV,nbofvariable) < 0 ) {
    00089     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,_path);
    00090     SSCRUTE(MED_NOM_NBV);ISCRUTE(*nbofvariable);
    00091     goto ERROR;
    00092   }
    00093
    00094   /*
    00095    * Lecture de l'attribut MED_NOM_MDG
    00096    */
    00097   if ( _MEDattrEntierLire(_interpid,MED_NOM_MDG,maxdegree) < 0 ) {
    00098     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,_path);
    00099     SSCRUTE(MED_NOM_MDG);ISCRUTE(*maxdegree);
    00100     goto ERROR;
    00101   }
    00102
    00103   /*
    00104    * Lecture de l'attribut MED_NOM_MCF
    00105    */
    00106   if ( _MEDattrEntierLire(_interpid,MED_NOM_MCF,nmaxcoef) < 0 ) {
    00107     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,_path);
    00108     SSCRUTE(MED_NOM_MCF);ISCRUTE(*nmaxcoef);
    00109     goto ERROR;
    00110   }
    00111
    00112   /*
    00113    * Lecture de l'attribut MED_NOM_FCN
    00114    */
    00115   if ( _MEDattrEntierLire(_interpid,MED_NOM_FCN,&_cellnode) < 0 ) {
    00116     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,_path);
    00117     SSCRUTE(MED_NOM_FCN);ISCRUTE(_cellnode);
    00118     goto ERROR;
    00119   }
    00120   if (_cellnode) *cellnode=MED_TRUE; else *cellnode=MED_FALSE;
    00121
    00122   /*
    00123    * Lecture de l'attribut MED_NOM_NBB
    00124    */
    00125 /*   if ( _MEDattrEntierLire(_interpid,MED_NOM_NBB,nbofbasisfunc) < 0 ) { */
    00126 /*     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,_path); */
    00127 /*     SSCRUTE(MED_NOM_NBB);ISCRUTE(*nbofbasisfunc); */
    00128 /*     goto ERROR; */
    00129 /*   } */
    00130
    00131   /*
    00132    *  Lecture du nombre de fonctions de base
    00133    */
    00134   if ((_err=_MEDnObjects(fid,_path,&_tmpn)) <0)
    00135     if ( _err == (MED_ERR_COUNT + MED_ERR_DATAGROUP) ) {
    00136       MED_ERR_(_ret,MED_ERR_COUNT,MED_ERR_INTERP,_path);
    00137       goto ERROR;
    00138     }
    00139   *nbofbasisfunc = (med_int) _tmpn;
    00140
    00141   _ret = 0;
    00142
    00143  ERROR:
    00144
    00145   if (_interpid>0)     if (_MEDdatagroupFermer(_interpid) < 0) {
    00146     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_path);
    00147     ISCRUTE_id(_interpid);
    00148   }
    00149   return _ret;
    00150
    00151 }