template <typename T> void read_array_impl(h5::group g, std::string const& name, T* start, array_stride_info info) { static_assert(!std::is_base_of<std::string, T>::value, " Not implemented"); // 1d is below bool is_complex = triqs::is_complex<T>::value; h5::dataset ds = g.open_dataset(name); h5::dataspace d_space = H5Dget_space(ds); herr_t err = H5Dread(ds, h5::data_type_memory<T>(), data_space_impl(info, is_complex), d_space, H5P_DEFAULT, h5::get_data_ptr(start)); if (err < 0) TRIQS_RUNTIME_ERROR << "Error reading the scalar dataset " << name << " in the group" << g.name(); }
std::vector<size_t> get_array_lengths(int R, h5::group g, std::string const& name, bool is_complex) { h5::dataset ds = g.open_dataset(name); h5::dataspace d_space = H5Dget_space(ds); int Rank = R + (is_complex ? 1 : 0); int rank = H5Sget_simple_extent_ndims(d_space); if (rank != Rank) TRIQS_RUNTIME_ERROR << "triqs::array::h5::read. Rank mismatch : the array has rank = " << Rank << " while the array stored in the hdf5 file has rank = " << rank; std::vector<size_t> d2(R); hsize_t dims_out[rank]; H5Sget_simple_extent_dims(d_space, dims_out, NULL); for (int u = 0; u < R; ++u) d2[u] = dims_out[u]; return d2; }