Gromacs
2025.0-dev-20241011-013a99c
|
#include <gromacs/modularsimulator/modularsimulatorinterfaces.h>
Client that needs to store data during checkpointing.
Clients receive a CheckpointData object for reading and writing. Note that ReadCheckpointData
is a typedef for CheckpointData<CheckpointDataOperation::Read>
, and WriteCheckpointData
is a typedef for CheckpointData<CheckpointDataOperation::Write>
. This allows clients to write a single templated function, e.g. template<CheckpointDataOperation operation> void doCheckpointData(CheckpointData<operation>* checkpointData, const t_commrec* cr) { checkpointData->scalar("important value", &value_); } for both checkpoint reading and writing. This function can then be dispatched from the interface functions, void writeCheckpoint(WriteCheckpointData checkpointData, const t_commrec* cr) { doCheckpointData<CheckpointDataOperation::Write>(&checkpointData, cr); } void readCheckpoint(ReadCheckpointData checkpointData, const t_commrec* cr) { doCheckpointData<CheckpointDataOperation::Read>(&checkpointData, cr); } This reduces code duplication and ensures that reading and writing operations will not get out of sync.
Public Member Functions | |
virtual | ~ICheckpointHelperClient ()=default |
Standard virtual destructor. | |
virtual void | saveCheckpointState (std::optional< WriteCheckpointData > checkpointData, const t_commrec *cr)=0 |
Write checkpoint (CheckpointData object only passed on main rank) | |
virtual void | restoreCheckpointState (std::optional< ReadCheckpointData > checkpointData, const t_commrec *cr)=0 |
Read checkpoint (CheckpointData object only passed on main rank) | |
virtual const std::string & | clientID ()=0 |
Get unique client id. | |