|
Gromacs
2026.0-dev-20251119-5f0a571d
|
#include <gromacs/fileio/h5md/h5md_timedatablock.h>
Class which manages time-dependent data sets of the templated ValueType.
Time-dependent data in H5md require the coexistance of multiple data sets:
1) A data set for the primary value type that is to be stored, 2) A data set with the simulation step number for each stored value, and 3) (Optionally) A data set with the simulation time for each stored value.
This class manages this set of data sets as one, providing routines for writing new frame data as well as reading existing values, steps or times. New data is written to all data sets as one to keep them synchronized.
Use the H5mdTimeDataBlockBuilder class to construct new objects with certain features. When opening already existing blocks for reading or appending data (i.e. when resuming simulations from checkpoints), use the H5mdTimeDataBlock constructor.
Public Member Functions | |
| H5mdTimeDataBlock (hid_t container, const char *name) | |
| bool | hasTime () const |
| Return whether or not this block manages a time data set. | |
| const DataSetDims & | frameDims () const |
| Return the frame dimensions of the value data set. | |
| int64_t | numFrames () const |
| Return the number of frames written to the managed data sets. | |
| std::optional< int64_t > | readStepAtIndex (int64_t frameIndex) |
Return the step value of the given frameIndex. More... | |
| std::optional< double > | readTimeAtIndex (int64_t frameIndex) |
Return the time value of the given frameIndex. More... | |
| bool | readValueAtIndex (int64_t frameIndex, ArrayRef< ValueType > values) |
Read the primary value of the given frameIndex into the given buffer if the index exists. More... | |
| bool | readFrame (int64_t frameIndex, ArrayRef< ValueType > values, int64_t *step, double *time) |
Read the frame at frameIndex into the given buffers if the index exists. More... | |
| void | writeNextFrame (ArrayRef< const ValueType > values, int64_t step) |
| Write given values and step to their data sets as the next frame. More... | |
| void | writeNextFrame (ArrayRef< const ValueType > values, int64_t step, double time) |
| Write given values to all managed data sets as the next frame. More... | |
| bool gmx::H5mdTimeDataBlock< ValueType >::readFrame | ( | int64_t | frameIndex, |
| ArrayRef< ValueType > | values, | ||
| int64_t * | step, | ||
| double * | time | ||
| ) |
Read the frame at frameIndex into the given buffers if the index exists.
If step or time are nullptr their values are not read. If a time data set is not managed time is never read.
| [in] | frameIndex | Index of frame to read. |
| [out] | values | Buffer to read values into. |
| [out] | step | Buffer to read step into, or nullptr if not to read. |
| [out] | time | Buffer to read time into, or nullptr if not to read. |
| FileIOError | if there was an error reading any value. |
| std::optional< int64_t > gmx::H5mdTimeDataBlock< ValueType >::readStepAtIndex | ( | int64_t | frameIndex | ) |
Return the step value of the given frameIndex.
| [in] | frameIndex | Index of frame to get the value for. |
frameIndex is not within [0, numFrames). | FileIOError | if there was an error reading the value. |
| std::optional< double > gmx::H5mdTimeDataBlock< ValueType >::readTimeAtIndex | ( | int64_t | frameIndex | ) |
Return the time value of the given frameIndex.
If the time data set is not managed this always returns std::nullopt.
| [in] | frameIndex | Index of frame to get the value for. |
frameIndex is not within [0, numFrames). | FileIOError | if there was an error reading the value. |
| bool gmx::H5mdTimeDataBlock< ValueType >::readValueAtIndex | ( | int64_t | frameIndex, |
| ArrayRef< ValueType > | values | ||
| ) |
Read the primary value of the given frameIndex into the given buffer if the index exists.
| [in] | frameIndex | Index of frame to get the value for. |
| [out] | values | Buffer to read the value into. |
| FileIOError | if there was an error reading the value. |
| void gmx::H5mdTimeDataBlock< ValueType >::writeNextFrame | ( | ArrayRef< const ValueType > | values, |
| int64_t | step | ||
| ) |
Write given values and step to their data sets as the next frame.
| [in] | values | Values to write. |
| [in] | step | Step to write. |
| FileIOError | if there was an error writing the values or if a time data set is managed. |
| void gmx::H5mdTimeDataBlock< ValueType >::writeNextFrame | ( | ArrayRef< const ValueType > | values, |
| int64_t | step, | ||
| double | time | ||
| ) |
Write given values to all managed data sets as the next frame.
This function works both when a time data set is managed and when it is not. If a time data set is managed the time is written to it. If a time data set is not managed the time is never written, but other values are.
| [in] | values | Values to write. |
| [in] | step | Step to write. |
| [in] | time | Time to write, if managed. |
| FileIOError | if there was an error writing the values. |
1.8.5