model_functions.h Source File

CPP API: model_functions.h Source File
model_functions.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2020-2026 MEmilio
3 *
4 * Authors: Daniel Abele, Elisabeth Kluth, Khoa Nguyen, David Kerkmann, Rene Schmieding
5 *
6 * Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20 
21 #ifndef MIO_ABM_MODEL_FUNCTIONS_H
22 #define MIO_ABM_MODEL_FUNCTIONS_H
23 
24 #include "abm/location.h"
25 #include "abm/person.h"
26 
27 #include <vector>
28 
29 namespace mio
30 {
31 namespace abm
32 {
33 
44 ScalarType total_exposure_by_contacts(const ContactExposureRates& rates, const CellIndex cell_index,
45  const VirusVariant virus, const AgeGroup age_receiver,
46  size_t age_receiver_group_size, const LocalInfectionParameters& params);
47 
56 ScalarType total_exposure_by_air(const AirExposureRates& rates, const CellIndex cell_index, const VirusVariant virus,
57  const Parameters& global_params);
58 
69 void add_exposure_contribution(AirExposureRates& local_air_exposure, ContactExposureRates& local_contact_exposure,
70  const Person& person, const Location& location, const Parameters& params,
71  const TimePoint t, const TimeSpan dt);
72 
74 
80 void normalize_exposure_contribution(ContactExposureRates& local_contact_exposure,
81  const PopulationByAge& local_population_by_age);
82 
95 void interact(PersonalRandomNumberGenerator& personal_rng, Person& person, const Location& location,
96  const PopulationByAge& local_population_by_age, const AirExposureRates& local_air_exposure,
97  const ContactExposureRates& local_contact_exposure, const TimePoint t, const TimeSpan dt,
98  const Parameters& global_parameters);
108 bool change_location(Person& person, const Location& destination, const TransportMode mode = TransportMode::Unknown,
109  const std::vector<uint32_t>& cells = {0});
110 
118 void adjust_contact_rates(Location& location, size_t num_agegroups);
119 
120 } // namespace abm
121 } // namespace mio
122 
123 #endif // MIO_ABM_MODEL_FUNCTIONS_H
A class template for an array with custom indices.
Definition: custom_index_array.h:136
All Locations in the simulated Model where Persons gather.
Definition: location.h:92
Parameters of the simulation that are the same everywhere within the Model.
Definition: abm/parameters.h:764
Agents in the simulated Model that can carry and spread the Infection.
Definition: person.h:51
Random number generator of individual persons.
Definition: personal_rng.h:50
Represents a point in time.
Definition: time.h:175
A duration of time.
Definition: time.h:36
double ScalarType
Configuration of memilio library.
Definition: memilio/config.h:30
ParameterSet< MaximumContacts, ContactRates, UseLocationCapacityForTransmissions > LocalInfectionParameters
Parameters of the Infection that depend on the Location.
Definition: abm/parameters.h:758
ScalarType total_exposure_by_air(const AirExposureRates &rates, const CellIndex cell_index, const VirusVariant virus, const Parameters &global_params)
Compute the total virus exposure for aerosol transmission in a cell (unit: per day).
Definition: model_functions.cpp:57
bool change_location(Person &person, const Location &destination, const TransportMode mode, const std::vector< uint32_t > &cells)
Change a persons location to another location.
Definition: model_functions.cpp:162
void adjust_contact_rates(Location &location, size_t num_agegroups)
Adjust ContactRates of location by MaximumContacts.
Definition: model_functions.cpp:183
void interact(PersonalRandomNumberGenerator &personal_rng, Person &person, const Location &location, const PopulationByAge &local_population_by_age, const AirExposureRates &local_air_exposure, const ContactExposureRates &local_contact_exposure, const TimePoint t, const TimeSpan dt, const Parameters &global_parameters)
Let a Person interact with the population at its current Location, possibly getting infected.
Definition: model_functions.cpp:63
void normalize_exposure_contribution(ContactExposureRates &local_contact_exposure, const PopulationByAge &local_population_by_age)
Normalize contact exposure rate to average exposure per contact per time (from total exposure per tim...
Definition: model_functions.cpp:145
CustomIndexArray< boost::atomic< ScalarType >, CellIndex, VirusVariant > AirExposureRates
Definition: location.h:45
void add_exposure_contribution(AirExposureRates &local_air_exposure, ContactExposureRates &local_contact_exposure, const Person &person, const Location &location, const Parameters &params, const TimePoint t, const TimeSpan dt)
Add the contribution of a person to the local exposure rates.
Definition: model_functions.cpp:113
TransportMode
Mode of Transport.
Definition: mobility_data.h:35
ScalarType total_exposure_by_contacts(const ContactExposureRates &rates, const CellIndex cell_index, const VirusVariant virus, const AgeGroup age_receiver, size_t age_receiver_group_size, const LocalInfectionParameters &params)
Compute the total virus exposure for contact transmission in a cell (unit: per day).
Definition: model_functions.cpp:35
VirusVariant
Virus variants in ABM.
Definition: virus_variant.h:38
CustomIndexArray< boost::atomic< ScalarType >, CellIndex, VirusVariant, AgeGroup > ContactExposureRates
Definition: location.h:44
A collection of classes to simplify handling of matrix shapes in meta programming.
Definition: models/abm/analyze_result.h:30