Gromacs
2024.4
|
#include <programs/mdrun/tests/energyreader.h>
Manages returning an EnergyFrame containing required energy term values read from successive frames of an .edr file.
Public Member Functions | |
bool | readNextFrame () |
Attempt to read the next frame from the energy file. More... | |
EnergyFrame | frame () |
Make an EnergyFrame from the contents of the next frame in the energy file. More... | |
EnergyFrameReader (const std::map< std::string, int > &indicesOfEnergyTerms, ener_file *energyFile) | |
Constructor. More... | |
|
explicit |
Constructor.
[in] | indicesOfEnergyTerms | Looks up energy terms by name to get the index into a t_enxframe structure read by the legacy API. |
[in] | energyFile | Open energy file object to manage, and from which to read frames |
EnergyFrame gmx::test::EnergyFrameReader::frame | ( | ) |
Make an EnergyFrame from the contents of the next frame in the energy 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. |
std::bad_alloc | when out of memory. |
bool gmx::test::EnergyFrameReader::readNextFrame | ( | ) |
Attempt to read the next frame from the energy file.
If true is returned, then 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 frame() should occur.