Model< FP > Class Template Reference

CPP API: mio::oseir::Model< FP > Class Template Reference
mio::oseir::Model< FP > Class Template Reference

#include <model.h>

Inheritance diagram for mio::oseir::Model< FP >:
Collaboration diagram for mio::oseir::Model< FP >:

Public Member Functions

void get_flows (Eigen::Ref< const Eigen::VectorX< FP >> pop, Eigen::Ref< const Eigen::VectorX< FP >> y, FP t, Eigen::Ref< Eigen::VectorX< FP >> flows) const override
 
IOResult< FP > get_reproduction_number (FP t_value, const mio::TimeSeries< FP > &y)
 Computes the reproduction number at a given time point of the Model output obtained by the Simulation. More...
 
IOResult< FP > get_reproduction_number (size_t t_idx, const mio::TimeSeries< FP > &y)
 Computes the reproduction number at a given index time of the Model output obtained by the Simulation. More...
 
Eigen::VectorX< FP > get_reproduction_numbers (const mio::TimeSeries< FP > &y)
 Computes the reproduction number for all time points of the Model output obtained by the Simulation. More...
 
 Model (const Populations &pop, const ParameterSet &params)
 
 Model (int num_agegroups)
 
template<class IOContext >
void serialize (IOContext &io) const
 serialize this. More...
 
- Public Member Functions inherited from mio::FlowModel< FP, InfectionState, mio::Populations< FP, AgeGroup, InfectionState >, Parameters< FP >, Flows >
 FlowModel (Args... args)
 Default constructor, forwarding args to Base constructor. More...
 
void get_derivatives (Eigen::Ref< const Eigen::VectorX< FP >> flows, Eigen::Ref< Eigen::VectorX< FP >> dydt) const
 Compute the right-hand-side of the ODE dydt = f(y, t) from flow values. More...
 
void get_derivatives (Eigen::Ref< const Eigen::VectorX< FP >> pop, Eigen::Ref< const Eigen::VectorX< FP >> y, FP t, Eigen::Ref< Eigen::VectorX< FP >> dydt) const final
 Compute the right-hand-side f(y, t) of the ODE and store it in dydt. More...
 
constexpr size_t get_flat_flow_index () const
 A flat index into an array of flows (as computed by get_flows), if the only used category in Pop is Comp. More...
 
size_t get_flat_flow_index (const FlowIndex &indices) const
 A flat index into an array of flows (as computed by get_flows), given the indices of each category. More...
 
Eigen::VectorX< FP > get_initial_flows () const
 Initial values for flows. More...
 
- Public Member Functions inherited from mio::CompartmentalModel< FP, InfectionState, mio::Populations< FP, AgeGroup, InfectionState >, Parameters< FP > >
bool apply_constraints ()
 Checks whether the model satisfies all constraints. More...
 
