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

Class for male hares. More...

#include <Hare_All.h>

Inheritance diagram for Hare_Male:
Hare_Juvenile THare TAnimal TALMaSSObject

Public Member Functions

void BeginStep (void) override
 BeginStep for Hare_Male. More...
 
void Step (void) override
 Step for Hare_Male. More...
 
void EndStep (void) override
 EndStep code for Hare_Male. More...
 
 Hare_Male (int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM, double p_weight, int a_age, int a_Ref)
 Constructor. More...
 
void ReInit (struct_Hare a_data)
 Male object reinitiation. More...
 
void Init (double p_weight, int a_age, int a_Ref)
 Object initiation. More...
 
 ~Hare_Male () override
 Destructor. More...
 
void ON_Dead () override
 
- Public Member Functions inherited from Hare_Juvenile
 Hare_Juvenile (int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM, double p_weight)
 Constructor for the juvenile hare object. More...
 
void ReInit (struct_Hare a_data)
 Juvenile object reinitiation. More...
 
void Init (double p_weight)
 Object initiation. More...
 
 ~Hare_Juvenile () override
 Destructor for the juvenile hare object. More...
 
- Public Member Functions inherited from THare
 THare (int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM)
 Constructor. More...
 
void THareInit (int p_x, int p_y, THare_Population_Manager *p_PPM)
 Object Initiation. More...
 
 ~THare () override
 Destructor. More...
 
double GetWeight ()
 
double GetTotalWeight ()
 Provide the wet weight of the hare. More...
 
int GetAge ()
 Provide the age of the hare. More...
 
void ON_MumDead (Hare_Female *a_Mum)
 Inform Mum that we are dead. More...
 
Hare_FemaleGetMum ()
 Get the mother pointer. More...
 
double GetRMR ()
 Get todays RMR. More...
 
int GetRefNum ()
 Get the refnum for this hare. More...
 
void loadVegPalatability (void)
 Loads static member m_vegPalatability with data. 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 int WhatState ()
 Returns the objects current state number. 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...
 

Protected Member Functions

TTypeOfHareState st_Developing () override
 Male Development. More...
 
TTypeOfHareState st_Foraging ()
 Male Foraging. More...
 
void InternalPesticideHandlingAndResponse () override
 Handles internal effects of pesticide exposure. If any effects are needed this method must be re-implemented by descendent classes. More...
 
void GeneralEndocrineDisruptor (double) override
 Handles internal effects of endocrine distrupter pesticide exposure. If any effects are needed this method must be re-implemented by descendent classes. More...
 
void GeneralOrganoPhosphate (double) override
 Handles internal effects of organophosphate pesticide exposure. If any effects are needed this method must be re-implemented by descendent classes. More...
 
- Protected Member Functions inherited from Hare_Juvenile
TTypeOfHareState st_Dispersal () override
 Juvenile Dispersal. More...
 
TTypeOfHareState st_Foraging ()
 Juvenile foraging. More...
 
void st_NextStage ()
 Maturation to Hare_Male or Hare_Female. More...
 
TTypeOfHareState st_Resting ()
 Juvenile Resting. More...
 
bool ShouldMature ()
 Test for maturation. More...
 
bool WasPredated () override
 Test for mortality. More...
 
- Protected Member Functions inherited from THare
bool Run (int a_dist, int a_direction)
 Run a distance in a direction. More...
 
void EnergyBalance (TTypeOfActivity a_activity, int dist)
 Adjust energy balance for an activity. More...
 
void TimeBudget (TTypeOfActivity a_activity, int dist)
 Adjust time budger for an activity. More...
 
void st_Dying ()
 Tidy up before removing the object on death. More...
 
virtual void Running (int a_max_dist)
 Run. More...
 
void Walking (int a_dist, int a_direction)
 Walking. More...
 
double Forage (int &time)
 Foraging. More...
 
double ForageP (int &time)
 Foraging but also incorporating pesticide exposure. More...
 
double ForageSquare (int a_x, int a_y)
 Forage from an area. More...
 
double ForageSquareP (int a_x, int a_y, double *a_pestexposure)
 Forage from an area and resturn pesticide exposure as well as food. More...
 
int GetPegDistance ()
 Get peg distance. More...
 
int GetPegPull ()
 Get attractive force of peg. More...
 
int GetPegDirection ()
 Get direction of peg. More...
 
void MovePeg ()
 Move the peg according to attraction forces. More...
 
bool OnFarmEvent (FarmToDo event) override
 Do we require a response to a farm event. More...
 
- Protected Member Functions inherited from TAnimal
void CorrectWrapRound ()
 Corrects wrap around co-ordinate problems. More...
 

Static Protected Member Functions

static TTypeOfHareState st_Resting ()
 Male Resting. More...
 
static TTypeOfHareState st_ReproBehaviour ()
 Currently Unused. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from THare
static void SetMum (Hare_Female *)
 Set the mother pointer. Reimplemented in Hare_Infant. 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 Attributes inherited from THare
static double * m_vegPalatability = nullptr
 Will hold and array of palatability for hare for each tov type. Most are 1, but unpalatable vegetation can be specified here. More...
 
- Protected Attributes inherited from THare
TTypeOfHareState m_CurrentHState
 Defines the current activity. More...
 
