ALMaSS Rodenticide Model ODdox
1.0
|
Base class for all population managers. More...
#include <PopulationManager.h>
Public Member Functions | |
bool | BeginningOfMonth () |
virtual void | BreedingPairsOutput (int) |
virtual void | BreedingSuccessProbeOutput (double, int, int, int, int, int, int, int) |
virtual void | Catastrophe (int) |
bool | CheckXY (int l, int i) |
Debug method to test for out of bounds coordinates. More... | |
void | CloseTheCIPEGridOutputProbe () |
void | CloseTheMonthlyRipleysOutputProbe () |
void | CloseTheReallyBigOutputProbe () |
void | CloseTheRipleysOutputProbe () |
virtual void | DisplayLocations () |
unsigned int | FarmAnimalCensus (unsigned int a_farm, unsigned int a_typeofanimal) |
TAnimal * | FindClosest (int x, int y, unsigned Type) |
virtual void | FledgelingProbeOutput (int, int) |
virtual void | GeneticsResultsOutput (FILE *, unsigned) |
unsigned | GetLiveArraySize (int a_listindex) |
Gets the number of 'live' objects for a list index in the TheArray. More... | |
TTypesOfPopulation | GetPopulationType () |
int | GetSeasonNumber () |
Get the season number. More... | |
virtual void | ImpactedProbe () |
void | ImpactProbeReport (int a_Time) |
void | IncLiveArraySize (int a_listindex) |
Increments the number of 'live' objects for a list index in the TheArray. More... | |
bool | IsLast (unsigned listindex) |
void | LamdaBirth (int x, int y) |
void | LamdaBirth (int x, int y, int z) |
void | LamdaClear () |
void | LamdaDeath (int x, int y) |
void | LamdaDumpOutput () |
void | LOG (const char *fname) |
virtual bool | OpenTheBreedingPairsProbe () |
virtual bool | OpenTheBreedingSuccessProbe () |
bool | OpenTheCIPEGridOutputProbe () |
virtual bool | OpenTheFledgelingProbe () |
bool | OpenTheMonthlyRipleysOutputProbe () |
bool | OpenTheReallyBigProbe () |
bool | OpenTheRipleysOutputProbe () |
Population_Manager (Landscape *L) | |
virtual float | Probe (int ListIndex, probe_data *p_TheProbe) |
int | ProbeFileInput (char *p_Filename, int p_ProbeNo) |
char * | ProbeReport (int a_time) |
char * | ProbeReportTimed (int a_time) |
virtual void | Run (int NoTSteps) |
void | SetNoProbes (int a_pn) |
char * | SpeciesSpecificReporting (int a_species, int a_time) |
virtual int | SupplyCovPosx (int) |
virtual int | SupplyCovPosy (int) |
unsigned | SupplyListIndexSize () |
const char * | SupplyListName (int i) |
int | SupplyListNameLength () |
unsigned | SupplyListSize (unsigned listindex) |
virtual void | SupplyLocXY (unsigned listindex, unsigned j, int &x, int &y) |
virtual int | SupplyPegPosx (int) |
virtual int | SupplyPegPosy (int) |
int | SupplySimH () |
int | SupplySimW () |
int | SupplyState (unsigned listindex, unsigned j) |
const char * | SupplyStateNames (int i) |
unsigned | SupplyStateNamesLength () |
int | SupplyStepSize () |
virtual int | TheBreedingFemalesProbe (int) |
virtual int | TheBreedingSuccessProbe (int &, int &, int &, int &, int &, int &) |
virtual void | TheCIPEGridOutputProbe () |
virtual int | TheFledgelingProbe () |
virtual void | TheGeneticProbe (unsigned, int, unsigned &) |
virtual void | TheNWordOutputProbe () |
virtual void | TheReallyBigOutputProbe () |
virtual void | TheRipleysOutputProbe (FILE *a_prb) |
virtual | ~Population_Manager (void) |
Public Attributes | |
int | IndexArrayX [5][10000] |
char | m_SimulationName [255] |
Landscape * | m_TheLandscape |
bool | ProbesSet |
int | SimH |
unsigned | SimHH |
int | SimW |
unsigned | SimWH |
probe_data * | TheProbe [100] |
Protected Member Functions | |
virtual void | Catastrophe () |
virtual void | DoAfter () |
virtual void | DoAlmostLast () |
virtual void | DoBefore () |
virtual void | DoFirst () |
virtual void | DoLast () |
void | EmptyTheArray () |
Removes all objects from the TheArray by deleting them and clearing TheArray. More... | |
void | NWordOutput () |
The output section for the NWord probe. . More... | |
unsigned | PartitionLiveDead (unsigned Type) |
void | Shuffle (unsigned Type) |
void | Shuffle_or_Sort (unsigned Type) |
void | SortState (unsigned Type) |
void | SortStateR (unsigned Type) |
void | SortX (unsigned Type) |
void | SortXIndex (unsigned Type) |
void | SortY (unsigned Type) |
virtual bool | StepFinished () |
Overrides the population manager StepFinished - there is no chance that hunters do not finish a step behaviour. More... | |
Base class for all population managers.
The core of the handling of animal populations. All time-step code and most input/output is handled by this class and its descendents. This class effectively implements a state machine to facilitate simulation of animal behaviours and handle potential issues with concurrency. The PopulationManager class is never instantiated but must be used by deriving a descendent class.
Population_Manager::Population_Manager | ( | Landscape * | L | ) |
Constructor for the Population_Manager class
References cfg_CipeGridSize(), and cfg_RipleysOutputMonthly_used().
|
virtual |
Destructor for the Population_Manager class
References cfg_ReallyBigOutput_used(), cfg_RipleysOutput_used(), and cfg_RipleysOutputMonthly_used().
bool Population_Manager::BeginningOfMonth | ( | ) |
Is it the first day of the month?
References cfg_DayInMonth().
|
inlinevirtual |
|
inlinevirtual |
References BeginningOfMonth(), ImpactProbeReport(), ProbeReport(), and SpeciesSpecificReporting().
|
protectedvirtual |
Debug method to test for out of bounds coordinates.
void Population_Manager::CloseTheCIPEGridOutputProbe | ( | ) |
close the probe
void Population_Manager::CloseTheMonthlyRipleysOutputProbe | ( | ) |
close the monthly probes
void Population_Manager::CloseTheReallyBigOutputProbe | ( | ) |
close the probe
void Population_Manager::CloseTheRipleysOutputProbe | ( | ) |
close the probe
References cfg_RipleysOutputMonthly_used().
|
virtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
Collects some data to describe the number of animals in each state at the end of the day
|
protected |
Removes all objects from the TheArray by deleting them and clearing TheArray.
Sort TheArray w.r.t. the m_Location_x attribute
unsigned int Population_Manager::FarmAnimalCensus | ( | unsigned int | a_farm, |
unsigned int | a_typeofanimal | ||
) |
Finds the closest individual to an x,y point
|
inlinevirtual |
|
inline |
Gets the number of 'live' objects for a list index in the TheArray.
|
inline |
|
inline |
Get the season number.
|
virtual |
void Population_Manager::ImpactProbeReport | ( | int | a_Time | ) |
|
inline |
Increments the number of 'live' objects for a list index in the TheArray.
|
inline |
|
inline |
void Population_Manager::LamdaDumpOutput | ( | ) |
Special probe
void Population_Manager::LOG | ( | const char * | fname | ) |
Debug function used to log whatever is needed - this is just a place to write whatever is needed at the time - so contents vary
References AnimalPosition::m_x, and AnimalPosition::m_y.
|
protected |
The output section for the NWord probe.
.
A common output stub for the NWord output probe. Specialist counting for each species occurs as part of the CIPE grid probe, then this method deals with the final output.
|
inlinevirtual |
Referenced by CreatePopulationManager().
|
inlinevirtual |
Referenced by CreatePopulationManager().
bool Population_Manager::OpenTheCIPEGridOutputProbe | ( | ) |
open the probe
References cfg_CIPEGridOutput_filename(), and cfg_CIPEGridOutput_filenameB().
|
inlinevirtual |
Referenced by CreatePopulationManager().
bool Population_Manager::OpenTheMonthlyRipleysOutputProbe | ( | ) |
open 12 ripley output probles, one for each month
References cfg_RipleysOutput_filename().
bool Population_Manager::OpenTheReallyBigProbe | ( | ) |
open the probe
References cfg_ReallyBigOutput_filename().
bool Population_Manager::OpenTheRipleysOutputProbe | ( | ) |
open the probe
References cfg_RipleysOutput_filename().
|
protected |
Sort TheArray w.r.t. the current state attribute in reverse order
|
virtual |
Default data probe. Rarely used in actuality but always available
References AnimalPosition::m_EleType, probe_data::m_NoAreas, probe_data::m_NoEleTypes, probe_data::m_NoFarms, probe_data::m_NoVegTypes, probe_data::m_Rect, probe_data::m_RefEle, probe_data::m_RefFarms, probe_data::m_RefVeg, AnimalPosition::m_VegType, AnimalPosition::m_x, rectangle::m_x1, rectangle::m_x2, AnimalPosition::m_y, rectangle::m_y1, and rectangle::m_y2.
Default probe file input
Referenced by GetProbeInput_ini().
char * Population_Manager::ProbeReport | ( | int | a_time | ) |
References BeginningOfMonth(), and g_str.
char * Population_Manager::ProbeReportTimed | ( | int | a_time | ) |
References g_str.
|
virtual |
This is the main scheduling method for the population manager.
Note the structure of Shuffle_or_Sort(), DoFirst(), BeginStep, DoBefore(), Step looping until all are finished, DoAfter(), DoAlmostLast(), EndStep, DoLast().
Can do multiple time-steps here inside one landscape time-step (a day). This is used in the roe deer model to provide 10 minute behavioural time-steps.
It is necessary to remove any dead animals before the timestep starts. It is possible that animals are killed after their population manager Run method has been executed. This is the case with geese and hunters. Checking death first prevents this becomming a problem.
References cfg_CatastropheEventStartYear(), cfg_CIPEGridOutput_day(), cfg_CIPEGridOutput_Interval(), cfg_CIPEGridOutput_used(), cfg_ReallyBigOutput_day1(), cfg_ReallyBigOutput_day2(), cfg_ReallyBigOutput_day3(), cfg_ReallyBigOutput_day4(), cfg_ReallyBigOutput_interval(), cfg_ReallyBigOutput_used(), cfg_ReallyBigOutputFirstYear(), cfg_RipleysOutput_day(), cfg_RipleysOutput_interval(), cfg_RipleysOutput_used(), cfg_RipleysOutputFirstYear(), and cfg_RipleysOutputMonthly_used().
Referenced by RunTheSim().
|
inline |
Referenced by CreatePopulationManager().
|
protected |
Run once through the list swapping randomly chosen elements
References random().
|
protected |
This method is used to determine whether the array of animals should be shuffled or sorted.
To do nothing ensure that the BeforeStepActions[] is set appropriately // 0 = Shuffle, 1 = SortX, 2 = SortY, 3 = sortXIndex, 4 = do nothing
References g_rand_uni.
|
protected |
Sort TheArray w.r.t. the current state attribute
|
protected |
Sort TheArray w.r.t. the current state attribute in reverse order
|
protected |
Sort TheArray w.r.t. the m_Location_x attribute
|
protected |
Sort TheArray w.r.t. the m_Location_x attribute, and make an indexing array
|
protected |
Sort TheArray w.r.t. the m_Location_y attribute
This method handles species specific outputs. This is one place to do it. More commonly this is done in descendent classes
References g_str, ImpactProbeReport(), and ProbeReport().
Referenced by RunTheSim().
|
protectedvirtual |
Overrides the population manager StepFinished - there is no chance that hunters do not finish a step behaviour.
Returns true if and only if all objects have finished the current step
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinevirtual |
|
inline |
|
inline |
|
inline |
IntArray100 * SupplyStateList() { return & StateList; }
|
inline |
|
inline |
|
inline |
|
virtual |
|
inlinevirtual |
|
inlinevirtual |
|
virtual |
|
virtual |
|
protected |
|
protected |
|
protected |
int Population_Manager::IndexArrayX[5][10000] |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Holds the season number. Used when running goose and hunter sims.
char Population_Manager::m_SimulationName[255] |
|
protected |
Landscape* Population_Manager::m_TheLandscape |
|
protected |
bool Population_Manager::ProbesSet |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
int Population_Manager::SimH |
unsigned Population_Manager::SimHH |
int Population_Manager::SimW |
unsigned Population_Manager::SimWH |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
probe_data* Population_Manager::TheProbe[100] |
Referenced by CloseDownSim(), and GetProbeInput_ini().