Class Model#
Defined in File Model.h
Class Documentation#
-
class Model
Sets up and runs the model.
In addition to the set-up of the model, Model coordinates the different classes to run daily steps of mosquito life processes and dispersal as well as other events like gene drive release, aestivation and seasonality. It also contains methods to interface with the Record class.
See also
Public Functions
-
Model(ModelParams *params, const std::array<std::array<std::array<double, constants::num_gen>, constants::num_gen>, constants::num_gen> &inher_frac, SineRainfallParams *season, double a0_mean, double a0_var, std::vector<int> rel_sites = {}, BoundaryType boundary = BoundaryType::Toroid, DispersalType disp_type = DispersalType::DistanceKernel, std::vector<Point> coords = {})
Model constructor.
Builds the components of the model for sinusoid rainfall-type seasonality.
- Parameters:
params – [in] model parameters
inher_frac – [in] inheritance fraction
season – [in] seasonality parameters for sinusoid rainfall
a0_mean – [in] alpha0 mean (mean of the baseline contribution to the carrying capacity)
a0_var – [in] alpha0 variance (variance of the baseline contribution to the carrying capacity)
rel_sites – [in] release sites (indices relative to the coords vector)
boundary – [in] boundary type
disp_type – [in] dispersal type
coords – [in] site coordinates vector
-
Model(ModelParams *params, const std::array<std::array<std::array<double, constants::num_gen>, constants::num_gen>, constants::num_gen> &inher_frac, InputRainfallParams *season, double a0_mean, double a0_var, std::vector<int> rel_sites = {}, BoundaryType boundary = BoundaryType::Toroid, DispersalType disp_type = DispersalType::DistanceKernel, std::vector<Point> coords = {})
Model constructor.
Builds the components of the model for input rainfall-type seasonality.
- Parameters:
params – [in] model parameters
inher_frac – [in] inheritance fraction
season – [in] seasonality parameters for input rainfall data
a0_mean – [in] alpha0 mean (mean of the baseline contribution to the carrying capacity)
a0_var – [in] alpha0 variance (variance of the baseline contribution to the carrying capacity)
rel_sites – [in] release sites (indices relative to the coords vector)
boundary – [in] boundary type
disp_type – [in] dispersal type
coords – [in] site coordinates vector
-
~Model()
Model destructor.
-
void initiate()
Sets up the model architecture.
Populates sites and sets dispersal connections.
-
void run(int day)
Runs the daily step of the model.
The life processes do not run during the initialisation day (day 0). However, gene drive release can be carried out on day 0.
- Parameters:
day – [in] simulation day
-
long long int calculate_tot_J()
Returns the total number of juveniles across all ages and genotypes and across all patches.
See also
- Returns:
The total number of juveniles in the model run.
-
long long int calculate_tot_M()
Returns the total number of adult males across all genotypes and across all patches.
See also
- Returns:
The total number of adult males in the model run.
-
long long int calculate_tot_V()
Returns the total number of adult virgin (unmated) females across all genotypes and across all patches.
See also
- Returns:
The total number of adult virgin (unmated) females in the model run.
-
long long int calculate_tot_F()
Returns the total number of adult mated females across all female and male sperm genotypes and across all patches.
See also
- Returns:
The total number of adult mated females in the model run.
-
std::array<long long int, constants::num_gen> calculate_tot_F_gen()
Returns the total number of adult mated females of each genotype across all patches.
See also
- Returns:
The total number of adult mated females in the model run, divided by female genotype.
-
std::vector<Patch*> get_sites() const
Returns the sites vector.
The patches within the vector are ordered according to order of creation. If specific coordinates have been set for patches, the sites vector will follow the same order as the coordinates vector of the Model constructor.
- Returns:
The sites vector, containing all Patch objects.
-
int get_day() const
Returns the current simulation day.
Simulation days run from 0 (initialisation day) up to
max_t
(inclusive).- Returns:
The simulation day.
-
double get_alpha(double alpha0)
Returns the carrying capacity for the given alpha0 (the baseline contribution to carrying capacity) and for the current day.
See also
- Parameters:
alpha0 – [in] baseline contribution to the carrying capacity
-
Model(ModelParams *params, const std::array<std::array<std::array<double, constants::num_gen>, constants::num_gen>, constants::num_gen> &inher_frac, SineRainfallParams *season, double a0_mean, double a0_var, std::vector<int> rel_sites = {}, BoundaryType boundary = BoundaryType::Toroid, DispersalType disp_type = DispersalType::DistanceKernel, std::vector<Point> coords = {})