LctInfectionState< FP, InfectionStates, Ns > Class Template Reference

CPP API: mio::LctInfectionState< FP, InfectionStates, Ns > Class Template Reference
mio::LctInfectionState< FP, InfectionStates, Ns > Class Template Reference

Provides the functionality to be able to work with subcompartments in an LCT model. More...

#include <lct_infection_state.h>

Public Types

using InfectionState = InfectionStates
 

Static Public Member Functions

static Eigen::VectorX< FP > calculate_compartments (const Eigen::VectorX< FP > &subcompartments)
 Cumulates a vector with the number of individuals in each subcompartment (with subcompartments according to the LctInfectionState) to produce a Vector that divides the population only into the infection states defined in InfectionStates. More...
 
template<InfectionState State>
static constexpr size_t get_first_index ()
 Gets the index of the first subcompartment of an infection state. More...
 
template<InfectionState State>
static constexpr size_t get_num_subcompartments ()
 Gets the number of subcompartments in an infection state. More...
 

Static Public Attributes

static constexpr size_t Count {(... + Ns)}
 

Static Private Attributes

static constexpr const std::array< size_t, sizeof...(Ns)> m_subcompartment_numbers
 Vector which defines the number of subcompartments for each infection state of InfectionState. More...
 

Detailed Description

template<typename FP, class InfectionStates, size_t... Ns>
class mio::LctInfectionState< FP, InfectionStates, Ns >

Provides the functionality to be able to work with subcompartments in an LCT model.

This class just stores the number of subcompartments for each InfectionState and not the number of individuals in each subcompartment.

Template Parameters
InfectionStatesAn enum class that defines the basic infection states.
NsNumber of subcompartments for each infection state defined in InfectionState. The number of given template arguments must be equal to the entry Count from InfectionStates.

Member Typedef Documentation

◆ InfectionState

template<typename FP , class InfectionStates , size_t... Ns>
using mio::LctInfectionState< FP, InfectionStates, Ns >::InfectionState = InfectionStates

Member Function Documentation

◆ calculate_compartments()

template<typename FP , class InfectionStates , size_t... Ns>
static Eigen::VectorX<FP> mio::LctInfectionState< FP, InfectionStates, Ns >::calculate_compartments ( const Eigen::VectorX< FP > &  subcompartments)
inlinestatic

Cumulates a vector with the number of individuals in each subcompartment (with subcompartments according to the LctInfectionState) to produce a Vector that divides the population only into the infection states defined in InfectionStates.

Parameters
[in]subcompartmentsVector with number of individuals in each subcompartment. The size of the vector has to match the LctInfectionState.
Returns
Vector with accumulated values for the InfectionStates.

◆ get_first_index()

template<typename FP , class InfectionStates , size_t... Ns>
template<InfectionState State>
static constexpr size_t mio::LctInfectionState< FP, InfectionStates, Ns >::get_first_index ( )
inlinestaticconstexpr

Gets the index of the first subcompartment of an infection state.

In a simulation, the number of individuals in the subcompartments are stored in vectors. Accordingly, the index of the first subcompartment of State in such a vector is returned.

Template Parameters
StateInfection state for which the index should be returned.
Returns
Index of the first subcompartment for a vector with one entry per subcompartment. Returned value is always non-negative.

◆ get_num_subcompartments()

template<typename FP , class InfectionStates , size_t... Ns>
template<InfectionState State>
static constexpr size_t mio::LctInfectionState< FP, InfectionStates, Ns >::get_num_subcompartments ( )
inlinestaticconstexpr

Gets the number of subcompartments in an infection state.

Template Parameters
StateInfection state for which the number of subcompartments should be returned.
Returns
Number of subcompartments for State. Returned value is always at least one.

Member Data Documentation

◆ Count

template<typename FP , class InfectionStates , size_t... Ns>
constexpr size_t mio::LctInfectionState< FP, InfectionStates, Ns >::Count {(... + Ns)}
staticconstexpr

◆ m_subcompartment_numbers

template<typename FP , class InfectionStates , size_t... Ns>
constexpr const std::array<size_t, sizeof...(Ns)> mio::LctInfectionState< FP, InfectionStates, Ns >::m_subcompartment_numbers
staticconstexprprivate
Initial value:
{
Ns...}

Vector which defines the number of subcompartments for each infection state of InfectionState.