ALMaSS Rabbit ODdox
1.00
The rabbit model description following ODdox protocol
|
Base class for all population managers. More...
#include <populationmanager.h>
Public Member Functions | |
Population_Manager (Landscape *L) | |
virtual | ~Population_Manager (void) |
void | SetNoProbes (int a_pn) |
unsigned | GetLiveArraySize (int a_listindex) |
Gets the number of 'live' objects for a list index in the TheArray. More... | |
void | IncLiveArraySize (int a_listindex) |
Increments the number of 'live' objects for a list index in the TheArray. More... | |
virtual void | Catastrophe (int) |
unsigned int | FarmAnimalCensus (unsigned int a_farm, unsigned int a_typeofanimal) |
char * | SpeciesSpecificReporting (int a_species, int a_time) |
char * | ProbeReport (int a_time) |
char * | ProbeReportTimed (int a_time) |
void | ImpactProbeReport (int a_Time) |
bool | BeginningOfMonth () |
void | LOG (const char *fname) |
int | SupplyStepSize () |
int | SupplySimW () |
int | SupplySimH () |
virtual void | Run (int NoTSteps) |
virtual float | Probe (int ListIndex, probe_data *p_TheProbe) |
virtual void | ImpactedProbe () |
int | SupplyListNameLength () |
unsigned | SupplyListIndexSize () |
unsigned | SupplyListSize (unsigned listindex) |
bool | CheckXY (int l, int i) |
Debug method to test for out of bounds coordinates. More... | |
const char * | SupplyListName (int i) |
bool | IsLast (unsigned listindex) |
int | SupplyState (unsigned listindex, unsigned j) |
virtual void | SupplyLocXY (unsigned listindex, unsigned j, int &x, int &y) |
const char * | SupplyStateNames (int i) |
unsigned | SupplyStateNamesLength () |
virtual void | DisplayLocations () |
int | ProbeFileInput (char *p_Filename, int p_ProbeNo) |
TAnimal * | FindClosest (int x, int y, unsigned Type) |
bool | OpenTheRipleysOutputProbe () |
bool | OpenTheMonthlyRipleysOutputProbe () |
bool | OpenTheReallyBigProbe () |
virtual void | TheRipleysOutputProbe (FILE *a_prb) |
virtual void | TheReallyBigOutputProbe () |
virtual void | TheNWordOutputProbe () |
void | CloseTheMonthlyRipleysOutputProbe () |
void | CloseTheRipleysOutputProbe () |
void | CloseTheReallyBigOutputProbe () |
bool | OpenTheCIPEGridOutputProbe () |
virtual void | TheCIPEGridOutputProbe () |
void | CloseTheCIPEGridOutputProbe () |
TTypesOfPopulation | GetPopulationType () |
int | GetSeasonNumber () |
Get the season number. More... | |
void | LamdaDeath (int x, int y) |
void | LamdaBirth (int x, int y) |
void | LamdaBirth (int x, int y, int z) |
void | LamdaClear () |
void | LamdaDumpOutput () |
virtual int | SupplyPegPosx (int) |
virtual int | SupplyPegPosy (int) |
virtual int | SupplyCovPosx (int) |
virtual int | SupplyCovPosy (int) |
virtual bool | OpenTheFledgelingProbe () |
virtual bool | OpenTheBreedingPairsProbe () |
virtual bool | OpenTheBreedingSuccessProbe () |
virtual void | BreedingPairsOutput (int) |
virtual int | TheBreedingFemalesProbe (int) |
virtual int | TheFledgelingProbe () |
virtual void | BreedingSuccessProbeOutput (double, int, int, int, int, int, int, int) |
virtual int | TheBreedingSuccessProbe (int &, int &, int &, int &, int &, int &) |
virtual void | FledgelingProbeOutput (int, int) |
virtual void | TheGeneticProbe (unsigned, int, unsigned &) |
virtual void | GeneticsResultsOutput (FILE *, unsigned) |
Public Attributes | |
int | IndexArrayX [5][10000] |
probe_data * | TheProbe [100] |
int | SimH |
int | SimW |
unsigned | SimHH |
unsigned | SimWH |
char | m_SimulationName [255] |
bool | ProbesSet |
Landscape * | m_TheLandscape |
Protected Member Functions | |
virtual bool | StepFinished () |
Overrides the population manager StepFinished - there is no chance that hunters do not finish a step behaviour. More... | |
virtual void | DoFirst () |
virtual void | DoBefore () |
virtual void | DoAfter () |
virtual void | DoAlmostLast () |
virtual void | DoLast () |
void | EmptyTheArray () |
Removes all objects from the TheArray by deleting them and clearing TheArray. More... | |
void | SortX (unsigned Type) |
void | SortXIndex (unsigned Type) |
void | SortY (unsigned Type) |
void | SortState (unsigned Type) |
void | SortStateR (unsigned Type) |
unsigned | PartitionLiveDead (unsigned Type) |
void | Shuffle_or_Sort (unsigned Type) |
void | Shuffle (unsigned Type) |
virtual void | Catastrophe () |
void | NWordOutput () |
The output section for the NWord probe. . 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.
Definition at line 401 of file populationmanager.h.
Population_Manager::Population_Manager | ( | Landscape * | L | ) |
Constructor for the Population_Manager class
Definition at line 222 of file PopulationManager.cpp.
References cfg_CipeGridSize, cfg_RipleysOutputMonthly_used, Landscape::SupplySimAreaHeight(), CfgInt::value(), and CfgBool::value().
|
virtual |
Destructor for the Population_Manager class
Definition at line 276 of file PopulationManager.cpp.
References cfg_ReallyBigOutput_used, cfg_RipleysOutput_used, cfg_RipleysOutputMonthly_used, and CfgBool::value().
bool Population_Manager::BeginningOfMonth | ( | ) |
Is it the first day of the month?
Definition at line 1172 of file PopulationManager.cpp.
References cfg_DayInMonth, and CfgInt::value().
|
inlinevirtual |
Definition at line 622 of file populationmanager.h.
|
inlinevirtual |
Definition at line 630 of file populationmanager.h.
|
inlinevirtual |
Definition at line 415 of file populationmanager.h.
|
protectedvirtual |
This method MUST be overidden in descendent classes if this functionality is does not match with the animals requirements
Definition at line 1179 of file PopulationManager.cpp.
bool Population_Manager::CheckXY | ( | int | l, |
int | i | ||
) |
Debug method to test for out of bounds coordinates.
Definition at line 1588 of file PopulationManager.cpp.
void Population_Manager::CloseTheCIPEGridOutputProbe | ( | ) |
void Population_Manager::CloseTheMonthlyRipleysOutputProbe | ( | ) |
void Population_Manager::CloseTheReallyBigOutputProbe | ( | ) |
void Population_Manager::CloseTheRipleysOutputProbe | ( | ) |
close the probe
Definition at line 950 of file PopulationManager.cpp.
References cfg_RipleysOutputMonthly_used, and CfgBool::value().
|
virtual |
Used to update the graphics when control is not returned to the ALMaSS_GUI between timesteps.
Definition at line 571 of file PopulationManager.cpp.
|
protectedvirtual |
Can be used in descendent classes
Reimplemented in Rabbit_Population_Manager.
Definition at line 524 of file PopulationManager.cpp.
|
protectedvirtual |
Can be used in descendent classes
Definition at line 533 of file PopulationManager.cpp.
|
protectedvirtual |
Can be used in descendent classes
Reimplemented in Rabbit_Population_Manager.
Definition at line 340 of file PopulationManager.cpp.
|
protectedvirtual |
Can be used in descendent classes
Reimplemented in Rabbit_Population_Manager.
Definition at line 332 of file PopulationManager.cpp.
|
protectedvirtual |
Collects some data to describe the number of animals in each state at the end of the day
Reimplemented in Rabbit_Population_Manager.
Definition at line 541 of file PopulationManager.cpp.
|
protected |
Removes all objects from the TheArray by deleting them and clearing TheArray.
Sort TheArray w.r.t. the m_Location_x attribute
Definition at line 1032 of file PopulationManager.cpp.
unsigned int Population_Manager::FarmAnimalCensus | ( | unsigned int | a_farm, |
unsigned int | a_typeofanimal | ||
) |
Definition at line 1331 of file PopulationManager.cpp.
TAnimal * Population_Manager::FindClosest | ( | int | x, |
int | y, | ||
unsigned | Type | ||
) |
Finds the closest individual to an x,y point
Definition at line 1007 of file PopulationManager.cpp.
References TAnimal::Supply_m_Location_x().
|
inlinevirtual |
Definition at line 635 of file populationmanager.h.
|
inlinevirtual |
Definition at line 639 of file populationmanager.h.
|
inline |
Gets the number of 'live' objects for a list index in the TheArray.
Definition at line 408 of file populationmanager.h.
Referenced by Rabbit_Warren::CalcDisease().
|
inline |
Definition at line 549 of file populationmanager.h.
|
inline |
Get the season number.
Definition at line 551 of file populationmanager.h.
|
virtual |
Special pesticide related probe. Overidden in descendent classes
Definition at line 683 of file PopulationManager.cpp.
void Population_Manager::ImpactProbeReport | ( | int | a_Time | ) |
|
inline |
Increments the number of 'live' objects for a list index in the TheArray.
Definition at line 412 of file populationmanager.h.
|
inline |
Definition at line 452 of file populationmanager.h.
|
inline |
Definition at line 584 of file populationmanager.h.
|
inline |
Definition at line 587 of file populationmanager.h.
|
inline |
Definition at line 590 of file populationmanager.h.
|
inline |
Definition at line 580 of file populationmanager.h.
void Population_Manager::LamdaDumpOutput | ( | ) |
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
Definition at line 306 of file PopulationManager.cpp.
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.
Definition at line 804 of file PopulationManager.cpp.
|
inlinevirtual |
Definition at line 616 of file populationmanager.h.
|
inlinevirtual |
Definition at line 619 of file populationmanager.h.
bool Population_Manager::OpenTheCIPEGridOutputProbe | ( | ) |
open the probe
Definition at line 769 of file PopulationManager.cpp.
References cfg_CIPEGridOutput_filename, cfg_CIPEGridOutput_filenameB, g_msg, CfgStr::value(), MapErrorMsg::Warn(), and WARN_FILE.
|
inlinevirtual |
Definition at line 613 of file populationmanager.h.
bool Population_Manager::OpenTheMonthlyRipleysOutputProbe | ( | ) |
open 12 ripley output probles, one for each month
Definition at line 854 of file PopulationManager.cpp.
References cfg_RipleysOutput_filename, g_msg, CfgStr::value(), MapErrorMsg::Warn(), and WARN_FILE.
bool Population_Manager::OpenTheReallyBigProbe | ( | ) |
open the probe
Definition at line 935 of file PopulationManager.cpp.
References cfg_ReallyBigOutput_filename, g_msg, CfgStr::value(), MapErrorMsg::Warn(), and WARN_FILE.
bool Population_Manager::OpenTheRipleysOutputProbe | ( | ) |
open the probe
Definition at line 834 of file PopulationManager.cpp.
References cfg_RipleysOutput_filename, g_msg, CfgStr::value(), MapErrorMsg::Warn(), and WARN_FILE.
Referenced by Rabbit_Population_Manager::Rabbit_Population_Manager().
|
protected |
Sort TheArray w.r.t. the current state attribute in reverse order
Definition at line 1085 of file PopulationManager.cpp.
|
virtual |
Default data probe. Rarely used in actuality but always available
Definition at line 691 of file PopulationManager.cpp.
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.
int Population_Manager::ProbeFileInput | ( | char * | p_Filename, |
int | p_ProbeNo | ||
) |
Default probe file input
Definition at line 585 of file PopulationManager.cpp.
char * Population_Manager::ProbeReport | ( | int | a_time | ) |
Definition at line 1343 of file PopulationManager.cpp.
References g_str.
char * Population_Manager::ProbeReportTimed | ( | int | a_time | ) |
Definition at line 1370 of file PopulationManager.cpp.
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.
Definition at line 349 of file PopulationManager.cpp.
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, cfg_RipleysOutputMonthly_used, CfgInt::value(), and CfgBool::value().
|
inline |
Definition at line 406 of file populationmanager.h.
|
protected |
Run once through the list swapping randomly chosen elements
Definition at line 1125 of file PopulationManager.cpp.
|
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
Definition at line 1143 of file PopulationManager.cpp.
References g_rand_uni.
|
protected |
Sort TheArray w.r.t. the current state attribute
Definition at line 1069 of file PopulationManager.cpp.
|
protected |
Sort TheArray w.r.t. the current state attribute in reverse order
Definition at line 1078 of file PopulationManager.cpp.
|
protected |
Sort TheArray w.r.t. the m_Location_x attribute
Definition at line 1049 of file PopulationManager.cpp.
|
protected |
Sort TheArray w.r.t. the m_Location_x attribute, and make an indexing array
Definition at line 1097 of file PopulationManager.cpp.
|
protected |
Sort TheArray w.r.t. the m_Location_y attribute
Definition at line 1059 of file PopulationManager.cpp.
char * Population_Manager::SpeciesSpecificReporting | ( | int | a_species, |
int | a_time | ||
) |
This method handles species specific outputs. This is one place to do it. More commonly this is done in descendent classes
Definition at line 1191 of file PopulationManager.cpp.
References g_str.
|
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
Definition at line 509 of file PopulationManager.cpp.
|
inlinevirtual |
Definition at line 607 of file populationmanager.h.
|
inlinevirtual |
Definition at line 610 of file populationmanager.h.
|
inline |
Definition at line 439 of file populationmanager.h.
|
inline |
Definition at line 449 of file populationmanager.h.
|
inline |
Definition at line 436 of file populationmanager.h.
|
inline |
Definition at line 442 of file populationmanager.h.
|
inlinevirtual |
Definition at line 464 of file populationmanager.h.
|
inlinevirtual |
Definition at line 601 of file populationmanager.h.
|
inlinevirtual |
Definition at line 604 of file populationmanager.h.
|
inline |
Definition at line 430 of file populationmanager.h.
|
inline |
Definition at line 427 of file populationmanager.h.
|
inline |
IntArray100 * SupplyStateList() { return & StateList; }
Definition at line 461 of file populationmanager.h.
|
inline |
Definition at line 468 of file populationmanager.h.
|
inline |
Definition at line 471 of file populationmanager.h.
|
inline |
Definition at line 424 of file populationmanager.h.
|
inlinevirtual |
Definition at line 624 of file populationmanager.h.
|
inlinevirtual |
Definition at line 632 of file populationmanager.h.
|
virtual |
This method MUST be overridden in descendent classes, if you want it to work
Definition at line 799 of file PopulationManager.cpp.
|
inlinevirtual |
Definition at line 627 of file populationmanager.h.
|
inlinevirtual |
Definition at line 637 of file populationmanager.h.
|
inlinevirtual |
Reimplemented in Rabbit_Population_Manager.
Definition at line 542 of file populationmanager.h.
|
virtual |
This method must be overridden in descendent classes
Definition at line 989 of file PopulationManager.cpp.
|
virtual |
This method must be overridden in descendent classes
Definition at line 994 of file PopulationManager.cpp.
|
protected |
Definition at line 511 of file populationmanager.h.
|
protected |
Definition at line 567 of file populationmanager.h.
|
protected |
Definition at line 568 of file populationmanager.h.
int Population_Manager::IndexArrayX[5][10000] |
Definition at line 480 of file populationmanager.h.
|
protected |
Definition at line 578 of file populationmanager.h.
|
protected |
Definition at line 498 of file populationmanager.h.
|
protected |
Definition at line 502 of file populationmanager.h.
|
protected |
Definition at line 571 of file populationmanager.h.
|
protected |
Definition at line 573 of file populationmanager.h.
|
protected |
Definition at line 575 of file populationmanager.h.
|
protected |
Definition at line 499 of file populationmanager.h.
|
protected |
Definition at line 497 of file populationmanager.h.
|
protected |
Definition at line 572 of file populationmanager.h.
|
protected |
Definition at line 576 of file populationmanager.h.
|
protected |
Definition at line 574 of file populationmanager.h.
|
protected |
Definition at line 508 of file populationmanager.h.
Referenced by Rabbit_Population_Manager::Rabbit_Population_Manager().
|
protected |
Definition at line 507 of file populationmanager.h.
Referenced by Rabbit_Population_Manager::Rabbit_Population_Manager().
|
protected |
Definition at line 495 of file populationmanager.h.
|
protected |
Definition at line 496 of file populationmanager.h.
|
protected |
Definition at line 553 of file populationmanager.h.
|
protected |
Holds the season number. Used when running goose and hunter sims.
Definition at line 513 of file populationmanager.h.
char Population_Manager::m_SimulationName[255] |
Definition at line 484 of file populationmanager.h.
Referenced by Rabbit_Population_Manager::Rabbit_Population_Manager().
|
protected |
Definition at line 503 of file populationmanager.h.
Landscape* Population_Manager::m_TheLandscape |
Definition at line 486 of file populationmanager.h.
Referenced by Rabbit_Population_Manager::AssignStaticVariables(), Rabbit_Population_Manager::ClassifyHabitat(), Rabbit_Population_Manager::DoFirst(), Rabbit_Population_Manager::DoLast(), Rabbit_Population_Manager::PreProcessWarrenLocations(), Rabbit_Population_Manager::Rabbit_Population_Manager(), and Rabbit_Population_Manager::WarrenLegalPos().
|
protected |
Definition at line 570 of file populationmanager.h.
bool Population_Manager::ProbesSet |
Definition at line 485 of file populationmanager.h.
|
protected |
Definition at line 569 of file populationmanager.h.
|
protected |
Definition at line 554 of file populationmanager.h.
|
protected |
Definition at line 555 of file populationmanager.h.
|
protected |
Definition at line 564 of file populationmanager.h.
|
protected |
Definition at line 565 of file populationmanager.h.
|
protected |
Definition at line 566 of file populationmanager.h.
|
protected |
Definition at line 556 of file populationmanager.h.
|
protected |
Definition at line 557 of file populationmanager.h.
|
protected |
Definition at line 558 of file populationmanager.h.
|
protected |
Definition at line 559 of file populationmanager.h.
|
protected |
Definition at line 560 of file populationmanager.h.
|
protected |
Definition at line 561 of file populationmanager.h.
|
protected |
Definition at line 562 of file populationmanager.h.
|
protected |
Definition at line 563 of file populationmanager.h.
int Population_Manager::SimH |
Definition at line 482 of file populationmanager.h.
Referenced by Rabbit_Population_Manager::DoFirst(), Rabbit_Population_Manager::PreProcessWarrenLocations(), and Rabbit_Population_Manager::Rabbit_Population_Manager().
unsigned Population_Manager::SimHH |
Definition at line 483 of file populationmanager.h.
int Population_Manager::SimW |
Definition at line 482 of file populationmanager.h.
Referenced by Rabbit_Population_Manager::DoFirst(), Rabbit_Population_Manager::PreProcessWarrenLocations(), and Rabbit_Population_Manager::Rabbit_Population_Manager().
unsigned Population_Manager::SimWH |
Definition at line 483 of file populationmanager.h.
|
protected |
Definition at line 501 of file populationmanager.h.
|
protected |
Definition at line 505 of file populationmanager.h.
|
protected |
Definition at line 509 of file populationmanager.h.
|
protected |
Definition at line 510 of file populationmanager.h.
|
protected |
Definition at line 504 of file populationmanager.h.
Referenced by Rabbit_Population_Manager::CreateObjects(), Rabbit_Population_Manager::DoFirst(), Rabbit_Population_Manager::PreProcessWarrenLocations(), Rabbit_Population_Manager::WarrenLegalPos(), and Rabbit_Population_Manager::~Rabbit_Population_Manager().
probe_data* Population_Manager::TheProbe[100] |
Definition at line 481 of file populationmanager.h.