![]() |
ALMaSS
1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
|
#include <Bembidion_All.h>
Public Member Functions | |
void | CreateObjects (int a_ob_type, TAnimal *a_pvo_ptr, void *null, Struct_Beetle *a_data, int a_number) override |
Method to add beetles to the population. More... | |
Bembidion_Population_Manager (Landscape *a_l_ptr) | |
Constructor. More... | |
![]() | |
Beetle_Population_Manager (Landscape *a_l_ptr, int a_n) | |
Beetle_Population_Manager Constructor. More... | |
~Beetle_Population_Manager () override | |
Beetle_Population_Manager Destructor. More... | |
void | DoBefore () override |
Replaces the Step function for the Egg_List. More... | |
void | DoLast () override |
Adds output adult locations to DoLast. More... | |
unsigned | Probe (int a_ListIndex, Probe_Data *a_TheProbe_ptr) override |
Overides the Population_Manager::Probe method. More... | |
int | SupplyEggPopSize () const |
Get egg population size. More... | |
int | SupplyDailyEggPopSize (const int day) const |
Get the number of eggs created on a given day. More... | |
void | SupplyEggLocXY (unsigned day, int j, int &x, int &y) const |
Get the location of an egg from a given day. More... | |
double | SupplyDevelConst1 (unsigned a_index) const |
virtual double | SupplyDayDegs (const unsigned a_stage, const int a_day) |
Get the day degress experienced this year for a specific day created and instar/stage. More... | |
unsigned | GetPopulationSize (int) override |
Returns the population size of the lifestage type bobType. More... | |
void | OpenTheAOROutputProbe (const string &a_AORFilename) override |
Opens the AOR output file. More... | |
virtual bool | OnFarmEventPupae (FarmToDo event, Beetle_Base *a_caller) |
Used to determine mortality based on an event for any beetle class - not a pure vitual but must be overriden if needed. More... | |
void | DoBeetleActiveProbe (int a_lifestage) |
Counts all active beetles and saves the results to a file. More... | |
void | SetStageProductionRecord (int a_value, int a_stage) |
Sets stage production record attribute. More... | |
int | GetStageProductionRecord (int a_stage) const |
Gets the stage production record attribute. More... | |
void | AddStageProductionRecord (int a_value, int a_stage) |
Adds to the stage production record attribute. More... | |
![]() | |
Population_Manager (Landscape *a_l_ptr, int a_numberLifeStages=12) | |
virtual | ~Population_Manager (void) |
void | SetNoProbesAndSpeciesSpecificFunctions (int a_pn) override |
Sets up probe and species specifics. More... | |
unsigned | GetLiveArraySize (int a_listindex) override |
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... | |
unsigned int | FarmAnimalCensus (unsigned int a_farm, unsigned int a_typeofanimal) |
char * | SpeciesSpecificReporting (int a_species, int a_time) override |
char * | ProbeReport (int a_time) |
char * | ProbeReportTimed (int a_time) |
void | ImpactProbeReport (int a_Time) |
bool | BeginningOfMonth () |
void | LOG (const char *fname) |
int | SupplyStepSize () const |
void | Run (int NoTSteps) override |
virtual void | ImpactedProbe () |
virtual TAnimal * | SupplyAnimalPtr (unsigned int a_index, unsigned int a_animal) |
Returns the pointer indexed by a_index and a_animal. Note NO RANGE CHECK. More... | |
virtual unsigned | SupplyListIndexSize () |
unsigned | SupplyListSize (unsigned listindex) const |
void | PushIndividual (const unsigned a_listindex, TAnimal *a_individual_ptr) |
const char * | SupplyStateNames (int i) const |
unsigned | SupplyStateNamesLength () const |
virtual void | DisplayLocations () |
TAnimal * | FindIndividual (unsigned Type, TAnimal *a_me) |
virtual TAnimal * | FindClosest (int x, int y, unsigned Type, TAnimal *a_me) |
omp_nest_lock_t * | GetGuardMapElement (unsigned a_x_index, unsigned a_y_index) |
Return the guard map cell. More... | |
void | SetGuardMapElement (unsigned a_x_index, unsigned a_y_index) |
Set the given guard map cell. More... | |
void | UnsetGuardMapElement (unsigned a_x_index, unsigned a_y_index) |
Unset the given guard map cell. More... | |
void | UpdateGuardMap (int a_x, int a_y, int &a_index_x, int &a_index_y) |
Get the index of the guard map for the given location. More... | |
bool | OpenTheRipleysOutputProbe () |
bool | OpenTheMonthlyRipleysOutputProbe () |
bool | OpenTheReallyBigProbe () |
void | CloseTheMonthlyRipleysOutputProbe () const |
virtual void | CloseTheRipleysOutputProbe () |
virtual void | CloseTheReallyBigOutputProbe () |
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) |
void | Debug_Shuffle (unsigned int Type) |
virtual void | RunStepMethods () |
![]() | |
Population_Manager_Base (Landscape *L) | |
The Population_Manager_Base constructor. More... | |
virtual void | Catastrophe (int) |
Must be re-implemented in descendent classes. More... | |
int | SupplySimW () const |
Returns landscape width in m. More... | |
int | SupplySimH () const |
Returns landscape height in m. More... | |
int | SupplySimWH () const |
Returns half the landscape width in m. More... | |
int | SupplySimHH () const |
Returns half the landscape height in m. More... | |
virtual int | ProbeFileInput (char *p_Filename, int p_ProbeNo) |
A stub to build specfic probes and functions. More... | |
int | SupplyListNameLength () const |
const char * | SupplyListName (int a_i) const |
Get a list name from the list. More... | |
virtual void | SupplyLocXY (unsigned, unsigned, int &, int &) |
A stub for identifying an individual at a location. More... | |
virtual TAnimal * | FindClosest (int, int, unsigned) |
A stub for identifying an individual at a location. More... | |
std::string | SupplySimulationName () |
void | SetStepCounterInADay (int a_counter) |
Set step counter in a day. More... | |
int | GetStepCounterInADay (void) |
Return the sep counter in a day. More... | |
virtual double | GetAphidDensity (int, int) |
Return the aphid density, it is only used when aphid simulations are running. More... | |
Protected Member Functions | |
void | CalculateDailyEggProduction (double a_temptoday) override |
Figure out the maximum number of eggs that can be laid today - must be overridden in descendent classes. More... | |
void | DoFirst () override |
Does day degree development calculations here. More... | |
bool | OnFarmEvent (FarmToDo a_event, Beetle_Base *a_caller) override |
Returns the consequence of farme events at a the current location. More... | |
![]() | |
void | Catastrophe () override |
Method to arbitrarily alter populations size. More... | |
void | Catastrophe2 () |
Method to arbitrarily alter populations size restricted spatially. More... | |
void | TheRipleysOutputProbe (ofstream *a_prb) override |
Special output functionality. More... | |
void | TheReallyBigOutputProbe () override |
Special output functionality. More... | |
void | TheAOROutputProbe () override |
Special output functionality. More... | |
bool | IsStartHabitat (int a_x, int a_y) const |
Used to specify legal starting habitats for simulation start-up. More... | |
bool | IsStartHabitatAux (TTypesOfLandscapeElement tole) const |
Used to specify legal starting habitats for simulation start-up. More... | |
virtual void | DoExtremeTempActions (double a_airtemp) |
Species specific actions to cope with response to extreme temperature, if needed. More... | |
virtual void | DoEggDailyMortalityActions (double a_atemptoday) |
Species specific actions to cope with temperature related egg mortality. More... | |
virtual void | DoLarvalDailyMortalityActions (double a_atemptoday) |
Species specific actions to cope with temperature related laval mortality. More... | |
virtual void | DayDegreeCalculations (int a_dayinyear, bool a_usehourly) |
Does the day degree calculations needed for the species here. More... | |
void | SetAdultEggLayingThreshold (const double a_value) |
Set the temperature threshold for egg laying. More... | |
void | incInField () |
Increments in field counter. More... | |
void | incInCrop () |
Increments in crop counter. More... | |
void | incOffField () |
Increments off field counter. More... | |
void | PestMortLocOutput () |
Annual pesticide mortality locations output. More... | |
![]() | |
virtual bool | StepFinished () |
Methods to run the simulations. More... | |
virtual void | DoAfter () |
virtual void | DoSpecialBetweenLifeStages (int a_life_stage) |
virtual void | SortX (unsigned Type) |
void | SortXIndex (unsigned Type) |
virtual void | SortY (unsigned Type) |
void | SortState (unsigned Type) |
void | SortStateR (unsigned Type) |
virtual unsigned | PartitionLiveDead (unsigned Type) |
virtual void | Shuffle_or_Sort (unsigned Type) |
virtual void | Shuffle (unsigned Type) |
![]() | |
~Population_Manager_Base ()=default | |
Additional Inherited Members | |
![]() | |
long | m_EPopSize {0} |
To store the current population size. More... | |
std::unique_ptr< MovementMap > | m_MoveMap |
Map of suitability for movement. More... | |
std::unique_ptr< std::vector< std::unique_ptr< Beetle_Egg_List > > > | m_EList {nullptr} |
Replacement for TheArray[0]. More... | |
![]() | |
bool | ProbesSet {} |
![]() | |
Probe_Data * | TheProbe [100] = {nullptr} |
Holds a list of pointers to standard output probes. More... | |
![]() | |
static void | PestMortLocOutputOpen () |
Annual pesticide mortality output file open. More... | |
static void | PestMortLocOutputError () |
Pesticide mortality output error handling. More... | |
![]() | |
double | m_MortalityTempStep {5.0} |
Threshold temperatures for mortalities: Step size. More... | |
double | m_MortalityTempMin {0.0} |
hreshold temperatures for mortalities: Min More... | |
double | m_MortalityTempMax {25.0} |
Threshold temperatures for mortalities: Max. More... | |
int | m_TemperatureCategory { 0 } |
Storage for the temperature category today. More... | |
int | m_NoTemperatureCategories { 0 } |
Storage for the number of temperature categories used. More... | |
vector< std::array< double, 365 > > | m_DayDegs {} |
Storage for daily day degrees for non-adult stages. More... | |
TToleList | m_BeetleStartHabitats |
the list of the toles that the beetles are assigned to in the beginning of the simulation More... | |
tBeetleToleTovs | m_BeetleToleTovs |
The list of start habitats for the beetle. More... | |
int | m_BeetleLarvalStagesNum { 3 } |
vector< int > | m_StageProductionProduction { 0 } |
Testing/Output attribute holding the number of larvae produced today. More... | |
double | m_AdultEggLayingThreshold {} |
Temperature threshold for egg laying. More... | |
double | m_EggProductionSlope {} |
the slope of the linear function that defines todays egg production More... | |
vector< double > | m_DevelConst1 {} |
Day degree threshold constant for eggs to pupae. More... | |
vector< double > | m_DevelopmentInflectionPoints {} |
Inflection point in day degree calculations for non-adult stages. More... | |
vector< double > | m_AboveInflectionRates {} |
Day degree constant above inflection point for all non-adult stages. More... | |
vector< SimplePositionMapInt * > | m_BeetlePositionMaps [bob_foobar] {} |
int | m_InFieldNo {} |
In-field counter. More... | |
int | m_InCropNo {} |
In-crop counter. More... | |
int | m_OffFieldNo {} |
Off-field counter. More... | |
TTypesOfVegetation | m_InCropRef {} |
In crop tole reference. More... | |
![]() | |
vector< unsigned > | m_LiveArraySize |
int | m_NoProbes = 0 |
std::vector< std::vector< omp_nest_lock_t * > > | m_MapGuard |
This is used to make sure animals will not behaviour at the same area - multi threads. More... | |
int | m_guard_cell_height_num |
int | m_guard_cell_width_num |
int | m_guard_cell_size |
bool | m_is_paralleled |
This is used to indicate whether the species is paralleled. More... | |
const char * | StateNames [100] {} |
int | m_StepSize {} |
vector< vector< forward_list< TAnimal * > * > > | TheSubArrays |
Hold all the animal pointers. More... | |
vector< vector< int > > | TheSubArraysSizes |
Hold all the animal sizes in each thread. More... | |
vector< int > | m_LifeStageOrderVec |
The vector to store the life stage order for looping specie life stages. More... | |
vector< forward_list< TAnimal * >::iterator > | TheSubArraysIterators |
the iterator from last time called for SupplyAnimalPtr(), this for fast loop all the animals in the derived class. More... | |
vector< int > | TheSubArrayPreviousIndex |
the animal index number from last time called for SupplyAnimalPtr(), this for fast loop all the animals in the derived class. More... | |
vector< int > | TheSubArrayThreadIndex |
the thread index number from last time called for SupplyAnimalPtr(), this for fast loop all the animals in the derived class. More... | |
unsigned | StateNamesLength |
FILE * | TestFile {} |
FILE * | TestFile2 {} |
vector< unsigned > | BeforeStepActions |
Holds the season list of possible before step actions. More... | |
int | m_SeasonNumber |
Holds the season number. Used when running goose and hunter sims. More... | |
TTypesOfPopulation | m_population_type {TOP_NoSpecies} |
ofstream * | AOROutputPrb {} |
ofstream * | RipleysOutputPrb {} |
ofstream * | RipleysOutputPrb1 {} |
ofstream * | RipleysOutputPrb2 {} |
ofstream * | RipleysOutputPrb3 {} |
ofstream * | RipleysOutputPrb4 {} |
ofstream * | RipleysOutputPrb5 {} |
ofstream * | RipleysOutputPrb6 {} |
ofstream * | RipleysOutputPrb7 {} |
ofstream * | RipleysOutputPrb8 {} |
ofstream * | RipleysOutputPrb9 {} |
ofstream * | RipleysOutputPrb10 {} |
ofstream * | RipleysOutputPrb11 {} |
ofstream * | RipleysOutputPrb12 {} |
ofstream * | ReallyBigOutputPrb {} |
AOR_Probe * | m_AOR_Probe {} |
A pointer to the AOR probe. More... | |
long int | lamdagrid [2][257][257] {} |
![]() | |
int | SimH |
stores the simulation height More... | |
int | SimW |
stores the simulation width More... | |
int | SimHH |
stores the simulation height halved More... | |
int | SimWH |
stores the simulation width halved More... | |
string | m_SimulationName |
stores the simulation name More... | |
Landscape * | m_TheLandscape |
holds an internal pointer to the landscape More... | |
int | m_ListNameLength {} |
the number of life-stages simulated in the population manager More... | |
const char * | m_ListNames [32] {} |
A list of life-stage names. More... | |
std::string | m_AORProbeFileName {"AOR_Probe.txt"} |
name of the AOR Probe file More... | |
std::string | m_ProbeFileName {"Probe.res"} |
name of the Probe file More... | |
int | m_step_counter_in_a_day |
Step counter in a day, this is used for the animals with finer step size other than one day. More... | |
Bembidion_Population_Manager::Bembidion_Population_Manager | ( | Landscape * | a_l_ptr | ) |
Constructor.
a_l_ptr | is a pointer to the landscape |
References bob_Adult, cfg_BeetleInCropRef, cfg_BeetleLarvalStagesNum, cfg_Beetlestartnos, cfg_BembidionDevelopmentInflectionPoints, cfg_BembidionLarvalDailyTemperatureMort, cfg_BembidionLarvalMortCategories, CreateObjects(), g_random_fnc(), Beetle_Population_Manager::IsStartHabitat(), Beetle_Population_Manager::m_BeetleLarvalStagesNum, Beetle_Population_Manager::m_DayDegs, Beetle_Population_Manager::m_DevelopmentInflectionPoints, Beetle_Population_Manager::m_InCropNo, Beetle_Population_Manager::m_InCropRef, Beetle_Population_Manager::m_InFieldNo, Beetle_Population_Manager::m_MortalityTempMax, Beetle_Population_Manager::m_OffFieldNo, Population_Manager::m_population_type, Population_Manager_Base::m_SimulationName, Population_Manager_Base::m_TheLandscape, Struct_Beetle::m_x, Struct_Beetle::m_y, Beetle_Larvae::SetLarvalDailyMort(), Landscape::SupplySimAreaHeight(), Landscape::SupplySimAreaWidth(), Population_Manager::TheSubArrays, tobs_Hibernating, TOP_Bembidion, Landscape::TranslateVegTypes(), CfgInt::value(), and CfgArray_Double::value().
|
overrideprotectedvirtual |
Figure out the maximum number of eggs that can be laid today - must be overridden in descendent classes.
Calculate the number of eggs laid today. This is based on a simple linear relationship from an egg laying threshold to a maximum production of 10 eggs per day.
Implements Beetle_Population_Manager.
References Beetle_Population_Manager::m_AdultEggLayingThreshold, Beetle_Population_Manager::m_EggProductionSlope, and Beetle_Adult::SetTodaysEggProduction().
|
overridevirtual |
Method to add beetles to the population.
All bembidion objects that are created must be created using this method. Data on the location and other attributes are passed in data, and the number to create in number.
Reimplemented from Beetle_Population_Manager.
References bob_Adult, bob_Egg, bob_Larva1, bob_Larva2, bob_Larva3, bob_Pupa, Population_Manager::IncLiveArraySize(), Struct_Beetle::m_l, Struct_Beetle::m_x, Struct_Beetle::m_y, Population_Manager::PushIndividual(), and Landscape::SupplyDayInYear().
Referenced by Bembidion_Population_Manager().
|
overrideprotectedvirtual |
Does day degree development calculations here.
This method removes any eggs that have survived until winter. In descendent classes other stages may need to be removed.
It subsequently calculates day degree development for each day for each beetle stage. This is an optimising strategy to prevent each beetle individual calculating these.
Finally it replaces the Egg_List BeginStep functionality. This is also an optimisation since it only requires 365 Egg_lists, one for each day of the year instead of millions of individual eggs.
NB this breaks the traditional ALMaSS protocol for handling animal individuals.
Reimplemented from Beetle_Population_Manager.
References bob_Larva1, bob_Pupa, Beetle_Population_Manager::DoFirst(), Population_Manager_Base::m_TheLandscape, Population_Manager::SupplyAnimalPtr(), and Landscape::SupplyDayInYear().
|
overrideprotectedvirtual |
Returns the consequence of farme events at a the current location.
a_event | The event of test |
a_caller | The object calling the test |
Implements Beetle_Population_Manager.
References autumn_harrow, autumn_or_spring_plough, autumn_plough, autumn_roll, autumn_sow, autumn_sow_with_ferti, bed_forming, biocide, bulb_harvest, burn_straw_stubble, burn_top, cattle_out, cattle_out_low, cfg_biocide_reduction_val, cut_to_hay, cut_to_silage, cut_weeds, deep_ploughing, fa_ammoniumsulphate, fa_boron, fa_calcium, fa_cu, fa_greenmanure, fa_k, fa_manganesesulphate, fa_manure, fa_n, fa_nk, fa_npk, fa_npks, fa_p, fa_pk, fa_pks, fa_rsm, fa_sk, fa_sludge, fa_slurry, fiber_covering, fiber_removal, flammebehandling, flower_cutting, fp_ammoniumsulphate, fp_boron, fp_calcium, fp_cu, fp_greenmanure, fp_k, fp_liquidNH3, fp_manganesesulphate, fp_manure, fp_n, fp_nc, fp_nk, fp_npk, fp_npks, fp_ns, fp_p, fp_pk, fp_pks, fp_rsm, fp_sk, fp_sludge, fp_slurry, fungicide_treat, g_rand_uni_fnc(), Beetle_Base::GetHarvestMortality(), Beetle_Base::GetInsecticideApplication(), Beetle_Base::GetSoilCultivationMortality(), Beetle_Base::GetStriglingMortality(), glyphosate, green_harvest, growth_regulator, harvest, harvest_bushfruit, harvestshoots, hay_bailing, hay_turning, heavy_cultivator_aggregate, herbicide_treat, hilling_up, insecticide_treat, Population_Manager_Base::m_TheLandscape, manual_weeding, molluscicide, mow, org_fungicide, org_herbicide, org_insecticide, pheromone, pigs_out, preseeding_cultivator, preseeding_cultivator_sow, product_treat, pruning, row_cultivation, shallow_harrow, shredding, sleep_all_day, spring_harrow, spring_plough, spring_roll, spring_sow, spring_sow_with_ferti, straw_chopping, straw_covering, straw_removal, strigling, strigling_hill, strigling_sow, stubble_cultivator_heavy, stubble_harrowing, stubble_plough, swathing, trial_control, CfgFloat::value(), Landscape::Warn(), water, and winter_plough.