TRIQS/h5 1.3.0
C++ interface to HDF5
|
#include <h5/array_interface.hpp>
Struct representing an HDF5 hyperslab.
A hyperslab is used to select elements from an n-dimensional array/dataspace and it is defined by 4 arrays of the same size as the rank of the underlying dataspace (see HDF5 docs):
offset
: Origin of the hyperslab in the dataspace.stride
: The number of elements to skip between each element or block to be selected. If the stride parameter is set to NULL
, the stride size defaults to 1 in each dimension.count
: The number of elements or blocks to select along each dimension.block
: The size of a block selected from the dataspace. If the block parameter is set to NULL
, the block size defaults to a single element in each dimension, as if the block array was set to all ones.The imaginary part of a complex array/dataspace is treated as just another dimension, i.e. its rank is increased by one.
The following example selects every second column in a 7x7
dataspace:
For a complex valued dataspace, the same example would look like this:
Definition at line 91 of file array_interface.hpp.
Public Member Functions | |
hyperslab ()=default | |
Default constructor leaves the hyperslab empty (uninitialized). | |
hyperslab (int rank, bool is_complex) | |
Construct a new empty hyperslab for a dataspace of a given rank. | |
bool | empty () const |
Check whether the hyperslab is empty (has been initialized). | |
int | rank () const |
Get the rank of the hyperslab (including the possible added imaginary dimension). | |
v_t | shape () const |
Get the shape of the selected hyperslab. | |
auto | size () const |
Get the total number of elements in the hyperslab. | |
Public Attributes | |
v_t | block |
Shape of a single block selected from the dataspace. | |
v_t | count |
Number of elements or blocks to select along each dimension. | |
v_t | offset |
Index offset for each dimension. | |
v_t | stride |
Stride in each dimension (in the HDF5 sense). | |
|
inline |
Construct a new empty hyperslab for a dataspace of a given rank.
A complex hyperslab has an additional dimension for the imaginary part. By default, offset
and count
are set to zero and stride
and block
are set to one. If complex valued, count.back() = 2
.
rank | Rank of the underlying dataspace (excluding the possible added imaginary dimension). |
is_complex | Whether the data is complex valued. |
Definition at line 113 of file array_interface.hpp.