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
Beetle_Egg_List Class Reference

The class describing the beetle Egg_List objects. More...

#include <Beetle_BaseClasses.h>

Inheritance diagram for Beetle_Egg_List:
Beetle_Base TAnimal TALMaSSObject Bembidion_Egg_List Ladybird_Egg_List PoecilusCupreus_Egg_List

Public Member Functions

 Beetle_Egg_List (int today, Beetle_Population_Manager *a_bpm_ptr, Landscape *L)
 Egg_List class constructor. More...
 
void Step () override
 Egg_List class Step code. More...
 
void BeginStep () override
 Egg_List class BeginStep code. More...
 
void AddEgg (const int x, const int y)
 Add an egg to the list. More...
 
void Clear ()
 
void Supply_m_Location (const int i, int &a_x, int &a_y) const
 supplies the x-coordinate of a specific egg in the list More...
 
int SupplyEggNumber () const
 
double GetStriglingMortality () const override
 Mortality by Strigling: similar for all forms– should use base class method. More...
 
double GetSoilCultivationMortality () const override
 the method overrides the method that returns the mortality due to soil cultivation More...
 
double GetInsecticideApplication () const override
 the method overrides the method that returns the mortality due to insecticide application More...
 
double GetHarvestMortality () const override
 the method overrides the method that returns the mortality due to harvest More...
 
void ExtremeTempMortality (double a_threshold)
 Extreme temperature mortality, this is only used for ladybird for now. More...
 
void CannibalismMortality (Eigen::MatrixXi &a_death_map, int &a_kill_num)
 Death caused by cannibalism. This is only used by lady birds. More...
 
- Public Member Functions inherited from Beetle_Base
 Beetle_Base (int a_x, int a_y, Landscape *a_l_ptr, Beetle_Population_Manager *a_bpm_ptr)
 Beetle_Base Constructor. More...
 
virtual void ReInit (int a_x, int a_y, Landscape *a_l_ptr, Beetle_Population_Manager *a_bpm_ptr)
 ReInit for object pool. More...
 
virtual void SetState (const TTypesOfBeetleState a_state)
 Used to force a beetle state (e.g. at start of the simulation) More...
 
virtual void StDie ()
 Common state Die. More...
 
void CopyMyself (int a_beetle)
 For experimental purposes. More...
 
virtual bool GetDensityDependentMortality ()
 The density dependent mortality calculation (cannibalism) defaults to none. More...
 
void KillAndRemoveFromMap ()
 Kills the beetle - this version forces the beetle to re-enter the Step code and call st_Dying. More...
 
void IncDensity (int a_x, int a_y, int a_lifestage)
 The method inreases the number of beetles in this specific location by one. Used when called by a beetle of different lifestage than the one incremented. More...
 
void DecDensity (int a_x, int a_y)
 The method decreases the number of beetles in this specific location by one. More...
 
void KillOneInMap (int a_x, int a_y, int a_lifestage)
 The method decreases the number of beetles in this specific location by one. More...
 
void IncDensity (const int a_x, const int a_y)
 The method inreases the number of beetles in this specific location by one. More...
 
void DecDensity (const int a_x, const int a_y, const int a_lifestage)
 The method decreases the number of beetles in this specific location by one. Used when called by a beetle of different lifestage than the one dying. More...
 
int GetDensity (int a_x, int a_y) const
 The method to return the number of beetles in this specific location. More...
 
int GetDensityRange (int a_x, int a_y, int a_range) const
 The method to return the number of beetles in this specific location with a range. More...
 
int GetDensityRangeEdge (int a_x, int a_y, int a_range) const
 The method to return the number of beetles in this specific location with a range. More...
 
virtual double GetDevelopmentConstants (const int a_i) const
 the method returns the larvae development constant to be used in day degrees calculation More...
 
int WhatState () override
 Return the beetle state as an integer. More...
 
- Public Member Functions inherited from TAnimal
 TAnimal (int x, int y, Landscape *L)
 The TAnimal constructor saving the x,y, location and the landscape pointer. More...
 
 TAnimal (int x, int y)
 The TAnimal constructor saving the x,y used if landscape is already set. More...
 
void SetGuardMapIndex (int a_index_x, int a_index_y)
 Set the guard map index, this is used to avoid two animals operating in the same location when using multithread. More...
 
unsigned SupplyFarmOwnerRef () const
 Get the current location farm ref if any. More...
 
AnimalPosition SupplyPosition () const
 Returns the objects location and habitat type and veg type. More...
 
APoint SupplyPoint () const
 Returns the objects location in ALMaSS coordinates. More...
 
int SupplyPolygonRef () const
 Returns the polygon reference where the object is located. More...
 
TTypesOfLandscapeElement SupplyPolygonType () const
 Returns the polygon type where the object is located. More...
 
int Supply_m_Location_x () const
 Returns the ALMaSS x-coordinate. More...
 
int Supply_m_Location_y () const
 Returns the ALMaSS y-coordinate. More...
 
int SupplyGuardCellX () const
 Returns the x-index to the guard cell. More...
 
int SupplyGuardCellY () const
 Returns the y-index to the guard cell. More...
 
int SupplyAge () const
 Returns the animals age in days. More...
 
void SetAge (int a_age)
 Sets the animals age in days. More...
 
virtual void KillThis ()
 Sets all parameters ready for object destruction. More...
 
virtual void CopyMyself ()
 Used to copy the object details to another in descendent classes. More...
 
void SetX (const int a_x)
 Sets the x-coordinate. More...
 
void SetY (const int a_y)
 Sets the y-coordinate. More...
 
virtual void ReinitialiseObject (int a_x, int a_y, Landscape *a_l_ptr)
 
virtual void ReinitialiseObject (int a_x, int a_y)
 Used to re-use an object - must be implemented in descendent classes. More...
 
