MobilityEdge< FP > Class Template Reference

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

represents the mobility between two nodes. More...

#include <metapopulation_mobility_instant.h>

Public Member Functions

template<class Sim >
void apply_mobility (FP t, FP dt, SimulationNode< FP, Sim > &node_from, SimulationNode< FP, Sim > &node_to)
 compute mobility from node_from to node_to. More...
 
const MobilityParameters< FP > & get_parameters () const
 get the mobility parameters. More...
 
 MobilityEdge (const Eigen::VectorX< FP > &coeffs)
 Create edge with coefficients. More...
 
 MobilityEdge (const Eigen::VectorX< FP > &coeffs, const std::vector< std::vector< size_t >> &save_indices)
 Create edge with coefficients and a 2D vector of indices which determine which compartments are saved. More...
 
 MobilityEdge (const MobilityParameters< FP > &params)
 Create edge with coefficients. More...
 
 MobilityEdge (const MobilityParameters< FP > &params, const std::vector< std::vector< size_t >> &save_indices)
 Create edge with coefficients as MobilityParameters object and a 2D vector of indices which determine which compartments are saved. More...
 
TimeSeries< FP > & get_mobility_results ()
 Get the count of commuters in selected compartments, along with the total number of commuters. More...
 
const TimeSeries< FP > & get_mobility_results () const
 Get the count of commuters in selected compartments, along with the total number of commuters. More...
 

Private Member Functions

void add_mobility_result_time_point (const FP t)
 Computes a condensed version of m_mobile_population and stores it in m_mobility_results. More...
 

Private Attributes

std::pair< FP, SimulationTime< FP > > m_dynamic_npi = {-std::numeric_limits<FP>::max(), SimulationTime<FP>(0)}
 
TimeSeries< FP > m_mobile_population
 
TimeSeries< FP > m_mobility_results
 
MobilityParameters< FP > m_parameters
 
bool m_return_mobile_population
 
TimeSeries< FP > m_return_times
 
std::vector< std::vector< size_t > > m_saved_compartment_indices
 
FP m_t_last_dynamic_npi_check = -std::numeric_limits<FP>::infinity()
 

Detailed Description

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

represents the mobility between two nodes.

Constructor & Destructor Documentation

◆ MobilityEdge() [1/4]

template<typename FP >
mio::MobilityEdge< FP >::MobilityEdge ( const MobilityParameters< FP > &  params)
inline

Create edge with coefficients.

Parameters
coeffs% of people in each group and compartment that change node in each time step.

◆ MobilityEdge() [2/4]

template<typename FP >
mio::MobilityEdge< FP >::MobilityEdge ( const Eigen::VectorX< FP > &  coeffs)
inline

Create edge with coefficients.

Parameters
[in]coeffsAn Eigen::VectorX<FP> representing the percentage of people in each group and compartment that change nodes in each time step.

◆ MobilityEdge() [3/4]

template<typename FP >
mio::MobilityEdge< FP >::MobilityEdge ( const MobilityParameters< FP > &  params,
const std::vector< std::vector< size_t >> &  save_indices 
)
inline

Create edge with coefficients as MobilityParameters object and a 2D vector of indices which determine which compartments are saved.

Parameters
[in]paramsA MobilityParameters object representing the percentage of people in each group and compartment that change nodes in each time step.
[in]save_indicesA 2D vector of indices. The outer vector represents different sets of compartments. Each inner vector represents a group of indices to be saved.

◆ MobilityEdge() [4/4]

template<typename FP >
mio::MobilityEdge< FP >::MobilityEdge ( const Eigen::VectorX< FP > &  coeffs,
const std::vector< std::vector< size_t >> &  save_indices 
)
inline

Create edge with coefficients and a 2D vector of indices which determine which compartments are saved.

Parameters
[in]coeffsAn Eigen::VectorX<FP> representing the percentage of people in each group and compartment that migrate in each time step.
[in]save_indicesA 2D vector of indices. The outer vector represents different sets of compartments, while each inner vector represents a group of indices for compartments to be saved.

Member Function Documentation

◆ add_mobility_result_time_point()

template<typename FP >
void mio::MobilityEdge< FP >::add_mobility_result_time_point ( const FP  t)
private

Computes a condensed version of m_mobile_population and stores it in m_mobility_results.

The m_mobility_results then only contains commuters with infection states InfectedNoSymptoms and InfectedSymptoms. Additionally, the total number of commuters is stored in the last entry of m_mobility_results.

Parameters
[in]tThe current time.

◆ apply_mobility()

template<typename FP >
template<class Sim >
void mio::MobilityEdge< FP >::apply_mobility ( FP  t,
FP  dt,
SimulationNode< FP, Sim > &  node_from,
SimulationNode< FP, Sim > &  node_to 
)

compute mobility from node_from to node_to.

mobility is based on coefficients. The mobile population is added to the current state of node_to, subtracted from node_from. on return, the mobile population (adjusted for infections) is subtracted from node_to, added to node_from.

Parameters
tcurrent time
dtlast time step (fixed to 0.5 for mobility model)
node_fromnode that people changed from, return to
node_tonode that people changed to, return from

◆ get_mobility_results() [1/2]

template<typename FP >
TimeSeries<FP>& mio::MobilityEdge< FP >::get_mobility_results ( )
inline

Get the count of commuters in selected compartments, along with the total number of commuters.

Returns
A reference to the TimeSeries object representing the mobility results.

◆ get_mobility_results() [2/2]

template<typename FP >
const TimeSeries<FP>& mio::MobilityEdge< FP >::get_mobility_results ( ) const
inline

Get the count of commuters in selected compartments, along with the total number of commuters.

Returns
A reference to the TimeSeries object representing the mobility results.

◆ get_parameters()

template<typename FP >
const MobilityParameters<FP>& mio::MobilityEdge< FP >::get_parameters ( ) const
inline

get the mobility parameters.

Member Data Documentation

◆ m_dynamic_npi

template<typename FP >
std::pair<FP, SimulationTime<FP> > mio::MobilityEdge< FP >::m_dynamic_npi = {-std::numeric_limits<FP>::max(), SimulationTime<FP>(0)}
private

◆ m_mobile_population

template<typename FP >
TimeSeries<FP> mio::MobilityEdge< FP >::m_mobile_population
private

◆ m_mobility_results

template<typename FP >
TimeSeries<FP> mio::MobilityEdge< FP >::m_mobility_results
private

◆ m_parameters

template<typename FP >
MobilityParameters<FP> mio::MobilityEdge< FP >::m_parameters
private

◆ m_return_mobile_population

template<typename FP >
bool mio::MobilityEdge< FP >::m_return_mobile_population
private

◆ m_return_times

template<typename FP >
TimeSeries<FP> mio::MobilityEdge< FP >::m_return_times
private

◆ m_saved_compartment_indices

template<typename FP >
std::vector<std::vector<size_t> > mio::MobilityEdge< FP >::m_saved_compartment_indices
private

◆ m_t_last_dynamic_npi_check

template<typename FP >
FP mio::MobilityEdge< FP >::m_t_last_dynamic_npi_check = -std::numeric_limits<FP>::infinity()
private