class Gambit::Printers::HDF5DataSet
Class for interfacing to a HDF5 dataset of fixed type. More…
#include <hdf5printer_v2.hpp>
Inherits from Gambit::Printers::HDF5DataSetBase
Public Functions
Name | |
---|---|
HDF5DataSet(const std::string & name) Constructor. | |
std::size_t | write_single(const hid_t loc_id, const T & data, const std::size_t target_pos, const bool force =false) Write a single piece of data to disk at the target position. |
std::size_t | write_vector(const hid_t loc_id, const std::vector< T > & data, const std::size_t target_pos, const bool force =false) Write a vector of data to disk at the target position. |
void | write_buffer(const T(&) buffer[MAX_BUFFER_SIZE], const std::size_t length, const std::size_t target_pos, const bool force =false) |
void | write_random(const hid_t loc_id, const std::map< std::size_t, T > & data) Write data to disk at specified positions. |
void | write_RA_buffer(const T(&) buffer[MAX_BUFFER_SIZE], const hsize_t(&) coords[MAX_BUFFER_SIZE], std::size_t npoints) Write a buffer of data to disk at the specified positions (must be within current dataset extents) |
std::vector< T > | get_chunk(std::size_t offset, std::size_t length) const Extract a data slice from the linked dataset. |
void | reset(hid_t loc_id) |
virtual void | create_dataset(hid_t location_id) Create a new dataset at the specified location. |
Additional inherited members
Public Functions inherited from Gambit::Printers::HDF5DataSetBase
Name | |
---|---|
HDF5DataSetBase(const std::string & name, const hid_t hdftype_id) HDF5DataSetBase member functions. | |
HDF5DataSetBase(const std::string & name) Version where type is not provided; set to default of -1. | |
virtual | ~HDF5DataSetBase() Destructor. |
void | open_dataset(hid_t location_id) Open dataset on disk and obtain HDF5 handles. |
void | close_dataset() Close dataset on disk and release handles. |
std::size_t | get_dset_length() const Retrieve the current size of the dataset on disk. |
bool | dataset_exists(const hid_t loc_id) Check if our dataset exists on disk with the required name at the given location. |
void | ensure_dataset_exists(const hid_t loc_id, const std::size_t length) Ensure that a correctly named dataset exists at the target location with the specified length. |
void | extend_dset_to(const std::size_t new_size) Extend dataset to the specified size, filling it with default values. |
std::string | myname() const Retrieve name of the dataset we are supposed to access. |
int | get_type_id() const Retrieve the integer type ID for this dataset. |
hid_t | get_hdftype_id() const Retrieve the HDF5 type ID for this dataset. |
bool | get_exists_on_disk() const Variable tracking whether the dataset is known to exist in the output file yet. |
void | set_exists_on_disk() |
Protected Functions inherited from Gambit::Printers::HDF5DataSetBase
Name | |
---|---|
void | ensure_dataset_is_open() const Enforce that the dataset must be open for whatever follows (or else an error is thrown) |
hid_t | get_dset_id() const Retrieve the dataset ID for the currently open dataset. |
void | extend_dset_by(const std::size_t extend_by) Set the variable that tracks the (virtual) dataset size on disk. |
std::pair< hid_t, hid_t > | select_hyperslab(std::size_t offset, std::size_t length) const Obtain memory and dataspace identifiers for writing to a hyperslab in the dataset. |
Protected Attributes inherited from Gambit::Printers::HDF5DataSetBase
Name | |
---|---|
hid_t | dset_id HDF5 dataset identifer. |
hid_t | hdftype_id HDF5 type ID for this dataset. |
int | type_id Integer identifier for the template type of this dataset (determined by derived type) |
Detailed Description
template <class T >
class Gambit::Printers::HDF5DataSet;
Class for interfacing to a HDF5 dataset of fixed type.
Public Functions Documentation
function HDF5DataSet
inline HDF5DataSet(
const std::string & name
)
Constructor.
function write_single
inline std::size_t write_single(
const hid_t loc_id,
const T & data,
const std::size_t target_pos,
const bool force =false
)
Write a single piece of data to disk at the target position.
function write_vector
inline std::size_t write_vector(
const hid_t loc_id,
const std::vector< T > & data,
const std::size_t target_pos,
const bool force =false
)
Write a vector of data to disk at the target position.
function write_buffer
inline void write_buffer(
const T(&) buffer[MAX_BUFFER_SIZE],
const std::size_t length,
const std::size_t target_pos,
const bool force =false
)
Write a block of data to disk at the end of the dataset This is the lower-level function. There is a fixed-size buffer that cannot be exceeded. If more data than MAX_BUFFER_SIZE is to be written then the ‘write_vector’ function will split it up and write it in pieces. If force=true then target_pos can be used to overwrite data
function write_random
inline void write_random(
const hid_t loc_id,
const std::map< std::size_t, T > & data
)
Write data to disk at specified positions.
function write_RA_buffer
inline void write_RA_buffer(
const T(&) buffer[MAX_BUFFER_SIZE],
const hsize_t(&) coords[MAX_BUFFER_SIZE],
std::size_t npoints
)
Write a buffer of data to disk at the specified positions (must be within current dataset extents)
function get_chunk
inline std::vector< T > get_chunk(
std::size_t offset,
std::size_t length
) const
Extract a data slice from the linked dataset.
function reset
inline void reset(
hid_t loc_id
)
Clear all data on disk for this dataset Note; this just sets all values to defaults, it doesn’t delete or resize the dataset
function create_dataset
virtual void create_dataset(
hid_t location_id
)
Create a new dataset at the specified location.
Reimplements: Gambit::Printers::HDF5DataSetBase::create_dataset
Create a (chunked) dataset.
Updated on 2024-07-18 at 13:53:32 +0000