virtual void Dying ()
 A wrapped for KillThis - ideally should not be used. More...
 
void CheckManagement ()
 Used to start a check for any management related effects at the objects current location. More...
 
void CheckManagementXY (int a_x, int a_y)
 Used to start a check for any management related effects at x,y. More...
 
- Public Member Functions inherited from TALMaSSObject
int GetCurrentStateNo () const
 Returns the current state number. More...
 
void SetCurrentStateNo (int a_num)
 Sets the current state number. More...
 
bool GetStepDone () const
 Returns the step done indicator flag. More...
 
void SetStepDone (bool a_bool)
 Sets the step done indicator flag. More...
 
virtual void EndStep ()
 EndStep behaviour - must be implemented in descendent classes. More...
 
void ReinitialiseObjectBase ()
 Used to initialise an object. More...
 
 TALMaSSObject ()
 The constructor for TALMaSSObject. More...
 
virtual ~TALMaSSObject ()=default
 The destructor for TALMaSSObject. More...
 

Static Public Member Functions

static void SetEgg_SoilCultivationMortality (const double a_value)
 Set egg soil mortality parameter. More...
 
static void SetEgg_InsecticideApplication (const double a_value)
 Set Larval insecticide mortality parameter. More...
 
static void SetDailyEggMort (const double a_value)
 Set the daily fixed mortality probability. More...
 
static void SetEgg_StriglingMort (const double a_value)
 Set mechanical weeding mortality parameter. More...
 
static void SetEgg_HarvestMort (const double a_value)
 Set harvest mortality parameter. More...
 
static void SetEggPppElimRate (const double a_rate)
 
static void SetEggPppThreshold (const double a_thresh)
 
static void SetEggPppEffectProb (const double a_conc)
 
static void SetEggPppEffectProbDecay (const double a_decay)
 
- Static Public Member Functions inherited from Beetle_Base
static int GetDensityStage (int a_x, int a_y, unsigned a_stage)
 The method to return the number of beetles in this specific location for a given stage. More...
 
static int GetDensityStages (int a_x, int a_y, int a_numberstageStart, int a_numberstangeEnd)
 The method to return the number of beetles in this specific location, summing multiple stages. More...
 
static int GetDensityRangeStages (int a_x, int a_y, int a_range, int a_numberstageStart, int a_numberstangeEnd)
 The method to return the number of beetles in this specific location with a range, summing multiple stages. More...
 
static void SetDevelopmentConstants (const std::vector< double > &a_value)
 Set the day degree constant. More...
 
static void SetTodaysTempCategory (int a_category)
 Set the soil temperature category used for calculatiung mortality steps. More...
 
static void SetMoveDistribution (const string &a_type_str, const string &a_args_str)
 Set the movement distribution. More...
 
static void SetBeetleSuitableForHibernation (const TTovList &a_list)
 Set the list of tovs that are suitable for hibernation. More...
 
static void SetBeetleReproductionLandscape (const TToleList &a_list)
 Set the list of toles that the beetles are allowed to reproduce upon. More...
 
static void SetBeetleHalfReproductionLandscape (const TToleList &a_list)
 Set the list of toles that the beetles are allowed to reproduce upon, but that yield half of normal fertility (bembidion) More...
 
static void SetDipsersalDayDegrees (const int a_value)
 
static void SetMaxShortRangeAttempts (const int a_value)
 
static void SetDDepRange (const int a_value)
 Set density-dependent range parameter. More...
 
static void SizeBeetleMap (const int a_value)
 Size the lifestage map. More...
 
static void SetBeetleMap (const int a_value, SimplePositionMapInt *a_map_ptr)
 Set lifestage map. More...
 
static int ChooseDirection (const double(&a_probabilities)[8])
 The function that draws the random number and checks in which interval in the probabilities vector are we This would be the direction the beetle will take. More...
 
- Static Public Member Functions inherited from TAnimal
static void SetSimulationWidth (int a_value)
 Sets the simulation width. More...
 
static void SetSimulationHeight (int a_value)
 Sets the simulation height. More...
 
static void SetDayInYear (int a_value)
 Sets the day in year attribute. More...
 
static void SetOurLandscape (Landscape *a_value)
 Sets the landscape pointer. More...
 
static void SetTempToday (double a_value)
 Sets the temperature today attribute. More...
 
- Static Public Member Functions inherited from TALMaSSObject
static void OnArrayBoundsError ()
 Used for debugging only, tests basic object properties. More...
 

Protected Member Functions

void InternalPesticideHandlingAndResponse () override
 Handle pesticide events code for the beetle. More...
 
virtual TTypesOfBeetleState St_Develop ()
 Egg_List state development. More...
 
virtual TTypesOfBeetleState St_Hatch ()
 Egg_List state hatching. More...
 
bool DailyMortality () override
 Checks daily mortality returns true on death. More...
 
- Protected Member Functions inherited from Beetle_Base
virtual void Init (Beetle_Population_Manager *a_bpm_ptr)
 Init for a beetle object. More...
 
bool OnFarmEvent (FarmToDo event) override
 the farming event mortality. This is the function that is used for all the beetles. It calls methods that are re-defined by object and by method. More...
 
virtual bool CheckManagementBeetle ()
 
virtual double TempRelatedMortality ()
 Basic movement for beetle. More...
 
virtual int GetDDepthRange () const
 range at which density dependent mortality is applied - base class does not override, but others might need to More...
 
void Beetle_1M_Move (int a_dist)
 The function that calculates the cumulative probability for the movement direction. It calls the movement factor method and processes ints result to adjust "p" (by reference) More...
 
virtual bool IsLocationAllowed (int x, int y)
 
virtual double GetShortRangeDistance () const
 returns the length of the short range hop
