StateAgeFunctionWrapper< FP > Struct Template Reference

CPP API: mio::StateAgeFunctionWrapper< FP > Struct Template Reference
mio::StateAgeFunctionWrapper< FP > Struct Template Reference

Wrapper around StateAgeFunction so that one can work with an arbitrary StateAgeFunction. More...

#include <state_age_function.h>

Public Member Functions

FP eval (FP state_age) const
 Accesses eval of m_function. More...
 
FP get_distribution_parameter () const
 Get the m_distribution_parameter object of m_function. More...
 
FP get_location () const
 Get the m_location object of m_function. More...
 
FP get_mean (FP dt=1.0, FP tol=1e-10) const
 Get the m_mean object of m_function. More...
 
FP get_scale () const
 Get the m_scale object of m_function. More...
 
std::string get_state_age_function_type () const
 Get type of StateAgeFunction, i.e. More...
 
FP get_support_max (FP dt, FP tol=1e-10) const
 Get the m_support_max object of m_function. More...
 
StateAgeFunctionWrapper< FP > & operator= (StateAgeFunctionWrapper< FP > &&other)=default
 Move assignment. More...
 
StateAgeFunctionWrapper< FP > & operator= (StateAgeFunctionWrapper< FP > const &other)
 Copy assignment. More...
 
bool operator== (const StateAgeFunctionWrapper< FP > &other) const
 Comparison operator. More...
 
void set_distribution_parameter (FP new_distribution_parameter)
 Set the m_distribution_parameter object of m_function. More...
 
void set_location (FP new_location)
 Set the m_location object of m_function. More...
 
void set_scale (FP new_scale)
 Set the m_scale object of m_function. More...
 
void set_state_age_function (StateAgeFunction< FP > &new_function)
 Set the StateAgeFunction object. More...
 
 StateAgeFunctionWrapper ()
 
 StateAgeFunctionWrapper (StateAgeFunction< FP > &init_function)
 Constructs a new StateAgeFunctionWrapper object. More...
 
 StateAgeFunctionWrapper (StateAgeFunctionWrapper< FP > &&other)=default
 Move constructor. More...
 
 StateAgeFunctionWrapper (StateAgeFunctionWrapper< FP > const &other)
 Copy constructor. More...
 
 ~StateAgeFunctionWrapper ()=default
 Destructor. More...
 

Private Attributes

std::unique_ptr< StateAgeFunction< FP > > m_function
 Stores StateAgeFunction that is used in Wrapper. More...
 

Detailed Description

template<typename FP>
struct mio::StateAgeFunctionWrapper< FP >

Wrapper around StateAgeFunction so that one can work with an arbitrary StateAgeFunction.

This way we can define e.g. the parameter TransmissionProbabilityOnContact as type StateAgeFunctionWrapper and set it with a specific StateAgeFunction for each example.

Example from IDE-SECIR model:

ExponentialSurvivalFunction exponential(1.0); StateAgeFunctionWrapper prob(exponential); model.parameters.set<mio::isecir::TransmissionProbabilityOnContact>(prob);

Constructor & Destructor Documentation

◆ StateAgeFunctionWrapper() [1/4]

template<typename FP >
mio::StateAgeFunctionWrapper< FP >::StateAgeFunctionWrapper ( )
inline

◆ StateAgeFunctionWrapper() [2/4]

template<typename FP >
mio::StateAgeFunctionWrapper< FP >::StateAgeFunctionWrapper ( StateAgeFunction< FP > &  init_function)
inline

Constructs a new StateAgeFunctionWrapper object.

Parameters
[in]init_functionspecifies the initial function.

◆ StateAgeFunctionWrapper() [3/4]

template<typename FP >
mio::StateAgeFunctionWrapper< FP >::StateAgeFunctionWrapper ( StateAgeFunctionWrapper< FP > const &  other)
inline

Copy constructor.

◆ StateAgeFunctionWrapper() [4/4]

template<typename FP >
mio::StateAgeFunctionWrapper< FP >::StateAgeFunctionWrapper ( StateAgeFunctionWrapper< FP > &&  other)
default

Move constructor.

