From 0151aaecf47af8c4782e7351337b90c28ce99e66 Mon Sep 17 00:00:00 2001 From: Daniel Garcia-Sanchez Date: Fri, 2 Apr 2021 11:53:20 +0200 Subject: [PATCH] Add bool type to HDF5 --- include/deal.II/base/hdf5.h | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/include/deal.II/base/hdf5.h b/include/deal.II/base/hdf5.h index 57e89492f8..5d357b36bd 100644 --- a/include/deal.II/base/hdf5.h +++ b/include/deal.II/base/hdf5.h @@ -1252,6 +1252,7 @@ namespace HDF5 static_assert(std::is_same::value || std::is_same::value || std::is_same::value || + std::is_same::value || std::is_same::value || std::is_same>::value || std::is_same>::value, @@ -1274,6 +1275,10 @@ namespace HDF5 { return std::make_shared(H5T_NATIVE_UINT); } + else if (std::is_same::value) + { + return std::make_shared(H5T_NATIVE_HBOOL); + } else if (std::is_same>::value) { std::shared_ptr t_type = @@ -1587,29 +1592,6 @@ namespace HDF5 - template <> - inline bool - HDF5Object::get_attribute(const std::string &attr_name) const - { - // The enum field generated by h5py can be casted to int - int int_value; - hid_t attr; - herr_t ret; - - attr = H5Aopen(*hdf5_reference, attr_name.data(), H5P_DEFAULT); - Assert(attr >= 0, ExcMessage("Error at H5Aopen")); - ret = H5Aread(attr, H5T_NATIVE_INT, &int_value); - (void)ret; - Assert(ret >= 0, ExcMessage("Error at H5Aread")); - ret = H5Aclose(attr); - (void)ret; - Assert(ret >= 0, ExcMessage("Error at H5Aclose")); - - return (int_value != 0); - } - - - template <> inline std::string HDF5Object::get_attribute(const std::string &attr_name) const -- 2.39.5