More...
 
virtual double MovementFactor (int x, int y, int x1, int y1)
 function that calculates the factor that is taken into account when considering the movement of the individual More...
 
virtual double GetDailyMortalityRate () const
 method returns the rate of the background mortality More...
 
- Protected Member Functions inherited from TAnimal
void CorrectWrapRound ()
 Corrects wrap around co-ordinate problems. More...
 

Protected Attributes

TListOfEggs m_EggList
 The list of eggs. More...
 
int m_DayMade
 Records the day hatched for development calculations. More...
 
- Protected Attributes inherited from Beetle_Base
TTypesOfBeetleState m_CurrentBState { tobs_Initiation }
 Current behavioural state. More...
 
Beetle_Population_Managerm_OurPopulation { nullptr }
 Pointer to the population manager. More...
 
double m_BodyBurden { -1.0 }
 Current body burden of pesticide. More...
 
double m_CurrentPppEffectProb { -1.0 }
 Current effect probability. More...
 
unsigned m_Lifestage { 0 }
 This is a useful parameter holding the beetle type (this includes larval stages) More...
 
- Protected Attributes inherited from TAnimal
int m_Location_x
 The objects ALMaSS x coordinate. More...
 
int m_Location_y
 The objects ALMaSS y coordinate. More...
 
int m_guard_cell_x
 The index x to the guard cell. More...
 
int m_guard_cell_y
 The index y to the guard cell. More...
 
int m_AgeDays {0}
 To hold the age in days. More...
 
PesticideToxicity m_my_pesticide
 
- Protected Attributes inherited from TALMaSSObject
int m_CurrentStateNo
 The basic state number for all objects - '-1' indicates death. More...
 
bool m_StepDone
 Indicates whether the iterative step code is done for this timestep. More...
 

Static Protected Attributes

static double m_DailyEggMort = 0.007
 Daily fixed mortality probability. More...
 
static double m_Egg_SoilCultivationMortality = 0
 The egg soil mortality parameter. More...
 
static double m_Egg_HarvestMort = 0
 The egg harvest mortality parameter. More...
 
static double m_Egg_StriglingMort = 0
 The egg strigling mortality parameter. More...
 
static double m_Egg_InsecticideApplication = 0
 The egg nsecticide mortality parameter. More...
 
static double m_BeetleEggPPPElimRate = 0
 
static double m_BeetleEPPPThreshold = 0
 
static double m_BeetleEPPPEffectProb = 0
 
static double m_BeetleEPPPEffectProbDecay = 0
 
- Static Protected Attributes inherited from Beetle_Base
static vector< double > m_DevelopmentConstants = {}
 Day degree constant, the target to reach before next stage. More...
 
static std::unique_ptr< probability_distributionm_Move_distribution = nullptr
 Probabilty of adult movement by distance to be defined by the probability type and parameters. More...
 
static TTovList m_BeetleSuitableForHibernation = {tov_Undefined}
 the list of tovs that are suitable for hibernation More...
 
static TToleList m_BeetleReproductionLandscape = {tole_Foobar}
 the list of toles that the beetles are allowed to reproduce upon More...
 
static TToleList m_BeetleHalfReproductionLandscape = {tole_Foobar}
 the list of toles that the beetles are allowed to reproduce upon, but that yield half of normal fertility (bembidion) More...
 
static int m_DipsersalDayDegrees = 8
 
static int m_DDepRange = 3
 The depth of the surrounding cells for density dependence calculations in adults. More...
 
static int m_MaxShortRangeAttempts = 1
 The number of tries allowed to find a short range legal move. More...
 
static int m_TodaysTempCategory = 0
 Set the soiltemperature category used for calculatiung mortality steps. More...
 
- Static Protected Attributes inherited from TAnimal
static Landscapem_OurLandscape = nullptr
 A pointer to the landscape object shared with all TAnimal objects. More...
 
static int m_SimulationWidth = 0
 A static member for the simulation width because it is often used by descendent classes. More...
 
static int m_SimulationHeight = 0
 A static member for the simulation height because it is often used by descendent classes. More...
 
static double m_TemperatureToday = 0.0
 A holder for the temperature today shared with all TAnimal objects. More...
 
static int m_DayInYear = 0
 A holder for the day in year shared with all TAnimal objects. More...
 

Additional Inherited Members

- Static Public Attributes inherited from Beetle_Base
static vector< SimplePositionMapInt * > m_BeetleMaps = {}
 A list of pointers to the specific map for a beetle lifestage. More...
 

Detailed Description

The class describing the beetle Egg_List objects.

Constructor & Destructor Documentation

◆ Beetle_Egg_List()

Beetle_Egg_List::Beetle_Egg_List ( int  today,
Beetle_Population_Manager a_bpm_ptr,
Landscape L 
)

Egg_List class constructor.

Beetle egg list constructor.

The egg list is an optimisation to reduce memory and time to run it means that there are only 365 of them possible and that each on contains all the eggs laid on that day. The only real problem is that there is no longer a link from parent to offspring - so this version cannot be used with genetics without adding the genes to the APoint struct.

450  : Beetle_Base(
451  0, 0, L, a_bpm_ptr) {
452  m_DayMade = today;
454  m_EggList.resize(omp_get_max_threads());
455 }

References bob_Egg, m_DayMade, m_EggList, and Beetle_Base::m_Lifestage.

Member Function Documentation

◆ AddEgg()

void Beetle_Egg_List::AddEgg ( const int  x,
const int  y 
)
inline

Add an egg to the list.

396  {
397  APoint E;
398  E.m_x = x;
399  E.m_y = y;
400  m_EggList[omp_get_thread_num()].push_front(E);
401  IncDensity(x, y);
402  }

References Beetle_Base::IncDensity(), m_EggList, APoint::m_x, and APoint::m_y.