int m_Age = 0
 State variale - hare age. More...
 
Hare_Object m_Type
 State variale - the type of hare. More...
 
double m_weight = 0.0
 State variale - hare weight g. More...
 
double m_old_weight = 0.0
 State variale - last hare weight. More...
 
Hare_Femalem_MyMum = nullptr
 Pointer to the hare's mum. More...
 
THare_Population_Managerm_OurPopulationManager
 Pointer to the hare population manager. More...
 
int m_Lifespan = 0
 Physiolocal lifespan, assuming nothing else kills the hare (unlikely to reach this age) More...
 
int m_ActivityTime = 0
 Minutes of potential activity time per day. More...
 
int m_StarvationDays = 0
 State variable - the number of consecutive days in negative energy balance. More...
 
double m_fatReserve = 0.0
 State variable - the energy reserve of the hare. More...
 
double m_TodaysEnergy = 0.0
 State variable - the amount of energy available today, can be in deficit. More...
 
double m_EnergyMax = 0.0
 State variable - the amount of energy it is possible to eat as a multiplyer or RMR. More...
 
double m_KJRunning = 0.0
 KJ/m cost of running per kg hare. More...
 
double m_KJWalking = 0.0
 KJ/m cost of walking per kg hare. More...
 
double m_KJForaging = 0.0
 KJ/m cost of foraging per kg hare. More...
 
double m_SpeedRunning = 0.0
 m/min speed of running per kg hare More...
 
double m_SpeedWalking = 0.0
 m/min speed of walking per kg hare More...
 
double m_foragingenergy = 0.0
 Energy obtained from foraging/feeding. More...
 
int m_peg_x = 0
 peg x-coordinate More...
 
int m_peg_y = 0
 peg y-coordinate More...
 
int m_RefNum = 0
 Unique hare reference number, also functions as sex flag. More...
 
int m_experiencedDensity = 0
 State variable used in alternative density-dependent configurations. More...
 
int m_lastYearsDensity = 0
 State variable used in alternative density-dependent configurations. More...
 
int m_ddindex = 0
 State variable used in alternative density-dependent configurations. More...
 
int m_expDensity [365] = {}
 State variable used in alternative density-dependent configurations. More...
 
int m_DensitySum = 0
 State variable used in alternative density-dependent configurations. More...
 
bool m_IamSick = false
 flag for sickness - used in conjunction with disease configurations More...
 
double m_pesticide_burden = 0.0
 State variable used to hold the current body-burden of pesticide. More...
 
double m_pesticidedegradationrate = 0.0
 State variable used to hold the daily degredation rate of the pesticide in the body. More...
 
bool m_pesticideInfluenced1 = false
 Flag to indicate pesticide effects (e.g. can be used for endocrine distruptors with delayed effects until birth). 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 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...
 

Detailed Description

Class for male hares.

Constructor & Destructor Documentation

◆ Hare_Male()

Hare_Male::Hare_Male ( int  p_x,
int  p_y,
Landscape p_L,
THare_Population_Manager p_PPM,
double  p_weight,
int  a_age,
int  a_Ref 
)

Constructor.

Hare_Male constructor.

2403  : Hare_Juvenile(p_x, p_y, p_L, p_PPM, p_weight) { Init(p_weight, a_age, a_Ref); }

References Init().

◆ ~Hare_Male()

Hare_Male::~Hare_Male ( )
override

Destructor.

Hare_Male destructor.

2426  {
2427  // Nothing to do
2428 }

Member Function Documentation

◆ BeginStep()

void Hare_Male::BeginStep ( void  )
overridevirtual

BeginStep for Hare_Male.

Resets the day's activity counter and checks for default mortalities and potentially extra mortalities. Calculates energy usage for movement based on todays weight.
Also contains optional code designed to test for disease and size related death probabilities - part of the POM exercise
Unlike younger classes this method also tests for reaching the end of physiological lifespan

Reimplemented from Hare_Juvenile.

2441  {
2442  m_ActivityTime = 1440; // Start the day
2443  m_KJWalking = m_OurPopulationManager->GetKJperM(static_cast<int>(m_weight));
2444  m_KJRunning = m_KJWalking * 2;
2446  m_foragingenergy = 0;
2447 #ifdef __SIZERELATEDDEATH
2449  if (m_Age>365) {
2451  ON_Dead();
2452  m_StepDone=true; // We need to skip the step code, we are dead
2453  return;
2454  }
2455  }
2456  }
2457 #endif
2458 #ifdef __DISEASEDDMORTALITY
2459  if (m_IamSick) {
2460  ON_Dead();
2461  m_StepDone=true; // We need to skip the step code, we are dead
2462  return;
2463  }
2464 #endif
2465  if (WasPredated())
2466  {
2467  ON_Dead();
2468  m_StepDone = true; // We need to skip the step code, we are dead
2469  return;
2470  }
2471  // Age physiolocally
2472  if (++m_Age > m_Lifespan)
2473  {
2474  ON_Dead();
2475  m_StepDone = true; // We need to skip the step code, we are dead
2476  return;
2477  }
2478 #ifdef __DISEASEDDM
2480  if (m_OurLandscape->SupplyDayInYear()==0) {
2483  // Now assume that if there are 100 hares on average that there is 100% chance of getting sick
2485  m_IamSick=true;
2486  }
2487  else m_IamSick=false;
2488  }
2489 #endif
2491 
2492 #ifdef __DISEASEDDM2
2494  if (m_OurLandscape->SupplyDayInYear()==0) {
2497  }
2498 #endif
2499 #ifdef __DISEASEDDM3
2500  m_ddindex++;
2501  if (m_ddindex==365) {
2502  m_ddindex=0;
2503  }
2507  m_lastYearsDensity= int(m_DensitySum * (1.0/365.0));
2508 #endif
2509  // Set the maximum possible energy intake
2511  CheckManagement();
2512 }

References cfg_hare_escape_dist, cfg_hare_minimum_breeding_weight, cfg_hare_proximity_alert, cfg_HareFemaleSicknessDensityDepValue, cfg_MaxEnergyIntakeScaler, TAnimal::CheckManagement(), g_rand_uni_fnc(), THare_Population_Manager::GetKJperM(), THare::GetRMR(), THare_Population_Manager::GetTotalDensity(), THare::m_ActivityTime, THare::m_Age, THare::m_ddindex, THare::m_DensitySum, THare::m_EnergyMax, THare::m_expDensity, THare::m_experiencedDensity, THare::m_foragingenergy, THare::m_IamSick, THare::m_KJForaging, THare::m_KJRunning, THare::m_KJWalking, THare::m_lastYearsDensity, THare::m_Lifespan, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, THare::m_OurPopulationManager, TALMaSSObject::m_StepDone, THare::m_weight, ON_Dead(), THare::Running(), Landscape::SupplyDayInYear(), CfgInt::value(), CfgFloat::value(), and Hare_Juvenile::WasPredated().

◆ EndStep()

void Hare_Male::EndStep ( void  )
overridevirtual

EndStep code for Hare_Male.

In EndStep, the home-range centre peg gravitates a little way towards the daily activity area for today.

Reimplemented from Hare_Juvenile.

References cfg_hare_pesticideresponse_on, InternalPesticideHandlingAndResponse(), THare::MovePeg(), and CfgBool::value().

◆ GeneralEndocrineDisruptor()

void Hare_Male::GeneralEndocrineDisruptor ( double  )
overrideprotectedvirtual

Handles internal effects of endocrine distrupter pesticide exposure. If any effects are needed this method must be re-implemented by descendent classes.

Reimplemented from THare.

2809  {
2810 }

Referenced by InternalPesticideHandlingAndResponse().

◆ GeneralOrganoPhosphate()

void Hare_Male::GeneralOrganoPhosphate ( double  )
overrideprotectedvirtual

Handles internal effects of organophosphate pesticide exposure. If any effects are needed this method must be re-implemented by descendent classes.

Reimplemented from THare.

2816  {
2817  if (g_rand_uni_fnc() > l_pest_daily_mort.value()) return;
2819  m_StepDone = true;
2820 }

References g_rand_uni_fnc(), l_pest_daily_mort, THare::m_CurrentHState, TALMaSSObject::m_StepDone, tohs_Dying, and CfgFloat::value().

Referenced by InternalPesticideHandlingAndResponse().

◆ Init()

void Hare_Male::Init ( double  p_weight,
int  a_age,
int  a_Ref 
)

Object initiation.

2414  {
2415  m_Type = hob_Male;
2416  m_fatReserve = p_weight * 0.04;
2417  m_weight = p_weight;
2418  m_Age = a_age;
2419  m_RefNum = a_Ref;
2420 }

References hob_Male, THare::m_Age, THare::m_fatReserve, THare::m_RefNum, THare::m_Type, and THare::m_weight.

Referenced by Hare_Male(), and ReInit().

◆ InternalPesticideHandlingAndResponse()

void Hare_Male::InternalPesticideHandlingAndResponse ( )
overrideprotectedvirtual

Handles internal effects of pesticide exposure. If any effects are needed this method must be re-implemented by descendent classes.

This method is re-implemented ffrom THare for any class which has pesticide response behaviour. If the body burden exceeds the trigger then call pesticide-specific actions by dose

Reimplemented from THare.

2769  {
2775  double pesticideInternalConc = m_pesticide_burden / m_weight;
2776  if (m_pesticide_burden > 0)
2778  m_pesticide_burden, pesticideInternalConc);
2779 
2780  if (pesticideInternalConc > cfg_HarePesticideAccumulationThreshold.value())
2781  {
2782  switch (tp)
2783  {
2784  case ttop_NoPesticide:
2785  break;
2787  GeneralEndocrineDisruptor(pesticideInternalConc); // Calls the EndocrineDisruptor action code
2788  break;
2789  case ttop_AcuteEffects:
2790  GeneralOrganoPhosphate(pesticideInternalConc); // Calls the GeneralOrganophosphate action code
2791  break;
2792  default:
2793  exit(47);
2794  }
2795  }
2797  // Does nothing by default except internal degredation of the pesticide
2798 }

References THare_Population_Manager::BodyBurdenOut(), cfg_HarePesticideAccumulationThreshold, GeneralEndocrineDisruptor(), GeneralOrganoPhosphate(), TAnimal::m_OurLandscape, THare::m_OurPopulationManager, THare::m_pesticide_burden, THare::m_pesticidedegradationrate, THare::m_weight, Landscape::SupplyDayInYear(), Landscape::SupplyPesticideType(), Landscape::SupplyYearNumber(), ttop_AcuteEffects, ttop_NoPesticide, ttop_ReproductiveEffects, and CfgFloat::value().

Referenced by EndStep().

◆ ON_Dead()

void Hare_Male::ON_Dead ( void  )
overridevirtual

Minimal housekeeping for dying for the male

Reimplemented from Hare_Juvenile.

2763  {
2765  m_CurrentStateNo = -1;
2766  m_StepDone = true;
2767 }

References THare::m_CurrentHState, TALMaSSObject::m_CurrentStateNo, TALMaSSObject::m_StepDone, and tohs_Dying.

Referenced by BeginStep(), and Step().

◆ ReInit()

void Hare_Male::ReInit ( struct_Hare  a_data)

Male object reinitiation.

2404  {
2405  m_Location_x = a_data.x;
2406  m_Location_y = a_data.y;
2407  m_OurLandscape = a_data.L;
2408  m_CurrentStateNo = 0;
2409  THareInit(a_data.x, a_data.y, a_data.HM);
2410  Init(a_data.weight, a_data.age, a_data.RefNum);
2411 }

References struct_Hare::age, struct_Hare::HM, Init(), struct_Hare::L, TALMaSSObject::m_CurrentStateNo, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, struct_Hare::RefNum, THare::THareInit(), struct_Hare::weight, struct_Hare::x, and struct_Hare::y.

◆ st_Developing()

TTypeOfHareState Hare_Male::st_Developing ( )
overrideprotectedvirtual

Male Development.

Reimplemented from Hare_Juvenile.

2661  {
2662  //Assumes that the fatReserve has been added to by st_Foraging from yesterday
2663  //
2664  // This is the last behaviour state called each day, so we can use this to sort out
2665  // the energetics
2666  //Assumes that the fatReserve has been added to by st_Foraging from yesterday
2667  //
2668 
2669  EnergyBalance(activity_Resting, 1440); // calculates the energy use by BMR
2670  if (m_TodaysEnergy < 0)
2671  {
2672  m_fatReserve += m_TodaysEnergy * (1.0 / 42.7);
2673  m_TodaysEnergy = 0;
2674  }
2675  // Grow
2676  // Solid food absorption is already taken into account by this time
2677  if (m_Age < 365)
2678  {
2680  if (m_TodaysEnergy < Target) Target = m_TodaysEnergy;
2681  double addedtoday = Target * m_OurPopulationManager->GetGrowthEfficiencyP(m_Age);
2682  m_weight += addedtoday;
2683  m_TodaysEnergy -= Target;
2685  if (m_TodaysEnergy < Target) Target = m_TodaysEnergy;
2686  addedtoday = Target * m_OurPopulationManager->GetGrowthEfficiencyF(m_Age);
2687  m_weight += addedtoday;
2688  m_TodaysEnergy -= Target;
2689  }
2690  else
2691  {
2693  if (m_TodaysEnergy < Target) Target = m_TodaysEnergy;
2695  double addedtoday = Target * gf;
2696  m_weight += addedtoday;
2697  m_TodaysEnergy -= Target;
2698  }
2699  if (m_TodaysEnergy > 0)
2700  {
2701  // Put what remains back into fat reserve
2703  // 366 is the fat conversion efficiency
2704  m_TodaysEnergy = 0;
2705  // Cap the fat reserve and store surplus energy for today
2707  m_StarvationDays = 0; // Not starving
2708  return tohs_Foraging;
2709  }
2711  // 366 is the fat conversion efficiency
2712  if (m_fatReserve < 0)
2713  {
2715  m_fatReserve = 0.0;
2716  }
2717  else m_TodaysEnergy = 0;
2718  // double rmr=m_OurPopulationManager->GetRMR(m_Age, GetTotalWeight());
2719  // if (m_TodaysEnergy<(0.0-(rmr*0.25)))
2720  if (m_TodaysEnergy < 0.0)
2721  {
2722  // Oh oh, we are starving need to lose body weight and maybe we will die?
2723 #ifdef __ADULT_WT_STARVE_CHANCE
2724  int testval = 0;
2726  {
2727  // Somewhere between juvenile and adult so use in between values
2728  int diff = cfg_adult_starve.value() - cfg_juv_starve.value();
2729  testval = cfg_adult_starve.value() - static_cast<int>((1.0 - cfg_fixadult_starve.value() / static_cast<
2730  double>(m_Age)) * diff);
2731  }
2732  else testval = cfg_adult_starve.value();
2734  {
2735  if (g_random_fnc(10000) > testval) { return tohs_Dying; }
2736  }
2737 #else
2739  return tohs_Dying;
2740  }
2741 #endif
2742  }
2743  else
2744  {
2745  m_StarvationDays--; // Not starving
2746  if (m_StarvationDays < 0) m_StarvationDays = 0;
2747  m_TodaysEnergy = 0;
2748  }
2749  if (g_random_fnc(3) == 0) return tohs_Dispersal; // We are hungry, we need to disperse
2750  return tohs_Foraging;
2751 }

References activity_Resting, cfg_adult_starvation_threshold, cfg_adult_starve, cfg_AdultMaxFat, cfg_fixadult_starve, cfg_juv_starve, THare::EnergyBalance(), g_random_fnc(), THare_Population_Manager::GetGrowthEfficiencyF(), THare_Population_Manager::GetGrowthEfficiencyP(), THare_Population_Manager::GetMaxDailyGrowthEnergyF(), THare_Population_Manager::GetMaxDailyGrowthEnergyP(), THare::m_Age, THare::m_fatReserve, THare::m_OurPopulationManager, THare::m_StarvationDays, THare::m_TodaysEnergy, THare::m_weight, tohs_Dispersal, tohs_Dying, tohs_Foraging, CfgInt::value(), and CfgFloat::value().

Referenced by Step().

◆ st_Foraging()

TTypeOfHareState Hare_Male::st_Foraging ( )
protected

Male Foraging.

Foraging code for the Hare_Male.

Foraging time is reduced dependent upon the density of hares in the local area. There are a number of options for calculting this effect used in the POM

2595  {
2599  double time = static_cast<double>(m_ActivityTime) * cfg_ForageRestingRatio.value();
2600  // We need to rest if there is no more time
2601  if (time < 30) return tohs_Resting;
2602  // If there are more hares here then interference reduces the activity time
2603 #ifdef __DELAYEDDD
2605 #else
2607 #endif
2608 #ifdef __THRESHOLD_AD_DD
2609  if (hares<m_OurPopulationManager->m_HareThresholdDD) hares=0;
2611 #endif
2612  //double interference=(1-(hares*hares)*cfg_HareMaleDensityDepValue.value());
2613  //if (interference<0) interference=0;
2614 #ifdef __DISEASEDDM2
2616 #else
2617 #ifdef __DISEASEDDM3
2619 #else
2620 #ifndef __DDEPMORT
2621  double inter = m_OurPopulationManager->GetInterference(hares);
2622 #else
2623 #ifndef __DISEASEDDM
2624  double inter=m_OurPopulationManager->GetInterference(hares);
2625 #else
2626  double inter=1.0;
2627 #endif
2628 #endif
2629 #endif
2630 #endif
2631  if (inter < 0.5 && time > 300)
2632  {
2633  if (g_rand_uni_fnc() > inter * 2) // added to reduce rate of dispersal
2634  {
2635  // m_ActivityTime = (int)(time / cfg_ForageRestingRatio.value()); removed because it is superfluous
2636  return tohs_Dispersal; // Added Sat 15th Dec 2007
2637  }
2638  }
2639  time *= inter;
2640  // Given the time we have then we need to feed, which will return an energy
2641  // Value obtained.
2642  int a_time = static_cast<int>(time);
2644  else { m_TodaysEnergy = Forage(a_time); }
2645  // We need to spend energy on foraging and associated movement - but this is done in ForageSquare()
2646  TimeBudget(activity_Foraging, static_cast<int>(time) - a_time);
2647  // We need to rest
2648  return tohs_Resting;
2649 }

References activity_Foraging, cfg_ForageRestingRatio, cfg_hare_pesticideresponse_on, THare::Forage(), THare::ForageP(), g_rand_uni_fnc(), THare_Population_Manager::GetAdultDensity(), THare_Population_Manager::GetDelayedAdultDensity(), THare_Population_Manager::GetInterference(), THare::m_ActivityTime, THare_Population_Manager::m_HareThresholdDD, THare::m_lastYearsDensity, TAnimal::m_Location_x, TAnimal::m_Location_y, THare::m_OurPopulationManager, THare::m_TodaysEnergy, THare::TimeBudget(), tohs_Dispersal, tohs_Resting, CfgFloat::value(), and CfgBool::value().

Referenced by Step().

◆ st_ReproBehaviour()

TTypeOfHareState Hare_Male::st_ReproBehaviour ( )
staticprotected

Currently Unused.

2754  {
2755  // TODO - this will need implementing if we have to simulate male reproduction (e.g. for genetic effects) or if we find we need this to alter survival in some way.
2756  return tohs_Resting;
2757 }

References tohs_Resting.

Referenced by Step().

◆ st_Resting()

TTypeOfHareState Hare_Male::st_Resting ( )
staticprotected

Male Resting.

This method uses up the rest of the day in resting

2653  {
2657  return tohs_Developing;
2658 }

References tohs_Developing.

Referenced by Step().

◆ Step()

void Hare_Male::Step ( void  )
overridevirtual

Step for Hare_Male.

Step controls all the state/transition behaviour for the male hare.
Has some optional code for dispersal related mortality for use in POM testing.

Reimplemented from Hare_Juvenile.

