From: Daniel Garcia-Sanchez Date: Fri, 2 Apr 2021 09:53:20 +0000 (+0200) Subject: Add bool type to HDF5 X-Git-Tag: v9.3.0-rc1~237^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0151aaecf47af8c4782e7351337b90c28ce99e66;p=dealii.git Add bool type to HDF5 --- 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