pops-core
0.9
PoPS (Pest or Pathogen Spread) Model Core C++ library
|
Classes | |
class | AbstractTreatment |
Abstract interface for treatment classes. More... | |
class | BaseTreatment |
Base treatment class. More... | |
class | CauchyKernel |
Dispersal kernel for cauchy distribution class utilized by RadialKernel and DeterministicKernel. More... | |
class | Config |
class | Date |
Representation and manipulation of a date for the simulation. More... | |
class | DeterministicDispersalKernel |
Dispersal kernel for deterministic spread to cell with highest probability of spread. More... | |
class | DeterministicNeighborDispersalKernel |
Dispersal kernel for deterministic spread to a next cell. More... | |
class | ExponentialKernel |
Dispersal kernel for exponential distribution class utilized by RadialKernel and DeterministicKernel. More... | |
class | ExponentialPowerKernel |
Dispersal kernel for exponential power distribution class utilized by RadialKernel and DeterministicKernel. More... | |
class | GammaKernel |
Dispersal kernel for gamma distribution class utilized by RadialKernel and DeterministicKernel. More... | |
class | HyperbolicSecantKernel |
Dispersal kernel for hyperbolic secant class utilized by RadialKernel and DeterministicKernel. More... | |
class | LogisticKernel |
Dispersal kernel for logistic distribution class utilized by RadialKernel and DeterministicKernel. More... | |
class | LogNormalKernel |
Dispersal kernel for log normal distribution class utilized by RadialKernel and DeterministicKernel. More... | |
class | Model |
class | NaturalAnthropogenicDispersalKernel |
Dispersal kernel template for natural and anthropogenic distance dispersal. More... | |
class | Network |
Network structure and algorithms. More... | |
class | NetworkDispersalKernel |
Dispersal kernel for dispersal over a network. More... | |
class | NormalKernel |
Dispersal kernel for normal distribution class utilized by RadialKernel and DeterministicKernel. More... | |
class | PesticideTreatment |
Pesticide treatment class. More... | |
class | PowerLawKernel |
Dispersal kernel for power law distribution class utilized by RadialKernel and DeterministicKernel. More... | |
class | QuarantineEscape |
Class storing and computing quarantine escap metrics for one simulation. More... | |
class | RadialDispersalKernel |
Dispersal kernel providing all the radial kernels. More... | |
class | Raster |
Representation of a raster image. More... | |
class | Scheduler |
class | Season |
Holds beginning and end of a season and decides what is in season. More... | |
class | SimpleTreatment |
Simple treatment class. More... | |
class | Simulation |
The main class to control the spread simulation. More... | |
class | SpreadRate |
Class storing and computing step spread rate for one simulation. More... | |
class | Step |
Representation and manipulation of a date for the simulation. More... | |
class | SwitchDispersalKernel |
Dispersal kernel providing all the radial kernels. More... | |
class | Treatments |
Treatments class manages all treatments. More... | |
class | UniformDispersalKernel |
Dispersal kernel for random uniform dispersal over the whole landscape. More... | |
class | VonMisesDistribution |
Von Mises Distribution (Circular data distribution) More... | |
class | WeibullKernel |
Dispersal kernel for weibull distribution class utilized by RadialKernel and DeterministicKernel. More... | |
Typedefs | |
template<typename IntegerRaster , typename RasterIndex > | |
using | DispersalKernel = NaturalAnthropogenicDispersalKernel< SwitchDispersalKernel< IntegerRaster, RasterIndex >, SwitchDispersalKernel< IntegerRaster, RasterIndex > > |
Dispersal kernel supporting all available kernels for natural and anthropogenic distance spread. More... | |
typedef std::tuple< double, Direction > | DistDir |
typedef std::tuple< bool, DistDir > | EscapeDistDir |
typedef std::vector< EscapeDistDir > | EscapeDistDirs |
Enumerations | |
enum | DispersalKernelType { DispersalKernelType::Cauchy, DispersalKernelType::Exponential, DispersalKernelType::Uniform, DispersalKernelType::DeterministicNeighbor, DispersalKernelType::PowerLaw, DispersalKernelType::HyperbolicSecant, DispersalKernelType::Gamma, DispersalKernelType::ExponentialPower, DispersalKernelType::Weibull, DispersalKernelType::Normal, DispersalKernelType::LogNormal, DispersalKernelType::Logistic, DispersalKernelType::Network, DispersalKernelType::None } |
Type of dispersal kernel. More... | |
enum | StepUnit { StepUnit::Day, StepUnit::Week, StepUnit::Month } |
Enum for step unit. More... | |
enum | ModelType { ModelType::SusceptibleInfected, ModelType::SusceptibleExposedInfected } |
The type of a epidemiological model (SI or SEI) More... | |
enum | TreatmentApplication { TreatmentApplication::Ratio, TreatmentApplication::AllInfectedInCell } |
The enum to decide how treatment is applied. More... | |
Functions | |
std::ostream & | operator<< (std::ostream &os, const Date &d) |
bool | operator> (const Date &d1, const Date &d2) |
bool | operator<= (const Date &d1, const Date &d2) |
bool | operator< (const Date &d1, const Date &d2) |
bool | operator>= (const Date &d1, const Date &d2) |
bool | operator== (const Date &d1, const Date &d2) |
bool | operator!= (const Date &d1, const Date &d2) |
DispersalKernelType | kernel_type_from_string (const std::string &text) |
Get a corresponding enum value for a string which is a kernel name. More... | |
DispersalKernelType | kernel_type_from_string (const char *text) |
Overload which allows to pass C-style string which is nullptr (NULL) More... | |
std::ostream & | operator<< (std::ostream &os, const Direction &obj) |
template<typename IntegerRaster > | |
double | quarantine_escape_probability (const std::vector< QuarantineEscape< IntegerRaster >> escape_infos, unsigned step) |
Reports probability of escaping quarantine based on multiple runs for certain step. More... | |
template<typename IntegerRaster > | |
std::vector< DistDir > | distance_direction_to_quarantine (const std::vector< QuarantineEscape< IntegerRaster >> escape_infos, unsigned step) |
Reports minimum distances to quarantine boundary (bbox) and associated distances for each run for certain step. More... | |
template<typename IntegerRaster > | |
std::string | write_quarantine_escape (const std::vector< QuarantineEscape< IntegerRaster >> escape_infos, unsigned num_steps) |
Writes quarantine escape summary for all steps into a string. More... | |
Direction | direction_from_string (const std::string &text) |
Get a corresponding enum value for a string which direction. More... | |
Direction | direction_from_string (const char *text) |
Overload which allows to pass C-style string which is nullptr (NULL) More... | |
template<class InputIt1 , class InputIt2 , class BinaryOperation > | |
BinaryOperation | for_each_zip (InputIt1 first1, InputIt1 last1, InputIt2 first2, BinaryOperation f) |
Iterate over two ranges and apply a binary function which modifies the first parameter. More... | |
template<typename LeftNumber , typename RightNumber , typename ResultNumber = typename std::common_type<LeftNumber, RightNumber>::type> | |
Raster< ResultNumber > | operator+ (const Raster< LeftNumber > &lhs, const Raster< RightNumber > &rhs) |
template<typename LeftNumber , typename RightNumber , typename ResultNumber = typename std::common_type<LeftNumber, RightNumber>::type> | |
Raster< ResultNumber > | operator- (const Raster< LeftNumber > &lhs, const Raster< RightNumber > &rhs) |
template<typename LeftNumber , typename RightNumber , typename ResultNumber = typename std::common_type<LeftNumber, RightNumber>::type> | |
Raster< ResultNumber > | operator* (const Raster< LeftNumber > &lhs, const Raster< RightNumber > &rhs) |
template<typename LeftNumber , typename RightNumber , typename ResultNumber = typename std::common_type<LeftNumber, RightNumber>::type> | |
Raster< ResultNumber > | operator/ (const Raster< LeftNumber > &lhs, const Raster< RightNumber > &rhs) |
std::ostream & | operator<< (std::ostream &os, const Step &step) |
StepUnit | step_unit_enum_from_string (const std::string &text) |
Get step enum from string. More... | |
unsigned | simulation_step_to_action_step (const std::vector< bool > &action_schedule, unsigned step) |
Converts simulation step to step of actions. More... | |
unsigned | get_number_of_scheduled_actions (const std::vector< bool > &action_schedule) |
Returns how many actions are scheduled. More... | |
std::vector< bool > | schedule_from_string (const Scheduler &scheduler, const std::string &frequency, unsigned n=0) |
Get output (export) schedule based on frequency string ("year", "month", "week", "day", "every_n_steps", "final_step"). More... | |
template<typename Container > | |
void | rotate_left_by_one (Container &container) |
Rotate elements in a container to the left by one. More... | |
template<typename Generator > | |
std::vector< int > | draw_n_from_v (std::vector< int > v, unsigned n, Generator &generator) |
Draws n elements from a vector. More... | |
ModelType | model_type_from_string (const std::string &text) |
Get a corresponding enum value for a string which is a model type name. More... | |
ModelType | model_type_from_string (const char *text) |
Overload which allows to pass C-style string which is nullptr (NULL) More... | |
template<typename Raster > | |
BBoxFloat | average_spread_rate (const std::vector< SpreadRate< Raster >> &rates, unsigned step) |
Computes average spread rate in n, s, e, w directions from vector of spread rates. More... | |
template<typename IntegerRaster > | |
unsigned | sum_of_infected (const IntegerRaster &infected, const std::vector< std::vector< int >> &suitable_cells) |
Computes sum of infected hosts from all cells of a raster. More... | |
template<typename IntegerRaster > | |
double | area_of_infected (const IntegerRaster &infected, double ew_res, double ns_res, const std::vector< std::vector< int >> &suitable_cells) |
Computes infected area as number of cell > 0 times cell size. More... | |
TreatmentApplication | treatment_app_enum_from_string (const std::string &text) |
Get treatment application enum from string. More... | |
using pops::DispersalKernel = typedef NaturalAnthropogenicDispersalKernel< SwitchDispersalKernel<IntegerRaster, RasterIndex>, SwitchDispersalKernel<IntegerRaster, RasterIndex> > |
Dispersal kernel supporting all available kernels for natural and anthropogenic distance spread.
This is a typedef defining the main disperal kernel class in the PoPS library. When you are using the library, this is default choice.
The choices which are allowed by this class are:
The ellipses represent whatever the SwitchDispersalKernel and RadialDispersalKernel classes support.
See NaturalAnthropogenicDispersalKernel and SwitchDispersalKernel for further documentation.
Definition at line 81 of file kernel.hpp.
typedef std::tuple<double, Direction> pops::DistDir |
Definition at line 37 of file quarantine.hpp.
typedef std::tuple<bool, DistDir> pops::EscapeDistDir |
Definition at line 38 of file quarantine.hpp.
typedef std::vector<EscapeDistDir> pops::EscapeDistDirs |
Definition at line 39 of file quarantine.hpp.
|
strong |
Type of dispersal kernel.
This contains all kernels supported by the PoPS library and it may be further used by the various classes which support more than one kernel type.
None is to represent no spread in the given context, e.g., no long distance spread.
Enumerator | |
---|---|
Cauchy | Cauchy dispersal kernel. |
Exponential | Exponential dispersal kernel. |
Uniform | Random uniform dispersal kernel. |
DeterministicNeighbor | Deterministic immediate neighbor dispersal kernel. |
PowerLaw | Power law dispersal kernel. |
HyperbolicSecant | Hyperbolic secant dispersal kernel. |
Gamma | Gamma dispersal kernel. |
ExponentialPower | Exponential power dispersal kernel. |
Weibull | Weibull dispersal kernel. |
Normal | Normal dispersal kernel. |
LogNormal | Log-normal dispersal kernel. |
Logistic | Logistic dispersal kernel. |
Network | Network spread. |
None | No dispersal kernel (no spread) |
Definition at line 53 of file kernel_types.hpp.
|
strong |
The type of a epidemiological model (SI or SEI)
Enumerator | |
---|---|
SusceptibleInfected | SI (susceptible - infected) |
SusceptibleExposedInfected | SEI (susceptible - exposed - infected) |
Definition at line 60 of file simulation.hpp.
|
strong |
|
strong |
The enum to decide how treatment is applied.
Enumerator | |
---|---|
Ratio | A ratio is applied to all treated rasters. |
AllInfectedInCell | All infected individuals are removed, rest by ratio. |
Definition at line 36 of file treatments.hpp.
double pops::area_of_infected | ( | const IntegerRaster & | infected, |
double | ew_res, | ||
double | ns_res, | ||
const std::vector< std::vector< int >> & | suitable_cells | ||
) |
Computes infected area as number of cell > 0 times cell size.
Definition at line 42 of file statistics.hpp.
BBoxFloat pops::average_spread_rate | ( | const std::vector< SpreadRate< Raster >> & | rates, |
unsigned | step | ||
) |
Computes average spread rate in n, s, e, w directions from vector of spread rates.
Checks if any rate is nan to not include it in the average.
Definition at line 193 of file spread_rate.hpp.
|
inline |
Overload which allows to pass C-style string which is nullptr (NULL)
Definition at line 77 of file radial_kernel.hpp.
|
inline |
Get a corresponding enum value for a string which direction.
Throws an std::invalid_argument exception if the values was not found or is not supported (which is the same thing).
Definition at line 51 of file radial_kernel.hpp.
std::vector<DistDir> pops::distance_direction_to_quarantine | ( | const std::vector< QuarantineEscape< IntegerRaster >> | escape_infos, |
unsigned | step | ||
) |
Reports minimum distances to quarantine boundary (bbox) and associated distances for each run for certain step.
If in certain runs infection escaped, it reports nan for distance and None for direction.
Definition at line 256 of file quarantine.hpp.
std::vector<int> pops::draw_n_from_v | ( | std::vector< int > | v, |
unsigned | n, | ||
Generator & | generator | ||
) |
Draws n elements from a vector.
Expects n to be equal or less than v.size().
Definition at line 48 of file simulation.hpp.
BinaryOperation pops::for_each_zip | ( | InputIt1 | first1, |
InputIt1 | last1, | ||
InputIt2 | first2, | ||
BinaryOperation | f | ||
) |
Iterate over two ranges and apply a binary function which modifies the first parameter.
Definition at line 35 of file raster.hpp.
unsigned pops::get_number_of_scheduled_actions | ( | const std::vector< bool > & | action_schedule | ) |
Returns how many actions are scheduled.
action_schedule: [F, T, F, F, F, T, F] -> 2
Definition at line 390 of file scheduling.hpp.
|
inline |
Overload which allows to pass C-style string which is nullptr (NULL)
Definition at line 128 of file kernel_types.hpp.
|
inline |
Get a corresponding enum value for a string which is a kernel name.
Throws an std::invalid_argument exception if the values was not found or is not supported (which is the same thing).
Definition at line 76 of file kernel_types.hpp.
|
inline |
Overload which allows to pass C-style string which is nullptr (NULL)
Definition at line 92 of file simulation.hpp.
|
inline |
Get a corresponding enum value for a string which is a model type name.
Throws an std::invalid_argument exception if the value was not found or is not supported (which is the same thing).
Definition at line 71 of file simulation.hpp.
std::ostream& pops::operator<< | ( | std::ostream & | os, |
const Date & | d | ||
) |
std::ostream& pops::operator<< | ( | std::ostream & | os, |
const Direction & | obj | ||
) |
Definition at line 31 of file quarantine.hpp.
std::ostream& pops::operator<< | ( | std::ostream & | os, |
const Step & | step | ||
) |
Definition at line 57 of file scheduling.hpp.
double pops::quarantine_escape_probability | ( | const std::vector< QuarantineEscape< IntegerRaster >> | escape_infos, |
unsigned | step | ||
) |
Reports probability of escaping quarantine based on multiple runs for certain step.
1 means 100% probability of escaping.
Definition at line 236 of file quarantine.hpp.
void pops::rotate_left_by_one | ( | Container & | container | ) |
Rotate elements in a container to the left by one.
Rotates (moves) elements in a container to the left (anticlockwise) by one. The second element is moved to the front and the first element is moved to the back.
Definition at line 40 of file simulation.hpp.
|
inline |
Get output (export) schedule based on frequency string ("year", "month", "week", "day", "every_n_steps", "final_step").
If frequency is "every_n_steps", then output is scheduled every n steps of the simulation.
Throws an std::invalid_argument exception if the value is not supported or the output frequency is not compatible with simulation step (e.g., frequency is weekly, but simulation runs every 2 weeks). If frequency is empty string, empty output schedule is returned.
Definition at line 406 of file scheduling.hpp.
unsigned pops::simulation_step_to_action_step | ( | const std::vector< bool > & | action_schedule, |
unsigned | step | ||
) |
Converts simulation step to step of actions.
This is useful for getting the right index of lethal temperature file.
schedule: [F, T, F, F, F, T, F] step: 1 -> returns 0 step: 5 -> returns 1
Result for input step any other then 1 and 5 in this case returns valid number but has no particular meaning.
Definition at line 373 of file scheduling.hpp.
|
inline |
Get step enum from string.
Throws an std::invalid_argument exception if the value is not supported.
Definition at line 79 of file scheduling.hpp.
unsigned pops::sum_of_infected | ( | const IntegerRaster & | infected, |
const std::vector< std::vector< int >> & | suitable_cells | ||
) |
Computes sum of infected hosts from all cells of a raster.
Definition at line 26 of file statistics.hpp.
|
inline |
Get treatment application enum from string.
Throws an std::invalid_argument exception if the value is not supported.
Definition at line 48 of file treatments.hpp.
std::string pops::write_quarantine_escape | ( | const std::vector< QuarantineEscape< IntegerRaster >> | escape_infos, |
unsigned | num_steps | ||
) |
Writes quarantine escape summary for all steps into a string.
Uses CSV fomat with commas (step, probability of escape, distance, direction as azimuth from runs). E.g. "0,0.4,1000,0,2000,90,1500,0" If escaped in particular run, there is empty value for that distance and direction (...,1000,0,,,2000,90,...).
Definition at line 278 of file quarantine.hpp.