22 template<
typename T,
typename U,
typename... UTail>
23 inline bool hdf5_read_vector_data_helper_impl(T * value, data_type
const &data_id, type_type
const &native_id,
24 std::vector<std::size_t>
const &chunk,
25 std::vector<std::size_t>
const &offset,
26 std::vector<std::size_t>
const &data_size,
29 H5Tequal(type_type(H5Tcopy(native_id)), type_type(get_native_type(U())))
31 std::size_t len = std::accumulate(chunk.begin(), chunk.end(), std::size_t(1), std::multiplies<std::size_t>());
32 std::unique_ptr<U[]> raw(
35 if (std::equal(chunk.begin(), chunk.end(), data_size.begin())) {
36 check_error(H5Dread(data_id, native_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, raw.get()));
37 cast(raw.get(), raw.get() + len, value);
39 std::vector<hsize_t> offset_hid(offset.begin(), offset.end()),
40 chunk_hid(chunk.begin(), chunk.end());
41 space_type space_id(H5Dget_space(data_id));
42 check_error(H5Sselect_hyperslab(space_id, H5S_SELECT_SET, &offset_hid.front(), NULL, &chunk_hid.front(), NULL));
43 space_type mem_id(H5Screate_simple(static_cast<int>(chunk_hid.size()), &chunk_hid.front(), NULL));
44 check_error(H5Dread(data_id, native_id, mem_id, space_id, H5P_DEFAULT, raw.get()));
45 cast(raw.get(), raw.get() + len, value);
49 return hdf5_read_vector_data_helper_impl<T, UTail...>(value,
55 std::integral_constant<bool,
sizeof...(UTail) != 0>());
57 template<
typename T,
typename... UTail>
58 inline bool hdf5_read_vector_data_helper_impl(T *, data_type
const &, type_type
const &,
59 std::vector<std::size_t>
const &,
60 std::vector<std::size_t>
const &,
61 std::vector<std::size_t>
const &,
66 bool hdf5_read_vector_data_helper(T * value, data_type
const &data_id, type_type
const &native_id,
67 std::vector<std::size_t>
const &chunk,
68 std::vector<std::size_t>
const &offset,
69 std::vector<std::size_t>
const &data_size) {
70 return hdf5_read_vector_data_helper_impl<T, ALPS_HDF5_NATIVE_INTEGRAL_TYPES>(value,
79 #define ALPS_HDF5_READ_VECTOR_DATA_HELPER(T) \ 80 template bool hdf5_read_vector_data_helper(T *, data_type const &, type_type const &, \ 81 std::vector<std::size_t> const &, \ 82 std::vector<std::size_t> const &, \ 83 std::vector<std::size_t> const &);
ALPS_FOREACH_NATIVE_HDF5_TYPE(ALPS_HDF5_READ_SCALAR)
#define ALPS_HDF5_READ_VECTOR_DATA_HELPER(T)