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