◆ BeginStep()

void Beetle_Egg_List::BeginStep ( void  )
overridevirtual

Egg_List class BeginStep code.

Implements Beetle_Base.

471  {
472  DailyMortality(); // should be dealt with for each species separately
473  // based on the constants injected in the inherited class
474 }

References DailyMortality().

◆ CannibalismMortality()

void Beetle_Egg_List::CannibalismMortality ( Eigen::MatrixXi &  a_death_map,
int &  a_kill_num 
)

Death caused by cannibalism. This is only used by lady birds.

530  {
531 
532  //we can run in parallel because we don't track the pointer at each location
533  int temp_thread_num = omp_get_max_threads();
534 
535  bool is_enough_eggs = false;
536  for (int thread_id=0; thread_id < temp_thread_num; thread_id++){
537  auto prev_point = m_EggList[thread_id].before_begin();
538  for (auto point = m_EggList[thread_id].begin(); point != m_EggList[thread_id].end();){
539  bool not_deleted_flag = true;
540  if(a_death_map((*point).m_y, (*point).m_x) > 0){
541  a_death_map((*point).m_y, (*point).m_x) -= 1;
542  point = m_EggList[omp_get_thread_num()].erase_after(prev_point); // Code for kill it
543  not_deleted_flag = false;
544  a_kill_num -= 1;
545  //DecDensity((*point).m_x, (*point).m_y, 0);
546  }
547  if(a_kill_num <= 0){
548  is_enough_eggs = true;
549  break;
550  }
551  if(not_deleted_flag){
552  prev_point = point;
553  ++point;
554  }
555  }
556  if(is_enough_eggs){
557  break;
558  }
559  }
560 }

References m_EggList.

◆ Clear()

void Beetle_Egg_List::Clear ( )
inline

/brief Empty the egg list

405  {
406  int max_thread_num = omp_get_max_threads();
407  for(int i = 0; i < max_thread_num; i++) {
408  m_EggList[i].clear();
409  }
410  }

References m_EggList.

◆ DailyMortality()

bool Beetle_Egg_List::DailyMortality ( )
overrideprotectedvirtual

Checks daily mortality returns true on death.

Reimplemented from Beetle_Base.

562  {
563  // Needs to go through all eggs in the list and test for background mortality
564  // and while we are here for OnFarmEvent stuff
565 
566  const TTypesOfBeetleState behaviour = m_CurrentBState; // Use only to be sure we don't change it inadvertently
567 
568  #pragma omp parallel
569  {
570  auto prev_point = m_EggList[omp_get_thread_num()].before_begin();
571  for (auto point = m_EggList[omp_get_thread_num()].begin(); point != m_EggList[omp_get_thread_num()].end(); )
572  {
573  bool not_deleted_flag = true;
575  {
576  // Remove the Egg it is dead
577  int temp_guard_x_index = (*point).m_x / cfg_MapGuardCellSize.value();
578  int temp_guard_y_index = (*point).m_y / cfg_MapGuardCellSize.value();
579  m_OurPopulation->SetGuardMapElement(temp_guard_x_index, temp_guard_y_index);
580  DecDensity((*point).m_x, (*point).m_y);
581  point = m_EggList[omp_get_thread_num()].erase_after(prev_point); // Code for kill it
582  m_OurPopulation->UnsetGuardMapElement(temp_guard_x_index, temp_guard_y_index);
583  not_deleted_flag = false;
584  }
585  else
586  {
587  FarmToDo event;
588  int res = 0; // used to iterate through the event list
589  while ((event = static_cast<FarmToDo>(m_OurLandscape->
590  SupplyLastTreatment((*point).m_x, (*point).m_y, &res))) != sleep_all_day)
591  {
592  if (OnFarmEvent(event))
593  {
594  // Remove the Egg it is dead
595  int temp_guard_x_index = (*point).m_x / cfg_MapGuardCellSize.value();
596  int temp_guard_y_index = (*point).m_y / cfg_MapGuardCellSize.value();
597  m_OurPopulation->SetGuardMapElement(temp_guard_x_index, temp_guard_y_index);
598  DecDensity((*point).m_x, (*point).m_y);
599  point = m_EggList[omp_get_thread_num()].erase_after(prev_point); // Code for kill it
600  m_OurPopulation->UnsetGuardMapElement(temp_guard_x_index, temp_guard_y_index);
601  not_deleted_flag = false;
602  break; //it is dead and removed, escape the llop
603  }
604  }
605  }
606 
607  if(not_deleted_flag){
608  prev_point = point;
609  ++point;
610  }
611  }
612  }
613 
614  // We need to reset the m_CurrentBState in case its changed.
615  // There is just one state for all the eggs for this day
616  m_CurrentBState = behaviour;
617  return true; // always returns true
618 }

References cfg_MapGuardCellSize, Beetle_Base::DecDensity(), g_rand_uni_fnc(), Beetle_Base::m_CurrentBState, m_DailyEggMort, m_EggList, TAnimal::m_OurLandscape, Beetle_Base::m_OurPopulation, Beetle_Base::OnFarmEvent(), Population_Manager::SetGuardMapElement(), sleep_all_day, Population_Manager::UnsetGuardMapElement(), and CfgInt::value().

Referenced by BeginStep().

◆ ExtremeTempMortality()

void Beetle_Egg_List::ExtremeTempMortality ( double  a_threshold)

Extreme temperature mortality, this is only used for ladybird for now.

