pops-core
0.9
PoPS (Pest or Pathogen Spread) Model Core C++ library
|
Go to the documentation of this file.
24 #ifndef POPS_MODEL_HPP
25 #define POPS_MODEL_HPP
39 template<
typename IntegerRaster,
typename FloatRaster,
typename RasterIndex>
90 return selectable_kernel;
129 deterministic_kernel,
134 return selectable_kernel;
171 deterministic_kernel,
176 return selectable_kernel;
192 config.latency_period_steps,
193 config.generate_stochasticity,
194 config.establishment_stochasticity,
195 config.movement_stochasticity)
250 IntegerRaster& infected,
251 IntegerRaster& susceptible,
252 IntegerRaster& total_populations,
253 IntegerRaster& total_hosts,
254 IntegerRaster& dispersers,
255 IntegerRaster& total_exposed,
256 std::vector<IntegerRaster>& exposed,
257 std::vector<IntegerRaster>& mortality_tracker,
259 const std::vector<FloatRaster>& temperatures,
260 const FloatRaster& weather_coefficient,
262 IntegerRaster& resistant,
263 std::vector<std::tuple<int, int>>& outside_dispersers,
266 const IntegerRaster& quarantine_areas,
267 const std::vector<std::vector<int>> movements,
269 std::vector<std::vector<int>>& suitable_cells)
279 temperatures[lethal_step],
298 auto overpopulation_kernel =
307 mortality_tracker.back(),
322 overpopulation_kernel,
346 bool managed = treatments.
manage(
356 for (
auto& raster : mortality_tracker) {
376 unsigned rates_step =
382 unsigned action_step =
385 infected, quarantine_areas, action_step, suitable_cells);
392 #endif // POPS_MODEL_HPP
Model(const Config &config)
DispersalKernelType anthro_kernel
DispersalKernelType kernel_type_from_string(const std::string &text)
Get a corresponding enum value for a string which is a kernel name.
bool manage_mortality(unsigned current, IntegerRaster &infected, const std::vector< std::vector< int >> &suitable_cells)
Separately manage mortality infected cohorts.
Dispersal kernel providing all the radial kernels.
void compute_step_spread_rate(const Raster &raster, unsigned step, const std::vector< std::vector< int >> &suitable_cells)
Computes spread rate in n, s, e, w directions for certain simulation year based on provided infection...
SwitchDispersalKernel< IntegerRaster, RasterIndex > create_anthro_kernel(const IntegerRaster &dispersers, const Network< RasterIndex > &network)
Create anthropogenic kernel.
double leaving_scale_coefficient
const std::vector< bool > & spread_schedule() const
Dispersal kernel for deterministic spread to cell with highest probability of spread.
Class storing and computing quarantine escap metrics for one simulation.
std::string anthro_direction
std::vector< unsigned > movement_schedule
Treatments class manages all treatments.
void infection_escape_quarantine(const IntegerRaster &infected, const IntegerRaster &quarantine_areas, unsigned step, const std::vector< std::vector< int >> &suitable_cells)
Computes whether infection in certain step escaped from quarantine areas and if not,...
The main class to control the spread simulation.
const std::vector< bool > & lethal_schedule() const
const std::vector< bool > & quarantine_schedule() const
bool use_overpopulation_movements
DeterministicNeighborDispersalKernel anthro_neighbor_kernel
Dispersal kernel for dispersal over a network.
Main entry point to dispersal kernel functionality.
DispersalKernelType
Type of dispersal kernel.
DeterministicNeighborDispersalKernel natural_neighbor_kernel
const std::vector< bool > & mortality_schedule() const
double establishment_probability
std::string natural_direction
SwitchDispersalKernel< IntegerRaster, RasterIndex > create_overpopulation_movement_kernel(const IntegerRaster &dispersers, const Network< RasterIndex > &network)
Create overpopulation movement kernel.
Class storing and computing step spread rate for one simulation.
SwitchDispersalKernel< IntegerRaster, RasterIndex > create_natural_kernel(const IntegerRaster &dispersers, const Network< RasterIndex > &network)
Create natural kernel.
DispersalKernelType natural_kernel
double dispersal_percentage
const std::vector< bool > & spread_rate_schedule() const
unsigned simulation_step_to_action_step(const std::vector< bool > &action_schedule, unsigned step)
Converts simulation step to step of actions.
Dispersal kernel template for natural and anthropogenic distance dispersal.
bool use_anthropogenic_kernel
ModelType model_type_from_string(const std::string &text)
Get a corresponding enum value for a string which is a model type name.
double percent_natural_dispersal
bool manage(unsigned current, IntegerRaster &infected, std::vector< IntegerRaster > &exposed, IntegerRaster &susceptible, IntegerRaster &resistant, IntegerRaster &total_hosts, const std::vector< std::vector< int >> &suitable_cells)
Do management if needed.
Dispersal kernel for deterministic spread to a next cell.
bool use_lethal_temperature
void run_step(int step, IntegerRaster &infected, IntegerRaster &susceptible, IntegerRaster &total_populations, IntegerRaster &total_hosts, IntegerRaster &dispersers, IntegerRaster &total_exposed, std::vector< IntegerRaster > &exposed, std::vector< IntegerRaster > &mortality_tracker, IntegerRaster &died, const std::vector< FloatRaster > &temperatures, const FloatRaster &weather_coefficient, Treatments< IntegerRaster, FloatRaster > &treatments, IntegerRaster &resistant, std::vector< std::tuple< int, int >> &outside_dispersers, SpreadRate< IntegerRaster > &spread_rate, QuarantineEscape< IntegerRaster > &quarantine, const IntegerRaster &quarantine_areas, const std::vector< std::vector< int >> movements, const Network< RasterIndex > &network, std::vector< std::vector< int >> &suitable_cells)
Run one step of the simulation.
Direction direction_from_string(const std::string &text)
Get a corresponding enum value for a string which direction.
double leaving_percentage
Simulation< IntegerRaster, FloatRaster, RasterIndex > simulation_
UniformDispersalKernel uniform_kernel
double lethal_temperature
Network structure and algorithms.
Dispersal kernel providing all the radial kernels.
double overpopulation_percentage