Stride Reference Manual  - generated for commit 9643b11
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
stride::SimRunner Class Reference

The simulation runner drive simulator throufgh time steps. More...

#include <SimRunner.h>

Inheritance diagram for stride::SimRunner:
Inheritance graph
Collaboration diagram for stride::SimRunner:
Collaboration graph

Public Member Functions

 SimRunner (const boost::property_tree::ptree &configPt, std::shared_ptr< Sim > sim)
 Initialization with property tree. More...
 
 ~SimRunner () override=default
 Destructor. More...
 
const util::StopwatchGetClock () const
 Return the run & sim configuration. More...
 
const boost::property_tree::ptree & GetConfig () const
 Return the run & sim configuration. More...
 
std::shared_ptr< SimGetSim () const
 Return the Simulator. More...
 
void Run ()
 Run simulator for as many steps/days as indicated in config. More...
 
void Run (unsigned int numSteps)
 Run simulator for numSteps steps/days. More...
 
- Public Member Functions inherited from stride::util::Subject< stride::sim_event::Id >
 Subject ()
 
virtual ~Subject ()
 
void Register (const std::shared_ptr< U > &u, CallbackType f)
 
void Unregister (const std::shared_ptr< U > &u)
 
void UnregisterAll ()
 
void Notify (const EventType &e)
 

Private Attributes

util::Stopwatch m_clock
 Stopwatch for timing the computation. More...
 
boost::property_tree::ptree m_config
 Ptree with configuration. More...
 
std::shared_ptr< Simm_sim
 Simulator object. More...
 

Additional Inherited Members

- Public Types inherited from stride::util::Subject< stride::sim_event::Id >
using EventType = stride::sim_event::Id
 
using CallbackType = std::function< void(const EventType &)>
 

Detailed Description

The simulation runner drive simulator throufgh time steps.

It's functions are:

  • invokes the simulator builder (
    See also
    SimulatorBuilder)
  • manages elapsed time clock
  • manages time steps viewers of its events (
    See also
    sim_event::Id)

Definition at line 44 of file SimRunner.h.

Constructor & Destructor Documentation

stride::SimRunner::SimRunner ( const boost::property_tree::ptree &  configPt,
std::shared_ptr< Sim sim 
)
explicit

Initialization with property tree.

Parameters
configPtconfig info for run and for config of simulator

Definition at line 33 of file SimRunner.cpp.

References m_clock, stride::util::Subject< stride::sim_event::Id >::Notify(), and stride::util::Stopwatch< T >::Start().

Here is the call graph for this function:

stride::SimRunner::~SimRunner ( )
overridedefault

Destructor.

Member Function Documentation

const util::Stopwatch& stride::SimRunner::GetClock ( ) const
inline

Return the run & sim configuration.

Definition at line 55 of file SimRunner.h.

References m_clock.

const boost::property_tree::ptree& stride::SimRunner::GetConfig ( ) const
inline

Return the run & sim configuration.

Definition at line 58 of file SimRunner.h.

References m_config.

std::shared_ptr<Sim> stride::SimRunner::GetSim ( ) const
inline

Return the Simulator.

Definition at line 61 of file SimRunner.h.

References m_sim, and Run().

Here is the call graph for this function:

void stride::SimRunner::Run ( )

Run simulator for as many steps/days as indicated in config.

Definition at line 76 of file SimRunner.cpp.

References m_config.

Referenced by GetSim().

Here is the caller graph for this function:

void stride::SimRunner::Run ( unsigned int  numSteps)

Run simulator for numSteps steps/days.

Definition at line 41 of file SimRunner.cpp.

References m_clock, m_config, m_sim, stride::util::Subject< stride::sim_event::Id >::Notify(), stride::util::Stopwatch< T >::Start(), and stride::util::Stopwatch< T >::Stop().

Here is the call graph for this function:

Member Data Documentation

util::Stopwatch stride::SimRunner::m_clock
private

Stopwatch for timing the computation.

Definition at line 70 of file SimRunner.h.

Referenced by GetClock(), Run(), and SimRunner().

boost::property_tree::ptree stride::SimRunner::m_config
private

Ptree with configuration.

Definition at line 71 of file SimRunner.h.

Referenced by GetConfig(), and Run().

std::shared_ptr<Sim> stride::SimRunner::m_sim
private

Simulator object.

Definition at line 72 of file SimRunner.h.

Referenced by GetSim(), and Run().


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