walberla::timeloop::Timeloop< TP > Class Template Referenceabstract

Detailed Description

template<typename TP = timing::WcPolicy>
class walberla::timeloop::Timeloop< TP >

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>

+ Inheritance diagram for walberla::timeloop::Timeloop< TP >:

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< SelectableFuncbeforeFunctions_
 
std::vector< SelectableFuncafterFunctions_
 
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)
 

Member Typedef Documentation

◆ FctHandle

template<typename TP = timing::WcPolicy>
using walberla::timeloop::Timeloop< TP >::FctHandle = size_t

◆ SelectableFunc

template<typename TP = timing::WcPolicy>
using walberla::timeloop::Timeloop< TP >::SelectableFunc = selectable::SetSelectableObject<VoidFctNoArguments, SUID>
protected

Constructor & Destructor Documentation

◆ Timeloop()

template<typename TP = timing::WcPolicy>
walberla::timeloop::Timeloop< TP >::Timeloop ( uint_t  nrOfTimeSteps)
inline

◆ ~Timeloop()

template<typename TP = timing::WcPolicy>
walberla::timeloop::Timeloop< TP >::~Timeloop ( )
overridedefault

Member Function Documentation

◆ addFuncAfterTimeStep() [1/2]

template<typename TP = timing::WcPolicy>
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() 
)

◆ addFuncAfterTimeStep() [2/2]

template<typename TP >
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() 
)

◆ addFuncBeforeTimeStep() [1/2]

template<typename TP = timing::WcPolicy>
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() 
)

◆ addFuncBeforeTimeStep() [2/2]

template<typename TP >
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() 
)

◆ doTimeStep() [1/2]

template<typename TP = timing::WcPolicy>
virtual void walberla::timeloop::Timeloop< TP >::doTimeStep ( const Set< SUID > &  selectors)
protectedpure virtual

◆ doTimeStep() [2/2]

template<typename TP = timing::WcPolicy>
virtual void walberla::timeloop::Timeloop< TP >::doTimeStep ( const Set< SUID > &  selectors,
timing::TimingPool< TP > &  timing 
)
protectedpure virtual

◆ executeSelectable() [1/2]

template<typename TP >
void walberla::timeloop::Timeloop< TP >::executeSelectable ( const selectable::SetSelectableObject< VoidFctNoArguments, SUID > &  selectable,
const Set< SUID > &  selector,
const std::string &  what 
)
protected

◆ executeSelectable() [2/2]

template<typename TP >
void walberla::timeloop::Timeloop< TP >::executeSelectable ( const selectable::SetSelectableObject< VoidFctNoArguments, SUID > &  selectable,
const Set< SUID > &  selector,
const std::string &  what,
timing::TimingPool< TP > &  tp 
)
protected

◆ getCurrentTimeStep()

template<typename TP = timing::WcPolicy>
uint_t walberla::timeloop::Timeloop< TP >::getCurrentTimeStep ( ) const
inlineoverridevirtual

◆ getNrOfTimeSteps()

template<typename TP = timing::WcPolicy>
uint_t walberla::timeloop::Timeloop< TP >::getNrOfTimeSteps ( ) const
inlineoverridevirtual

◆ run() [1/3]

template<typename TP = timing::WcPolicy>
void walberla::timeloop::Timeloop< TP >::run ( )
inlineoverridevirtual

◆ run() [2/3]

template<typename TP >
void walberla::timeloop::Timeloop< TP >::run ( const bool  logTimeStep)

◆ run() [3/3]

template<typename TP >
void walberla::timeloop::Timeloop< TP >::run ( timing::TimingPool< TP > &  timing,
const bool  logTimeStep = true 
)

◆ setCurrentTimeStep()

template<typename TP = timing::WcPolicy>
void walberla::timeloop::Timeloop< TP >::setCurrentTimeStep ( uint_t  ts)
inlineoverridevirtual

◆ setCurrentTimeStepToZero()

template<typename TP = timing::WcPolicy>
void walberla::timeloop::Timeloop< TP >::setCurrentTimeStepToZero ( )
inline

◆ singleStep() [1/3]

template<typename TP = timing::WcPolicy>
void walberla::timeloop::Timeloop< TP >::singleStep ( )
inlineoverridevirtual

◆ singleStep() [2/3]

template<typename TP >
void walberla::timeloop::Timeloop< TP >::singleStep ( const bool  logTimeStep)

◆ singleStep() [3/3]

template<typename TP >
void walberla::timeloop::Timeloop< TP >::singleStep ( timing::TimingPool< TP > &  timing,
const bool  logTimeStep = true 
)

◆ stop()

template<typename TP >
void walberla::timeloop::Timeloop< TP >::stop
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.

◆ synchronizedStop()

template<typename TP >
void walberla::timeloop::Timeloop< TP >::synchronizedStop ( bool  stopVal)
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.

Friends And Related Function Documentation

◆ LoggingStamp

template<typename TP = timing::WcPolicy>
friend class LoggingStamp
friend

Member Data Documentation

◆ afterFunctions_

template<typename TP = timing::WcPolicy>
std::vector<SelectableFunc> walberla::timeloop::Timeloop< TP >::afterFunctions_
protected

◆ beforeFunctions_

template<typename TP = timing::WcPolicy>
std::vector<SelectableFunc> walberla::timeloop::Timeloop< TP >::beforeFunctions_
protected

◆ curTimeStep_

template<typename TP = timing::WcPolicy>
uint_t walberla::timeloop::Timeloop< TP >::curTimeStep_
protected

current time step

◆ nrOfTimeSteps_

template<typename TP = timing::WcPolicy>
uint_t walberla::timeloop::Timeloop< TP >::nrOfTimeSteps_
protected

total number of time steps

◆ stop_

template<typename TP = timing::WcPolicy>
bool walberla::timeloop::Timeloop< TP >::stop_
protected

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