Public Member Functions | List of all members
KillSwitch Class Reference

Wrapper around another termination condition that allows the user to terminate the main loop manually. More...

#include <kill_switch.hpp>

Inheritance diagram for KillSwitch:
Inheritance graph
[legend]
Collaboration diagram for KillSwitch:
Collaboration graph
[legend]

Public Member Functions

 KillSwitch (const string &fname, TerminationCondition &tc)
 Class constructor. More...
 
bool operator() (const hdsim &sim)
 Returns true if the simulation should continue, false otherwise. More...
 
- Public Member Functions inherited from TerminationCondition
virtual ~TerminationCondition (void)
 Virtual destructor.
 

Detailed Description

Wrapper around another termination condition that allows the user to terminate the main loop manually.

Definition at line 12 of file kill_switch.hpp.

Constructor & Destructor Documentation

◆ KillSwitch()

KillSwitch::KillSwitch ( const string &  fname,
TerminationCondition tc 
)

Class constructor.

Parameters
fnameKill switch file. When the program first starts, a file with this name will be created and the value 0 be written to it. If, at some point, the value in this file will be different from 0, then the main loop should stop.
tcOriginal termination condition

Definition at line 8 of file kill_switch.cpp.

Member Function Documentation

◆ operator()()

bool KillSwitch::operator() ( const hdsim sim)
virtual

Returns true if the simulation should continue, false otherwise.

Parameters
simHydrodynamic simulation
Returns
True is simulation should continue running

Implements TerminationCondition.

Definition at line 17 of file kill_switch.cpp.


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