Loading [MathJax]/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
Ladybird_Larvae1 Class Reference

#include <Ladybird_All.h>

Inheritance diagram for Ladybird_Larvae1:
Beetle_Larvae Ladybird_Base Beetle_Base Beetle_Base TAnimal TAnimal TALMaSSObject TALMaSSObject Ladybird_Larvae2 Ladybird_Larvae3 Ladybird_Larvae4

Public Member Functions

 Ladybird_Larvae1 (int a_x, int a_y, Landscape *a_l_ptr, Ladybird_Population_Manager *a_bpm_ptr)
 Constructor of larva object. More...
 
 ~Ladybird_Larvae1 () override=default
 Destructor of larva object. More...
 
virtual void ReInit (int a_x, int a_y, Landscape *a_l_ptr, Ladybird_Population_Manager *a_bpm_ptr)
 ReInit for object pool. More...
 
bool IsLocationAllowed (int a_x, int a_y) override
 Re-implements the function to determine if larval movement is allowed. More...
 
- Public Member Functions inherited from Beetle_Larvae
 Beetle_Larvae (int a_x, int a_y, Landscape *a_l_ptr, Beetle_Population_Manager *a_bpm_ptr)
 constructor for Larvae
More...
 
void ReInit (int a_x, int a_y, Landscape *a_l_ptr, Beetle_Population_Manager *a_bpm_ptr) override
 ReInit for object pool. More...
 
void Step () override
 Larvae Step code. More...
 
void EndStep () override
 Larvae EndStep code. More...
 
bool getDevelopment () const
 The larval development calculation. More...
 
bool GetDensityDependentMortality () override
 The larval density depenend mortality calculation (cannibalism) More...
 
double GetStriglingMortality () const override
 Mortality by mechanical weeding - method override specific to larvae. More...
 
double GetSoilCultivationMortality () const override
 The method overrides the base class method that returns the mortality due to soil cultivation. More...
 
double GetInsecticideApplication () const override
 The method overrides the base class method that returns the mortality due to insecticide application. More...
 
double GetHarvestMortality () const override
 The method overrides the base class method that returns the mortality due to harvest. 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 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...
 
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...
 
void ReinitialiseObjectBase ()
 Used to initialise an object. More...
 
 TALMaSSObject ()
 The constructor for TALMaSSObject. More...
 
virtual ~TALMaSSObject ()=default
 The destructor for TALMaSSObject. More...
 
- Public Member Functions inherited from Ladybird_Base
 Ladybird_Base (Ladybird_Population_Manager *a_lpm_ptr)
 Class constructor. More...
 
 ~Ladybird_Base () override=default
 

Static Public Member Functions

static void SetLadybirdLarvalPreyDevelParameters (const vector< double > &a_array, int a_no_stages)
 Set the larval per instar development factor, a function of aphid abundance. More...
 
static void SetLadybirdLarvaeMoveMax (const int a_value)
 
static void SetLadybirdLarvaeMoveStep (const int a_value)
 
static void SetLarvalAppetite (const vector< int > &a_value)
 
- Static Public Member Functions inherited from Beetle_Larvae
static double GetLarvalPPPElimRate ()
 Kill this larva. More...
 
static double GetLPPPThreshold ()
 
static double GetLPPPEffectProb ()
 
static double GetLPPPEffectProbDecay ()
 
static void SetLarva_SoilCultivationMortality (const double a_value)
 Set Larval soil mortality parameter. More...
 
static void SetLarva_InsecticideApplication (const double a_value)
 Set Larval insecticide mortality parameter. More...
 
static void SetLarvalPPPElimRate (const double a_rate)
 
static void SetLPPPThreshold (const double a_thresh)
 
static void SetLPPPEffectProb (const double a_conc)
 
static void SetLPPPEffectProbDecay (const double a_decay)
 
static void SetLDDepMort0 (const int a_value)
 Storage for density-dependent mortality parameter. More...
 
