#include <iostream>
#include <string>
#include <vector>
#include <h5cpp/all>
int main() {
{
std::cout <<
" h5::offset{2,3} = " << h5::offset{2, 3} <<
"\n";
std::cout <<
" h5::count{10,20} = " << h5::count{10, 20} <<
"\n";
std::cout <<
" h5::stride{1,2} = " << h5::stride{1, 2} <<
"\n";
std::cout <<
" h5::block{4,4} = " << h5::block{4, 4} <<
"\n";
std::cout <<
" h5::current_dims{50,60}= " << h5::current_dims{50, 60}<<
"\n";
std::cout <<
" h5::max_dims{H5S_UNLIMITED,40} = "
<< h5::max_dims{H5S_UNLIMITED, 40} << " (note 'inf' for unlimited)\n";
}
{
h5::current_dims{10, 20}, h5::count{10, 20});
std::cout <<
" fresh dataspace (all selected):\n" << space;
h5::select_hyperslab(space, h5::offset{2, 3}, h5::count{4, 4});
std::cout <<
"\n after select_hyperslab(offset{2,3}, count{4,4}):\n"
<< space;
}
{
std::cout <<
" default dxpl : " << h5::default_dxpl <<
"\n";
}
{
h5::at_t at =
h5::open(gr,
"units", h5::default_acpl);
hsize_t cdims[2] = {4, 8};
H5Pset_chunk(static_cast<hid_t>(dcpl), 2, cdims);
H5Pset_deflate(static_cast<hid_t>(dcpl), 6);
H5Pset_alloc_time(static_cast<hid_t>(dcpl), H5D_ALLOC_TIME_INCR);
H5Pset_libver_bounds(static_cast<hid_t>(fapl),
H5F_LIBVER_V18, H5F_LIBVER_V112);
}
{
std::cout <<
"\n[5] STL pretty-printer (H5Uall.hpp)\n";
std::cout <<
" vector<string> : " << tags <<
"\n";
std::cout <<
" vector<vector<int>> : " << ragged <<
"\n";
}
std::cout <<
"\ncout.h5 written; structure visible via `h5ls -r cout.h5` or `h5dump cout.h5`.\n";
return 0;
}
h5::at_t create(const hid_t &parent, const std::string &path, args_t &&... args)
Create a new attribute of element type T on a parent HDF5 object.
Definition H5Acreate.hpp:100
T aread(const hid_t &ds, const std::string &name, const h5::acpl_t &acpl=h5::default_acpl)
Read an attribute by name and return its value as type T.
Definition H5Aread.hpp:76
h5::at_t open(const hid_t &parent, const std::string &path, const h5::acpl_t &acpl=h5::default_acpl)
Open an existing attribute by name on a parent HDF5 object.
Definition H5Aopen.hpp:56
void awrite(const h5::at_t &attr, const T *ptr)
Low-level attribute write — copies elements from ptr into an already-open h5::at_t.
Definition H5Awrite.hpp:47
h5::gr_t write(const LOC &parent, const std::string &path, const T &src)
Write a sparse matrix or vector as a CSC group.
Definition H5Dsparse.hpp:185
std::enable_if_t< h5::impl::is_valid_group_parent< HID_T >::value, h5::gr_t > gcreate(const HID_T &parent, const std::string &path, const h5::lcpl_t &lcpl=h5::default_lcpl)
Creates an HDF5 group and returns a managed h5::gr_t handle.
Definition H5Gcreate.hpp:32