ConstantFunction< FP > Struct Template Reference

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

Class that defines a constant function. More...

#include <state_age_function.h>

Inheritance diagram for mio::ConstantFunction< FP >:
Collaboration diagram for mio::ConstantFunction< FP >:

Public Member Functions

 ConstantFunction (FP init_distribution_parameter)
 Constructs a new ConstantFunction object. More...
 
FP eval (FP state_age) override
 Defines constant function. More...
 
FP get_mean (FP dt=1.0, FP tol=1e-10) override
 Computes the mean value of the function. More...
 
FP get_support_max (FP dt, FP tol=1e-10) override
 Computes the maximum of the support of the function. More...
 
- Public Member Functions inherited from mio::StateAgeFunction< FP >
std::unique_ptr< StateAgeFunction< FP > > clone () const
 Clones unique pointer to a StateAgeFunction. More...
 
FP get_distribution_parameter () const
 Get the m_distribution_parameter object. More...
 
FP get_location () const
 Get the m_location object. More...
 
FP get_scale () const
 Get the m_scale object. More...
 
std::string get_state_age_function_type () const
 Get type of StateAgeFunction, i.e.which derived class is used. More...
 
StateAgeFunction< FP > & operator= (const StateAgeFunction< FP > &other)=default
 Copy assignment operator. More...
 
StateAgeFunction< FP > & operator= (StateAgeFunction< FP > &&other)=default
 Move assignment operator. More...
 
bool operator== (const StateAgeFunction< FP > &other) const
 Comparison operator. More...
 
void set_distribution_parameter (FP new_distribution_parameter)
 Set the m_distribution_parameter object. More...
 
void set_location (FP new_location)
 Set the m_location object. More...
 
void set_scale (FP new_scale)
 Set the m_scale object. More...
 
 StateAgeFunction (const StateAgeFunction< FP > &other)=default
 Copy constructor. More...
 
 StateAgeFunction (FP init_distribution_parameter, FP init_location=0, FP init_scale=1)
 Constructs a new StateAgeFunction object. More...
 
 StateAgeFunction (StateAgeFunction< FP > &&other)=default
 Move constructor. More...
 
virtual ~StateAgeFunction ()=default
 Virtual destructor. More...
 

Protected Member Functions

StateAgeFunction< FP > * clone_impl () const override
 Clones unique pointer to a StateAgeFunction. More...
 

Additional Inherited Members

- Protected Attributes inherited from mio::StateAgeFunction< FP >
FP m_distribution_parameter
 Parameter for function in derived class. More...
 
FP m_location
 Location parameter for function in derived class. More...
 
FP m_mean
 Mean value of the function. More...
 
FP m_mean_tol {-1.0}
 Tolerance for computation of the mean (initialize as not set). More...
 
FP m_scale
 Scale parameter for function in derived class. More...
 
FP m_support_max
 Maximum of the support of the function. More...
 
FP m_support_tol {-1.0}
 Tolerance for computation of the support (initialize as not set). More...
 

Detailed Description

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

Class that defines a constant function.

Constructor & Destructor Documentation

◆ ConstantFunction()

template<typename FP >
mio::ConstantFunction< FP >::ConstantFunction ( FP  init_distribution_parameter)
inline

Constructs a new ConstantFunction object.

Parameters
init_distribution_parameterspecifies value of the constant function.

Member Function Documentation

◆ clone_impl()

template<typename FP >
StateAgeFunction<FP>* mio::ConstantFunction< FP >::clone_impl ( ) const
inlineoverrideprotectedvirtual

Clones unique pointer to a StateAgeFunction.

Returns
std::unique_ptr<StateAgeFunction> unique pointer to a StateAgeFunction

Implements mio::StateAgeFunction< FP >.

◆ eval()

template<typename FP >
FP mio::ConstantFunction< FP >::eval ( FP  state_age)
inlineoverridevirtual

Defines constant function.

The function parameter defines the value of the function.

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

Implements mio::StateAgeFunction< FP >.

◆ get_mean()

template<typename FP >
FP mio::ConstantFunction< FP >::get_mean ( FP  dt = 1.0,
FP  tol = 1e-10 
)
inlineoverridevirtual

Computes the mean value of the function.

For ConstantFunction, the mean value is the function parameter.

Parameters
[in]dtTime step size used for the numerical integration (unused for ConstantFunction).
[in]tolThe maximum support used for numerical integration is calculated using this tolerance (unused for ConstantFunction).
Returns
ScalarType mean value.

Reimplemented from mio::StateAgeFunction< FP >.

◆ get_support_max()

template<typename FP >
FP mio::ConstantFunction< FP >::get_support_max ( FP  dt,
FP  tol = 1e-10 
)
inlineoverridevirtual

Computes the maximum of the support of the function.

For ConstantFunction the maximum of the support would be infinity. This is why we do not want to use it as a TransitionDistribution and getting the maximum of the support doe not make sense.

Parameters
[in]dtTime step size.
[in]tolTolerance used for cutting the support if the function value falls below.
Returns
ScalarType support_max

Reimplemented from mio::StateAgeFunction< FP >.