Abstract base class for time loops.
Supports registration of selectable functions that are run before/after a timestep. The function doTimeStep() runs the timestep itself and must be implemented by derived classes.
#include <Timeloop.h>
Classes | |
class | LoggingStamp |
class | LoggingStampManager |
Public Member Functions | |
Construction & Destruction | |
Timeloop (uint_t nrOfTimeSteps) | |
~Timeloop () override=default | |
Execution Control | |
void | run () override |
void | run (const bool logTimeStep) |
void | run (timing::TimingPool< TP > &timing, const bool logTimeStep=true) |
void | singleStep () override |
void | singleStep (const bool logTimeStep) |
void | singleStep (timing::TimingPool< TP > &timing, const bool logTimeStep=true) |
void | stop () override |
Stops the timeloop, has to be called on every process. More... | |
void | synchronizedStop (bool stop) override |
Similar to stop - useful if the stop signal is only known on a single process. More... | |
void | setCurrentTimeStepToZero () |
void | setCurrentTimeStep (uint_t ts) override |
Public Member Functions inherited from walberla::timeloop::ITimeloop | |
virtual | ~ITimeloop ()=default |
Friends | |
class | LoggingStamp |
Registration Functions | |
using | FctHandle = size_t |
FctHandle | addFuncBeforeTimeStep (const VoidFctNoArguments &f, const std::string &identifier=std::string(), const Set< SUID > &require=Set< SUID >::emptySet(), const Set< SUID > &incompatible=Set< SUID >::emptySet()) |
void | addFuncBeforeTimeStep (const FctHandle &fctToBindTo, const VoidFctNoArguments &f, const std::string &identifier=std::string(), const Set< SUID > &require=Set< SUID >::emptySet(), const Set< SUID > &incompatible=Set< SUID >::emptySet()) |
FctHandle | addFuncAfterTimeStep (const VoidFctNoArguments &f, const std::string &identifier=std::string(), const Set< SUID > &require=Set< SUID >::emptySet(), const Set< SUID > &exludingSelector=Set< SUID >::emptySet()) |
void | addFuncAfterTimeStep (const FctHandle &fctToBindTo, const VoidFctNoArguments &f, const std::string &identifier=std::string(), const Set< SUID > &require=Set< SUID >::emptySet(), const Set< SUID > &incompatible=Set< SUID >::emptySet()) |
Timestep | |
using | SelectableFunc = selectable::SetSelectableObject< VoidFctNoArguments, SUID > |
uint_t | curTimeStep_ |
current time step More... | |
uint_t | nrOfTimeSteps_ |
total number of time steps More... | |
std::vector< SelectableFunc > | beforeFunctions_ |
std::vector< SelectableFunc > | afterFunctions_ |
bool | stop_ |
uint_t | getCurrentTimeStep () const override |
uint_t | getNrOfTimeSteps () const override |
virtual void | doTimeStep (const Set< SUID > &selectors)=0 |
virtual void | doTimeStep (const Set< SUID > &selectors, timing::TimingPool< TP > &timing)=0 |
void | executeSelectable (const selectable::SetSelectableObject< VoidFctNoArguments, SUID > &selectable, const Set< SUID > &selector, const std::string &what) |
void | executeSelectable (const selectable::SetSelectableObject< VoidFctNoArguments, SUID > &selectable, const Set< SUID > &selector, const std::string &what, timing::TimingPool< TP > &tp) |
using walberla::timeloop::Timeloop< TP >::FctHandle = size_t |
|
protected |
|
inline |
|
overridedefault |
void walberla::timeloop::Timeloop< TP >::addFuncAfterTimeStep | ( | const FctHandle & | fctToBindTo, |
const VoidFctNoArguments & | f, | ||
const std::string & | identifier = std::string() , |
||
const Set< SUID > & | require = Set< SUID >::emptySet() , |
||
const Set< SUID > & | incompatible = Set< SUID >::emptySet() |
||
) |
Timeloop< TP >::FctHandle walberla::timeloop::Timeloop< TP >::addFuncAfterTimeStep | ( | const VoidFctNoArguments & | f, |
const std::string & | identifier = std::string() , |
||
const Set< SUID > & | require = Set<SUID>::emptySet() , |
||
const Set< SUID > & | exludingSelector = Set<SUID>::emptySet() |
||
) |
void walberla::timeloop::Timeloop< TP >::addFuncBeforeTimeStep | ( | const FctHandle & | fctToBindTo, |
const VoidFctNoArguments & | f, | ||
const std::string & | identifier = std::string() , |
||
const Set< SUID > & | require = Set< SUID >::emptySet() , |
||
const Set< SUID > & | incompatible = Set< SUID >::emptySet() |
||
) |
Timeloop< TP >::FctHandle walberla::timeloop::Timeloop< TP >::addFuncBeforeTimeStep | ( | const VoidFctNoArguments & | f, |
const std::string & | identifier = std::string() , |
||
const Set< SUID > & | require = Set<SUID>::emptySet() , |
||
const Set< SUID > & | incompatible = Set<SUID>::emptySet() |
||
) |
|
protectedpure virtual |
Implemented in walberla::timeloop::SweepTimeloop< TP >.
|
protectedpure virtual |
|
protected |
|
protected |
|
inlineoverridevirtual |
Implements walberla::timeloop::ITimeloop.
|
inlineoverridevirtual |
Implements walberla::timeloop::ITimeloop.
|
inlineoverridevirtual |
Implements walberla::timeloop::ITimeloop.
void walberla::timeloop::Timeloop< TP >::run | ( | const bool | logTimeStep | ) |
void walberla::timeloop::Timeloop< TP >::run | ( | timing::TimingPool< TP > & | timing, |
const bool | logTimeStep = true |
||
) |
|
inlineoverridevirtual |
Implements walberla::timeloop::ITimeloop.
|
inline |
|
inlineoverridevirtual |
Implements walberla::timeloop::ITimeloop.
void walberla::timeloop::Timeloop< TP >::singleStep | ( | const bool | logTimeStep | ) |
void walberla::timeloop::Timeloop< TP >::singleStep | ( | timing::TimingPool< TP > & | timing, |
const bool | logTimeStep = true |
||
) |
|
overridevirtual |
Stops the timeloop, has to be called on every process.
While the timeloop is running and calling function or sweeps, a called function can call this stop() function then the run() loop is stopped before reaching nrOfTimeSteps
Implements walberla::timeloop::ITimeloop.
|
overridevirtual |
Similar to stop - useful if the stop signal is only known on a single process.
Typical scenario: One process gathers information about the simulation state to determine a stopping criterion ( convergence test ). If this process decides to stop this information has to be communicated, such that all processes stop - this is done using synchronizedStop() -> If at least on process calls synchronizedStop(true) the timeloop is stopped
Implements walberla::timeloop::ITimeloop.
|
friend |
|
protected |
|
protected |
|
protected |
current time step
|
protected |
total number of time steps
|
protected |