2523  {
2524  if (m_StepDone || m_CurrentStateNo == -1) return;
2525  switch (m_CurrentHState)
2526  {
2527  case tohs_InitialState: // Initial state
2529  break;
2530  case tohs_Dispersal:
2531  // Legal returns are:
2532  // tohs_MResting
2533  // tohs_MReproBehaviour
2534  // Dispersal is risky therefore take a test again
2535 #ifdef __DISPERSALDDM
2536  if (g_rand_uni()<(cfg_hare_adult_predation.value())) {
2537  ON_Dead();
2538  m_StepDone=true; // We need to skip the step code, we are dead
2539  return;
2540  }
2541 #endif
2543  break;
2544  case tohs_Foraging:
2545  // Legal returns are:
2546  // tohs_MDispersal
2547  // tohs_MResting
2548  // tohs_MReproBehaviour
2550  break;
2551  case tohs_Resting:
2552  // Legal returns are:
2553  // tohs_MDeveloping
2555  break;
2556  case tohs_ReproBehaviour:
2557  // Legal returns are:
2558  // tohs_MResting
2559  // tohs_MDeveloping
2561  break;
2562  case tohs_Developing:
2563  // Legal returns are:
2564  // tohs_Dying
2565  // tohs_MForaging
2567  m_StepDone = true;
2568  break;
2569  case tohs_Dying:
2570  ON_Dead();
2571  m_StepDone = true;
2572  break;
2573  default:
2574  m_OurLandscape->Warn("Hare_Male::Step - unknown state", nullptr);
2575  exit(1);
2576  }
2577 }

References cfg_hare_adult_predation, THare::m_CurrentHState, TALMaSSObject::m_CurrentStateNo, TAnimal::m_OurLandscape, TALMaSSObject::m_StepDone, ON_Dead(), st_Developing(), Hare_Juvenile::st_Dispersal(), st_Foraging(), st_ReproBehaviour(), st_Resting(), tohs_Developing, tohs_Dispersal, tohs_Dying, tohs_Foraging, tohs_InitialState, tohs_ReproBehaviour, tohs_Resting, CfgFloat::value(), and Landscape::Warn().