static void SetLDDepMort1 (const double a_value)
 Storage for density-dependent mortality parameter. More...
 
static void SetDailyLarvaMort (const double a_value)
 Set the daily fixed mortality probability. More...
 
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. More...
 
static void SetLarva_StriglingMort (const double a_value)
 Set mechanical weeding mortality parameter. More...
 
static void SetLarva_HarvestMort (const double a_value)
 Set harvest mortality parameter. More...
 
- 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...
 
- Static Public Member Functions inherited from Ladybird_Base
static void SetLadybirdStagesNutritionalValue (const vector< int > &a_list)
 Sets the list of aphid equivalents of each ladybird stage. More...
 

Protected Member Functions

void BeginStep () override
 The override of a funtion that precedes Step() More...
 
TTypesOfBeetleState St_Develop () override
 The main behaviour method that is responsible for the development and eventually leading to larvae2. More...
 
int GetAphidsAppetite () override
 The function returns the aphids appetite (virtual function stub: to be overridden) More...
 
- Protected Member Functions inherited from Beetle_Larvae
void InternalPesticideHandlingAndResponse () override
 Handle pesticide events code for the beetle. More...
 
int getLarvalStage () const
 the method returns the larval stage (instar) number More...
 
virtual TTypesOfBeetleState St_NextStage ()
 Larvae state pupation. More...
 
double TempRelatedMortality () const
 Determine larval temperature related mortality. 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 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 bool DailyMortality ()
 Checks daily mortality returns true on death, default, no death. 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 Member Functions inherited from Ladybird_Base
void EatToday (const int a_add)
 Adds to the counter of eaten aphids. More...
 
virtual int GetEatenToday () const
 return the value of daily aphid consumption counter More...
 
virtual void SetEatenToday (int a)
 set the value of the counter of eaten aphids More...
 
int GetAphidsToEat ()
 return how many aphids are left to be eaten More...
 
virtual void ResetAphidsAppetite ()
 reset the appetite to zero More...
 
virtual int EatAphids (int a_x, int a_y, int a_appetite)
 the method that is responsible for aphid foraging behaviour (removes the aphids from the aphid model) More...
 
int Cannibalise (int a_appetite)
 Perform the cannibalisation behaviour from the perspective of a cannibal : receives the appetite to fulfill, returns how much is left to be eaten after an attempt to cannibalise. More...
 
virtual void CalcAphidsAppetite ()
 Calculates the appetite of aphids based on the age (Arshad et al, 2017) More...
 
bool CanMove ()
 returns true if the beetle can still move today More...
 
int GetMaxDailyDistance ()
 

Protected Attributes

double m_AphidTotalNum {0}
 The sum of aphid populations densities experienced. More...
 
int m_StarvationCount {0}
 The max number of aphids possible to eat/day per larval stage. More...
 
- Protected Attributes inherited from Beetle_Larvae
double m_AgeDegrees = {0}
 Record larvae day degrees. More...
 
int m_DayMade = { 0 }
 
int m_LarvalStage = {0}
 Current larval growth stage (1-3), used as a small speed hack. 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...
 
- Protected Attributes inherited from Ladybird_Base
int m_EatenToday { 0 }
 number of aphids or aphid equivalents eaten today More...
 
int m_WantToEatToday { 0 }
 number of ladybird larvae younger than this to eat in EndStep More...
 
int m_AphidsAppetite { 0 }
 the today's appetite More...
 
int m_MoveCounter { 0 }
 the counter of the steps made today More...
 
Ladybird_Population_Managerm_OurPopulationLadybird { nullptr }
 pointer to the population manager More...
 

Static Protected Attributes

static int m_LadybirdLarvaeNoMoves = 0
 The number of moves (1m) possible per day. More...
 
static int m_LadybirdLarvaeMoveStep = 0
 The size of moves (m) possible per move try. More...
 
static int m_MaxUsefulAphids [4] = { 0,0,0,0 }
 The max useful aphid abundance for instars 1-4. More...
 
static vector< double > m_LadybirdLarvalPreyDevelScalers [4] = {}
 The prey indexed scaler on development, 0-120 per larval stage. More...
 
static int m_LarvalAppetite [4] = { 0,0,0,0 }
 The max number of aphids possible to eat/day per larval stage. More...
 
- Static Protected Attributes inherited from Beetle_Larvae
static double m_DailyLarvaeMort = 0.001
 Daily fixed mortality probability. More...
 
static std::vector< std::vector< double > > m_LarvalDailyTMort
 Daily fixed mortality probability based on three larval stages and temperature. More...
 
static int m_LDDepMort0 = 0
 Storage for density-dependent mortality parameter. More...
 
static double m_LDDepMort1 = 0
 Storage for density-dependent mortality parameter. More...
 
static double m_Larva_SoilCultivationMortality = 0
 The larva soil mortality parameter. More...
 
static double m_Larva_HarvestMort = 0
 The larva harvest mortality parameter. More...
 
static double m_Larva_StriglingMort = 0
 The larva strigling mortality parameter. More...
 
static double m_Larva_InsecticideApplication = 0
 The larva nsecticide mortality parameter. More...
 
static double m_BeetleLarvalPPPElimRate = 0
 the daily elimination rate for pesticides More...
 
static double m_BeetleLPPPThreshold = 0
 PPP effects threshold. More...
 
static double m_BeetleLPPPEffectProb = 0
 Effect probability on threshold excedence. More...
 
static double m_BeetleLPPPEffectProbDecay = 0
 Effect probability on threshold excedence. More...
 
- 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...
 
- Static Protected Attributes inherited from Ladybird_Base
static vector< int > m_LadybirdStagesNutritionalValue = {}
 Holds the aphid equivalents of each ladybird stage. 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...
 
- Static Protected Member Functions inherited from Beetle_Larvae
static double GetLarvaTDailyMortality (const int a_st, const int a_t)
 returns temp-related daily mortality rate More...
 
- Static Protected Member Functions inherited from Ladybird_Base
static int GetTempMortRange (double a_temp)
 returns the mortality range that corresponds to the temperature More...
 

Constructor & Destructor Documentation

◆ Ladybird_Larvae1()

Ladybird_Larvae1::Ladybird_Larvae1 ( int  a_x,
int  a_y,
Landscape a_l_ptr,
Ladybird_Population_Manager a_bpm_ptr 
)

Constructor of larva object.

315  : Beetle_Base(a_x, a_y, a_l_ptr, static_cast<Beetle_Population_Manager*>(a_bpm_ptr)),
316  Beetle_Larvae(a_x, a_y, a_l_ptr, a_bpm_ptr),
317  Ladybird_Base(a_bpm_ptr)
318 {
320  m_LarvalStage = 0;
321  m_AgeDays = 1; // Needed because larvae are called in step after the egg hatch, so miss BeginStep
322 }

References lobs_Larva1, TAnimal::m_AgeDays, Beetle_Larvae::m_LarvalStage, and Beetle_Base::m_Lifestage.

◆ ~Ladybird_Larvae1()

Ladybird_Larvae1::~Ladybird_Larvae1 ( )
overridedefault

Destructor of larva object.

Member Function Documentation

◆ BeginStep()

void Ladybird_Larvae1::BeginStep ( void  )
overrideprotectedvirtual

The override of a funtion that precedes Step()

Reimplemented from Beetle_Larvae.

357  {
360  return; // No need to do the rest, already dead
361  }
362  SetEatenToday(0); // reset the aphids eaten counter
363  CheckManagement();
365 }

References Ladybird_Base::CalcAphidsAppetite(), cfg_LadybirdMaxLarvaStageLength, TAnimal::CheckManagement(), TAnimal::m_AgeDays, Beetle_Base::m_CurrentBState, Ladybird_Base::SetEatenToday(), tobs_BDying, and CfgInt::value().

◆ GetAphidsAppetite()

int Ladybird_Larvae1::GetAphidsAppetite ( )
inlineoverrideprotectedvirtual

The function returns the aphids appetite (virtual function stub: to be overridden)

Reimplemented from Ladybird_Base.

204 { return m_LarvalAppetite[m_LarvalStage]; }

References m_LarvalAppetite, and Beetle_Larvae::m_LarvalStage.

◆ IsLocationAllowed()

bool Ladybird_Larvae1::IsLocationAllowed ( int  a_x,
int  a_y 
)
inlineoverridevirtual

Re-implements the function to determine if larval movement is allowed.

Reimplemented from Beetle_Base.

References Ladybird_Population_Manager::IsLocationAllowedLarvae(), TAnimal::m_OurLandscape, Ladybird_Base::m_OurPopulationLadybird, and Landscape::SupplyVegType().

◆ ReInit()

void Ladybird_Larvae1::ReInit ( int  a_x,
int  a_y,
Landscape a_l_ptr,
Ladybird_Population_Manager a_bpm_ptr 
)
virtual

◆ SetLadybirdLarvaeMoveMax()

static void Ladybird_Larvae1::SetLadybirdLarvaeMoveMax ( const int  a_value)
inlinestatic

brief Set the number of tries allowed to find a short range legal move

192 { m_LadybirdLarvaeNoMoves = a_value; }

References m_LadybirdLarvaeNoMoves.

Referenced by Ladybird_Population_Manager::DayDegreeCalculations().

◆ SetLadybirdLarvaeMoveStep()

static void Ladybird_Larvae1::SetLadybirdLarvaeMoveStep ( const int  a_value)
inlinestatic

brief Set the number of tries allowed to find a short range legal move

194 { m_LadybirdLarvaeMoveStep = a_value; }

References m_LadybirdLarvaeMoveStep.

Referenced by Ladybird_Population_Manager::DayDegreeCalculations().

◆ SetLadybirdLarvalPreyDevelParameters()

void Ladybird_Larvae1::SetLadybirdLarvalPreyDevelParameters ( const vector< double > &  a_array,
int  a_no_stages 
)
static

Set the larval per instar development factor, a function of aphid abundance.

The format of a_array is max aphids, a, b, c for each each instar 1-4

338  {
342  for (int instar = 0; instar < a_no_stages; instar++)
343  {
344  m_MaxUsefulAphids[instar] = static_cast<int>(a_array.at(instar * 4));
345  const double a = a_array.at(instar * 4 + 1);
346  const double b = a_array.at(instar * 4 + 2);
347  const double c = a_array.at(instar * 4 + 3);
348  m_LadybirdLarvalPreyDevelScalers[instar].push_back(9999); // infinity at no food level.
349  for (int i = 1; i <= 120; i++) {
350  double scaler = a + b * i + c * i * i; // 2nd order polynomial
351  if (i >= m_MaxUsefulAphids[instar]) scaler = 1.0;
352  m_LadybirdLarvalPreyDevelScalers[instar].push_back(scaler);
353  }
354  }
355 }

References m_LadybirdLarvalPreyDevelScalers, and m_MaxUsefulAphids.

Referenced by Ladybird_Population_Manager::Ladybird_Population_Manager().

◆ SetLarvalAppetite()

static void Ladybird_Larvae1::SetLarvalAppetite ( const vector< int > &  a_value)
inlinestatic

brief Set the number of tries allowed to find a short range legal move

196 { for (int i=0; i<4; i++) m_LarvalAppetite[i] = a_value[i]; }

References m_LarvalAppetite.

Referenced by Ladybird_Population_Manager::Ladybird_Population_Manager().

◆ St_Develop()

TTypesOfBeetleState Ladybird_Larvae1::St_Develop ( )
overrideprotectedvirtual

The main behaviour method that is responsible for the development and eventually leading to larvae2.

Function that controls daily development, in addition controls feeding and movement. Larva only moves if there is not enough aphids or lower larvae to feed upon If it reaches the maximum daily distance and haven't got enough food– it dies.

Reimplemented from Beetle_Larvae.

368 {
375  return tobs_BDying; // die due to temperture effects
376  }
377  double aphids_num = m_OurPopulationLadybird->GetAphidDensity(m_Location_x, m_Location_y); // aphids at this location
378  if (aphids_num > m_MaxUsefulAphids[m_LarvalStage]) aphids_num = m_MaxUsefulAphids[m_LarvalStage];
379  //m_AphidTotalNum += m_MaxUsefulAphids[m_LarvalStage]; // for testing
380  m_AphidTotalNum += aphids_num; // keeps a sum of the aphids experienced
381  int to_eat = GetAphidsToEat(); // how many aphids still needed to eat today
382  if (aphids_num > 0) {
383 
384  to_eat = EatAphids(m_Location_x, m_Location_y, to_eat);
385 
386  if (m_OurPopulationLadybird->GetLadybirdLarvaCanMove()) { // LadybirdLarvaCanMove controlled by population manager
387  int moves = 0;
388  while ((to_eat > 0) && (moves < m_LadybirdLarvaeNoMoves)) { // beetle is is hungry and has movement left and must have eaten all aphids
389  // we will have to check if there are eggs/ younger larva to cannibalise
390  to_eat = Cannibalise(to_eat);
391  if (to_eat > 0) {
394  }
395  }
396  }
397  }
398  if (to_eat < 1) {
399  // Still alive and not hungry so now do the development bit
400  const double tempsofar = m_OurPopulation->SupplyDayDegs(m_Lifestage, m_DayMade);
401  const int average_aphids_per_day = static_cast<int>(m_AphidTotalNum / m_AgeDays);
402  if (tempsofar > m_DevelopmentConstants[m_Lifestage] * m_LadybirdLarvalPreyDevelScalers[m_LarvalStage][average_aphids_per_day]) return tobs_NextStage;
403  // not mature, carry on developing
404  m_StarvationCount = 0;
405  }
406  else
407  {
408  if (++m_StarvationCount > 3) return tobs_BDying;
409  }
410  return tobs_Developing;
411 }

References Beetle_Base::Beetle_1M_Move(), Ladybird_Base::Cannibalise(), Ladybird_Base::EatAphids(), g_rand_uni_fnc(), Ladybird_Population_Manager::GetAphidDensity(), Ladybird_Base::GetAphidsToEat(), Ladybird_Population_Manager::GetLadybirdLarvaCanMove(), TAnimal::m_AgeDays, m_AphidTotalNum, Beetle_Larvae::m_DayMade, Beetle_Base::m_DevelopmentConstants, m_LadybirdLarvaeMoveStep, m_LadybirdLarvaeNoMoves, m_LadybirdLarvalPreyDevelScalers, Beetle_Larvae::m_LarvalStage, Beetle_Base::m_Lifestage, TAnimal::m_Location_x, TAnimal::m_Location_y, m_MaxUsefulAphids, Beetle_Base::m_OurPopulation, Ladybird_Base::m_OurPopulationLadybird, m_StarvationCount, Beetle_Population_Manager::SupplyDayDegs(), Beetle_Larvae::TempRelatedMortality(), tobs_BDying, tobs_Developing, and tobs_NextStage.

Member Data Documentation

◆ m_AphidTotalNum

double Ladybird_Larvae1::m_AphidTotalNum {0}
protected

The sum of aphid populations densities experienced.

Referenced by ReInit(), and St_Develop().

◆ m_LadybirdLarvaeMoveStep

int Ladybird_Larvae1::m_LadybirdLarvaeMoveStep = 0
staticprotected

The size of moves (m) possible per move try.

Referenced by SetLadybirdLarvaeMoveStep(), and St_Develop().

◆ m_LadybirdLarvaeNoMoves

int Ladybird_Larvae1::m_LadybirdLarvaeNoMoves = 0
staticprotected

The number of moves (1m) possible per day.

Referenced by SetLadybirdLarvaeMoveMax(), and St_Develop().

◆ m_LadybirdLarvalPreyDevelScalers

vector< double > Ladybird_Larvae1::m_LadybirdLarvalPreyDevelScalers = {}
staticprotected

The prey indexed scaler on development, 0-120 per larval stage.

Referenced by SetLadybirdLarvalPreyDevelParameters(), and St_Develop().

◆ m_LarvalAppetite

int Ladybird_Larvae1::m_LarvalAppetite = { 0,0,0,0 }
staticprotected

The max number of aphids possible to eat/day per larval stage.

Referenced by GetAphidsAppetite(), and SetLarvalAppetite().

◆ m_MaxUsefulAphids

int Ladybird_Larvae1::m_MaxUsefulAphids = { 0,0,0,0 }
staticprotected

The max useful aphid abundance for instars 1-4.

Referenced by SetLadybirdLarvalPreyDevelParameters(), and St_Develop().

◆ m_StarvationCount

int Ladybird_Larvae1::m_StarvationCount {0}
protected

The max number of aphids possible to eat/day per larval stage.

Referenced by St_Develop().


