DampingSampling< FP > Class Template Reference

CPP API: mio::DampingSampling< FP > Class Template Reference
mio::DampingSampling< FP > Class Template Reference

randomly sample dampings for e.g. More...

#include <damping_sampling.h>

Collaboration diagram for mio::DampingSampling< FP >:

Public Member Functions

template<class V >
 DampingSampling (const UncertainValue< FP > &value, DampingLevel level, DampingType type, SimulationTime< FP > time, const std::vector< size_t > matrices, const Eigen::MatrixBase< V > &groups)
 Creates a DampingSampling. More...
 
void draw_sample ()
 draw a value from the distribution. More...
 
const Eigen::VectorX< FP > & get_group_weights () const
 Get the group weights. More...
 
DampingLevel get_level () const
 Get the damping level. More...
 
const std::vector< size_t > & get_matrix_indices () const
 Get a list of matrix indices that the damping applies to. More...
 
SimulationTime< FP > get_time () const
 Get the time the damping becomes active. More...
 
DampingType get_type () const
 Get the damping type. More...
 
template<class IOContext >
void serialize (IOContext &io) const
 serialize this. More...
 
template<class V >
void set_group_weights (const Eigen::MatrixBase< V > &v)
 Set the group weights. More...
 
void set_level (DampingLevel l)
 Set the damping level. More...
 
void set_matrix_indices (const std::vector< size_t > &v)
 Set a list of matrix indices that the damping applies to. More...
 
void set_time (SimulationTime< FP > t)
 Set the time the damping becomes active. More...
 
void set_type (DampingType t)
 Set the damping type. More...
 
void set_value (const UncertainValue< FP > &v)
 Set the random value. More...
 
const UncertainValue< FP > & get_value () const
 Get the random value. More...
 
UncertainValue< FP > & get_value ()
 Get the random value. More...
 
bool operator== (const DampingSampling &other) const
 equality comparison operators. More...
 
bool operator!= (const DampingSampling &other) const
 equality comparison operators. More...
 

Static Public Member Functions

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

Private Attributes

Eigen::VectorX< FP > m_groups
 
DampingLevel m_level
 
std::vector< size_t > m_matrices
 
SimulationTime< FP > m_time
 
DampingType m_type
 
UncertainValue< FP > m_value
 

Detailed Description

template<typename FP>
class mio::DampingSampling< FP >

randomly sample dampings for e.g.

contact matrices. All coefficients of the damping matrix depend on a single random value. The damping applies to one or more of the matrices of a DampingExpressionGroup (e.g. ContactMatrixGroup). The damping value is weighted by group (e.g. age) to be able to e.g. construct dampings that only apply to specific groups.

Constructor & Destructor Documentation

◆ DampingSampling()

template<typename FP >
template<class V >
mio::DampingSampling< FP >::DampingSampling ( const UncertainValue< FP > &  value,
DampingLevel  level,
DampingType  type,
SimulationTime< FP >  time,
const std::vector< size_t >  matrices,
const Eigen::MatrixBase< V > &  groups 
)
inline

Creates a DampingSampling.

Parameters
valuerandom value that all matrix coefficients depend on.
levellevel of the damping.
typetype of the damping.
timetime of the damping.
matriceslist of matrix indices that the damping applies to.
groupsweights of age groups.

Member Function Documentation

◆ deserialize()

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

deserialize an object of this class.

See also
mio::deserialize

◆ draw_sample()

template<typename FP >
void mio::DampingSampling< FP >::draw_sample ( )
inline

draw a value from the distribution.

◆ get_group_weights()

template<typename FP >
const Eigen::VectorX<FP>& mio::DampingSampling< FP >::get_group_weights ( ) const
inline

Get the group weights.

The groups correspond to e.g. age groups in the SECIR model.

Returns
weights of groups.

◆ get_level()

template<typename FP >
DampingLevel mio::DampingSampling< FP >::get_level ( ) const
inline

Get the damping level.

Returns
damping level.

◆ get_matrix_indices()

template<typename FP >
const std::vector<size_t>& mio::DampingSampling< FP >::get_matrix_indices ( ) const
inline

Get a list of matrix indices that the damping applies to.

The indices correspond to the indices of matrix in a DampingExpressionGroup (e.g. ContactMatrixGroup).

Returns
list of matrix indices.

◆ get_time()

template<typename FP >
SimulationTime<FP> mio::DampingSampling< FP >::get_time ( ) const
inline

Get the time the damping becomes active.

Returns
the damping time.

◆ get_type()

template<typename FP >
DampingType mio::DampingSampling< FP >::get_type ( ) const
inline

Get the damping type.

Returns
damping type.

◆ get_value() [1/2]

template<typename FP >
UncertainValue<FP>& mio::DampingSampling< FP >::get_value ( )
inline

Get the random value.

Returns
the random value.

◆ get_value() [2/2]

template<typename FP >
const UncertainValue<FP>& mio::DampingSampling< FP >::get_value ( ) const
inline

Get the random value.

Returns
the random value.

◆ operator!=()

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

equality comparison operators.

◆ operator==()

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

equality comparison operators.

◆ serialize()

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

serialize this.

See also
mio::serialize

◆ set_group_weights()

template<typename FP >
template<class V >
void mio::DampingSampling< FP >::set_group_weights ( const Eigen::MatrixBase< V > &  v)
inline

Set the group weights.

Parameters
va vector expression of group weights.
Template Parameters
VEigen3 vector expression type.

◆ set_level()

template<typename FP >
void mio::DampingSampling< FP >::set_level ( DampingLevel  l)
inline

Set the damping level.

Parameters
lthe damping level

◆ set_matrix_indices()

template<typename FP >
void mio::DampingSampling< FP >::set_matrix_indices ( const std::vector< size_t > &  v)
inline

Set a list of matrix indices that the damping applies to.

Returns
list of matrix indices.

◆ set_time()

template<typename FP >
void mio::DampingSampling< FP >::set_time ( SimulationTime< FP >  t)
inline

Set the time the damping becomes active.

Parameters
tthe damping time.

◆ set_type()

template<typename FP >
void mio::DampingSampling< FP >::set_type ( DampingType  t)
inline

Set the damping type.

Parameters
tthe damping type.

◆ set_value()

template<typename FP >
void mio::DampingSampling< FP >::set_value ( const UncertainValue< FP > &  v)
inline

Set the random value.

Parameters
vrandom value.

Member Data Documentation

◆ m_groups

template<typename FP >
Eigen::VectorX<FP> mio::DampingSampling< FP >::m_groups
private

◆ m_level

template<typename FP >
DampingLevel mio::DampingSampling< FP >::m_level
private

◆ m_matrices

template<typename FP >
std::vector<size_t> mio::DampingSampling< FP >::m_matrices
private

◆ m_time

template<typename FP >
SimulationTime<FP> mio::DampingSampling< FP >::m_time
private

◆ m_type

template<typename FP >
DampingType mio::DampingSampling< FP >::m_type
private

◆ m_value

template<typename FP >
UncertainValue<FP> mio::DampingSampling< FP >::m_value
private