MEDinterpBaseFunctionCoeffSize.c
Aller à la documentation de ce fichier.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
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 
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 
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 
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 
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 }