Gromacs
2022.2
|
#include <gromacs/mdlib/stophandler.h>
Class handling the stop signal.
Loops over the registered stop conditions and sets a signal if requested (currently only done by master rank). All ranks receive the stop signal and set the respective flag. The functions are implemented within this header file to avoid leaving the translation unit unnecessarily.
Public Member Functions | |
StopHandler (compat::not_null< SimulationSignal * > signal, bool simulationShareState, std::vector< std::function< StopSignal()>> stopConditions, bool neverUpdateNeighborList) | |
StopHandler constructor (will be called by StopHandlerBuilder) More... | |
void | setSignal () const |
Decides whether a stop signal shall be sent. More... | |
bool | stoppingAfterCurrentStep (bool bNS) const |
Decides whether the simulation shall be stopped after the current step. More... | |
gmx::StopHandler::StopHandler | ( | compat::not_null< SimulationSignal * > | signal, |
bool | simulationShareState, | ||
std::vector< std::function< StopSignal()>> | stopConditions, | ||
bool | neverUpdateNeighborList | ||
) |
StopHandler constructor (will be called by StopHandlerBuilder)
signal | Non-null pointer to a signal used for reading and writing of signals |
simulationShareState | Whether this signal needs to be shared across multiple simulations |
stopConditions | Vector of callback functions setting the signal |
neverUpdateNeighborList | Whether simulation keeps same neighbor list forever |
Note: As the StopHandler does not work without this signal, it keeps a non-const reference to it as a member variable.
|
inline |
Decides whether a stop signal shall be sent.
Loops over the stopCondition vector passed at build time (consisting of conditions registered with StopHandlerBuilder, and conditions built by StopHandlerBuilder by default), and sets any signal obtained. Returns as soon as a StopSignal::stopImmediately signal was obtained, or after checking all registered stop conditions.
|
inline |
Decides whether the simulation shall be stopped after the current step.
The simulation is stopped after the current step if