SingleWell< InfectionState > Class Template Reference
|
CPP API
|
Implementation of diffusive ABM, see dabm::Model. More...
#include <single_well.h>
Classes | |
| struct | Agent |
Public Types | |
| using | Position = Eigen::Vector2d |
| using | Status = InfectionState |
Public Member Functions | |
| ScalarType | adoption_rate (const Agent &agent, const Status &new_status) const |
| Calculate adoption rate for an Agent. More... | |
| std::map< std::tuple< mio::regions::Region, Status, Status >, mio::AdoptionRate< ScalarType, Status > > & | get_adoption_rates () |
| mio::RandomNumberGenerator & | get_rng () |
| Get the RandomNumberGenerator used by this Model for random events. More... | |
| void | move (const ScalarType, const ScalarType dt, Agent &agent) |
| Perform one integration step of the diffusion process for a given Agent using the Euler-Maruyama method. More... | |
| SingleWell (const std::vector< Agent > &agents, const std::vector< mio::AdoptionRate< ScalarType, Status >> &rates, ScalarType contact_radius=0.4, ScalarType sigma=0.4, std::vector< Status > non_moving_states={}) | |
| Set up a diffusive ABM using the quadwell potential F(x,y) = (x^4 + y^4)/2. More... | |
| Eigen::VectorX< ScalarType > | time_point () const |
| Calculate the current system state i.e. More... | |
Static Public Member Functions | |
| static constexpr void | adopt (Agent &agent, const Status &new_status) |
| Perform infection state adoption for an Agent. More... | |
Public Attributes | |
| std::vector< Agent > | populations |
| Vector containing all Agents in the model. More... | |
Private Member Functions | |
| bool | is_contact (const Agent &agent, const Agent &contact) const |
| Evaluate whether two agents are within their contact radius. More... | |
| bool | is_in_domain (const Position &p, const ScalarType lower_domain_border=-2, const ScalarType upper_domain_border=2) const |
| Restrict domain to [-2, 2]^2 where "escaping" is impossible. More... | |
Static Private Member Functions | |
| static Position | grad_U (const Position p) |
| Calculate the gradient of the potential at a given position. More... | |
Private Attributes | |
| std::map< std::tuple< mio::regions::Region, Status, Status >, mio::AdoptionRate< ScalarType, Status > > | m_adoption_rates |
| Map of AdoptionRates according to their region index and their from -> to infection states. More... | |
| ScalarType | m_contact_radius |
| Agents' interaction radius. Within this radius agents are considered as contacts. More... | |
| std::vector< Status > | m_non_moving_states |
| Infection states within which agents do not change their location. More... | |
| mio::RandomNumberGenerator | m_rng |
| Model's random number generator. More... | |
| ScalarType | m_sigma |
| Noise term of the diffusion process. More... | |
Detailed Description
template<class InfectionState>
class SingleWell< InfectionState >
Implementation of diffusive ABM, see dabm::Model.
This implementation defines a diffusion process for the potential F(x,y) = (x^4 + y^4)/2.
- Template Parameters
-
InfectionState An infection state enum.
Member Typedef Documentation
◆ Position
| using SingleWell< InfectionState >::Position = Eigen::Vector2d |
◆ Status
| using SingleWell< InfectionState >::Status = InfectionState |
Constructor & Destructor Documentation
◆ SingleWell()
|
inline |
Set up a diffusive ABM using the quadwell potential F(x,y) = (x^4 + y^4)/2.
- Parameters
-
[in] agents A vector of Agents representing the population. [in] rates AdoptionRates defining InfectionState adoptions, see mio::AdoptionRate. [in] contact_radius Contact radius for second-order adoptions. [in] sigma Noise term for the diffusion process. [in] non_moving_state InfectionStates that are excluded from movement e.g. Dead.
Member Function Documentation
◆ adopt()
|
inlinestaticconstexpr |
◆ adoption_rate()
|
inline |
Calculate adoption rate for an Agent.
- Parameters
-
[in] agent Agent for whom the adoption rate is calculated. [in] new_status Target infection state of the adoption rate, see mio::AdoptionRate.to.
- Returns
- Value of agent-dependent AdoptionRate.
◆ get_adoption_rates()
|
inline |
◆ get_rng()
|
inline |
Get the RandomNumberGenerator used by this Model for random events.
- Returns
- The random number generator.
◆ grad_U()
|
inlinestaticprivate |
Calculate the gradient of the potential at a given position.
- Parameters
-
[in] p Position at which the gradient is evaluated.
- Returns
- Value of potential gradient.
◆ is_contact()
|
inlineprivate |
Evaluate whether two agents are within their contact radius.
- Parameters
-
[in] agent Agent whose position specifies the contact area. [in] contact Potential contact of agent.
- Returns
- Boolean specifying whether are within each others contact radius.
◆ is_in_domain()
|
inlineprivate |
Restrict domain to [-2, 2]^2 where "escaping" is impossible.
- Parameters
-
[in] p Position to check.
- Returns
- Boolean specifying whether p is in [-2, 2]^2.
◆ move()
|
inline |
◆ time_point()
|
inline |
Calculate the current system state i.e.
the populations for each infection state.
- Returns
- Vector containing the number of agents per infection state.
Member Data Documentation
◆ m_adoption_rates
|
private |
Map of AdoptionRates according to their region index and their from -> to infection states.
◆ m_contact_radius
|
private |
Agents' interaction radius. Within this radius agents are considered as contacts.
◆ m_non_moving_states
|
private |
Infection states within which agents do not change their location.
◆ m_rng
|
private |
Model's random number generator.
◆ m_sigma
|
private |
Noise term of the diffusion process.
◆ populations
| std::vector<Agent> SingleWell< InfectionState >::populations |
Vector containing all Agents in the model.
Generated by