Gromacs  2025-dev-20240718-982dfdc
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions
gmx::ICheckpointHelperClient Class Referenceabstract

#include <gromacs/modularsimulator/modularsimulatorinterfaces.h>

+ Inheritance diagram for gmx::ICheckpointHelperClient:


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.

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