ALMaSS Rodenticide Model ODdox
1.0
|
Class for management of bait locations. More...
#include <Rodenticide.h>
Public Member Functions | |
void | Diffuse (int a_x, int a_y) |
Move poisoned mice around to twin map. More... | |
void | DistributeRing (int a_x, int a_y, double a_amount) |
Distribute an amount to the twin map in a ring. More... | |
void | DoDeath (void) |
Reduce each cell in twin map by m_deathRate. More... | |
void | DoDiffuse (void) |
void | DoImmigration (void) |
void | DoPlaceBait () |
Initiates bait placement for those bait locations necessary. More... | |
void | DumpRodenticideMap (string a_fname) |
Dumps a map of rodenticide loads per 1m2 cells. More... | |
int | GetBaitStartDate (TTypesBaitLocation) |
Determines when the bait will be placed within a season. More... | |
double | GetMap (int a_x, int a_y) |
Get poisoned mice at x,y. More... | |
double | GetMapTwin (int a_x, int a_y) |
Get poisoned mice at x,y on twin map. More... | |
double | GetRodenticide (unsigned a_x, int a_y) |
Return the poisoned mice value at x,y. More... | |
void | InitiateRodenticidePolyData (string a_fname) |
Opens and initiates the output file for polygon rodenticide information. More... | |
void | RecordRodenticidePolyData (string a_fname) |
Records rodenticide loads per polygon. More... | |
RodenticideManager (string fname, Landscape *a_land) | |
RodenticideManager constructor. More... | |
void | SetMap (int a_x, int a_y, double a_p) |
Set poisoned mice at x,y. More... | |
void | SetMapTwin (int a_x, int a_y, double a_p) |
Set poisoned mice at x,y on twin map. More... | |
void | SetMapTwinMult (int a_x, int a_y, double a_p) |
Multiply poisoned mice at x,y on twin map by constant. More... | |
void | SetMapTwinP (int a_x, int a_y, double a_p) |
Add to poisoned mice at x,y on twin map. More... | |
bool | ShouldPlaceBait (TTypesBaitLocation) |
Place bait dependent upon a frequency test. More... | |
void | Tick (void) |
Advance one day. More... | |
virtual | ~RodenticideManager (void) |
RodenticideManager destructor. More... | |
Protected Attributes | |
vector< BaitLocation > | m_BaitList |
List of bait locations. More... | |
double | m_deathRate |
poisoned mice death rate More... | |
double | m_diffusionRate |
poisoned mice diffusion rate More... | |
int | m_gridsize |
rodenticide grid size - also affect diffusion rate More... | |
int | m_height |
int | m_heightm1 |
double | m_immigrationRate |
poisoned mice immigration rate More... | |
Landscape * | m_land |
Landscape pointer. More... | |
vector< double > | m_pmouse_map_main |
Map of probability of encountering a poisoned mouse. More... | |
vector< double > | m_pmouse_map_twin |
Temporary map for calculation poisoned mouse diffusion. More... | |
int | m_seasonstartprob [tbl_foobar][1000] |
season start probability distribution More... | |
int | m_width |
Landscape dimensions. More... | |
Class for management of bait locations.
RodenticideManager::RodenticideManager | ( | string | fname, |
Landscape * | a_land | ||
) |
RodenticideManager constructor.
Uses the file name to open a file and read in all bait locations required for managemnet
Creates the rodenticide grid with its twin-map and fills them with zeros. The maps have a resolution which is defined by __RODENTICIDE_GRID_RES. Cannot have diffusion of >= map width or height - this needs checking to prevent wrapping around the world.
Read in and handle the probability distributions for seasonal start dates for bait locations. BaitLocationsSeasonalStartProbs.txt holds a column of daily probability for bait placement for each building type ()values range 0.0 to 1.0).
References cfg_rodenticide_deathRate(), cfg_rodenticide_diffusionRate(), cfg_rodenticide_gridsize(), cfg_rodenticide_immigrationRate(), BaitLocation::SetBLtype(), BaitLocation::SetX(), BaitLocation::SetY(), Landscape::SupplySimAreaWidth(), and tbl_foobar.
|
virtual |
RodenticideManager destructor.
Move poisoned mice around to twin map.
Distribute an amount to the twin map in a ring.
Distribute a_amount to the eight cells around m_x,m_y
|
inline |
Reduce each cell in twin map by m_deathRate.
|
inline |
void RodenticideManager::DoImmigration | ( | void | ) |
void RodenticideManager::DoPlaceBait | ( | void | ) |
Initiates bait placement for those bait locations necessary.
Depending upon the bait type, whether the bait has been used this year and whether it is destined to be used this method will add mass to the bait locations.
Housekeeping on Jan 1st is to remove all masses and zero all flags for the start of the new year.
The first test is of date, since whether a BL is used is determined by the frequency of that BL type on Jan 1st.
The next test is on the season, determining the start of bait placement.
NB this not so time critical so no optimising of the loops is done here.
References cfg_rodenticide_BLchristmasstrees_Length(), cfg_rodenticide_BLcountry_Length(), cfg_rodenticide_BLtown_Length(), cfg_rodenticide_BLwoodland_Length(), tbl_christmasstrees, tbl_country, tbl_town, and tbl_woodland.
void RodenticideManager::DumpRodenticideMap | ( | string | a_fname | ) |
Dumps a map of rodenticide loads per 1m2 cells.
Uses the file name to open a file and saves the rodenticide value for each cell at the time this method is called.
int RodenticideManager::GetBaitStartDate | ( | TTypesBaitLocation | a_BLt | ) |
Determines when the bait will be placed within a season.
References g_rand_uni.
Get poisoned mice at x,y.
Get poisoned mice at x,y on twin map.
|
inline |
Return the poisoned mice value at x,y.
void RodenticideManager::InitiateRodenticidePolyData | ( | string | a_fname | ) |
Opens and initiates the output file for polygon rodenticide information.
Uses the file name to open a file and saves the rodenticide value for each polygon at the time this method is called.
void RodenticideManager::RecordRodenticidePolyData | ( | string | a_fname | ) |
Records rodenticide loads per polygon.
Uses the file name to open a file and saves the rodenticide value for each polygon at the time this method is called.
Set poisoned mice at x,y.
Set poisoned mice at x,y on twin map.
Multiply poisoned mice at x,y on twin map by constant.
Add to poisoned mice at x,y on twin map.
bool RodenticideManager::ShouldPlaceBait | ( | TTypesBaitLocation | a_BLt | ) |
Place bait dependent upon a frequency test.
References cfg_rodenticide_BLchristmastrees_AnnFreq(), cfg_rodenticide_BLcountry_AnnFreq(), cfg_rodenticide_BLtown_AnnFreq(), cfg_rodenticide_BLwoodland_AnnFreq(), g_rand_uni, tbl_christmasstrees, tbl_country, tbl_foobar, tbl_town, and tbl_woodland.
void RodenticideManager::Tick | ( | void | ) |
Advance one day.
Check for bait location placement each day, but also do intialisation on Jan 1st.
For each bait location - first add immigration to the main map.
Then calculate diffusion for every cell - this is time consuming! Diffusion is added to twin map.
Apply mortalities to all cells in the twin map.
Finally swap the twin map and main map, then clear the twin map.
References cfg_rodenticide_dumpmapday(), cfg_rodenticide_dumpmapstartyear(), cfg_rodenticide_dumppolyendyear(), cfg_rodenticide_dumppolyinterval(), and cfg_rodenticide_dumppolystartyear().
|
protected |
List of bait locations.
|
protected |
poisoned mice death rate
|
protected |
poisoned mice diffusion rate
|
protected |
rodenticide grid size - also affect diffusion rate
|
protected |
|
protected |
|
protected |
poisoned mice immigration rate
|
protected |
Map of probability of encountering a poisoned mouse.
|
protected |
Temporary map for calculation poisoned mouse diffusion.
|
protected |
season start probability distribution