Gromacs  2024.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions
gmx::test::EnergyFrameReader Class Reference

#include <programs/mdrun/tests/energyreader.h>

Description

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...
 

Constructor & Destructor Documentation

gmx::test::EnergyFrameReader::EnergyFrameReader ( const std::map< std::string, int > &  indicesOfEnergyTerms,
ener_file *  energyFile 
)
explicit

Constructor.

Parameters
[in]indicesOfEnergyTermsLooks up energy terms by name to get the index into a t_enxframe structure read by the legacy API.
[in]energyFileOpen energy file object to manage, and from which to read frames

Member Function Documentation

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.)

Exceptions
APIErrorif no next frame exists.
std::bad_allocwhen out of memory.
bool gmx::test::EnergyFrameReader::readNextFrame ( )

Attempt to read the next frame from the energy file.

Returns
Whether a frame was available to read.

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.

Exceptions
APIErrorif an earlier probe has not been properly handled (by calling frame(), or stopping trying to read from the file).

The documentation for this class was generated from the following files: