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

#include <skylarks_all.h>

Inheritance diagram for Skylark_Adult:
Skylark_Base TAnimal TALMaSSObject Skylark_Female Skylark_Male

Public Member Functions

 Skylark_Adult (int x, int y, double size, int age, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
 
virtual void ReInit (int x, int y, double size, int age, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
 
 ~Skylark_Adult () override
 
virtual void CopyMyself (int a_sktype)
 
- Public Member Functions inherited from Skylark_Base
 Skylark_Base (int x, int y, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
 
virtual void ReInit (int x, int y, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
 
virtual double On_FoodSupply (double)
 
void AddStriglingMort (const int lifestage) const
 
int WhatState () override
 Returns the objects current state number. More...
 
bool InSquare (rectangle R) const
 
- 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...
 
virtual bool OnFarmEvent (FarmToDo)
 Must be reimplemented if used in descendent classes. Sets the action on a management event. 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 BeginStep ()
 BeingStep behaviour - must be implemented in descendent classes. More...
 
virtual void Step ()
 Step behaviour - must be implemented in descendent classes. 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...
 

Public Attributes

bool Paired
 
- Public Attributes inherited from Skylark_Base
TTypesOfSkState m_CurrentSkState
 
int Age
 
double m_Size
 
int m_Born_x
 
int m_Born_y
 
int m_MyHome
 The vegetation type where the skylark was born. More...
 
SkTerritoriesm_OurTerritories
 
Skylark_Population_Managerm_OurPopulationManager
 

Protected Member Functions

virtual double RemoveEM (double food)
 
double GetVegHindrance (int PolyRef) const
 
double GetWeatherHindrance () const
 
- Protected Member Functions inherited from TAnimal
void CorrectWrapRound ()
 Corrects wrap around co-ordinate problems. More...
 

Static Protected Member Functions

static bool GetBadWeather ()
 Extreme weather conditions check. More...
 
- Static Protected Member Functions inherited from Skylark_Base
static bool DailyMortality (int mort)
 

Protected Attributes

int GoodWeather
 
bool BSuccess
 
double MyExtractEff
 
int m_pesticide_affected
 
skTerritory_struct MyTerritory
 
vector< APoint > * m_aTerrlist
 
- 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...
 

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ Skylark_Adult()

Skylark_Adult::Skylark_Adult ( int  x,
int  y,
double  size,
int  age,
SkTerritories Terrs,
Landscape L,
Skylark_Population_Manager SPM,
int  bx,
int  by,
int  mh 
)
3489  : Skylark_Base(
3490  x, y, Terrs, L, SPM, bx, by, mh) {
3491  m_Size = size;
3492  Age = age;
3493  BSuccess = false;
3494  MyExtractEff = (0.90 + g_random_fnc(21) / 100.0) * MeanExtractionRatePerMinute;
3495  GoodWeather = 0;
3496  Paired = false;
3497  MyTerritory.ref = -1;
3498  m_aTerrlist = new vector<APoint>;
3499  m_pesticide_affected = -1;
3500 }

References Skylark_Base::Age, BSuccess, g_random_fnc(), GoodWeather, m_aTerrlist, m_pesticide_affected, Skylark_Base::m_Size, MeanExtractionRatePerMinute, MyExtractEff, MyTerritory, Paired, and skTerritory_struct::ref.

◆ ~Skylark_Adult()

Skylark_Adult::~Skylark_Adult ( )
override
3517 { delete m_aTerrlist; }

References m_aTerrlist.

Member Function Documentation

◆ CopyMyself()

void Skylark_Adult::CopyMyself ( int  a_sktype)
virtual
6601  {
6602  const auto aps = new AdultSkylark_struct;
6603  aps->x = m_Location_x;
6604  aps->y = m_Location_y;
6605  aps->size = m_Size;
6606  aps->Terrs = m_OurTerritories;
6607  aps->L = m_OurLandscape;
6608  aps->sex = false;
6609  aps->age = 0;
6610  aps->bx = m_Born_x;
6611  aps->mh = m_MyHome;
6612  aps->by = m_Born_y;
6613  m_OurPopulationManager->CreateObjects(a_sktype, this, nullptr, aps, -1);
6614  // object will be destroyed by death state
6615  // but must let Dad know anyway
6616  delete aps;
6617 }

References Skylark_Population_Manager::CreateObjects(), Skylark_Base::m_Born_x, Skylark_Base::m_Born_y, TAnimal::m_Location_x, TAnimal::m_Location_y, Skylark_Base::m_MyHome, TAnimal::m_OurLandscape, Skylark_Base::m_OurPopulationManager, Skylark_Base::m_OurTerritories, Skylark_Base::m_Size, and Skylark_struct::x.

Referenced by Skylark_Population_Manager::Catastrophe().

◆ GetBadWeather()

bool Skylark_Adult::GetBadWeather ( )
staticprotected

◆ GetVegHindrance()

double Skylark_Adult::GetVegHindrance ( int  PolyRef) const
protected
3567  {
3568 #ifdef __CJTDebug_5
3569  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
3570 #endif
3571  /* CJT Changed in favour of a function of veg density double veg_biomass = m_OurLandscape->SupplyVegBiomass(polyref);
3572  double veg_height = m_OurLandscape->SupplyVegHeight(polyref); int bio = (int)floor(0.5+veg_biomass/(VeryHighDensityVeg/
3573  double(HindranceBiomassCategories))); // 0-24, 25-49, 50-74,74-100 categories
3574  int hei=(int)floor(0.5+veg_height/(100.0/double(HindranceHeightCategories)));
3575  if (hei>HindranceHeightCategories-1) hei=HindranceHeightCategories-1;
3576  if (bio>HindranceBiomassCategories-1) bio=HindranceBiomassCategories-1; return VegHindrance[hei][bio]; */
3577  if (m_OurLandscape->SupplyVegPatchy(polyref)) return 1.0;
3578  const int veg_height = static_cast<int>(floor(0.5 + m_OurLandscape->SupplyVegHeight(polyref)));
3579  if (veg_height < 26) return 1.0;
3580  const int veg_dens = m_OurLandscape->SupplyVegDensity(polyref);
3581  // double vh = ( VegHindranceH[ veg_height ] * 2 + VegHindranceD[ veg_dens ] ) / 3.0;
3582  //double vh = (0.33*( DensityScore[ veg_dens ] + 2 * HeightScore[ ( int )veg_height ] ) * 0.33333333)+0.67;
3583  double vh = (VegHindranceD[veg_dens] + 2 * VegHindranceH[veg_height]) * 0.3333;
3584  //cout<<veg_dens<<" "<<veg_height<<" "<<vh<<endl;
3585 #ifdef __TRAMLINES_ON
3586  // Tramlines affect the amount of veg hindrance only
3587  // vh must be increased by a factor corresponding to the tramline effect
3588  // IF USING SKLARK SCRAPES !
3589  if (m_OurLandscape->SupplySkScrapes(polyref)) { vh += (1.0 - vh) * cfg_tramline_foraging.value(); }
3590  else if (m_OurLandscape->SupplyHasTramlines(polyref)) { vh += (1.0 - vh) * cfg_tramline_foraging.value(); }
3591 #endif
3592  return vh;
3593 }

References cfg_tramline_foraging, TAnimal::m_OurLandscape, Landscape::SupplyHasTramlines(), Landscape::SupplySkScrapes(), Landscape::SupplyVegDensity(), Landscape::SupplyVegHeight(), Landscape::SupplyVegPatchy(), CfgFloat::value(), VegHindranceD, and VegHindranceH.

Referenced by Skylark_Male::GetFood().

◆ GetWeatherHindrance()

double Skylark_Adult::GetWeatherHindrance ( ) const
protected
3549  {
3550 #ifdef __CJTDebug_5
3551  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
3552 #endif
3553  int rain = static_cast<int>(m_OurLandscape->SupplyRain()) / 2;
3554  // Assume half of this falls at night
3555  // Make sure the indices remain in bounds
3556  if (rain > 10) rain = 10;
3557  int temp = static_cast<int>(floor(0.5 + m_OurLandscape->SupplyTemp()));
3558  if (temp < 0) temp = 0;
3559  if (temp > 20) temp = 20;
3560  double hind = RainHindrance[rain];
3561  hind *= TempHindrance[temp];
3562  return hind;
3563 }

References TAnimal::m_OurLandscape, RainHindrance, Landscape::SupplyRain(), Landscape::SupplyTemp(), and TempHindrance.

Referenced by Skylark_Male::GetFood().

◆ ReInit()

void Skylark_Adult::ReInit ( int  x,
int  y,
double  size,
int  age,
SkTerritories Terrs,
Landscape L,
Skylark_Population_Manager SPM,
int  bx,
int  by,
int  mh 
)
virtual

Reimplemented in Skylark_Male, and Skylark_Female.

3503  {
3504  Skylark_Base::ReInit(x, y, Terrs, L, SPM, bx, by, mh);
3505  m_Size = size;
3506  Age = age;
3507  BSuccess = false;
3508  MyExtractEff = (0.90 + g_random_fnc(21) / 100.0) * MeanExtractionRatePerMinute;
3509  GoodWeather = 0;
3510  Paired = false;
3511  MyTerritory.ref = -1;
3512  m_aTerrlist = new vector<APoint>;
3513  m_pesticide_affected = -1;
3514 }

References Skylark_Base::Age, BSuccess, g_random_fnc(), GoodWeather, m_aTerrlist, m_pesticide_affected, Skylark_Base::m_Size, MeanExtractionRatePerMinute, MyExtractEff, MyTerritory, Paired, skTerritory_struct::ref, and Skylark_Base::ReInit().

Referenced by Skylark_Female::ReInit(), and Skylark_Male::ReInit().

◆ RemoveEM()

double Skylark_Adult::RemoveEM ( double  food)
protectedvirtual
3527  {
3528 #ifdef __CJTDebug_5
3529  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
3530 #endif
3531  // remove metabolic requirements
3532  const double used = m_OurPopulationManager->SupplyEMi();
3533 #ifdef __PESTICIDE_RA_ADULT
3534  // If using pesticide risk assessment then the total mg of pesticide collected that day are now in m_pcide
3535  // But, there well be more than we wanted, so now we take a mean as mg/kcal resource
3536  m_pcide_conc = m_pcide / food;
3537  // Note there is an assumption here that they only eat insects. We know this to be incorrect so depending upon the
3538  // aim of the assessment the line below may need to be modified (e.g. by scaling by the relative calorific content of
3539  // insects compared to plant matter.
3540  m_pesticide_accumulation = m_pesticide_accumulation + m_pcide_conc * used;
3541 #endif
3542  food -= used;
3543  if (food < 0) food = 0;
3544  return food; // Food still in gdw insects
3545 }

References Skylark_Base::m_OurPopulationManager, and Skylark_Population_Manager::SupplyEMi().

Referenced by Skylark_Female::FeedYoung(), Skylark_Male::st_CaringForYoung(), and Skylark_Female::st_PreparingForBreeding().

Member Data Documentation

◆ BSuccess

◆ GoodWeather

◆ m_aTerrlist

◆ m_pesticide_affected

◆ MyExtractEff

double Skylark_Adult::MyExtractEff
protected

◆ MyTerritory

◆ Paired


The documentation for this class was generated from the following files:
Landscape::SupplyTemp
double SupplyTemp(void)
Passes a request on to the associated Weather class function, the temperature for the current day.
Definition: Landscape.h:1993
Landscape::SupplySkScrapes
bool SupplySkScrapes(int a_polyref)
Returns the presence of skylark scrapes in the vegetation using the polygon reference number a_polyre...
Definition: Landscape.h:1567
VegHindranceD
double VegHindranceD[111]
Definition: skylarks_all.cpp:191
Skylark_Population_Manager::SupplyEMi
double SupplyEMi() const
Definition: skylarks_all.h:492
CfgFloat::value
double value() const
Definition: Configurator.h:142
Skylark_Base::m_Born_y
int m_Born_y
Definition: skylarks_all.h:521
Skylark_struct::x
int x
Definition: skylarks_all.h:209
skTerritory_struct::ref
int ref
Definition: skylarks_all.h:302
TempHindrance
double TempHindrance[31]
Definition: skylarks_all.cpp:189
Skylark_Base::m_OurTerritories
SkTerritories * m_OurTerritories
Definition: skylarks_all.h:525
VegHindranceH
double VegHindranceH[111]
Definition: skylarks_all.cpp:190
Landscape::SupplyVegDensity
int SupplyVegDensity(int a_polyref)
Returns the density of the vegetation using the polygon reference number a_polyref or based on the x,...
Definition: Landscape.h:1562
Skylark_Adult::m_pesticide_affected
int m_pesticide_affected
Definition: skylarks_all.h:659
Skylark_Base::m_MyHome
int m_MyHome
The vegetation type where the skylark was born.
Definition: skylarks_all.h:523
RainHindrance
double RainHindrance[21]
Definition: skylarks_all.cpp:188
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
Skylark_Base::Age
int Age
Definition: skylarks_all.h:518
MeanExtractionRatePerMinute
static double MeanExtractionRatePerMinute
Definition: skylarks_all.cpp:165
Landscape::SupplyVegPatchy
bool SupplyVegPatchy(int a_polyref)
Returns whether the polygon referenced by a_polyref or a_x, a_y has a vegetation type designated as p...
Definition: Landscape.h:1004
Skylark_Base::Skylark_Base
Skylark_Base(int x, int y, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
Definition: skylarks_all.cpp:2058
Landscape::SupplyHasTramlines
bool SupplyHasTramlines(int a_x, int a_y)
Returns whether the polygon referenced by a_polyref or a_x, a_y has a vegetation type with tramlines.
Definition: Landscape.h:1870
Skylark_Adult::Paired
bool Paired
Definition: skylarks_all.h:670
cfg_tramline_foraging
CfgFloat cfg_tramline_foraging
Skylark_Base::m_Born_x
int m_Born_x
Definition: skylarks_all.h:520
Skylark_Adult::m_aTerrlist
vector< APoint > * m_aTerrlist
Definition: skylarks_all.h:661
Landscape::SupplyRain
double SupplyRain(void)
Passes a request on to the associated Weather class function, the amount of rain for the current day.
Definition: Landscape.h:1971
Skylark_Adult::GoodWeather
int GoodWeather
Definition: skylarks_all.h:656
Skylark_Base::ReInit
virtual void ReInit(int x, int y, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
Definition: skylarks_all.cpp:2074
Landscape::SupplyVegHeight
double SupplyVegHeight(int a_polyref)
Returns the height of the vegetation using the polygon reference number a_polyref or based on the x,...
Definition: Landscape.h:1527
Skylark_Base::m_Size
double m_Size
Definition: skylarks_all.h:519
AdultSkylark_struct
Definition: skylarks_all.h:248
Skylark_Adult::MyExtractEff
double MyExtractEff
Definition: skylarks_all.h:658
Skylark_Base::m_OurPopulationManager
Skylark_Population_Manager * m_OurPopulationManager
Definition: skylarks_all.h:526
Skylark_Population_Manager::CreateObjects
void CreateObjects(int ob_type, TAnimal *pTAo, void *null, Skylark_struct *data, int number)
Definition: skylarks_all.cpp:539
g_random_fnc
int g_random_fnc(const int a_range)
Definition: ALMaSS_Random.cpp:74
Skylark_Adult::MyTerritory
skTerritory_struct MyTerritory
Definition: skylarks_all.h:660
TAnimal::m_Location_x
int m_Location_x
The objects ALMaSS x coordinate.
Definition: PopulationManager.h:362
Skylark_Adult::BSuccess
bool BSuccess
Definition: skylarks_all.h:657