ritsuko
Helper utilities for ArtifactDB C++ code
Loading...
Searching...
No Matches
ritsuko::hdf5::IterateNdDataset Struct Reference

Iterate through an N-dimensional dataset by block. More...

#include <IterateNdDataset.hpp>

Public Member Functions

 IterateNdDataset (std::vector< hsize_t > d, std::vector< hsize_t > b)
 
void next ()
 
bool finished () const
 
size_t current_block_size () const
 
const std::vector< hsize_t > & starts () const
 
const std::vector< hsize_t > & counts () const
 
const H5::DataSpace & file_space () const
 
const H5::DataSpace & memory_space () const
 
const std::vector< hsize_t > & dimensions () const
 
const std::vector< hsize_t > & block_dimensions () const
 

Detailed Description

Iterate through an N-dimensional dataset by block.

This iterates through an N-dimensional dataset in a blockwise fashion, constructing H5::DataSpace objects to enable callers to easily read the dataset contents at each block. Block sizes are typically determined from dataset chunking via pick_nd_block_dimensions(), which ensures efficient access of entire chunks at each step.

Constructor & Destructor Documentation

◆ IterateNdDataset()

ritsuko::hdf5::IterateNdDataset::IterateNdDataset ( std::vector< hsize_t > d,
std::vector< hsize_t > b )
inline
Parameters
dDataset dimensions.
bBlock dimensions, typically obtained from pick_nd_block_dimensions(). This should be of the same length as d, where each value of b is no greater than its counterpart in d.

Member Function Documentation

◆ block_dimensions()

const std::vector< hsize_t > & ritsuko::hdf5::IterateNdDataset::block_dimensions ( ) const
inline
Returns
Dimensions of the blocks, as provided in the constructor.

◆ counts()

const std::vector< hsize_t > & ritsuko::hdf5::IterateNdDataset::counts ( ) const
inline
Returns
Dimensions of the current block. This is usually equal to the block dimensions used in the constructor, except at the edges of the dataset where the current block may be truncated.

◆ current_block_size()

size_t ritsuko::hdf5::IterateNdDataset::current_block_size ( ) const
inline
Returns
Size of the current block, in terms of the number of elements. This is usually equal to the product of the block dimensions used in the constructor, except at the edges of the dataset where the current block may be truncated.

◆ dimensions()

const std::vector< hsize_t > & ritsuko::hdf5::IterateNdDataset::dimensions ( ) const
inline
Returns
Dimensions of the dataset, as provided in the constructor.

◆ file_space()

const H5::DataSpace & ritsuko::hdf5::IterateNdDataset::file_space ( ) const
inline
Returns
Dataspace for extracting block contents from file.

◆ finished()

bool ritsuko::hdf5::IterateNdDataset::finished ( ) const
inline
Returns
Whether the iteration is finished. All other getters should only be accessed if this is true.

◆ memory_space()

const H5::DataSpace & ritsuko::hdf5::IterateNdDataset::memory_space ( ) const
inline
Returns
Dataspace for storing the block contents in memory. This assumes a contiguous memory allocation that has space for at least total_size() elements.

◆ next()

void ritsuko::hdf5::IterateNdDataset::next ( )
inline

Move to the next step in the iteration. This will modify the state of all references returned by the getters.

◆ starts()

const std::vector< hsize_t > & ritsuko::hdf5::IterateNdDataset::starts ( ) const
inline
Returns
Starting coordinates of the current block.

The documentation for this struct was generated from the following file: