Gromacs
2025-dev-20241002-88a4191
|
#include <testutils/include/testutils/trajectoryreader.h>
Manages returning a t_trxframe whose contents were read from successive frames of an trajectory file.
Public Member Functions | |
bool | readNextFrame () |
Attempt to read the next frame from the trajectory file. More... | |
TrajectoryFrame | frame () |
Return the next frame from the trajectory file. More... | |
TrajectoryFrameReader (const std::string &filename) | |
Constructor. More... | |
|
explicit |
Constructor.
[in] | filename | Name of trajectory file to open and read. |
TrajectoryFrame gmx::test::TrajectoryFrameReader::frame | ( | ) |
Return the next frame from the trajectory file.
If the next frame has not been probed for, then probe for it. If no next frame exists, then throw APIError, because user code should have called readNextFrame itself if this is possible. (This permits user code to avoid making calls to readNextFrame in a case where it already knows that the frame exists.)
APIError | if no next frame exists, or if it lacks either time or step number. |
bool gmx::test::TrajectoryFrameReader::readNextFrame | ( | ) |
Attempt to read the next frame from the trajectory file.
This call wraps the read_first_frame()/read_next_frame() API, which does the file opening as a side effect of reading the first frame.
If true is returned, then TrajectoryFrame frame() should be called to get access to the data. If false is returned, then no further data exists and no further call to readNextFrame or TrajectoryFrame frame() should occur.
FileIOError | upon reading the first frame, if the trajectory file cannot be opened |
APIError | if an earlier probe has not been properly handled (by calling frame(), or stopping trying to read from the file). |