MED21attrNumLire.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_config.h>
00020 #include <med.h>
00021 #include <med_outils.h>
00022 #include <hdf5.h>
00023
00024 med_err _MED21attrNumLire(med_idt pere,med_type_champ type,char *nom,
00025 unsigned char *val,hid_t hdf_file)
00026 {
00027 med_idt attid;
00028 med_err ret;
00029 int type_hdf;
00030
00031 if ((attid = H5Aopen_name(pere,nom)) < 0)
00032 return -1;
00033
00034 switch(type)
00035 {
00036 case MED_FLOAT64 :
00037 if (H5Tequal(hdf_file,H5T_IEEE_F64BE))
00038 type_hdf = H5T_IEEE_F64LE;
00039 if (H5Tequal(hdf_file,H5T_IEEE_F64LE))
00040 type_hdf = H5T_IEEE_F64BE;
00041 break;
00042
00043 case MED_INT :
00044 #if defined(HAVE_F77INT64)
00045 type_hdf = H5T_NATIVE_LONG;
00046 #else
00047 type_hdf = H5T_NATIVE_INT;
00048 #endif
00049 break;
00050
00051 default :
00052 return -1;
00053 }
00054
00055 if ((ret = H5Aread(attid,type_hdf,val)) < 0)
00056 return -1;
00057
00058 if ((ret = H5Aclose(attid)) < 0)
00059 return -1;
00060
00061 return 0;
00062 }