◆ ~StateAgeFunctionWrapper()

template<typename FP >
mio::StateAgeFunctionWrapper< FP >::~StateAgeFunctionWrapper ( )
default

Destructor.

Member Function Documentation

◆ eval()

template<typename FP >
FP mio::StateAgeFunctionWrapper< FP >::eval ( FP  state_age) const
inline

Accesses eval of m_function.

Parameters
[in]state_ageTime at which the function is evaluated.
Returns
Evaluation of the function at state_age.

◆ get_distribution_parameter()

template<typename FP >
FP mio::StateAgeFunctionWrapper< FP >::get_distribution_parameter ( ) const
inline

Get the m_distribution_parameter object of m_function.

Returns
ScalarType

◆ get_location()

template<typename FP >
FP mio::StateAgeFunctionWrapper< FP >::get_location ( ) const
inline

Get the m_location object of m_function.

Returns
ScalarType

◆ get_mean()

template<typename FP >
FP mio::StateAgeFunctionWrapper< FP >::get_mean ( FP  dt = 1.0,
FP  tol = 1e-10 
) const
inline

Get the m_mean object of m_function.

Parameters
[in]dtTime step size used for the numerical integration.
[in]tolThe maximum support used for numerical integration is calculated using this tolerance.
Returns
ScalarType m_mean

◆ get_scale()

template<typename FP >
FP mio::StateAgeFunctionWrapper< FP >::get_scale ( ) const
inline

Get the m_scale object of m_function.

Returns
ScalarType

◆ get_state_age_function_type()

template<typename FP >
std::string mio::StateAgeFunctionWrapper< FP >::get_state_age_function_type ( ) const
inline

Get type of StateAgeFunction, i.e.

which derived class is used.

Returns
string

◆ get_support_max()

template<typename FP >
FP mio::StateAgeFunctionWrapper< FP >::get_support_max ( FP  dt,
FP  tol = 1e-10 
) const
inline

Get the m_support_max object of m_function.

Parameters
[in]dtTime step size at which function will be evaluated.
[in]tolTolerance used for cutting the support if the function value falls below.
Returns
ScalarType m_support_max

◆ operator=() [1/2]

template<typename FP >
StateAgeFunctionWrapper<FP>& mio::StateAgeFunctionWrapper< FP >::operator= ( StateAgeFunctionWrapper< FP > &&  other)
default

Move assignment.

◆ operator=() [2/2]

template<typename FP >
StateAgeFunctionWrapper<FP>& mio::StateAgeFunctionWrapper< FP >::operator= ( StateAgeFunctionWrapper< FP > const &  other)
inline

Copy assignment.

◆ operator==()

template<typename FP >
bool mio::StateAgeFunctionWrapper< FP >::operator== ( const StateAgeFunctionWrapper< FP > &  other) const
inline

Comparison operator.

◆ set_distribution_parameter()

template<typename FP >
void mio::StateAgeFunctionWrapper< FP >::set_distribution_parameter ( FP  new_distribution_parameter)
inline

Set the m_distribution_parameter object of m_function.

Parameters
[in]new_distribution_parameterNew parameter for StateAgeFunction.

◆ set_location()

template<typename FP >
void mio::StateAgeFunctionWrapper< FP >::set_location ( FP  new_location)
inline

Set the m_location object of m_function.

Parameters
[in]new_locationNew location for StateAgeFunction.

◆ set_scale()

template<typename FP >
void mio::StateAgeFunctionWrapper< FP >::set_scale ( FP  new_scale)
inline

Set the m_scale object of m_function.

Parameters
[in]new_scaleNew scale for StateAgeFunction.

◆ set_state_age_function()

template<typename FP >
void mio::StateAgeFunctionWrapper< FP >::set_state_age_function ( StateAgeFunction< FP > &  new_function)
inline

Set the StateAgeFunction object.

Parameters
[in]new_functionfunction that we want to set member m_function to.

Member Data Documentation

◆ m_function

template<typename FP >
std::unique_ptr<StateAgeFunction<FP> > mio::StateAgeFunctionWrapper< FP >::m_function
private

Stores StateAgeFunction that is used in Wrapper.