FlowSimulationBase< FP, M, Integrands > Class Template Reference
|
CPP API
|
Base class to define a FlowSimulation. More...
#include <flow_simulation_base.h>
Public Types | |
| using | Base = SimulationBase< FP, M, Integrands... > |
| using | Core = IntegratorCore< FP, Integrands... > |
| using | Model = M |
Public Types inherited from mio::details::SimulationBase< FP, M, Integrands... > | |
| using | Core = IntegratorCore< FP, Integrands... > |
| using | Model = M |
Public Member Functions | |
| FlowSimulationBase (Model const &model, std::unique_ptr< Core > &&integrator_core, FP t0, FP dt) | |
| Create a FlowSimulationBase. More... | |
| TimeSeries< FP > & | get_flows () |
| Returns the simulation result describing the transitions between compartments for each time step. More... | |
| const TimeSeries< FP > & | get_flows () const |
| Returns the simulation result describing the transitions between compartments for each time step. More... | |
Public Member Functions inherited from mio::details::SimulationBase< FP, M, Integrands... > | |
| SimulationBase & | operator= (const SimulationBase &other) |
| void | set_integrator_core (std::unique_ptr< Core > &&integrator_core) |
| Set the IntegratorCore used in the simulation. More... | |
| SimulationBase (const SimulationBase &other) | |
| SimulationBase (Model const &model, std::unique_ptr< Core > &&integrator_core, FP t0, FP dt) | |
| Create a SimulationBase. More... | |
| Core & | get_integrator_core () |
| Access the IntegratorCore used in the simulation. More... | |
| const Core & | get_integrator_core () const |
| Access the IntegratorCore used in the simulation. More... | |
| TimeSeries< FP > & | get_result () |
| Returns the simulation result describing the model population in each time step. More... | |
| const TimeSeries< FP > & | get_result () const |
| Returns the simulation result describing the model population in each time step. More... | |
| const Model & | get_model () const |
| Get a reference to the model owned and used by the simulation. More... | |
| Model & | get_model () |
| Get a reference to the model owned and used by the simulation. More... | |
| FP & | get_dt () |
| Returns the step size used by the integrator. More... | |
| const FP & | get_dt () const |
| Returns the step size used by the integrator. More... | |
Protected Member Functions | |
| void | compute_population_results () |
| Computes the distribution of the Population to the InfectionStates based on the simulated flows. More... | |
Protected Member Functions inherited from mio::details::SimulationBase< FP, M, Integrands... > | |
| Eigen::Ref< Eigen::VectorX< FP > > | advance (const Integrands &... fs, FP tmax, TimeSeries< FP > &results) |
| Run the simulation up to a given time. More... | |
Private Attributes | |
| mio::TimeSeries< FP > | m_flow_result |
| Flow result of the simulation. More... | |
Detailed Description
template<typename FP, IsFlowModel< FP > M, class... Integrands>
class mio::details::FlowSimulationBase< FP, M, Integrands >
Base class to define a FlowSimulation.
Provides a protected advance method that accepts the specified integrands, that must be exposed by the Derived class. Also defines all relevant members and accessors for a FlowSimulation.
- Template Parameters
-
FP A floating point type, e.g. double. M An implementation of FlowModel. Integrands One or more function types used for defining the right hand side of a system of equations.
Member Typedef Documentation
◆ Base
| using mio::details::FlowSimulationBase< FP, M, Integrands >::Base = SimulationBase<FP, M, Integrands...> |
◆ Core
| using mio::details::FlowSimulationBase< FP, M, Integrands >::Core = IntegratorCore<FP, Integrands...> |
◆ Model
| using mio::details::FlowSimulationBase< FP, M, Integrands >::Model = M |
Constructor & Destructor Documentation
◆ FlowSimulationBase()
|
inline |
Create a FlowSimulationBase.
- Parameters
-
[in] model An instance of a FlowModel. [in] integrator_core A unique pointer to an object derived from IntegratorCore. [in] t0 Start time. [in] dt Initial step size of integration.
Member Function Documentation
◆ compute_population_results()
|
inlineprotected |
Computes the distribution of the Population to the InfectionStates based on the simulated flows.
Uses the same method as the DerivFunction used in advance to compute the population given the flows and initial values. Adds time points to Base::m_result until it has the same number of time points as m_flow_result. Does not recalculate older values.
◆ get_flows() [1/2]
|
inline |
Returns the simulation result describing the transitions between compartments for each time step.
Which flows are used by the model is defined by the Flows template argument for the FlowModel. To get the correct index for the flow between two compartments use FlowModel::get_flat_flow_index.
- Returns
- A TimeSeries to represent a numerical solution for the flows in the model. For each simulated time step, the TimeSeries contains the value of each flow.
◆ get_flows() [2/2]
|
inline |
Returns the simulation result describing the transitions between compartments for each time step.
Which flows are used by the model is defined by the Flows template argument for the FlowModel. To get the correct index for the flow between two compartments use FlowModel::get_flat_flow_index.
- Returns
- A TimeSeries to represent a numerical solution for the flows in the model. For each simulated time step, the TimeSeries contains the value of each flow.
Member Data Documentation
◆ m_flow_result
|
private |
Flow result of the simulation.
Generated by
Public Types inherited from