File failed to load: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/extensions/ams.js
ALMaSS  1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Bembidion_Population_Manager Class Referencefinal

#include <Bembidion_All.h>

Inheritance diagram for Bembidion_Population_Manager:
Beetle_Population_Manager Population_Manager Population_Manager_Base

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...
 
- Public Member Functions inherited from Beetle_Population_Manager
 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...
 
- Public Member Functions inherited from Population_Manager
 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 TAnimalSupplyAnimalPtr (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 ()
 
TAnimalFindIndividual (unsigned Type, TAnimal *a_me)
 
virtual TAnimalFindClosest (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 ()
 
- Public Member Functions inherited from Population_Manager_Base
 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 TAnimalFindClosest (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...
 
- Protected Member Functions inherited from Beetle_Population_Manager
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...
 
- Protected Member Functions inherited from Population_Manager
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)
 
- Protected Member Functions inherited from Population_Manager_Base
 ~Population_Manager_Base ()=default
 

Additional Inherited Members

- Public Attributes inherited from Beetle_Population_Manager
long m_EPopSize {0}
 To store the current population size. More...
 
std::unique_ptr< MovementMapm_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...
 
- Public Attributes inherited from Population_Manager
bool ProbesSet {}
 
- Public Attributes inherited from Population_Manager_Base
Probe_DataTheProbe [100] = {nullptr}
 Holds a list of pointers to standard output probes. More...
 
- Static Protected Member Functions inherited from Beetle_Population_Manager
static void PestMortLocOutputOpen ()
 Annual pesticide mortality output file open. More...
 
static void PestMortLocOutputError ()
 Pesticide mortality output error handling. More...
 
- Protected Attributes inherited from Beetle_Population_Manager
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...
 
- Protected Attributes inherited from Population_Manager
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_Probem_AOR_Probe {}
 A pointer to the AOR probe. More...
 
long int lamdagrid [2][257][257] {}
 
- Protected Attributes inherited from Population_Manager_Base
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...
 
Landscapem_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...
 

Constructor & Destructor Documentation

◆ Bembidion_Population_Manager()

Bembidion_Population_Manager::Bembidion_Population_Manager ( Landscape a_l_ptr)

Constructor.

Parameters
a_l_ptris a pointer to the landscape
208  a_l_ptr, bob_foobar) {
209  m_SimulationName = "Bembidion";
211  m_DayDegs.resize(m_BeetleLarvalStagesNum + 2); // Resets the values to zero (+2 = eggs & pupae)
214  m_MortalityTempMax = 35;
215 
216 #ifdef __BEETLEPESTICIDE1
217  //PestMortLocOutputOpen();
218  m_InFieldNo = 0;
219  m_OffFieldNo = 0;
220  m_InCropNo = 0;
222 #endif
223  // Create cfg_beetlestartnos adults
224  int temp_thread_num = omp_get_max_threads();
225  int start_num_in_thread = (cfg_Beetlestartnos.value() / temp_thread_num + 1);
226  #pragma omp parallel
227  {
228  for (int i = 0; i < start_num_in_thread; i++)
229  {
230  Struct_Beetle aps(-1, -1, m_TheLandscape, this);
231  do
232  {
235  }
236  while (!IsStartHabitat(aps.m_x, aps.m_y));
237  CreateObjects(bob_Adult, nullptr, nullptr, &aps, 1);
238  }
239  }
240 
241  for (int t=0; t<temp_thread_num; t++) {
242  for (auto it = TheSubArrays[bob_Adult][t]->begin(); it != TheSubArrays[bob_Adult][t]->end(); ++it) {
243  dynamic_cast<Bembidion_Adult*>(*it)->SetState(tobs_Hibernating);
244  }
245  }
246 }

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().

Member Function Documentation

◆ CalculateDailyEggProduction()

void Bembidion_Population_Manager::CalculateDailyEggProduction ( double  a_temptoday)
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.

292  {
297  int eggs = 0;
298  if (a_temptoday > m_AdultEggLayingThreshold) eggs = static_cast<int>(floor(
299  0.5 + (a_temptoday - m_AdultEggLayingThreshold) * m_EggProductionSlope));
300  if (eggs > 10) eggs = 10; // ensure no bigger than 10
302 }

References Beetle_Population_Manager::m_AdultEggLayingThreshold, Beetle_Population_Manager::m_EggProductionSlope, and Beetle_Adult::SetTodaysEggProduction().

◆ CreateObjects()

void Bembidion_Population_Manager::CreateObjects ( int  a_ob_type,
TAnimal a_pvo_ptr,
void *  null,
Struct_Beetle a_data,
int  number 
)
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.

254  {
255  for (int i = 0; i < number; i++)
256  {
257  if (a_ob_type == bob_Egg) { (*m_EList)[a_data->m_l->SupplyDayInYear()]->AddEgg(a_data->m_x, a_data->m_y); }
258  if (a_ob_type == bob_Larva1)
259  {
260  auto* new_Larva(new Bembidion_Larvae1(a_data->m_x, a_data->m_y, a_data->m_l, this));
261  PushIndividual(a_ob_type, new_Larva);
262  IncLiveArraySize(a_ob_type);
263  }
264  if (a_ob_type == bob_Larva2)
265  {
266  auto* new_Larva(new Bembidion_Larvae2(a_data->m_x, a_data->m_y, a_data->m_l, this));
267  PushIndividual(a_ob_type, new_Larva);
268  IncLiveArraySize(a_ob_type);
269  }
270  if (a_ob_type == bob_Larva3)
271  {
272  auto* new_Larva(new Bembidion_Larvae3(a_data->m_x, a_data->m_y, a_data->m_l, this));
273  PushIndividual(a_ob_type, new_Larva);
274  IncLiveArraySize(a_ob_type);
275  }
276  if (a_ob_type == bob_Pupa)
277  {
278  auto* new_Pupa(new Bembidion_Pupae(a_data->m_x, a_data->m_y, a_data->m_l, this));
279  PushIndividual(a_ob_type, new_Pupa);
280  IncLiveArraySize(a_ob_type);
281  }
282  if (a_ob_type == bob_Adult)
283  {
284  auto* new_Adult(new Bembidion_Adult(a_data->m_x, a_data->m_y, a_data->m_l, this));
285  PushIndividual(a_ob_type, new_Adult);
286  IncLiveArraySize(a_ob_type);
287  }
288  }
289 }

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().

◆ DoFirst()

void Bembidion_Population_Manager::DoFirst ( void  )
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.

304  {
306  if (m_TheLandscape->SupplyDayInYear() == 364)
307  {
308  for (unsigned j = 0; j < GetLiveArraySize(bob_Larva1); j++) dynamic_cast<Beetle_Base*> (SupplyAnimalPtr(bob_Larva1, j))->KillAndRemoveFromMap();
309  // Destroy this
310  for (unsigned j = 0; j < GetLiveArraySize(bob_Pupa); j++) dynamic_cast<Beetle_Base*> (SupplyAnimalPtr(bob_Pupa, j))->KillAndRemoveFromMap();
311  // Destroy this
312  }
313 }

References bob_Larva1, bob_Pupa, Beetle_Population_Manager::DoFirst(), Population_Manager_Base::m_TheLandscape, Population_Manager::SupplyAnimalPtr(), and Landscape::SupplyDayInYear().

◆ OnFarmEvent()

bool Bembidion_Population_Manager::OnFarmEvent ( FarmToDo  a_event,
Beetle_Base a_caller 
)
overrideprotectedvirtual

Returns the consequence of farme events at a the current location.

Parameters
a_eventThe event of test
a_callerThe object calling the test
Returns
true = dead, false = alive This method must be placed in each beetle population manager and the mortality choices adjusted accordingly for the species. The tests relies on parameters passed to static members and accessed through these get functions e.g. getSoilCultivationMortality.

Implements Beetle_Population_Manager.

323  {
324  switch (a_event)
325  {
326  case sleep_all_day:
327  break;
328  case autumn_plough:
329  case stubble_plough: // assumed to be the same as for autumn plough
330  case stubble_cultivator_heavy: // assumed to be the same as for autumn plough
331  case heavy_cultivator_aggregate: // assumed to be the same as for autumn plough
332  case autumn_harrow:
333  case preseeding_cultivator: // assumed to be the same as for harrow
334  case preseeding_cultivator_sow: // assumed to be the same as for harrow
335  case autumn_roll:
336  case autumn_sow:
337  case winter_plough:
338  case deep_ploughing:
339  case spring_plough:
340  case spring_harrow:
341  case shallow_harrow:
343  case strigling_sow:
344  case bed_forming:
345  case bulb_harvest:
346  if (g_rand_uni_fnc() < a_caller->GetSoilCultivationMortality()) return true;
347  break;
348  case harvest:
349  case green_harvest:
350  if (g_rand_uni_fnc() < a_caller->GetHarvestMortality()) return true;
351  break;
352  case strigling:
353  case strigling_hill:
354  if (g_rand_uni_fnc() < a_caller->GetStriglingMortality()) return true;
355  break;
356  case insecticide_treat:
357  if (g_rand_uni_fnc() < a_caller->GetInsecticideApplication()) return true;
358  break;
359  // Below here are all the no mortality operations
360  case spring_roll:
361  case spring_sow:
363  case fp_npks:
364  case fp_npk:
365  case fp_pk:
366  case fp_sk:
367  case fp_k:
368  case fp_p:
369  case fp_liquidNH3:
370  case fp_slurry:
372  case fp_ammoniumsulphate:
373  case fp_manure:
374  case fp_greenmanure:
375  case fp_sludge:
376  case fp_rsm:
377  case fp_calcium:
378  case fp_boron:
379  case fa_npks:
380  case fa_boron:
381  case fa_npk:
382  case fa_cu:
383  case fa_nk:
384  case harvestshoots:
385  case manual_weeding:
386  case fa_pk:
387  case fa_p:
388  case fa_k:
389  case fa_sk:
390  case fa_slurry:
391  case fa_ammoniumsulphate:
393  case fa_manure:
394  case fa_greenmanure:
395  case fa_sludge:
396  case fa_rsm:
397  case fa_calcium:
398  case herbicide_treat:
399  case growth_regulator:
400  case fungicide_treat:
401  case org_insecticide:
402  case org_herbicide:
403  case org_fungicide:
404  case fp_pks:
405  case fa_pks:
406  case fp_n:
407  case fa_n:
409  case pruning:
410  case shredding:
411  case fiber_covering:
412  case fiber_removal:
413  case fp_nk:
414  case fp_ns:
415  case fp_nc:
417  case harvest_bushfruit:
418  case fp_cu:
419  case hilling_up:
420  case water:
421  case swathing:
422  case flower_cutting:
423  case straw_covering:
424  case straw_removal:
425  case cattle_out:
426  case cattle_out_low:
427  case cut_to_hay:
428  case cut_to_silage:
429  case straw_chopping:
430  case hay_turning:
431  case hay_bailing:
432  case flammebehandling:
433  case stubble_harrowing:
434  case burn_straw_stubble:
435  case burn_top: //AHA
436  case mow:
437  case cut_weeds:
438  case pigs_out:
439  case molluscicide:
440  case row_cultivation:
441  case trial_control:
442  case product_treat:
443  case glyphosate:
444  case pheromone:
445  break;
446 // Biocide Treatment mortality
447  case biocide:
448  if (g_rand_uni_fnc() < (a_caller->GetInsecticideApplication())*(1.0-cfg_biocide_reduction_val.value())) return true;
449  break;
450  default:
451  m_TheLandscape->Warn("Beetle Adult - Unknown Treatment in Daily Mortality:", std::to_string(a_event));
452  exit(1);
453  }
454  return false;
455 }

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.


The documentation for this class was generated from the following files:
Beetle_Population_Manager::Beetle_Population_Manager
Beetle_Population_Manager(Landscape *a_l_ptr, int a_n)
Beetle_Population_Manager Constructor.
Definition: Beetle_BaseClasses.cpp:1400
cfg_Beetlestartnos
CfgInt cfg_Beetlestartnos
The number of beetles to start in the simulation.
fiber_removal
Definition: Treatment.h:129
fp_rsm
Definition: Treatment.h:64
org_insecticide
Definition: Treatment.h:84
Beetle_Population_Manager::IsStartHabitat
bool IsStartHabitat(int a_x, int a_y) const
Used to specify legal starting habitats for simulation start-up.
Definition: Beetle_BaseClasses.cpp:1557
Bembidion_Larvae1
Class for beetle larval stage 1, most functionality is in Beetle_Larvae.
Definition: Bembidion_All.h:89
fa_sk
Definition: Treatment.h:71
row_cultivation
Definition: Treatment.h:88
fa_pk
Definition: Treatment.h:68
fp_npk
Definition: Treatment.h:52
strigling
Definition: Treatment.h:89
g_rand_uni_fnc
double g_rand_uni_fnc()
Definition: ALMaSS_Random.cpp:56
harvest
Definition: Treatment.h:94
fa_nk
Definition: Treatment.h:142
Beetle_Population_Manager::m_InFieldNo
int m_InFieldNo
In-field counter.
Definition: Beetle_BaseClasses.h:1117
Landscape::TranslateVegTypes
TTypesOfVegetation TranslateVegTypes(int VegReference)
Returns vegetation type translated from the ALMaSS reference number.
Definition: Landscape.h:2326
Population_Manager::SupplyAnimalPtr
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.
Definition: PopulationManager.h:678
insecticide_treat
Definition: Treatment.h:83
straw_chopping
Definition: Treatment.h:99
fa_greenmanure
Definition: Treatment.h:76
bob_Pupa
Definition: Beetle_BaseClasses.h:86
stubble_plough
Definition: Treatment.h:35
growth_regulator
Definition: Treatment.h:81
deep_ploughing
Definition: Treatment.h:43
hilling_up
Definition: Treatment.h:91
green_harvest
Definition: Treatment.h:127
autumn_or_spring_plough
Definition: Treatment.h:103
Population_Manager::m_population_type
TTypesOfPopulation m_population_type
Definition: PopulationManager.h:858
flower_cutting
Definition: Treatment.h:121
Bembidion_Population_Manager::CreateObjects
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.
Definition: Bembidion_All.cpp:253
spring_plough
Definition: Treatment.h:44
fp_sk
Definition: Treatment.h:56
pruning
Definition: Treatment.h:125
Beetle_Population_Manager::m_AdultEggLayingThreshold
double m_AdultEggLayingThreshold
Temperature threshold for egg laying.
Definition: Beetle_BaseClasses.h:1064
fp_manure
Definition: Treatment.h:61
herbicide_treat
Definition: Treatment.h:80
fp_ammoniumsulphate
Definition: Treatment.h:60
flammebehandling
Definition: Treatment.h:90
straw_covering
Definition: Treatment.h:123
fp_boron
Definition: Treatment.h:131
Beetle_Base::GetInsecticideApplication
virtual double GetInsecticideApplication() const
the method overrides the method that returns the mortality due to insecticide application
Definition: Beetle_BaseClasses.h:367
fp_cu
Definition: Treatment.h:138
bulb_harvest
Definition: Treatment.h:122
preseeding_cultivator
Definition: Treatment.h:39
Struct_Beetle::m_l
Landscape * m_l
Definition: Beetle_BaseClasses.h:129
trial_control
Definition: Treatment.h:110
fp_npks
Definition: Treatment.h:51
CfgFloat::value
double value() const
Definition: Configurator.h:142
burn_top
Definition: Treatment.h:143
Bembidion_Larvae2
Class for beetle larval stage 2, most functionality is in Beetle_Larvae.
Definition: Bembidion_All.h:103
cfg_BembidionDevelopmentInflectionPoints
static CfgArray_Double cfg_BembidionDevelopmentInflectionPoints("BEMBIDION_DEVELOPMENTINFLECTIONPOINTS", CFG_CUSTOM, 10, vector< double >{12.0, 12.0, 12.0, 12.0, 12.0, 9999, 9999, 9999, 9999, 9999})
Inflection point in day degree calculations - default bembidion.
fp_nk
Definition: Treatment.h:133
burn_straw_stubble
Definition: Treatment.h:104
org_herbicide
Definition: Treatment.h:85
cfg_BembidionLarvalMortCategories
static CfgInt cfg_BembidionLarvalMortCategories("BEMBIDION_LARVALMORTCATEGORIES", CFG_CUSTOM, 7)
fa_cu
Definition: Treatment.h:140
autumn_roll
Definition: Treatment.h:38
strigling_hill
Definition: Treatment.h:117
heavy_cultivator_aggregate
Definition: Treatment.h:120
Struct_Beetle::m_y
int m_y
Definition: Beetle_BaseClasses.h:128
fp_manganesesulphate
Definition: Treatment.h:59
TOP_Bembidion
Definition: PopulationManager.h:62
hay_turning
Definition: Treatment.h:100
Bembidion_Larvae3
Class for beetle larval stage 3, most functionality is in Beetle_Larvae.
Definition: Bembidion_All.h:117
straw_removal
Definition: Treatment.h:124
fa_n
Definition: Treatment.h:139
shredding
Definition: Treatment.h:126
cfg_BeetleLarvalStagesNum
CfgInt cfg_BeetleLarvalStagesNum
The number of larval stages for this species.
Beetle_Adult::SetTodaysEggProduction
static void SetTodaysEggProduction(const int a_value)
Daily temperature determined egg production.
Definition: Beetle_BaseClasses.h:848
pheromone
Definition: Treatment.h:149
fp_n
Definition: Treatment.h:132
manual_weeding
Definition: Treatment.h:148
fa_npk
Definition: Treatment.h:67
Population_Manager_Base::m_TheLandscape
Landscape * m_TheLandscape
holds an internal pointer to the landscape
Definition: PopulationManager.h:624
winter_plough
Definition: Treatment.h:42
fp_calcium
Definition: Treatment.h:65
spring_harrow
Definition: Treatment.h:45
cut_to_silage
Definition: Treatment.h:98
fa_sludge
Definition: Treatment.h:77
pigs_out
Definition: Treatment.h:96
fp_p
Definition: Treatment.h:54
cut_to_hay
Definition: Treatment.h:97
fa_boron
Definition: Treatment.h:141
Beetle_Larvae::SetLarvalDailyMort
static void SetLarvalDailyMort(const vector< double > &a_value, const int a_numLarvalStages, const int a_catagories)
Set the daily fixed mortality probability based on the larval stages and temperature.
Definition: Beetle_BaseClasses.h:582
cfg_BeetleInCropRef
CfgInt cfg_BeetleInCropRef
A reference to a crop type if we are looking for mortality locations within a special crop.
Landscape::SupplySimAreaHeight
int SupplySimAreaHeight(void)
Gets the simulation landscape height.
Definition: Landscape.h:2302
Landscape::SupplySimAreaWidth
int SupplySimAreaWidth(void)
Gets the simulation landscape width.
Definition: Landscape.h:2297
fa_k
Definition: Treatment.h:70
spring_roll
Definition: Treatment.h:46
fp_nc
Definition: Treatment.h:135
fungicide_treat
Definition: Treatment.h:82
fp_sludge
Definition: Treatment.h:63
fp_greenmanure
Definition: Treatment.h:62
shallow_harrow
Definition: Treatment.h:119
fa_slurry
Definition: Treatment.h:72
cattle_out_low
Definition: Treatment.h:112
harvest_bushfruit
Definition: Treatment.h:137
preseeding_cultivator_sow
Definition: Treatment.h:40
fp_pk
Definition: Treatment.h:53
Beetle_Base::GetHarvestMortality
virtual double GetHarvestMortality() const
the method overrides the method that returns the mortality due to harvest
Definition: Beetle_BaseClasses.h:369
fa_pks
Definition: Treatment.h:145
cfg_biocide_reduction_val
CfgFloat cfg_biocide_reduction_val
Beetle_Population_Manager::m_InCropRef
TTypesOfVegetation m_InCropRef
In crop tole reference.
Definition: Beetle_BaseClasses.h:1123
org_fungicide
Definition: Treatment.h:86
Beetle_Population_Manager::m_BeetleLarvalStagesNum
int m_BeetleLarvalStagesNum
Definition: Beetle_BaseClasses.h:1058
Landscape::SupplyDayInYear
int SupplyDayInYear(void)
Passes a request on to the associated Calendar class function, the day in the year.
Definition: Landscape.h:2267
cattle_out
Definition: Treatment.h:95
harvestshoots
Definition: Treatment.h:147
stubble_cultivator_heavy
Definition: Treatment.h:36
Beetle_Population_Manager::DoFirst
void DoFirst() override
Does day degree development calculations here.
Definition: Beetle_BaseClasses.cpp:1563
biocide
Definition: Treatment.h:116
swathing
Definition: Treatment.h:93
glyphosate
Definition: Treatment.h:114
CfgInt::value
int value() const
Definition: Configurator.h:116
fa_manure
Definition: Treatment.h:75
CfgArray_Double::value
std::vector< double > value() const
Definition: Configurator.h:219
bob_Larva3
Definition: Beetle_BaseClasses.h:85
spring_sow
Definition: Treatment.h:47
Bembidion_Pupae
Definition: Bembidion_All.h:131
cut_weeds
Definition: Treatment.h:106
Beetle_Population_Manager::m_MortalityTempMax
double m_MortalityTempMax
Threshold temperatures for mortalities: Max.
Definition: Beetle_BaseClasses.h:1046
Struct_Beetle
A data class for Beetle data.
Definition: Beetle_BaseClasses.h:125
fp_pks
Definition: Treatment.h:146
fp_ns
Definition: Treatment.h:134
Bembidion_Adult
Definition: Bembidion_All.h:145
bed_forming
Definition: Treatment.h:118
bob_foobar
Definition: Beetle_BaseClasses.h:88
product_treat
Definition: Treatment.h:113
Beetle_Population_Manager::m_EggProductionSlope
double m_EggProductionSlope
the slope of the linear function that defines todays egg production
Definition: Beetle_BaseClasses.h:1066
autumn_sow
Definition: Treatment.h:41
Beetle_Population_Manager::m_InCropNo
int m_InCropNo
In-crop counter.
Definition: Beetle_BaseClasses.h:1119
autumn_harrow
Definition: Treatment.h:37
fa_calcium
Definition: Treatment.h:79
Beetle_Population_Manager::m_DevelopmentInflectionPoints
vector< double > m_DevelopmentInflectionPoints
Inflection point in day degree calculations for non-adult stages.
Definition: Beetle_BaseClasses.h:1070
fa_ammoniumsulphate
Definition: Treatment.h:74
bob_Larva1
Definition: Beetle_BaseClasses.h:83
Population_Manager_Base::m_SimulationName
string m_SimulationName
stores the simulation name
Definition: PopulationManager.h:622
autumn_sow_with_ferti
Definition: Treatment.h:136
fa_p
Definition: Treatment.h:69
mow
Definition: Treatment.h:105
fa_rsm
Definition: Treatment.h:78
g_random_fnc
int g_random_fnc(const int a_range)
Definition: ALMaSS_Random.cpp:74
fa_npks
Definition: Treatment.h:66
water
Definition: Treatment.h:92
stubble_harrowing
Definition: Treatment.h:102
cfg_BembidionLarvalDailyTemperatureMort
static CfgArray_Double cfg_BembidionLarvalDailyTemperatureMort("BEMBIDION_LARVALDAILYTEMPERATUREMORT", CFG_CUSTOM, 3 *7, vector< double >{ 0.0855, 0.0855, 0.1036, 0.0563, 0.0515, 0.0657, 0.0957, 0.0626, 0.0626, 0.0940, 0.0529, 0.0492, 0.0633, 0.0933, 0.0631, 0.0631, 0.0545, 0.0268, 0.0236, 0.0295, 0.0595 })
The daily fixed temperature related mmortality larval probability.
Beetle_Population_Manager::m_OffFieldNo
int m_OffFieldNo
Off-field counter.
Definition: Beetle_BaseClasses.h:1121
fp_liquidNH3
Definition: Treatment.h:57
molluscicide
Definition: Treatment.h:87
Population_Manager::PushIndividual
void PushIndividual(const unsigned a_listindex, TAnimal *a_individual_ptr)
Definition: PopulationManager.cpp:1682
hay_bailing
Definition: Treatment.h:101
Struct_Beetle::m_x
int m_x
Definition: Beetle_BaseClasses.h:127
fa_manganesesulphate
Definition: Treatment.h:73
Population_Manager::TheSubArrays
vector< vector< forward_list< TAnimal * > * > > TheSubArrays
Hold all the animal pointers.
Definition: PopulationManager.h:804
fp_k
Definition: Treatment.h:55
Landscape::Warn
void Warn(std::string a_msg1, std::string a_msg2)
Wrapper for the g_msg Warn function.
Definition: Landscape.h:2250
bob_Egg
Definition: Beetle_BaseClasses.h:82
Beetle_Base::GetStriglingMortality
virtual double GetStriglingMortality() const
Mortality by Strigling: similar for all forms– should use base class method.
Definition: Beetle_BaseClasses.h:363
autumn_plough
Definition: Treatment.h:34
bob_Adult
Definition: Beetle_BaseClasses.h:87
Beetle_Base::GetSoilCultivationMortality
virtual double GetSoilCultivationMortality() const
the method overrides the method that returns the mortality due to soil cultivation
Definition: Beetle_BaseClasses.h:365
fp_slurry
Definition: Treatment.h:58
fiber_covering
Definition: Treatment.h:128
bob_Larva2
Definition: Beetle_BaseClasses.h:84
tobs_Hibernating
Definition: Beetle_BaseClasses.h:70
spring_sow_with_ferti
Definition: Treatment.h:115
sleep_all_day
Definition: Treatment.h:33
strigling_sow
Definition: Treatment.h:107
Beetle_Population_Manager::m_DayDegs
vector< std::array< double, 365 > > m_DayDegs
Storage for daily day degrees for non-adult stages.
Definition: Beetle_BaseClasses.h:1052
Population_Manager::IncLiveArraySize
void IncLiveArraySize(int a_listindex)
Increments the number of 'live' objects for a list index in the TheArray.
Definition: PopulationManager.h:665