Template Function opensn::H5ReadDataset1DRanges

Function Documentation

template<typename T>
bool opensn::H5ReadDataset1DRanges(hid_t id, const std::string &name, const std::vector<std::pair<std::uint64_t, std::uint64_t>> &ranges, std::vector<T> &data)

Read parts of the 1D dataset name.

Each range is a pair of the first element and the number of elements. Ranges with no elements are ignored. The other ranges must be in increasing order, must not overlap, and must lie within the dataset. data receives the elements of the ranges one after the other, and only those, so a reader of a large dataset needs memory for its part only. Returns false, with data empty, if name is not a 1D dataset, the ranges break these rules, or the read fails.

The ranges are read in batches of at most max_ranges_per_read. HDF5 merges each range added to a selection with the ranges already in it, so one selection of n ranges costs O(n^2). The batches bound this cost to O(n * max_ranges_per_read).