# MEDinterpBaseFunctionCoeffSize.c

Aller à la documentation de ce fichier.

    00001 /*  This file is part of MED.
    00002  *
    00003  *  COPYRIGHT (C) 1999 - 2012  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
    00036 med_int
    00037 MEDinterpBaseFunctionCoefSize( const med_idt          fid,
    00038                                const char*      const interpname,
    00039                                const med_int          basisfuncit)
    00040
    00041 {
    00042   med_idt           _interpid=0,_bid=0;
    00043   med_int           _ret=-1;
    00044   char              _path[MED_TAILLE_INTERP+MED_NAME_SIZE+1]=MED_INTERP;
    00045   char              _basisfuncname[MED_MAX_PARA+1]="";
    00046   med_int           _ncoef=0;
    00047   /*
    00048    * On inhibe le gestionnaire d'erreur
    00049    */
    00050   _MEDmodeErreurVerrouiller();
    00051
    00052   if (basisfuncit < 1 ) {
    00053     MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_PARAMETER,"");
    00054     ISCRUTE(basisfuncit);
    00055     goto ERROR;
    00056   }
    00057
    00058   NOFINALBLANK(interpname,ERROR);
    00059   strcat(_path,interpname);
    00060   /*
    00061    * Ouverture du DataGroup /INTERP/<interpname>
    00062    */
    00063   if ((_interpid = _MEDdatagroupOpen(fid,_path)) < 0) {
    00064     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,interpname);
    00065     SSCRUTE(_path);goto ERROR;
    00066   }
    00067
    00068   sprintf(_basisfuncname,"%0*li",MED_MAX_PARA,(long ) basisfuncit);
    00069   /*
    00070    * Ouverture du DataGroup /INTERP/<interpname>/<basisfuncit>
    00071    */
    00072   if ((_bid = _MEDdatagroupOpen(_interpid,_basisfuncname)) < 0) {
    00073     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_path);SSCRUTE(_basisfuncname);
    00074     goto ERROR;
    00075   }
    00076
    00077   /*
    00078    * Lecture de l'attribut MED_NOM_MCF
    00079    */
    00080   if ( _MEDattrEntierLire(_bid,MED_NOM_MCF,&_ncoef) < 0 ) {
    00081     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,_path);SSCRUTE(_basisfuncname);
    00082     SSCRUTE(MED_NOM_MCF);ISCRUTE(_ncoef);
    00083     goto ERROR;
    00084   }
    00085
    00086   _ret=_ncoef;
    00087
    00088  ERROR:
    00089
    00090   if (_interpid>0)            if (_MEDdatagroupFermer(_interpid) < 0) {
    00091     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_path);
    00092     ISCRUTE_id(_interpid);
    00093   }
    00094
    00095   if (_bid>0)            if (_MEDdatagroupFermer(_bid) < 0) {
    00096     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_basisfuncname);
    00097     ISCRUTE_id(_bid);SSCRUTE(_path);
    00098   }
    00099
    00100   return _ret;
    00101 }