621  {
622  #pragma omp parallel
623  {
624  int thread_num = omp_get_thread_num();
625  auto prev_point = m_EggList[thread_num].before_begin();
626  for (auto point = m_EggList[thread_num].begin(); point != m_EggList[thread_num].end(); )
627  {
628  if (g_rand_uni_fnc() < a_threshold)
629  {
630  // Remove the Egg it is dead
631  int temp_guard_x_index = (*point).m_x / cfg_MapGuardCellSize.value();
632  int temp_guard_y_index = (*point).m_y / cfg_MapGuardCellSize.value();
633  m_OurPopulation->SetGuardMapElement(temp_guard_x_index, temp_guard_y_index);
634  DecDensity((*point).m_x, (*point).m_y);
635  point = m_EggList[thread_num].erase_after(prev_point); // Code for kill it
636  m_OurPopulation->UnsetGuardMapElement(temp_guard_x_index, temp_guard_y_index);
637  }
638  else{
639  prev_point = point;
640  ++point;
641  }
642  }
643  }
644 }

References cfg_MapGuardCellSize, Beetle_Base::DecDensity(), g_rand_uni_fnc(), m_EggList, Beetle_Base::m_OurPopulation, Population_Manager::SetGuardMapElement(), Population_Manager::UnsetGuardMapElement(), and CfgInt::value().

◆ GetHarvestMortality()

double Beetle_Egg_List::GetHarvestMortality ( ) const
inlineoverridevirtual

the method overrides the method that returns the mortality due to harvest

Reimplemented from Beetle_Base.

477 { return m_Egg_HarvestMort; }

References m_Egg_HarvestMort.

◆ GetInsecticideApplication()

double Beetle_Egg_List::GetInsecticideApplication ( ) const
inlineoverridevirtual

the method overrides the method that returns the mortality due to insecticide application

Reimplemented from Beetle_Base.

References m_Egg_InsecticideApplication.

◆ GetSoilCultivationMortality()

double Beetle_Egg_List::GetSoilCultivationMortality ( ) const
inlineoverridevirtual

the method overrides the method that returns the mortality due to soil cultivation

Reimplemented from Beetle_Base.

References m_Egg_SoilCultivationMortality.

◆ GetStriglingMortality()

double Beetle_Egg_List::GetStriglingMortality ( ) const
inlineoverridevirtual

Mortality by Strigling: similar for all forms– should use base class method.

Reimplemented from Beetle_Base.

471 { return m_Egg_StriglingMort; }

References m_Egg_StriglingMort.

◆ InternalPesticideHandlingAndResponse()

void Beetle_Egg_List::InternalPesticideHandlingAndResponse ( )
overrideprotectedvirtual

Handle pesticide events code for the beetle.

If the body burden exceeds the trigger then an effect is tested for and implemented depending on the pesticide type.

Reimplemented from Beetle_Base.