bool check_constraints () const
 Checks that the model satisfies all constraints (e.g. More...
 
 CompartmentalModel (CompartmentalModel &&)=default
 
 CompartmentalModel (const CompartmentalModel &)=default
 
 CompartmentalModel (Populations const &po, ParameterSet const &pa)
 CompartmentalModel default constructor. More...
 
void eval_right_hand_side (Eigen::Ref< const Eigen::VectorX< FP >> pop, Eigen::Ref< const Eigen::VectorX< FP >> y, FP t, Eigen::Ref< Eigen::VectorX< FP >> dydt) const
 This function evaluates the right-hand-side f of the ODE dydt = f(y, t). More...
 
Eigen::VectorX< FP > get_initial_values () const
 Get the initial conditions for the ODE dydt = f(y, t). More...
 
CompartmentalModeloperator= (CompartmentalModel &&)=default
 
CompartmentalModeloperator= (const CompartmentalModel &)=default
 
virtual ~CompartmentalModel ()=default
 

Static Public Member Functions

template<class IOContext >
static IOResult< Modeldeserialize (IOContext &io)
 deserialize an object of this class. More...
 

Private Types

using Base = FlowModel< FP, InfectionState, mio::Populations< FP, AgeGroup, InfectionState >, Parameters< FP >, Flows >
 

Additional Inherited Members

- Public Types inherited from mio::FlowModel< FP, InfectionState, mio::Populations< FP, AgeGroup, InfectionState >, Parameters< FP >, Flows >
using Base = CompartmentalModel< FP, InfectionState, mio::Populations< FP, AgeGroup, InfectionState >, Parameters< FP > >
 
- Public Types inherited from mio::CompartmentalModel< FP, InfectionState, mio::Populations< FP, AgeGroup, InfectionState >, Parameters< FP > >
using Compartments = InfectionState
 
using ParameterSet = Parameters< FP >
 
using Populations = mio::Populations< FP, AgeGroup, InfectionState >
 
- Public Attributes inherited from mio::CompartmentalModel< FP, InfectionState, mio::Populations< FP, AgeGroup, InfectionState >, Parameters< FP > >
ParameterSet parameters
 
Populations populations
 

Member Typedef Documentation

◆ Base

template<typename FP >
using mio::oseir::Model< FP >::Base = FlowModel<FP, InfectionState, mio::Populations<FP, AgeGroup, InfectionState>, Parameters<FP>, Flows>
private

Constructor & Destructor Documentation

◆ Model() [1/2]

template<typename FP >
mio::oseir::Model< FP >::Model ( const Populations pop,
const ParameterSet params 
)
inline

◆ Model() [2/2]

template<typename FP >
mio::oseir::Model< FP >::Model ( int  num_agegroups)
inline

Member Function Documentation

◆ deserialize()

template<typename FP >
template<class IOContext >
static IOResult<Model> mio::oseir::Model< FP >::deserialize ( IOContext &  io)
inlinestatic

deserialize an object of this class.

See also
mio::deserialize

◆ get_flows()

template<typename FP >
void mio::oseir::Model< FP >::get_flows ( Eigen::Ref< const Eigen::VectorX< FP >>  pop,
Eigen::Ref< const Eigen::VectorX< FP >>  y,
FP  t,
Eigen::Ref< Eigen::VectorX< FP >>  flows 
) const
inlineoverridevirtual

◆ get_reproduction_number() [1/2]

template<typename FP >
IOResult<FP> mio::oseir::Model< FP >::get_reproduction_number ( FP  t_value,
const mio::TimeSeries< FP > &  y 
)
inline

Computes the reproduction number at a given time point of the Model output obtained by the Simulation.

If the particular time point is not inside the output, a linearly interpolated value is returned.

Parameters
t_valueThe time point at which the reproduction number is computed.
yThe TimeSeries obtained from the Model Simulation.
Returns
The computed reproduction number at the provided time point, potentially using linear interpolation.

◆ get_reproduction_number() [2/2]

template<typename FP >
IOResult<FP> mio::oseir::Model< FP >::get_reproduction_number ( size_t  t_idx,
const mio::TimeSeries< FP > &  y 
)
inline

Computes the reproduction number at a given index time of the Model output obtained by the Simulation.

Parameters
t_idxThe index time at which the reproduction number is computed.
yThe TimeSeries obtained from the Model Simulation.
Returns
The computed reproduction number at the provided index time.

◆ get_reproduction_numbers()

template<typename FP >
Eigen::VectorX<FP> mio::oseir::Model< FP >::get_reproduction_numbers ( const mio::TimeSeries< FP > &  y)
inline

Computes the reproduction number for all time points of the Model output obtained by the Simulation.

Parameters
yThe TimeSeries obtained from the Model Simulation.
Returns
vector containing all reproduction numbers

◆ serialize()

template<typename FP >
template<class IOContext >
void mio::oseir::Model< FP >::serialize ( IOContext &  io) const
inline

serialize this.

See also
mio::serialize