The documentation for this class was generated from the following files:
Ladybird_Population_Manager::GetAphidDensity
double GetAphidDensity(int a_x, int a_y) override
Returns the number of aphids per square metre at this x,y location.
Definition: Ladybird_All.cpp:1323
Ladybird_Larvae1::m_LarvalAppetite
static int m_LarvalAppetite[4]
The max number of aphids possible to eat/day per larval stage.
Definition: Ladybird_All.h:177
g_rand_uni_fnc
double g_rand_uni_fnc()
Definition: ALMaSS_Random.cpp:56
Ladybird_Base::GetAphidsToEat
int GetAphidsToEat()
return how many aphids are left to be eaten
Definition: Ladybird_All.h:107
Landscape::SupplyVegType
TTypesOfVegetation SupplyVegType(int a_x, int a_y)
Returns the vegetation type of the polygon using the polygon reference number a_polyref or coordinate...
Definition: Landscape.h:1925
Ladybird_Larvae1::m_AphidTotalNum
double m_AphidTotalNum
The sum of aphid populations densities experienced.
Definition: Ladybird_All.h:167
Ladybird_Larvae1::m_MaxUsefulAphids
static int m_MaxUsefulAphids[4]
The max useful aphid abundance for instars 1-4.
Definition: Ladybird_All.h:173
Ladybird_Base::m_EatenToday
int m_EatenToday
number of aphids or aphid equivalents eaten today
Definition: Ladybird_All.h:89
Ladybird_Base::EatAphids
virtual int EatAphids(int a_x, int a_y, int a_appetite)
the method that is responsible for aphid foraging behaviour (removes the aphids from the aphid model)
Definition: Ladybird_All.cpp:240
Ladybird_Base::m_OurPopulationLadybird
Ladybird_Population_Manager * m_OurPopulationLadybird
pointer to the population manager
Definition: Ladybird_All.h:97
lobs_Larva1
Definition: Ladybird_All.h:66
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
Ladybird_Base::SetEatenToday
virtual void SetEatenToday(int a)
set the value of the counter of eaten aphids
Definition: Ladybird_All.h:105
Beetle_Larvae::TempRelatedMortality
double TempRelatedMortality() const
Determine larval temperature related mortality.
Definition: Beetle_BaseClasses.h:666
Ladybird_Population_Manager::GetLadybirdLarvaCanMove
bool GetLadybirdLarvaCanMove() const
Gets the larval movement flag for today.
Definition: Ladybird_All.h:455
Beetle_Larvae::ReInit
void ReInit(int a_x, int a_y, Landscape *a_l_ptr, Beetle_Population_Manager *a_bpm_ptr) override
ReInit for object pool.
Definition: Beetle_BaseClasses.cpp:655
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_Larvae::m_LarvalStage
int m_LarvalStage
Current larval growth stage (1-3), used as a small speed hack.
Definition: Beetle_BaseClasses.h:619
Ladybird_Larvae1::m_LadybirdLarvalPreyDevelScalers
static vector< double > m_LadybirdLarvalPreyDevelScalers[4]
The prey indexed scaler on development, 0-120 per larval stage.
Definition: Ladybird_All.h:175
TAnimal::m_Location_y
int m_Location_y
The objects ALMaSS y coordinate.
Definition: PopulationManager.h:366
TAnimal::m_OurLandscape
static Landscape * m_OurLandscape
A pointer to the landscape object shared with all TAnimal objects.
Definition: PopulationManager.h:342
TAnimal::CheckManagement
void CheckManagement()
Used to start a check for any management related effects at the objects current location.
Definition: PopulationManager.cpp:1591
Ladybird_Base::Cannibalise
int Cannibalise(int a_appetite)
Perform the cannibalisation behaviour from the perspective of a cannibal : receives the appetite to f...
Definition: Ladybird_All.cpp:269
TAnimal::m_AgeDays
int m_AgeDays
To hold the age in days.
Definition: PopulationManager.h:378
Beetle_Base::Beetle_1M_Move
void Beetle_1M_Move(int a_dist)
The function that calculates the cumulative probability for the movement direction....
Definition: Beetle_BaseClasses.cpp:326
Beetle_Larvae::m_DayMade
int m_DayMade
Definition: Beetle_BaseClasses.h:617
Ladybird_Larvae1::m_LadybirdLarvaeNoMoves
static int m_LadybirdLarvaeNoMoves
The number of moves (1m) possible per day.
Definition: Ladybird_All.h:169
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
Beetle_Larvae::Beetle_Larvae
Beetle_Larvae(int a_x, int a_y, Landscape *a_l_ptr, Beetle_Population_Manager *a_bpm_ptr)
constructor for Larvae
Definition: Beetle_BaseClasses.cpp:650
Ladybird_Larvae1::m_StarvationCount
int m_StarvationCount
The max number of aphids possible to eat/day per larval stage.
Definition: Ladybird_All.h:179
Ladybird_Base::Ladybird_Base
Ladybird_Base(Ladybird_Population_Manager *a_lpm_ptr)
Class constructor.
Definition: Ladybird_All.cpp:236
cfg_LadybirdMaxLarvaStageLength
static CfgInt cfg_LadybirdMaxLarvaStageLength("LADYBIRD_MAX_PUPA_STAGE_LENGTH", CFG_CUSTOM, 30)
tobs_BDying
Definition: Beetle_BaseClasses.h:73
Ladybird_Population_Manager::IsLocationAllowedLarvae
bool IsLocationAllowedLarvae(TTypesOfVegetation a_tov)
Checks the tov list of disallowed tovs and returns false if a_tov is disallowed
Definition: Ladybird_All.h:444
TAnimal::m_Location_x
int m_Location_x
The objects ALMaSS x coordinate.
Definition: PopulationManager.h:362
Ladybird_Base::CalcAphidsAppetite
virtual void CalcAphidsAppetite()
Calculates the appetite of aphids based on the age (Arshad et al, 2017)
Definition: Ladybird_All.h:119
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
Ladybird_Larvae1::m_LadybirdLarvaeMoveStep
static int m_LadybirdLarvaeMoveStep
The size of moves (m) possible per move try.
Definition: Ladybird_All.h:171