SmootherCosine< FP > Struct Template Reference

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

Class that defines an smoother_cosine function depending on the state age. More...

#include <state_age_function.h>

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

Public Member Functions

FP eval (FP state_age) override
 Defines smoother cosine function depending on state_age. 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...
 
 SmootherCosine (FP init_distribution_parameter, FP init_location=0)
 Constructs a new SmootherCosine object. 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::SmootherCosine< FP >

Class that defines an smoother_cosine function depending on the state age.

This function is a StateAgeFunction of type a) and can therefore be seen as a survival function.

Constructor & Destructor Documentation

◆ SmootherCosine()

template<typename FP >
mio::SmootherCosine< FP >::SmootherCosine ( FP  init_distribution_parameter,
FP  init_location = 0 
)
inline

Constructs a new SmootherCosine object.

This function is a StateAgeFunction of type a) and can therefore be seen as a survival function.

Parameters
[in]init_distribution_parameterspecifies the initial parameter of the function.
[in]init_locationLocation paramter to shift the SmootherCosine function. Should be a positive number to fulfill characteristics of a TransitionDistribution.

Member Function Documentation

◆ clone_impl()

template<typename FP >
StateAgeFunction<FP>* mio::SmootherCosine< 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::SmootherCosine< FP >::eval ( FP  state_age)
inlineoverridevirtual

Defines smoother cosine function depending on state_age.

Used function goes through points (0+m_location,1) and (m_distribution_parameter+m_location,0) and is interpolated in between using a smoothed cosine function.

Parameters
[in]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::SmootherCosine< FP >::get_mean ( FP  dt = 1.0,
FP  tol = 1e-10 
)
inlineoverridevirtual

Computes the mean value of the function.

For the associated distribution to SmootherCosine, the mean value is 0.5 * m_distribution_parameter + m_location.

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

Reimplemented from mio::StateAgeFunction< FP >.

◆ get_support_max()

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

Computes the maximum of the support of the function.

For SmootherCosine, the maximum of the support is equal to the function parameter.

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 >.