2222  {
2226  // Test against the threshold level for larvae to determine if an effect needs to be tested for
2228  {
2229  // We are above the PPP body burden threshold, so make a test for effect
2231  {
2232  case ttop_NoPesticide:
2233  case ttop_ReproductiveEffects: // Reproductive effects
2234  // TODO
2235  break;
2236  case ttop_AcuteEffects: // Acute mortality
2237  case ttop_AcuteEffectsDoseResponse: // Acute mortality
2239  break;
2242  {
2244  }
2245  break;
2246  case ttop_MultipleEffects:
2247  break;
2248  default:
2249  g_msg->Warn(
2250  "Unknown pesticide type used in Beetle_Adult::InternalPesticideHandlingAndResponse() pesticide code ",
2252  exit(47);
2253  }
2254  }
2255 }

References g_msg, g_rand_uni_fnc(), Beetle_Base::KillAndRemoveFromMap(), m_BeetleEPPPEffectProb, m_BeetleEPPPEffectProbDecay, m_BeetleEPPPThreshold, Beetle_Base::m_BodyBurden, Beetle_Base::m_CurrentPppEffectProb, TAnimal::m_OurLandscape, Landscape::SupplyPesticideType(), ttop_AcuteDelayedEffects, ttop_AcuteEffects, ttop_AcuteEffectsDoseResponse, ttop_MultipleEffects, ttop_NoPesticide, ttop_ReproductiveEffects, and MapErrorMsg::Warn().

◆ SetDailyEggMort()

static void Beetle_Egg_List::SetDailyEggMort ( const double  a_value)
inlinestatic

◆ SetEgg_HarvestMort()

static void Beetle_Egg_List::SetEgg_HarvestMort ( const double  a_value)
inlinestatic

Set harvest mortality parameter.

450 { m_Egg_HarvestMort = a_value; }

References m_Egg_HarvestMort.

Referenced by Beetle_Population_Manager::Beetle_Population_Manager().

◆ SetEgg_InsecticideApplication()

static void Beetle_Egg_List::SetEgg_InsecticideApplication ( const double  a_value)
inlinestatic

Set Larval insecticide mortality parameter.

444 { m_Egg_InsecticideApplication = a_value; }

References m_Egg_InsecticideApplication.

Referenced by Beetle_Population_Manager::Beetle_Population_Manager().

◆ SetEgg_SoilCultivationMortality()

static void Beetle_Egg_List::SetEgg_SoilCultivationMortality ( const double  a_value)
inlinestatic

Set egg soil mortality parameter.

442 { m_Egg_SoilCultivationMortality = a_value; }

References m_Egg_SoilCultivationMortality.

Referenced by Beetle_Population_Manager::Beetle_Population_Manager().

◆ SetEgg_StriglingMort()

static void Beetle_Egg_List::SetEgg_StriglingMort ( const double  a_value)
inlinestatic

Set mechanical weeding mortality parameter.

448 { m_Egg_StriglingMort = a_value; }

References m_Egg_StriglingMort.

Referenced by Beetle_Population_Manager::Beetle_Population_Manager().

◆ SetEggPppEffectProb()

static void Beetle_Egg_List::SetEggPppEffectProb ( const double  a_conc)
inlinestatic

Set body PPP effect probability

456 { m_BeetleEPPPEffectProb = a_conc; }

References m_BeetleEPPPEffectProb.

Referenced by Beetle_Population_Manager::Beetle_Population_Manager().

◆ SetEggPppEffectProbDecay()

static void Beetle_Egg_List::SetEggPppEffectProbDecay ( const double  a_decay)
inlinestatic

Set PPP effect decayy

458 { m_BeetleEPPPEffectProbDecay = a_decay; }

References m_BeetleEPPPEffectProbDecay.

Referenced by Beetle_Population_Manager::Beetle_Population_Manager().

◆ SetEggPppElimRate()

static void Beetle_Egg_List::SetEggPppElimRate ( const double  a_rate)
inlinestatic

Set body burden elimination rate for egg

452 { m_BeetleEggPPPElimRate = a_rate; }

References m_BeetleEggPPPElimRate.

Referenced by Beetle_Population_Manager::Beetle_Population_Manager().

◆ SetEggPppThreshold()

static void Beetle_Egg_List::SetEggPppThreshold ( const double  a_thresh)
inlinestatic

Set body PPP threshold

454 { m_BeetleEPPPThreshold = a_thresh; }

References m_BeetleEPPPThreshold.

Referenced by Beetle_Population_Manager::Beetle_Population_Manager().

◆ St_Develop()

TTypesOfBeetleState Beetle_Egg_List::St_Develop ( )
protectedvirtual

Egg_List state development.

458  {
460  {
461  return tobs_NextStage; // go to hatch
462  }
463  return tobs_Developing;
464  // carry on developing
465 }

References m_DayMade, Beetle_Base::m_DevelopmentConstants, Beetle_Base::m_Lifestage, Beetle_Base::m_OurPopulation, Beetle_Population_Manager::SupplyDayDegs(), tobs_Developing, and tobs_NextStage.

Referenced by Step().

◆ St_Hatch()

TTypesOfBeetleState Beetle_Egg_List::St_Hatch ( )
protectedvirtual

Egg_List state hatching.

506  {
507  #pragma omp parallel
508  {
509  for(auto point: m_EggList[omp_get_thread_num()])
510  {
511  int temp_guard_x_index = point.m_x / cfg_MapGuardCellSize.value();
512  int temp_guard_y_index = point.m_y / cfg_MapGuardCellSize.value();
513  m_OurPopulation->SetGuardMapElement(temp_guard_x_index, temp_guard_y_index);
514  DecDensity(point.m_x, point.m_y);
515  Struct_Beetle BS(point.m_x, point.m_y, m_OurLandscape, m_OurPopulation);
516  m_OurPopulation->CreateObjects(bob_Larva1, this, nullptr, &BS, 1);
517  m_OurPopulation->UnsetGuardMapElement(temp_guard_x_index, temp_guard_y_index);
518  }
519 
520  m_EggList[omp_get_thread_num()].clear(); // empty the list
521  }
522 
523  return tobs_Initiation;
524 #ifdef __LAMBDA_RECORD
526 #endif
527 }

References bob_Larva1, cfg_MapGuardCellSize, Beetle_Population_Manager::CreateObjects(), Beetle_Base::DecDensity(), Population_Manager::LamdaBirth(), m_EggList, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, Beetle_Base::m_OurPopulation, Population_Manager::SetGuardMapElement(), tobs_Initiation, Population_Manager::UnsetGuardMapElement(), and CfgInt::value().

Referenced by Step().

◆ Step()

void Beetle_Egg_List::Step ( void  )
overridevirtual

Egg_List class Step code.

Implements Beetle_Base.

477  {
478  if (m_CurrentStateNo == -1 || m_StepDone) return;
479  switch (m_CurrentBState)
480  {
481  case tobs_Initiation: // Initial
483  break;
484  case tobs_Developing: // Developing
485  m_CurrentBState = St_Develop(); // st_Develop() can return: tobs_Hatching tobs_Developing
487  break;
488  case tobs_NextStage:
489  m_CurrentBState = St_Hatch(); // st_Hatch() can return: tobs_Initiation
490  break;
491  case tobs_Emerging:
492  case tobs_Foraging:
493  case tobs_Aggregating:
494  case tobs_Hibernating:
495  case tobs_Dispersing:
496  case tobs_BDying:
497  case tobs_Destroy:
498  m_OurLandscape->Warn("Beetle_Egg_List::Step()", "Beetle Egg - Unknown State");
499  g_msg->Warn(WARN_BUG, "State attempted was: ", static_cast<int>(m_CurrentBState));
500  exit(1);
501  }
502 }

References g_msg, Beetle_Base::m_CurrentBState, TALMaSSObject::m_CurrentStateNo, TAnimal::m_OurLandscape, TALMaSSObject::m_StepDone, St_Develop(), St_Hatch(), tobs_Aggregating, tobs_BDying, tobs_Destroy, tobs_Developing, tobs_Dispersing, tobs_Emerging, tobs_Foraging, tobs_Hibernating, tobs_Initiation, tobs_NextStage, MapErrorMsg::Warn(), Landscape::Warn(), and WARN_BUG.

◆ Supply_m_Location()

void Beetle_Egg_List::Supply_m_Location ( const int  i,
int &  a_x,
int &  a_y 
) const
inline

supplies the x-coordinate of a specific egg in the list

412  {
413  int max_thread_num = omp_get_max_threads();
414  int number = 0;
415  int thread_found = 0;
416  for(int j = 0; j < max_thread_num; j++) {
417  int temp_number = distance(m_EggList[j].begin(), m_EggList[j].end());
418  number += temp_number;
419  if(number >= i) {
420  thread_found = j;
421  number = i - (number - temp_number);
422  break;
423  }
424  }
425  auto l_point = m_EggList[thread_found].begin();
426  std::advance(l_point, number);
427  a_x = (*l_point).m_x;
428  a_y = (*l_point).m_y;
429  }

References m_EggList.

◆ SupplyEggNumber()

int Beetle_Egg_List::SupplyEggNumber ( ) const
inline

/brief Returns the total egg population size for a day

431  {
432  int max_thread_num = omp_get_max_threads();
433  int number = 0;
434  for(int i = 0; i < max_thread_num; i++) {
435  number += distance(m_EggList[i].begin(), m_EggList[i].end());
436  }
437  return number;
438  }

References m_EggList.

Member Data Documentation

◆ m_BeetleEggPPPElimRate

double Beetle_Egg_List::m_BeetleEggPPPElimRate = 0
staticprotected

Set PPP elimination rate

Referenced by SetEggPppElimRate().

◆ m_BeetleEPPPEffectProb

double Beetle_Egg_List::m_BeetleEPPPEffectProb = 0
staticprotected

Set body PPP effect probability

Referenced by InternalPesticideHandlingAndResponse(), and SetEggPppEffectProb().

◆ m_BeetleEPPPEffectProbDecay

double Beetle_Egg_List::m_BeetleEPPPEffectProbDecay = 0
staticprotected

◆ m_BeetleEPPPThreshold

double Beetle_Egg_List::m_BeetleEPPPThreshold = 0
staticprotected

Set body PPP effect threshold

Referenced by InternalPesticideHandlingAndResponse(), and SetEggPppThreshold().

◆ m_DailyEggMort

double Beetle_Egg_List::m_DailyEggMort = 0.007
staticprotected

Daily fixed mortality probability.

Referenced by DailyMortality(), and SetDailyEggMort().

◆ m_DayMade

int Beetle_Egg_List::m_DayMade
protected

Records the day hatched for development calculations.

Referenced by Beetle_Egg_List(), and St_Develop().

◆ m_Egg_HarvestMort

double Beetle_Egg_List::m_Egg_HarvestMort = 0
staticprotected

The egg harvest mortality parameter.

Referenced by GetHarvestMortality(), and SetEgg_HarvestMort().

◆ m_Egg_InsecticideApplication

double Beetle_Egg_List::m_Egg_InsecticideApplication = 0
staticprotected

The egg nsecticide mortality parameter.

Referenced by GetInsecticideApplication(), and SetEgg_InsecticideApplication().

◆ m_Egg_SoilCultivationMortality

double Beetle_Egg_List::m_Egg_SoilCultivationMortality = 0
staticprotected

The egg soil mortality parameter.

Referenced by GetSoilCultivationMortality(), and SetEgg_SoilCultivationMortality().

◆ m_Egg_StriglingMort

double Beetle_Egg_List::m_Egg_StriglingMort = 0
staticprotected

The egg strigling mortality parameter.

Referenced by GetStriglingMortality(), and SetEgg_StriglingMort().

◆ m_EggList


The documentation for this class was generated from the following files:
tobs_Foraging
Definition: Beetle_BaseClasses.h:68
tobs_Aggregating
Definition: Beetle_BaseClasses.h:69
Beetle_Egg_List::m_Egg_InsecticideApplication
static double m_Egg_InsecticideApplication
The egg nsecticide mortality parameter.
Definition: Beetle_BaseClasses.h:500
g_rand_uni_fnc
double g_rand_uni_fnc()
Definition: ALMaSS_Random.cpp:56
Population_Manager::UnsetGuardMapElement
void UnsetGuardMapElement(unsigned a_x_index, unsigned a_y_index)
Unset the given guard map cell.
Definition: PopulationManager.h:762
Beetle_Egg_List::m_BeetleEPPPEffectProb
static double m_BeetleEPPPEffectProb
Definition: Beetle_BaseClasses.h:506
Beetle_Egg_List::m_EggList
TListOfEggs m_EggList
The list of eggs.
Definition: Beetle_BaseClasses.h:487
tobs_Initiation
Definition: Beetle_BaseClasses.h:59
Beetle_Base::IncDensity
void IncDensity(int a_x, int a_y, int a_lifestage)
The method inreases the number of beetles in this specific location by one. Used when called by a bee...
Definition: Beetle_BaseClasses.h:255
ttop_MultipleEffects
Definition: LandscapeFarmingEnums.h:1066
Beetle_Base::m_CurrentPppEffectProb
double m_CurrentPppEffectProb
Current effect probability.
Definition: Beetle_BaseClasses.h:164
ttop_AcuteEffectsDoseResponse
Definition: LandscapeFarmingEnums.h:1069
Beetle_Egg_List::m_BeetleEPPPEffectProbDecay
static double m_BeetleEPPPEffectProbDecay
Definition: Beetle_BaseClasses.h:508
FarmToDo
FarmToDo
Definition: Treatment.h:31
Beetle_Egg_List::m_BeetleEggPPPElimRate
static double m_BeetleEggPPPElimRate
Definition: Beetle_BaseClasses.h:502
TTypesOfBeetleState
TTypesOfBeetleState
The enumeration lists all beetle behavioural states used by all the beetle species.
Definition: Beetle_BaseClasses.h:58
Population_Manager::SetGuardMapElement
void SetGuardMapElement(unsigned a_x_index, unsigned a_y_index)
Set the given guard map cell.
Definition: PopulationManager.h:756
cfg_MapGuardCellSize
CfgInt cfg_MapGuardCellSize
The size to create the map guard.
Beetle_Base::m_Lifestage
unsigned m_Lifestage
This is a useful parameter holding the beetle type (this includes larval stages)
Definition: Beetle_BaseClasses.h:166
Beetle_Egg_List::m_Egg_SoilCultivationMortality
static double m_Egg_SoilCultivationMortality
The egg soil mortality parameter.
Definition: Beetle_BaseClasses.h:494
Beetle_Base::OnFarmEvent
bool OnFarmEvent(FarmToDo event) override
the farming event mortality. This is the function that is used for all the beetles....
Definition: Beetle_BaseClasses.cpp:317
ttop_AcuteEffects
Definition: LandscapeFarmingEnums.h:1060
Population_Manager::LamdaBirth
void LamdaBirth(int x, int y)
Definition: PopulationManager.h:883
tobs_NextStage
Definition: Beetle_BaseClasses.h:64
Beetle_Base::m_OurPopulation
Beetle_Population_Manager * m_OurPopulation
Pointer to the population manager.
Definition: Beetle_BaseClasses.h:160
Beetle_Egg_List::m_DayMade
int m_DayMade
Records the day hatched for development calculations.
Definition: Beetle_BaseClasses.h:489
Beetle_Population_Manager::CreateObjects
virtual void CreateObjects(int, TAnimal *, void *, Struct_Beetle *, int)
Method to add beetles to the population - it must be overridden in all descendent classes.
Definition: Beetle_BaseClasses.h:1013
TAnimal::m_Location_y
int m_Location_y
The objects ALMaSS y coordinate.
Definition: PopulationManager.h:366
APoint
A simple class defining an x,y coordinate set.
Definition: ALMaSS_Setup.h:52
TAnimal::m_OurLandscape
static Landscape * m_OurLandscape
A pointer to the landscape object shared with all TAnimal objects.
Definition: PopulationManager.h:342
ttop_AcuteDelayedEffects
Definition: LandscapeFarmingEnums.h:1068
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
Beetle_Egg_List::St_Develop
virtual TTypesOfBeetleState St_Develop()
Egg_List state development.
Definition: Beetle_BaseClasses.cpp:458
TALMaSSObject::m_StepDone
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
Definition: PopulationManager.h:133
Landscape::SupplyPesticideType
TTypesOfPesticide SupplyPesticideType(void)
Gets type of pesticide effect from a reference.
Definition: Landscape.h:788
APoint::m_x
int m_x
Definition: ALMaSS_Setup.h:55
CfgInt::value
int value() const
Definition: Configurator.h:116
Beetle_Base::Beetle_Base
Beetle_Base(int a_x, int a_y, Landscape *a_l_ptr, Beetle_Population_Manager *a_bpm_ptr)
Beetle_Base Constructor.
Definition: Beetle_BaseClasses.cpp:291
Beetle_Base::m_DevelopmentConstants
static vector< double > m_DevelopmentConstants
Day degree constant, the target to reach before next stage.
Definition: Beetle_BaseClasses.h:168
Beetle_Base::m_CurrentBState
TTypesOfBeetleState m_CurrentBState
Current behavioural state.
Definition: Beetle_BaseClasses.h:158
tobs_Developing
Definition: Beetle_BaseClasses.h:61
tobs_Destroy
Definition: Beetle_BaseClasses.h:74
Beetle_Egg_List::m_Egg_HarvestMort
static double m_Egg_HarvestMort
The egg harvest mortality parameter.
Definition: Beetle_BaseClasses.h:496
Beetle_Egg_List::St_Hatch
virtual TTypesOfBeetleState St_Hatch()
Egg_List state hatching.
Definition: Beetle_BaseClasses.cpp:506
Struct_Beetle
A data class for Beetle data.
Definition: Beetle_BaseClasses.h:125
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
ttop_ReproductiveEffects
Definition: LandscapeFarmingEnums.h:1061
tobs_Emerging
Definition: Beetle_BaseClasses.h:66
Beetle_Egg_List::DailyMortality
bool DailyMortality() override
Checks daily mortality returns true on death.
Definition: Beetle_BaseClasses.cpp:562
bob_Larva1
Definition: Beetle_BaseClasses.h:83
tobs_Dispersing
Definition: Beetle_BaseClasses.h:71
Beetle_Egg_List::m_DailyEggMort
static double m_DailyEggMort
Daily fixed mortality probability.
Definition: Beetle_BaseClasses.h:492
Beetle_Base::DecDensity
void DecDensity(int a_x, int a_y)
The method decreases the number of beetles in this specific location by one.
Definition: Beetle_BaseClasses.h:263
Beetle_Base::KillAndRemoveFromMap
void KillAndRemoveFromMap()
Kills the beetle - this version forces the beetle to re-enter the Step code and call st_Dying.
Definition: Beetle_BaseClasses.cpp:438
TALMaSSObject::m_CurrentStateNo
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
Definition: PopulationManager.h:131
tobs_BDying
Definition: Beetle_BaseClasses.h:73
Beetle_Base::m_BodyBurden
double m_BodyBurden
Current body burden of pesticide.
Definition: Beetle_BaseClasses.h:162
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_Egg_List::m_Egg_StriglingMort
static double m_Egg_StriglingMort
The egg strigling mortality parameter.
Definition: Beetle_BaseClasses.h:498
TAnimal::m_Location_x
int m_Location_x
The objects ALMaSS x coordinate.
Definition: PopulationManager.h:362
WARN_BUG
Definition: MapErrorMsg.h:34
Beetle_Population_Manager::SupplyDayDegs
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.
Definition: Beetle_BaseClasses.h:1030
ttop_NoPesticide
Definition: LandscapeFarmingEnums.h:1059
APoint::m_y
int m_y
Definition: ALMaSS_Setup.h:56
tobs_Hibernating
Definition: Beetle_BaseClasses.h:70
Beetle_Egg_List::m_BeetleEPPPThreshold
static double m_BeetleEPPPThreshold
Definition: Beetle_BaseClasses.h:504
sleep_all_day
Definition: Treatment.h:33