The documentation for this class was generated from the following files:
tohs_Dying
Definition: Hare_All.h:80
struct_Hare::x
int x
Definition: Hare_All.h:138
g_rand_uni_fnc
double g_rand_uni_fnc()
Definition: ALMaSS_Random.cpp:56
cfg_juv_starve
CfgInt cfg_juv_starve("HARE_JUV_STARVE", CFG_CUSTOM, 2500)
struct_Hare::y
int y
Definition: Hare_All.h:139
Hare_Male::GeneralEndocrineDisruptor
void GeneralEndocrineDisruptor(double) override
Handles internal effects of endocrine distrupter pesticide exposure. If any effects are needed this m...
Definition: Hare_All.cpp:2809
cfg_HareFemaleSicknessDensityDepValue
CfgInt cfg_HareFemaleSicknessDensityDepValue("HARE_FEMALESICKNESSDENDEPVALUE", CFG_CUSTOM, 40)
cfg_hare_pesticideresponse_on
CfgBool cfg_hare_pesticideresponse_on("HARE_PESTICIDERESPONSE_ON", CFG_CUSTOM, false)
If set to true then hares will collect and respond to pesticide information. This will slow the simul...
THare::m_pesticidedegradationrate
double m_pesticidedegradationrate
State variable used to hold the daily degredation rate of the pesticide in the body.
Definition: Hare_All.h:306
THare_Population_Manager::GetKJperM
double GetKJperM(int a_size)
Get the cost of moving 1m in KJ dependent upon mass (.
Definition: Hare_All.h:628
THare::m_EnergyMax
double m_EnergyMax
State variable - the amount of energy it is possible to eat as a multiplyer or RMR.
Definition: Hare_All.h:223
Hare_Male::InternalPesticideHandlingAndResponse
void InternalPesticideHandlingAndResponse() override
Handles internal effects of pesticide exposure. If any effects are needed this method must be re-impl...
Definition: Hare_All.cpp:2769
struct_Hare::age
int age
Definition: Hare_All.h:140
Hare_Juvenile::WasPredated
bool WasPredated() override
Test for mortality.
Definition: Hare_All.cpp:2380
THare::m_Lifespan
int m_Lifespan
Physiolocal lifespan, assuming nothing else kills the hare (unlikely to reach this age)
Definition: Hare_All.h:198
cfg_MaxEnergyIntakeScaler
static CfgFloat cfg_MaxEnergyIntakeScaler("HARE_MAXENERGYINTAKESCALER", CFG_CUSTOM, 1.825)
CfgFloat::value
double value() const
Definition: Configurator.h:142
cfg_HarePesticideAccumulationThreshold
CfgFloat cfg_HarePesticideAccumulationThreshold("HARE_PESTICIDEACCUMULATIONTHRESHOLD", CFG_CUSTOM, 0.0)
This is the value that triggers pesticide response, which may be a threshold, or if simply set to 0....
tohs_InitialState
Definition: Hare_All.h:72
THare::m_ActivityTime
int m_ActivityTime
Minutes of potential activity time per day.
Definition: Hare_All.h:203
cfg_adult_starvation_threshold
static CfgInt cfg_adult_starvation_threshold("HARE_ADULT_STARVE_THRESHOLD", CFG_CUSTOM, 16)
THare::m_OurPopulationManager
THare_Population_Manager * m_OurPopulationManager
Pointer to the hare population manager.
Definition: Hare_All.h:194
struct_Hare::HM
THare_Population_Manager * HM
Definition: Hare_All.h:142
Hare_Male::ON_Dead
void ON_Dead() override
Definition: Hare_All.cpp:2763
hob_Male
Definition: Hare_All.h:62
THare_Population_Manager::GetMaxDailyGrowthEnergyF
double GetMaxDailyGrowthEnergyF(int a_age)
Get the maximum daily energy needed for growth for this a_age for use in fat construction.
Definition: Hare_All.h:576
cfg_ForageRestingRatio
CfgFloat cfg_ForageRestingRatio("HARE_FORAGERESTRATIO", CFG_CUSTOM, 0.67)
THare::m_KJForaging
double m_KJForaging
KJ/m cost of foraging per kg hare.
Definition: Hare_All.h:238
THare_Population_Manager::m_HareThresholdDD
int m_HareThresholdDD
Input variable - Threshold density dependence level.
Definition: Hare_All.h:757
THare::GetRMR
double GetRMR()
Get todays RMR.
Definition: Hare_THare.cpp:333
THare::Forage
double Forage(int &time)
Foraging.
Definition: HareForagenPeg.cpp:52
THare::THareInit
void THareInit(int p_x, int p_y, THare_Population_Manager *p_PPM)
Object Initiation.
Definition: Hare_THare.cpp:70
struct_Hare::RefNum
int RefNum
Definition: Hare_All.h:144
CfgBool::value
bool value() const
Definition: Configurator.h:164
ttop_AcuteEffects
Definition: LandscapeFarmingEnums.h:1060
THare::m_KJWalking
double m_KJWalking
KJ/m cost of walking per kg hare.
Definition: Hare_All.h:233
THare::m_fatReserve
double m_fatReserve
State variable - the energy reserve of the hare.
Definition: Hare_All.h:213
THare::m_lastYearsDensity
int m_lastYearsDensity
State variable used in alternative density-dependent configurations.
Definition: Hare_All.h:276
tohs_Dispersal
Definition: Hare_All.h:75
THare::m_experiencedDensity
int m_experiencedDensity
State variable used in alternative density-dependent configurations.
Definition: Hare_All.h:271
THare::m_KJRunning
double m_KJRunning
KJ/m cost of running per kg hare.
Definition: Hare_All.h:228
TAnimal::m_Location_y
int m_Location_y
The objects ALMaSS y coordinate.
Definition: PopulationManager.h:366
THare::m_RefNum
int m_RefNum
Unique hare reference number, also functions as sex flag.
Definition: Hare_All.h:265
cfg_hare_minimum_breeding_weight
CfgInt cfg_hare_minimum_breeding_weight("HARE_MIN_BREEDING_WT", CFG_CUSTOM, 780)
TAnimal::m_OurLandscape
static Landscape * m_OurLandscape
A pointer to the landscape object shared with all TAnimal objects.
Definition: PopulationManager.h:342
Hare_Male::st_ReproBehaviour
static TTypeOfHareState st_ReproBehaviour()
Currently Unused.
Definition: Hare_All.cpp:2754
TAnimal::CheckManagement
void CheckManagement()
Used to start a check for any management related effects at the objects current location.
Definition: PopulationManager.cpp:1591
struct_Hare::L
Landscape * L
Definition: Hare_All.h:141
cfg_hare_adult_predation
CfgFloat cfg_hare_adult_predation("HARE_ADULT_PREDATION", CFG_CUSTOM, 0.0015)
Hare_Male::Init
void Init(double p_weight, int a_age, int a_Ref)
Object initiation.
Definition: Hare_All.cpp:2414
activity_Foraging
Definition: Hare_All.h:92
THare_Population_Manager::GetMaxDailyGrowthEnergyP
double GetMaxDailyGrowthEnergyP(int a_age)
Get the maximum daily energy needed for growth for this a_age for use in protein construction.
Definition: Hare_All.h:563
THare::MovePeg
void MovePeg()
Move the peg according to attraction forces.
Definition: HareForagenPeg.cpp:535
THare_Population_Manager::GetGrowthEfficiencyF
double GetGrowthEfficiencyF(int a_age)
Get the growth efficiency for this a_age for creating fat.
Definition: Hare_All.h:615
cfg_hare_escape_dist
CfgInt cfg_hare_escape_dist("HARE_ESCAPE_DIST", CFG_CUSTOM, 100)
THare::m_ddindex
int m_ddindex
State variable used in alternative density-dependent configurations.
Definition: Hare_All.h:281
THare::m_TodaysEnergy
double m_TodaysEnergy
State variable - the amount of energy available today, can be in deficit.
Definition: Hare_All.h:218
Landscape::SupplyDayInYear
int SupplyDayInYear(void)
Passes a request on to the associated Calendar class function, the day in the year.
Definition: Landscape.h:2267
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
Hare_Juvenile::st_Dispersal
TTypeOfHareState st_Dispersal() override
Juvenile Dispersal.
Definition: Hare_All.cpp:2185
THare::EnergyBalance
void EnergyBalance(TTypeOfActivity a_activity, int dist)
Adjust energy balance for an activity.
Definition: Hare_THare.cpp:261
Hare_Male::st_Developing
TTypeOfHareState st_Developing() override
Male Development.
Definition: Hare_All.cpp:2661
Landscape::SupplyYearNumber
int SupplyYearNumber(void)
Passes a request on to the associated Calendar class function, returns m_simulationyear
Definition: Landscape.h:2287
THare::m_foragingenergy
double m_foragingenergy
Energy obtained from foraging/feeding.
Definition: Hare_All.h:252
Hare_Male::st_Resting
static TTypeOfHareState st_Resting()
Male Resting.
Definition: Hare_All.cpp:2653
CfgInt::value
int value() const
Definition: Configurator.h:116
THare_Population_Manager::GetAdultDensity
int GetAdultDensity(int x, int y)
Density function - returns the density of adults in the square containing by x,y. Each square is 256x...
Definition: Hare_All.h:688
TTypesOfPesticide
TTypesOfPesticide
Values that represent types of pesticide actions.
Definition: LandscapeFarmingEnums.h:1057
l_pest_daily_mort
CfgFloat l_pest_daily_mort
Daily mortality of pesticide with type 1.
THare::m_expDensity
int m_expDensity[365]
State variable used in alternative density-dependent configurations.
Definition: Hare_All.h:286
THare::m_DensitySum
int m_DensitySum
State variable used in alternative density-dependent configurations.
Definition: Hare_All.h:291
THare::m_pesticide_burden
double m_pesticide_burden
State variable used to hold the current body-burden of pesticide.
Definition: Hare_All.h:301
THare::m_Age
int m_Age
State variale - hare age.
Definition: Hare_All.h:170
THare::ForageP
double ForageP(int &time)
Foraging but also incorporating pesticide exposure.
Definition: HareForagenPeg.cpp:179
tohs_Developing
Definition: Hare_All.h:74
THare::m_CurrentHState
TTypeOfHareState m_CurrentHState
Defines the current activity.
Definition: Hare_All.h:165
THare::m_IamSick
bool m_IamSick
flag for sickness - used in conjunction with disease configurations
Definition: Hare_All.h:295
cfg_AdultMaxFat
static CfgFloat cfg_AdultMaxFat("HARE_ADULT_MAXFAT", CFG_CUSTOM, 0.04/(0.33 *0.88))
THare_Population_Manager::GetInterference
double GetInterference(int h)
Return the proportion of time used in communicating with con-specifics.
Definition: Hare_All.h:707
ttop_ReproductiveEffects
Definition: LandscapeFarmingEnums.h:1061
THare::m_StarvationDays
int m_StarvationDays
State variable - the number of consecutive days in negative energy balance.
Definition: Hare_All.h:208
cfg_adult_starve
CfgInt cfg_adult_starve("HARE_ADULT_STARVE", CFG_CUSTOM, 5000)
THare::Running
virtual void Running(int a_max_dist)
Run.
Definition: Hare_THare.cpp:136
g_random_fnc
int g_random_fnc(const int a_range)
Definition: ALMaSS_Random.cpp:74
THare::m_weight
double m_weight
State variale - hare weight g.
Definition: Hare_All.h:180
THare_Population_Manager::GetGrowthEfficiencyP
double GetGrowthEfficiencyP(int a_age)
Get the growth efficiency for this a_age for creating protein.
Definition: Hare_All.h:602
THare::m_Type
Hare_Object m_Type
State variale - the type of hare.
Definition: Hare_All.h:175
tohs_Resting
Definition: Hare_All.h:77
cfg_fixadult_starve
CfgInt cfg_fixadult_starve("HARE_FIXADULT_STARVE", CFG_CUSTOM, 370)
TALMaSSObject::m_CurrentStateNo
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
Definition: PopulationManager.h:131
Hare_Male::st_Foraging
TTypeOfHareState st_Foraging()
Male Foraging.
Definition: Hare_All.cpp:2595
struct_Hare::weight
double weight
Definition: Hare_All.h:145
Hare_Juvenile::Hare_Juvenile
Hare_Juvenile(int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM, double p_weight)
Constructor for the juvenile hare object.
Definition: Hare_All.cpp:1972
tohs_ReproBehaviour
Definition: Hare_All.h:78
THare::TimeBudget
void TimeBudget(TTypeOfActivity a_activity, int dist)
Adjust time budger for an activity.
Definition: Hare_THare.cpp:298
Landscape::Warn
void Warn(std::string a_msg1, std::string a_msg2)
Wrapper for the g_msg Warn function.
Definition: Landscape.h:2250
THare_Population_Manager::GetTotalDensity
int GetTotalDensity(int x, int y)
Density function - returns the density of all hares in the square containing by x,...
Definition: Hare_All.h:683
cfg_hare_proximity_alert
static CfgFloat cfg_hare_proximity_alert("HARE_PROXIMITY_ALERT", CFG_CUSTOM, 0.05)
TAnimal::m_Location_x
int m_Location_x
The objects ALMaSS x coordinate.
Definition: PopulationManager.h:362
THare_Population_Manager::BodyBurdenOut
void BodyBurdenOut(int a_year, int a_day, double a_bb, double a_mgkg)
BodyBurden output.
Definition: Hare_All.h:730
THare_Population_Manager::GetDelayedAdultDensity
int GetDelayedAdultDensity(int x, int y)
Density function - returns the density of adults in the square containing by x,y, but for last year a...
Definition: Hare_All.h:696
ttop_NoPesticide
Definition: LandscapeFarmingEnums.h:1059
activity_Resting
Definition: Hare_All.h:90
tohs_Foraging
Definition: Hare_All.h:76
Hare_Male::GeneralOrganoPhosphate
void GeneralOrganoPhosphate(double) override
Handles internal effects of organophosphate pesticide exposure. If any effects are needed this method...
Definition: Hare_All.cpp:2816