Simulation< M > Class Template Reference

CPP API: mio::abm::Simulation< M > Class Template Reference
mio::abm::Simulation< M > Class Template Reference

Run the Simulation in discrete steps, evolve the Model and report results. More...

#include <simulation.h>

Collaboration diagram for mio::abm::Simulation< M >:

Public Types

using Model = M
 

Public Member Functions

template<typename... History>
void advance (TimePoint tmax, History &... history)
 Run the Simulation from the current time to tmax. More...
 
Modelget_model ()
 Get the Model that this Simulation evolves. More...
 
const Modelget_model () const
 
TimePoint get_time () const
 Get the current time of the Simulation. More...
 
 Simulation (TimePoint t0, Model &&model)
 Create a simulation. More...
 
 Simulation (TimePoint t0, size_t num_agegroups)
 Create a Simulation with an empty Model. More...
 

Private Member Functions

void evolve_model (TimePoint tmax)
 
void store_result_at (TimePoint t)
 

Private Attributes

TimeSpan m_dt
 The length of the time steps. More...
 
Model m_model
 The Model to simulate. More...
 
TimePoint m_t
 The current TimePoint of the Simulation. More...
 

Detailed Description

template<class M = Model>
class mio::abm::Simulation< M >

Run the Simulation in discrete steps, evolve the Model and report results.

Member Typedef Documentation

◆ Model

template<class M = Model>
using mio::abm::Simulation< M >::Model = M

Constructor & Destructor Documentation

◆ Simulation() [1/2]

template<class M = Model>
mio::abm::Simulation< M >::Simulation ( TimePoint  t0,
Model &&  model 
)
inline

Create a simulation.

Parameters
[in]t0The starting time of the Simulation.
[in]modelThe Model to simulate.

◆ Simulation() [2/2]

template<class M = Model>
mio::abm::Simulation< M >::Simulation ( TimePoint  t0,
size_t  num_agegroups 
)
inline

Create a Simulation with an empty Model.

Model needs to be filled later.

See also
Simulation::get_model
Parameters
[in]t0The starting time of the Simulation.

Member Function Documentation

◆ advance()

template<class M = Model>
template<typename... History>
void mio::abm::Simulation< M >::advance ( TimePoint  tmax,
History &...  history 
)
inline

Run the Simulation from the current time to tmax.

Parameters
[in]tmaxTime to stop.
[in]historyHistory object to log data of the Simulation.

◆ evolve_model()

template<class M = Model>
void mio::abm::Simulation< M >::evolve_model ( TimePoint  tmax)
inlineprivate

◆ get_model() [1/2]

template<class M = Model>
Model& mio::abm::Simulation< M >::get_model ( )
inline

Get the Model that this Simulation evolves.

◆ get_model() [2/2]

template<class M = Model>
const Model& mio::abm::Simulation< M >::get_model ( ) const
inline

◆ get_time()

template<class M = Model>
TimePoint mio::abm::Simulation< M >::get_time ( ) const
inline

Get the current time of the Simulation.

◆ store_result_at()

template<class M = Model>
void mio::abm::Simulation< M >::store_result_at ( TimePoint  t)
private

Member Data Documentation

◆ m_dt

template<class M = Model>
TimeSpan mio::abm::Simulation< M >::m_dt
private

The length of the time steps.

◆ m_model

template<class M = Model>
Model mio::abm::Simulation< M >::m_model
private

The Model to simulate.

◆ m_t

template<class M = Model>
TimePoint mio::abm::Simulation< M >::m_t
private

The current TimePoint of the Simulation.