ALMaSS Hare ODDox  1.1
The hare model description following ODdox protocol
THare Class Reference

The base class for all hare classes. More...

#include <Hare_all.h>

Public Member Functions

virtual void BeginStep (void)
 Base implementation only - reimplemented. More...
 
virtual void EndStep (void)
 Base implementation only - reimplemented. More...
 
int GetAge ()
 
Hare_FemaleGetMum ()
 Get the mother pointer. More...
 
int GetRefNum ()
 Get the refnum for this hare. More...
 
double GetRMR ()
 Get todays RMR. More...
 
double GetTotalWeight ()
 Provide the wet weight of the hare. More...
 
double GetWeight ()
 
void loadVegPalatability (void)
 Loads static member m_vegPalatability with data. More...
 
virtual void ON_Dead (void)
 Mortality - overridden in descendent classes. More...
 
void ON_MumDead (Hare_Female *a_Mum)
 Inform Mum that we are dead. More...
 
void SetMum (Hare_Female *)
 Set the mother pointer. Reimplemented in Hare_Infant. More...
 
virtual TTypeOfHareState st_Dispersal ()
 Base implementation only - reimplemented. More...
 
virtual void Step (void)
 Base implementation only - reimplemented. More...
 
 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...
 
virtual bool WasPredated ()
 Test for predation. More...
 
virtual ~THare ()
 Destructor. More...
 
- Public Member Functions inherited from TAnimal
void CheckManagement (void)
 
void CheckManagementXY (int x, int y)
 
virtual void CopyMyself ()
 
virtual void Dying ()
 
virtual void KillThis ()
 
virtual void ReinitialiseObject (int x, int y, Landscape *L)
 Used to re-use an object - must be implemented in descendent classes. More...
 
void SetX (int a_x)
 
void SetY (int a_y)
 
int Supply_m_Location_x ()
 
int Supply_m_Location_y ()
 
unsigned SupplyFarmOwnerRef ()
 
APoint SupplyPoint ()
 
int SupplyPolygonRef ()
 
AnimalPosition SupplyPosition ()
 
 TAnimal (int x, int y, Landscape *L)
 
virtual int WhatState ()
 
- Public Member Functions inherited from TALMaSSObject
int GetCurrentStateNo ()
 Returns the current state number. More...
 
bool GetStepDone ()
 Returns the step done indicator flag. More...
 
void OnArrayBoundsError ()
 Used for debugging only, tests basic object properties. More...
 
virtual void ReinitialiseObject ()
 Used to re-use an object - must be implemented in descendent classes. More...
 
void SetCurrentStateNo (int a_num)
 Sets the current state number. More...
 
void SetStepDone (bool a_bool)
 Sets the step done indicator flag. More...
 
 TALMaSSObject ()
 The constructor for TALMaSSObject. More...
 
virtual ~TALMaSSObject ()
 The destructor for TALMaSSObject. More...
 

Static Public Attributes

static double * m_vegPalatability = NULL
 Will hold and array of palatability for hare for each tov type. Most are 1, but unpalatable vegetation can be specified here. More...
 

Protected Member Functions

void EnergyBalance (TTypeOfActivity a_activity, int dist)
 Adjust energy balance for an activity. 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...
 
virtual void GeneralEndocrineDisruptor (double)
 Handles internal effects of endocrine distrupter pesticide exposure. If any effects are needed this method must be re-implemented by descendent classes. More...
 
virtual void GeneralOrganoPhosphate (double)
 Handles internal effects of organophosphate pesticide exposure. If any effects are needed this method must be re-implemented by descendent classes. More...
 
int GetPegDirection ()
 Get direction of peg. More...
 
int GetPegDistance ()
 Get peg distance. More...
 
int GetPegPull ()
 Get attractive force of peg. More...
 
virtual void InternalPesticideHandlingAndResponse ()
 Handles internal effects of pesticide exposure. If any effects are needed this method must be re-implemented by descendent classes. More...
 
void MovePeg ()
 Move the peg according to attraction forces. More...
 
bool OnFarmEvent (FarmToDo event)
 Do we require a response to a farm event. More...
 
bool Run (int a_dist, int a_direction)
 Run a distance in a direction. More...
 
virtual void Running (int a_max_dist)
 Run. More...
 
void st_Dying ()
 Tidy up before removing the object on death. More...
 
void TimeBudget (TTypeOfActivity a_activity, int dist)
 Adjust time budger for an activity. More...
 
void Walking (int a_dist, int a_direction)
 Walking. More...
 
- Protected Member Functions inherited from TAnimal
void CorrectWrapRound ()
 Corrects wrap around co-ordinate problems. More...
 

Protected Attributes

int m_ActivityTime
 Minutes of potential activity time per day. More...
 
int m_Age
 State variale - hare age. More...
 
TTypeOfHareState m_CurrentHState
 Defines the current activity. More...
 
int m_ddindex
 State variable used in alternative density-dependent configurations. More...
 
int m_DensitySum
 State variable used in alternative density-dependent configurations. More...
 
double m_EnergyMax
 State variable - the amount of energy it is possible to eat as a multiplyer or RMR. More...
 
int m_expDensity [365]
 State variable used in alternative density-dependent configurations. More...
 
int m_experiencedDensity
 State variable used in alternative density-dependent configurations. More...
 
double m_fatReserve
 State variable - the energy reserve of the hare. More...
 
double m_foragingenergy
 Energy obtained from foraging/feeding. More...
 
bool m_IamSick
 flag for sickness - used in conjunction with disease configurations More...
 
double m_KJForaging
 KJ/m cost of foraging per kg hare. More...
 
double m_KJRunning
 KJ/m cost of running per kg hare. More...
 
double m_KJWalking
 KJ/m cost of walking per kg hare. More...
 
int m_lastYearsDensity
 State variable used in alternative density-dependent configurations. More...
 
int m_Lifespan
 Physiolocal lifespan, assuming nothing else kills the hare (unlikely to reach this age) More...
 
Hare_Femalem_MyMum
 Pointer to the hare's mum. More...
 
double m_old_weight
 State variale - last hare weight. More...
 
THare_Population_Managerm_OurPopulationManager
 Pointer to the hare population manager. More...
 
int m_peg_x
 peg x-coordinate More...
 
int m_peg_y
 peg y-coordinate More...
 
double m_pesticide_burden
 State variable used to hold the current body-burden of pesticide. More...
 
double m_pesticidedegradationrate
 State variable used to hold the daily degredation rate of the pesticide in the body. More...
 
bool m_pesticideInfluenced1
 Flag to indicate pesticide effects (e.g. can be used for endocrine distruptors with delayed effects until birth). More...
 
int m_RefNum
 Unique hare reference number, also functions as sex flag. More...
 
double m_SpeedRunning
 m/min speed of running per kg hare More...
 
double m_SpeedWalking
 m/min speed of walking per kg hare More...
 
int m_StarvationDays
 State variable - the number of consecutive days in negative energy balance. More...
 
double m_TodaysEnergy
 State variable - the amount of energy available today, can be in deficit. More...
 
Hare_Object m_Type
 State variale - the type of hare. More...
 
double m_weight
 State variale - hare weight g. More...
 
- Protected Attributes inherited from TAnimal
int m_Location_x
 
int m_Location_y
 
Landscapem_OurLandscape
 
- 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...
 

Detailed Description

The base class for all hare classes.

Definition at line 154 of file Hare_all.h.

Constructor & Destructor Documentation

◆ THare()

THare::THare ( int  p_x,
int  p_y,
Landscape p_L,
THare_Population_Manager p_PPM 
)

Constructor.

THare constructor code

Definition at line 66 of file Hare_THare.cpp.

67  : TAnimal(p_x, p_y, p_L)
68 {
69  THareInit(p_x, p_y, p_PPM);
70 }

References THareInit().

◆ ~THare()

THare::~THare ( )
virtual

Destructor.

THare destructor

Definition at line 111 of file Hare_THare.cpp.

112 {
113 }

Member Function Documentation

◆ BeginStep()

virtual void THare::BeginStep ( void  )
inlinevirtual

Base implementation only - reimplemented.

Reimplemented from TAnimal.

Reimplemented in Hare_Female, Hare_Male, Hare_Juvenile, Hare_Young, and Hare_Infant.

Definition at line 344 of file Hare_all.h.

344 {}

◆ EndStep()

virtual void THare::EndStep ( void  )
inlinevirtual

Base implementation only - reimplemented.

Reimplemented from TAnimal.

Reimplemented in Hare_Female, Hare_Male, Hare_Juvenile, Hare_Young, and Hare_Infant.

Definition at line 354 of file Hare_all.h.

354 { MovePeg(); }

References MovePeg().

◆ EnergyBalance()

void THare::EnergyBalance ( TTypeOfActivity  a_activity,
int  dist 
)
protected

Adjust energy balance for an activity.

This method calculates energy used and subtracts this from the fat store.
The fat store is KJ so no conversion is required here. The fat store can only be a maximum X% of the body weight

Definition at line 277 of file Hare_THare.cpp.

278 {
283  switch (a_activity)
284  {
285  case activity_Resting:
287  break;
288  case activity_Running:
289  // Note here it is the fatReserve that is altered
290  // This is because this activity could be called at anytime, and we
291  // do not know if m_TodaysEnergy is set to anything sensible. fatReserve is
292  // always sensible though. Note this will potentially influence behaviour
293  // if running causes a low fatReserve.
294  m_fatReserve-=dist*m_KJRunning; // dist in metres
295  break;
296  case activity_Dispersal:
297  m_TodaysEnergy-=dist*m_KJWalking; // dist in metres
298  break;
299  case activity_Walking:
300  m_TodaysEnergy-=dist*m_KJWalking; // dist in metres
301  break;
302  case activity_Foraging:
303  m_TodaysEnergy-=dist*m_KJForaging; // dist in minutes
304  // Checking code
306  break;
307  default:
308  m_OurLandscape->Warn("THare::EnergyBalance - unknown activity",NULL);
309  exit(1);
310  }
311 }

References activity_Dispersal, activity_Foraging, activity_Resting, activity_Running, activity_Walking, THare_Population_Manager::GetRMR(), GetTotalWeight(), m_Age, m_fatReserve, m_foragingenergy, m_KJForaging, m_KJRunning, m_KJWalking, TAnimal::m_OurLandscape, m_OurPopulationManager, m_TodaysEnergy, and Landscape::Warn().

Referenced by Forage(), ForageP(), Running(), Hare_Male::st_Developing(), Hare_Female::st_Developing(), Hare_Juvenile::st_Dispersal(), Hare_Young::st_Resting(), and Hare_Juvenile::st_Resting().

◆ Forage()

double THare::Forage ( int &  time)
protected

Foraging.

This could be implemented in each hare's st_Foraging, but is implemented as a common method because all the hares do it the same way. This method determine how much energy can be foraged from the current location in the time available (a_time).
It is important that energy used for foraging is deducted from the energybudget calculations before calculating the target - otherwise growth will be affected.
Efficiency can be roughly calculated for optimal forage by calculating the number squares and the cost of foraging together with the return. e.g. 100m2 -> 10m2 forage with ext of 5.0 = 50KJ at a cost of 100*m_KJForaging.
Hence return can be calculated and the target adjusted accordingly

m_EnergyMax is the max amount of energy possible in one day (intake/cfg_hare_ExtEff to reduce calculations). This needs to be no more than they ever need, the closer to this limit the faster the code will run due to avoiding unnecessary searching, but also will prevent high energy usage being offset by too high intake. m_EnergyMax is set at the beginnng of each day in BeginStep.

Definition at line 54 of file HareForagenPeg.cpp.

55 {
64  #define __SQRS 100 // __SQRS is the number of m2 foraged per forage square
65  int y_add[8] = { -10, -10, 0, 10, 10, 10, 0, -10 }; // N,NE,E,SE,S,SW,W,NW
66  int x_add[8] = { 0, 10, 10, 10, 0, -10, -10, -10 }; // N,NE,E,SE,S,SW,W,NW
67  unsigned next=0;
68  double food[8];
69  int bestsquare = 0;
77  // Get the top corner of our square
78  int x=m_Location_x;
79  int y=m_Location_y;
80  // Search central square
81  double TotalFood = ForageSquare(x,y); // this calls walking automatically
82  a_time -= __SQRS;
83  EnergyBalance(activity_Foraging, __SQRS * 5); // Assume a 20cm swath, therefore distance = 5 * m2
84  if ((a_time - __SQRS)<0)
85  {
86  return TotalFood;
87  }
88  // Set up searching for the next 8 squares around this one
89  food[0]=0;
90  int equal=0;
91  double best=-1;
92  for (int i=0; i<8; i++)
93  {
94  x = m_Location_x+x_add[i];
95  y = m_Location_y+y_add[i];
96  food[i]=ForageSquare(x,y);
97  if (food[i]>best) {
98  best=food[i];
99  equal=0;
100  bestsquare=i;
101  } else if (food[i]==best)
102  {
103  equal++;
104  }
105  }
106  if (equal>0)
107  {
108  // No real direction to move in, so go towards our peg if this is OK
109  unsigned pd=(GetPegDirection());
110  // Our normal directions are 0-7 N,NE,E,SE,S,SW,W,NW //
111  if (food[pd]== best) bestsquare=pd;
112  else {
113  pd= (pd-1) & 0x07;
114  if (food[pd]== best) bestsquare=pd;
115  else {
116  // First check the directions
117  bestsquare=-1;
118  while (bestsquare==-1)
119  {
120  int t=random(8);
121  if (food[t]==best) bestsquare=t;
122  }
123  }
124  }
125  }
126  // Now move to the next square, also the best in food return
127  a_time -= __SQRS;
129  Walking(10, bestsquare);
130  TotalFood+=food[bestsquare];
131  if (TotalFood>=m_EnergyMax)
132  {
133  return TotalFood;
134  }
135  // OK now dependent upon the direction bestsquare, we need to check 3 or 5 new squares for food
136  while (a_time>0)
137  {
138  int nsqs;
139  int subtract=1+(bestsquare & 1);
140  if ( subtract == 1) nsqs = 3; else nsqs = 5;
141  for (int j=0; j<nsqs; j++) {
142  next=((bestsquare-subtract)+j) & 7;
143  x = m_Location_x+x_add[next];
144  y = m_Location_y+y_add[next];
145  food[j]=ForageSquare(x,y);
146  TotalFood+=food[j];
147  a_time -= __SQRS;
149  }
150  // Choose the best
151  int found=0;
152  //bestsquare=0;
153  for (int j=1; j<nsqs; j++) {
154  if (food[j]>food[found]) found=j;
155  else if (food[j]==food[found]) {
156  if (random(3)==0) {
157  found=j;
158  }
159  }
160  }
161  bestsquare=((bestsquare-subtract)+found) & 7;
162  if (GetPegPull()> random(cfg_hare_pegmoveto_chance.value()))
163  {
164  bestsquare=(GetPegDirection());
165  // Our normal directions are 0-7 N,NE,E,SE,S,SW,W,NW
166  }
167  //
168  Walking(10,bestsquare);
169  if (TotalFood>m_EnergyMax) {
170  return TotalFood;
171  }
172  }
173  if (TotalFood > m_EnergyMax)
174  {
175  TotalFood = m_EnergyMax;
176  }
177  return TotalFood;
178 }

References __SQRS, activity_Foraging, cfg_hare_pegmoveto_chance(), EnergyBalance(), ForageSquare(), GetPegDirection(), GetPegPull(), m_EnergyMax, TAnimal::m_Location_x, TAnimal::m_Location_y, and Walking().

Referenced by Hare_Young::st_Foraging(), Hare_Juvenile::st_Foraging(), Hare_Male::st_Foraging(), and Hare_Female::st_Foraging().

◆ ForageP()

double THare::ForageP ( int &  time)
protected

Foraging but also incorporating pesticide exposure.

This could be implemented in each hare's st_Foraging, but is implemented as a common method because all the hares do it the same way. This method determine how much energy can be foraged from the current location in the time available (a_time).
It is important that energy used for foraging is deducted from the energybudget calculations before calculating the target - otherwise growth will be affected.
Efficiency can be roughly calculated for optimal forage by calculating the number squares and the cost of foraging together with the return. e.g. 100m2 -> 10m2 forage with ext of 5.0 = 50KJ at a cost of 100*m_KJForaging. Hence return can be calculated and the target adjusted accordingly
The only difference between this method and THare::Forage is that this one calls the version of ForageSquare that also calculates pesticide exposure.

m_EnergyMax is the max amount of energy possible in one day. This needs to be no more than they ever need, the closer to this limit the faster the code will run due to avoiding unnecessary searching, but also will prevent high energy usage being offset by too high intake. m_EnergyMax is set at the beginnng of each day in BeginStep.

Definition at line 181 of file HareForagenPeg.cpp.

182 {
194  #define __SQRS 100 // __SQRS is the number of m2 foraged per forage square
195  int y_add[8] = { -10, -10, 0, 10, 10, 10, 0, -10 }; // N,NE,E,SE,S,SW,W,NW
196  int x_add[8] = { 0, 10, 10, 10, 0, -10, -10, -10 }; // N,NE,E,SE,S,SW,W,NW
197  unsigned next = 0;
198  double food[8];
199  double pesticide[8];
200  int bestsquare = 0;
208  // Get the top corner of our square
209  int x = m_Location_x;
210  int y = m_Location_y;
211  // Search central square
212  double PesticideExposure = 0.0;
213  double TotalFood = ForageSquareP(x, y, &PesticideExposure); // this calls walking automatically
214  a_time -= __SQRS;
215  EnergyBalance(activity_Foraging, __SQRS * 5); // Assume a 20cm swath, therefore distance = 5 * m2
216  if ((a_time - __SQRS)<0)
217  {
218  m_pesticide_burden += PesticideExposure;
219  return TotalFood;
220  }
221  // Set up searching for the next 8 squares around this one
222  food[0] = 0;
223  int equal = 0;
224  double best = -1;
225  double tempP;
226  for (int i = 0; i<8; i++)
227  {
228  x = m_Location_x + x_add[i];
229  y = m_Location_y + y_add[i];
230  tempP = 0.0;
231  food[i] = ForageSquareP(x, y, &tempP);
232  pesticide[i] = tempP;
233  if (food[i]>best) {
234  best = food[i];
235  equal = 0;
236  bestsquare = i;
237  }
238  else if (food[i] == best)
239  {
240  equal++;
241  }
242  }
243  if (equal>0)
244  {
245  // No real direction to move in, so go towards our peg if this is OK
246  unsigned pd = (GetPegDirection());
247  // Our normal directions are 0-7 N,NE,E,SE,S,SW,W,NW //
248  if (food[pd] == best) bestsquare = pd;
249  else {
250  pd = (pd - 1) & 0x07;
251  if (food[pd] == best) bestsquare = pd;
252  else {
253  // First check the directions
254  bestsquare = -1;
255  while (bestsquare == -1)
256  {
257  int t = random(8);
258  if (food[t] == best) bestsquare = t;
259  }
260  }
261  }
262  }
263  // Now move to the next square, also the best in food return
264  Walking(10, bestsquare);
265  a_time -= __SQRS;
267  TotalFood += food[bestsquare];
268  PesticideExposure += pesticide[bestsquare];
269  if (TotalFood >= m_EnergyMax)
270  {
271  m_pesticide_burden += PesticideExposure;
272  return TotalFood;
273  }
274  // OK now dependent upon the direction bestsquare, we need to check 3 or 5 new squares for food
275  while (a_time>0)
276  {
277  int nsqs;
278  int subtract = 1 + (bestsquare & 1);
279  if (subtract == 1) nsqs = 3; else nsqs = 5;
280  for (int j = 0; j<nsqs; j++) {
281  next = ((bestsquare - subtract) + j) & 7;
282  x = m_Location_x + x_add[next];
283  y = m_Location_y + y_add[next];
284  food[j] = ForageSquareP(x, y, &PesticideExposure);
285  TotalFood += food[j];
286  a_time -= __SQRS;
288  }
289  // Choose the best
290  int found = 0;
291  //bestsquare=0;
292  for (int j = 1; j<nsqs; j++) {
293  if (food[j]>food[found]) found = j;
294  else if (food[j] == food[found]) {
295  if (random(3) == 0) {
296  found = j;
297  }
298  }
299  }
300  bestsquare = ((bestsquare - subtract) + found) & 7;
301  if (GetPegPull()> random(cfg_hare_pegmoveto_chance.value()))
302  {
303  bestsquare = (GetPegDirection());
304  // Our normal directions are 0-7 N,NE,E,SE,S,SW,W,NW
305  }
306  //
307  Walking(10, bestsquare);
308  if (TotalFood>m_EnergyMax) {
309  m_pesticide_burden += PesticideExposure;
310  return TotalFood;
311  }
312  }
313  if (TotalFood > m_EnergyMax)
314  {
315  TotalFood = m_EnergyMax;
316  }
317  m_pesticide_burden += PesticideExposure;
318  return TotalFood;
319 }

References __SQRS, activity_Foraging, cfg_hare_pegmoveto_chance(), EnergyBalance(), ForageSquareP(), GetPegDirection(), GetPegPull(), m_EnergyMax, TAnimal::m_Location_x, TAnimal::m_Location_y, m_pesticide_burden, and Walking().

Referenced by Hare_Young::st_Foraging(), Hare_Juvenile::st_Foraging(), Hare_Male::st_Foraging(), and Hare_Female::st_Foraging().

◆ ForageSquare()

double THare::ForageSquare ( int  a_x,
int  a_y 
)
protected

Forage from an area.

Definition at line 322 of file HareForagenPeg.cpp.

323 {
324  int polyref;
325  double food=0.0;
328  // Do the search and return the value
329  // Now we need the irritating boundary check
330  if ((a_x >= sw-10) || (a_y > sh-10) || (a_x < 0 ) || (a_y < 0))
331  {
332  // We check __FSQRS% of the cell and assume that the hare can find forage matching the best square
333  for (int i=0; i<__FSQRS; i++)
334  {
335  // Here is the boundary check
336  int x = (sw+a_x+random(10)) % sw;
337  int y = (sh+a_y+random(10)) % sh;
338  // All OK now, so get the polygon information and food
339  polyref=m_OurLandscape->SupplyPolyRef(x,y);
340  double f=m_OurPopulationManager->GetPolyFood(polyref);
341  if (f==-1.0)
342  {
345  }
346  food+=f; //Changed foraging methods - now find the best sample cell and assume the whole square is this good - allows focus in foraging
347  //if (f > food) food = f;
348 
349  }
350  } else
351  {
352  for (int i=0; i<__FSQRS; i++)
353  {
354  int x = a_x+random(10);
355  int y = a_y+random(10);
356  polyref=m_OurLandscape->SupplyPolyRef(x,y);
357  double f=m_OurPopulationManager->GetPolyFood(polyref);
358  if (f==-1.0)
359  {
362  }
363  food+=f; //Changed foraging methods - now find the best sample cell and assume the whole square is this good - allows focus in foraging
364  //if (f > food) food = f;
365  }
366  }
367  return food * 10 * cfg_hare_ExtEff.value(); // Assume they eat from all 100 m2 at this rate
368 }

References __FSQRS, cfg_hare_ExtEff, Landscape::GetHareFoodQuality(), THare_Population_Manager::GetPolyFood(), TAnimal::m_OurLandscape, m_OurPopulationManager, m_vegPalatability, THare_Population_Manager::SetPolyFood(), Landscape::SupplyPolyRef(), Landscape::SupplySimAreaHeight(), Landscape::SupplySimAreaWidth(), and Landscape::SupplyVegType().

Referenced by Forage().

◆ ForageSquareP()

double THare::ForageSquareP ( int  a_x,
int  a_y,
double *  a_pestexposure 
)
protected

Forage from an area and resturn pesticide exposure as well as food.

Definition at line 372 of file HareForagenPeg.cpp.

373 {
374  int polyref;
375  double somepesticide = 0.0;
376  double food = 0.0;
379  // Do the search and return the value
380  // Now we need the irritating boundary check
381  if ((a_x >= sw - 10) || (a_y > sh - 10) || (a_x < 0) || (a_y < 0))
382  {
383  // We check __FSQRS% of the cell and assume that the hare can find forage matching the best square
384  for (int i = 0; i<__FSQRS; i++)
385  {
386  // Here is the boundary check
387  int x = (sw + a_x + random(10)) % sw;
388  int y = (sh + a_y + random(10)) % sh;
389  // All OK now, so get the polygon information and food
390  polyref = m_OurLandscape->SupplyPolyRef(x, y);
391  somepesticide += m_OurLandscape->SupplyPesticideP(x, y, ppp_1);
392  double f = m_OurPopulationManager->GetPolyFood(polyref);
393  if (f == -1.0)
394  {
396  m_OurPopulationManager->SetPolyFood(polyref, f);
397  }
398  food += f; //Changed foraging methods - now find the best sample cell and assume the whole square is this good - allows focus in foraging
399  }
400  }
401  else
402  {
403  for (int i = 0; i<__FSQRS; i++)
404  {
405  int x = a_x + random(10);
406  int y = a_y + random(10);
407  polyref = m_OurLandscape->SupplyPolyRef(x, y);
408  somepesticide += m_OurLandscape->SupplyPesticideP(x, y, ppp_1);
409  double f = m_OurPopulationManager->GetPolyFood(polyref);
410  if (f == -1.0)
411  {
413  m_OurPopulationManager->SetPolyFood(polyref, f);
414  }
415  food += f;
416  }
417  }
418  // somepesticide now has the pesticide exposure in units per 10m2, but we need 100m and there are two routes with different rates of intake, so first X10
419  somepesticide *= 10;
420  // contact exposure
421  (*a_pesticideexposure) += somepesticide * cfg_hare_pesticide_contact_exposure_rate.value();
422  // ingestion exposure
423  (*a_pesticideexposure) += somepesticide * cfg_hare_pesticide_ingestion_exposure_rate.value();
424  return food * 10 * cfg_hare_ExtEff.value(); // Assume they eat from all 100 m2 at this rate
425 }

References __FSQRS, cfg_hare_ExtEff, cfg_hare_pesticide_contact_exposure_rate(), cfg_hare_pesticide_ingestion_exposure_rate(), Landscape::GetHareFoodQuality(), THare_Population_Manager::GetPolyFood(), TAnimal::m_OurLandscape, m_OurPopulationManager, m_vegPalatability, ppp_1, THare_Population_Manager::SetPolyFood(), Landscape::SupplyPesticideP(), Landscape::SupplyPolyRef(), Landscape::SupplySimAreaHeight(), Landscape::SupplySimAreaWidth(), and Landscape::SupplyVegType().

Referenced by ForageP().

◆ GeneralEndocrineDisruptor()

virtual void THare::GeneralEndocrineDisruptor ( double  )
inlineprotectedvirtual

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

Reimplemented in Hare_Male, and Hare_Female.

Definition at line 482 of file Hare_all.h.

482 { ; }

◆ GeneralOrganoPhosphate()

virtual void THare::GeneralOrganoPhosphate ( double  )
inlineprotectedvirtual

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

Reimplemented in Hare_Male, and Hare_Female.

Definition at line 487 of file Hare_all.h.

487 { ; }

◆ GetAge()

int THare::GetAge ( )
inline

Provide the age of the hare

Definition at line 377 of file Hare_all.h.

377  {
378  return m_Age;
379  }

References m_Age.

Referenced by THare_Population_Manager::DoFirst(), Hare_Female::DoLactation(), and THare_Population_Manager::POMOutputs().

◆ GetMum()

Hare_Female* THare::GetMum ( )
inline

Get the mother pointer.

Definition at line 404 of file Hare_all.h.

404 { return m_MyMum; }

References m_MyMum.

Referenced by Hare_Female::SanityCheckYoungList().

◆ GetPegDirection()

int THare::GetPegDirection ( )
inlineprotected

Get direction of peg.

Daily movement is limited by a peg which does not really want to move, but can be dragged slowly. This requires a set of rapid functions because they will be used a lot. NB dispersal takes no account of the peg.
Figures out the closest direction to peg.
1 NE, 3 SE, 5 SWest & 7 NW
only uses 4 returns because this is very fast and relatively simple - 8 directions would be quite difficult to implement fast
This is also complicated by the fact that the peg can be at the other end of the world due to wrap around.

Definition at line 460 of file HareForagenPeg.cpp.

461 {
469  int d1 = m_Location_x - m_peg_x;
470  int d2 = m_Location_y - m_peg_y;
471  if ((d1 == 0) && (d2 == 0)) return random(8);
472  if (abs(d1) > (int)m_OurPopulationManager->SimWH)
473  {
474  if (d1<0)
475  {
476  if ( abs(d2) > (int) m_OurPopulationManager->SimHH)
477  {
478  if (d2<0) return 7; //NW;
479  else return 5; //SW;
480  }
481  else
482  {
483  if (d2<0) return 5; //SW;
484  else return 7; //NW;
485  }
486  }
487  else
488  {
489  if ( abs(d2) > (int) m_OurPopulationManager->SimHH) {
490  if (d2<0) return 1; //NE;
491  else return 3; //SE;
492  }
493  else {
494  if (d2<0) return 3; //SE;
495  else return 1; //NE;
496  }
497  }
498  }
499  else
500  {
501  if (d1<0)
502  {
503  if ( abs(d2) > (int) m_OurPopulationManager->SimHH)
504  {
505  if (d2<0) return 1; //NE;
506  else return 3; //SE;
507  }
508  else {
509  if (d2<0) return 3; //SE;
510  else return 1; //NE;
511  }
512  }
513  else {
514  if ( abs(d2) > (int) m_OurPopulationManager->SimHH) {
515  if (d2<0) return 7; //NW;
516  else return 5; //SW;
517  }
518  else {
519  if (d2<0) return 5; //SW;
520  else return 7; //NW;
521  }
522  }
523  }
524 }

References TAnimal::m_Location_x, TAnimal::m_Location_y, m_OurPopulationManager, m_peg_x, m_peg_y, Population_Manager::SimHH, and Population_Manager::SimWH.

Referenced by Forage(), and ForageP().

◆ GetPegDistance()

int THare::GetPegDistance ( )
inlineprotected

Get peg distance.

Daily movement is limited by a peg which does not really want to move, but can be dragged slowly. This requires a set of rapid functions because they will be used a lot. NB dispersal takes no account of the peg.
Calculates the distance from our current x,y to the peg We must avoid sqrt and the like so our distance is in rectangular co-ordinates. This is complicated by the fact that the peg and hare may be on opposite sides of the world due to wrap around.

Definition at line 435 of file HareForagenPeg.cpp.

436 {
444  int d1=abs(m_Location_x-m_peg_x);
445  if (d1 > (int) m_OurPopulationManager->SimWH) d1 = abs(d1-m_OurPopulationManager->SimW);
446  int d2=abs(m_Location_y-m_peg_y);
447  if (d2 > (int) m_OurPopulationManager->SimHH) d2 = abs(d2-m_OurPopulationManager->SimH);
448  return d1+d2;
449 }

References TAnimal::m_Location_x, TAnimal::m_Location_y, m_OurPopulationManager, m_peg_x, m_peg_y, Population_Manager::SimH, Population_Manager::SimHH, Population_Manager::SimW, and Population_Manager::SimWH.

Referenced by GetPegPull().

◆ GetPegPull()

int THare::GetPegPull ( )
inlineprotected

Get attractive force of peg.

Returns the squared rectangular distance from the peg

Definition at line 451 of file HareForagenPeg.cpp.

452 {
456  int d = GetPegDistance();
457  return d*d;
458 }

References GetPegDistance().

Referenced by Forage(), and ForageP().

◆ GetRefNum()

int THare::GetRefNum ( )
inline

Get the refnum for this hare.

Definition at line 419 of file Hare_all.h.

419 { return m_RefNum; }

References m_RefNum.

Referenced by THare_Population_Manager::MRROutputs().

◆ GetRMR()

double THare::GetRMR ( )

Get todays RMR.

Gets the hare RMR based on age and mass

Definition at line 349 of file Hare_THare.cpp.

349  {
351 }

References THare_Population_Manager::GetRMR(), GetTotalWeight(), m_Age, and m_OurPopulationManager.

Referenced by Hare_Young::BeginStep(), Hare_Juvenile::BeginStep(), Hare_Male::BeginStep(), and Hare_Female::BeginStep().

◆ GetTotalWeight()

double THare::GetTotalWeight ( )
inline

Provide the wet weight of the hare.

Uses a standard multiplier of 3.8 to convert dry to wet weight, then adds the fat (no water here).

Definition at line 370 of file Hare_all.h.

370  {
371  return m_weight*3.8+m_fatReserve;
372  }

References m_fatReserve, and m_weight.

Referenced by EnergyBalance(), GetRMR(), THare_Population_Manager::POMOutputs(), Hare_Infant::st_Developing(), and Hare_Young::st_Foraging().

◆ GetWeight()

double THare::GetWeight ( )
inline

Provide the weight of the hare.

Definition at line 360 of file Hare_all.h.

360  {
361  return m_weight;
362  }

References m_weight.

◆ InternalPesticideHandlingAndResponse()

void THare::InternalPesticideHandlingAndResponse ( )
protectedvirtual

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

This method needs to be re-implemented for any class which has pesticide response behaviour. e.g. see Hare_Female::InternalPesticideHandlingAndResponse

Reimplemented in Hare_Female, and Hare_Male.

Definition at line 551 of file HareForagenPeg.cpp.

552  {
556  m_pesticide_burden *= m_pesticidedegradationrate; // Does nothing by default except internal degredation of the pesticide
557  }

References m_pesticide_burden, and m_pesticidedegradationrate.

Referenced by Hare_Young::EndStep(), and Hare_Juvenile::EndStep().

◆ loadVegPalatability()

void THare::loadVegPalatability ( void  )

Loads static member m_vegPalatability with data.

Definition at line 116 of file Hare_THare.cpp.

117 {
118  m_vegPalatability = new double[ tov_Undefined ];
119  // First fill in default value
120  for (int i = 0; i < tov_Undefined; i++) m_vegPalatability[ i ] = 1.0;
121  // Now set any special values
126  m_vegPalatability[ tov_None ] = 0.0;
130  /*
131  m_vegPalatability[tov_FodderBeet] = 1.25;
132  m_vegPalatability[tov_SugarBeet] = 1.25;
133  m_vegPalatability[tov_OFodderBeet] = 1.25;
134  */
135 }

References m_vegPalatability, tov_Carrots, tov_NoGrowth, tov_None, tov_OCarrots, tov_OPotatoes, tov_PlantNursery, tov_Potatoes, tov_PotatoesIndustry, and tov_Undefined.

Referenced by THare_Population_Manager::Init().

◆ MovePeg()

void THare::MovePeg ( )
protected

Move the peg according to attraction forces.

Daily movement is limited by a peg which does not really want to move, but can be dragged slowly. This requires a set of rapid functions because they will be used a lot. NB dispersal takes no account of the peg.
Moves the peg towards the location, the speed of movement is dependent upon an inertia parameter.
Once again we have the problem of wrap around.

Definition at line 527 of file HareForagenPeg.cpp.

528 {
534  //
535  // Find the distance between the peg & x,y and add a fixed proportion to move peg
536  int d1=(m_Location_x-m_peg_x);
537  if (abs(d1)< (int) m_OurPopulationManager->SimWH) m_peg_x += int(d1*g_hare_peg_inertia); // Global used for speed
538  else {
539  if (d1<0) d1+=m_OurPopulationManager->SimWH; else d1-=m_OurPopulationManager->SimWH;
540  m_peg_x += int(d1*g_hare_peg_inertia);
541  }
542  d1=(m_Location_y-m_peg_y);
543  if (abs(d1)< (int) m_OurPopulationManager->SimHH) m_peg_y += int(d1*g_hare_peg_inertia);
544  else {
545  if (d1<0) d1+=m_OurPopulationManager->SimHH; else d1-=m_OurPopulationManager->SimHH;
546  m_peg_y += int(d1*g_hare_peg_inertia);
547  }
548  }

References g_hare_peg_inertia, TAnimal::m_Location_x, TAnimal::m_Location_y, m_OurPopulationManager, m_peg_x, m_peg_y, Population_Manager::SimHH, and Population_Manager::SimWH.

Referenced by EndStep(), Hare_Infant::EndStep(), Hare_Young::EndStep(), Hare_Juvenile::EndStep(), Hare_Male::EndStep(), and Hare_Female::EndStep().

◆ ON_Dead()

virtual void THare::ON_Dead ( void  )
inlinevirtual

Mortality - overridden in descendent classes.

Reimplemented in Hare_Female, Hare_Male, Hare_Juvenile, Hare_Young, and Hare_Infant.

Definition at line 424 of file Hare_all.h.

424  {
425  ;
426  }

Referenced by THare_Population_Manager::HuntingDifferentiatedBeetleBankArea().

◆ ON_MumDead()

void THare::ON_MumDead ( Hare_Female a_Mum)
inline

Inform Mum that we are dead.

Really a Hare_Infant method. Implemented here because it is needed only for debug.

Definition at line 387 of file Hare_all.h.

387  {
388  if (a_Mum != m_MyMum) {
389  m_OurLandscape->Warn("Hare_Infant::On_MumDead - not my mum!!",NULL);
390  exit(1);
391  }
392  // I am now an orphan
393  m_MyMum=NULL;
394  }

References m_MyMum, TAnimal::m_OurLandscape, and Landscape::Warn().

◆ OnFarmEvent()

bool THare::OnFarmEvent ( FarmToDo  event)
protectedvirtual

Do we require a response to a farm event.

Checks to see if any nasty farm event has caused any behaviour. Few do directly, most work by changes in vegetation or forage, but if they do they can be added here

Reimplemented from TAnimal.

Reimplemented in Hare_Young, and Hare_Infant.

Definition at line 372 of file Hare_THare.cpp.

377 {
378  switch (event)
379  {
380  case cattle_out:
381  case pigs_out:
382  // In these cases we want to move.
383  Running(cfg_hare_escape_dist.value());
384  return true; // This will ensure that the next event checked is sensible.
385  default:
386  break;
387  }
388  return false;
389 }

References cattle_out, cfg_hare_escape_dist, pigs_out, and Running().

◆ Run()

bool THare::Run ( int  a_dist,
int  a_direction 
)
protected

Run a distance in a direction.

Definition at line 193 of file Hare_THare.cpp.

194 {
195  // Need to move a_dist in direction a_direction
196  int Width=m_OurPopulationManager->SimW;
197  int Height=m_OurPopulationManager->SimH;
198  int tx=m_Location_x;
199  int ty=m_Location_y;
200  switch(a_direction)
201  {
202  case 0: // North
203  ty=m_Location_y-a_dist;
204  if (ty<0) ty+=Height;
205  break;
206  case 1: // NorthWest
207  // OK, OK I know, I should reduce the distance for the diagonal - but it
208  // costs two multiplications if I do, and this is used a lot
209  ty=m_Location_y-a_dist;
210  tx=m_Location_x+a_dist;
211  if (ty<0) ty+=Height;
212  if (tx>=Width) tx-=Width;
213  break;
214  case 2: // West
215  tx=m_Location_x+a_dist;
216  if (tx>=Width) tx-=Width;
217  break;
218  case 3: // SouthWest
219  ty=m_Location_y+a_dist;
220  tx=m_Location_x+a_dist;
221  if (tx>=Width) tx-=Width;
222  if (ty>=Height) ty-=Height;
223  break;
224  case 4: // South
225  ty=m_Location_y+a_dist;
226  if (ty>=Height) ty-=Height;
227  break;
228  case 5: // SouthEast
229  ty=m_Location_y+a_dist;
230  tx=m_Location_x-a_dist;
231  if (tx<0) tx+=Width;
232  if (ty>=Height) ty-=Height;
233  break;
234  case 6: // East
235  tx=m_Location_x-a_dist;
236  if (tx<0) tx+=Width;
237  break;
238  case 7: // NorthEast
239  ty=m_Location_y-a_dist;
240  tx=m_Location_x-a_dist;
241  if (tx<0) tx+=Width;
242  if (ty<0) ty+=Height;
243  break;
244  default: // No direction
245  break;
246 
247  }
248  // Now just before we do anything, check that we can go to tx,ty
250  switch (habitat) {
251  // Impossible stuff
252  case tole_Building:
253  case tole_Pond:
254  case tole_Freshwater:
255  case tole_River:
256  case tole_Saltwater:
257  case tole_Coast:
258  case tole_BareRock:
259  case tole_UrbanNoVeg:
260  case tole_UrbanPark:
261  case tole_SandDune:
262  case tole_Stream:
263  return false;
264  break;
265  default:
266  m_Location_x=tx;
267  m_Location_y=ty;
268  return true;
269  break;
270  }
271  // I know I can save code by only testing for boundary conditions
272  // at the end, but 50% of the time this will involve an unnecessary test and
273  // speed usually being the problem I think it is better this way
274 }

References TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, m_OurPopulationManager, Population_Manager::SimH, Population_Manager::SimW, Landscape::SupplyElementType(), tole_BareRock, tole_Building, tole_Coast, tole_Freshwater, tole_Pond, tole_River, tole_Saltwater, tole_SandDune, tole_Stream, tole_UrbanNoVeg, and tole_UrbanPark.

Referenced by Running(), and Walking().

◆ Running()

void THare::Running ( int  a_max_dist)
protectedvirtual

Run.

Moves the hare and alters the energy and time budget to simulate running /n All proximity alerts or other causes of running for all hares are sent via this code - the code then calls a movement code and energetic code. However these are may not the same for all hare types, so if there is a specific routine for a type, that is called, if not the default is used - there is no need to worry about this as the calling program.

Definition at line 152 of file Hare_THare.cpp.

153 {
154  int dist;
155  bool b;
156  // The length of this loop can cause problems, hence in very small landscapes max_dist has to be small. A minimum distance was not used because this invites infinite looping.
157  do {
158  // Choose a distance......
159  dist=random(a_max_dist);
160  // and see if it is possible to go there in a random direction
161  b=Run(dist, random(8));
162  } while (b==false);
163  // Now adjust our energy balance
167 }

References activity_Recovery, activity_Running, cfg_Hare_Recovery_Time, EnergyBalance(), Run(), and TimeBudget().

Referenced by Hare_Young::BeginStep(), Hare_Juvenile::BeginStep(), Hare_Male::BeginStep(), Hare_Female::BeginStep(), and OnFarmEvent().

◆ SetMum()

void THare::SetMum ( Hare_Female )
inline

Set the mother pointer. Reimplemented in Hare_Infant.

Definition at line 399 of file Hare_all.h.

399 { ; }

Referenced by THare_Population_Manager::CreateObjects().

◆ st_Dispersal()

TTypeOfHareState THare::st_Dispersal ( )
virtual

Base implementation only - reimplemented.

This function is really a dummy - but it needs to be here.
The return values is meaningless, but stops the compiler complaining

Reimplemented in Hare_Female, Hare_Juvenile, and Hare_Young.

Definition at line 138 of file Hare_THare.cpp.

139 {
144  return tohs_InitialState;
145 }

References tohs_InitialState.

◆ st_Dying()

void THare::st_Dying ( )
protected

Tidy up before removing the object on death.

Do the housekeeping necessary to die

Definition at line 172 of file Hare_THare.cpp.

172  {
173  if (m_MyMum) m_MyMum->ON_YoungKilled(this);
175  m_CurrentStateNo=-1;
176  m_MyMum=NULL;
177  m_StepDone=true;
178 }

References m_CurrentHState, TALMaSSObject::m_CurrentStateNo, m_MyMum, TALMaSSObject::m_StepDone, Hare_Female::ON_YoungKilled(), and tohs_DestroyObject.

Referenced by Hare_Infant::ON_Dead(), and Hare_Young::ON_Dead().

◆ Step()

virtual void THare::Step ( void  )
inlinevirtual

Base implementation only - reimplemented.

Reimplemented from TAnimal.

Reimplemented in Hare_Female, Hare_Male, Hare_Juvenile, Hare_Young, and Hare_Infant.

Definition at line 349 of file Hare_all.h.

349 {}

◆ THareInit()

void THare::THareInit ( int  p_x,
int  p_y,
THare_Population_Manager p_PPM 
)

Object Initiation.

Definition at line 72 of file Hare_THare.cpp.

73 {
74  // The THare constructor - only needs to know about the Hare Population
75  // Manager
78  // Set the lifespan
79  m_Lifespan=cfg_hare_max_age.value()+(random(cfg_hare_max_age_var.value()*2)-cfg_hare_max_age_var.value());
80  // Energetic values - these can be overwritten by the constructor of
81  // descendent classes
82  m_KJRunning=0;
83  m_KJWalking=0;
84  m_KJForaging=0;
87  m_fatReserve=0;
90  //m_in_dispersal = false;
91  //m_TimePerForageSquare= 13 * 13; // 24 squares
92  m_ActivityTime=1440; // In the case of object creation, this cannot be set in the begin step
93  m_foragingenergy=0.001; // a bit more than 0
94  m_peg_x=p_x;
95  m_peg_y=p_y;
98  for (int i=0; i<365; i++) m_expDensity[i]=0;
99  m_DensitySum=0;
100  m_ddindex=0;
101  m_RefNum=p_PPM->GetHareRefNum();
102  m_pesticideInfluenced1 = false;
103  m_pesticide_burden = 0.0;
104  m_pesticidedegradationrate = cfg_hare_pesticidedegradationrate.value(); // default of 0.0 will remove all body burden pesticide at the end of each day
105 }

References cfg_hare_max_age, cfg_hare_max_age_var, cfg_hare_pesticidedegradationrate(), cfg_Hare_StdSpeedRunning, cfg_Hare_StdSpeedWalking, THare_Population_Manager::GetHareRefNum(), m_ActivityTime, m_CurrentHState, m_ddindex, m_DensitySum, m_expDensity, m_experiencedDensity, m_fatReserve, m_foragingenergy, m_KJForaging, m_KJRunning, m_KJWalking, m_lastYearsDensity, m_Lifespan, m_OurPopulationManager, m_peg_x, m_peg_y, m_pesticide_burden, m_pesticidedegradationrate, m_pesticideInfluenced1, m_RefNum, m_SpeedRunning, m_SpeedWalking, m_StarvationDays, m_TodaysEnergy, and tohs_InitialState.

Referenced by Hare_Infant::ReInit(), Hare_Young::ReInit(), Hare_Juvenile::ReInit(), Hare_Male::ReInit(), Hare_Female::ReInit(), and THare().

◆ TimeBudget()

void THare::TimeBudget ( TTypeOfActivity  a_activity,
int  dist 
)
protected

Adjust time budger for an activity.

This method calculates time used for each activity and subtracts this from the day

Definition at line 314 of file Hare_THare.cpp.

315 {
319  switch (a_activity)
320  {
321  case activity_Resting:
322  m_ActivityTime-=dist; // dist is in time here (minutes)
323  break;
324  case activity_Running:
325  m_ActivityTime-=(int)(dist/m_SpeedRunning); // dist in metres
326  break;
327  case activity_Walking:
328  m_ActivityTime-=(int)(dist/m_SpeedWalking); // dist in metres
329  break;
330  case activity_Foraging:
331  m_ActivityTime-=dist; // dist in minutes
332  break;
333  case activity_Dispersal:
334  m_ActivityTime -= (int)(dist / m_SpeedWalking); // dist in metres
335  break;
336  case activity_Recovery:
337  m_ActivityTime-=dist; // dist in minutes
338  break;
339  default:
340  m_OurLandscape->Warn("THare::TimeBudget - unknown activity",NULL);
341  exit(1);
342  }
343 }

References activity_Dispersal, activity_Foraging, activity_Recovery, activity_Resting, activity_Running, activity_Walking, m_ActivityTime, TAnimal::m_OurLandscape, m_SpeedRunning, m_SpeedWalking, and Landscape::Warn().

Referenced by Running(), Hare_Juvenile::st_Dispersal(), Hare_Young::st_Foraging(), Hare_Juvenile::st_Foraging(), Hare_Male::st_Foraging(), Hare_Female::st_Foraging(), Hare_Young::st_Resting(), and Hare_Juvenile::st_Resting().

◆ Walking()

void THare::Walking ( int  a_dist,
int  a_direction 
)
protected

Walking.

Moves the hare and alters the energy budget to simulate walking.

Definition at line 183 of file Hare_THare.cpp.

184 {
185  while (!Run(a_dist, a_direction)) {
186  a_direction=random(8);
187  //a_dist=random(500); // This is just for cases like Illumø where it is possible to travel too far in all directions
188  a_dist--; // This is because hares can get stuck otherwise.
189  }
190 }

References Run().

Referenced by Forage(), ForageP(), and Hare_Juvenile::st_Dispersal().

◆ WasPredated()

bool THare::WasPredated ( )
virtual

Test for predation.

A mortality test. Also include optional code for size and low fat reserve increased mortality - tested under the POM

Reimplemented in Hare_Juvenile.

Definition at line 357 of file Hare_THare.cpp.

357  {
358  // This is only called by adult states, so don't call it from any other hare class
359 #ifdef __SIZERELATEDDEATH2
360  if (m_weight<cfg_hare_minimum_breeding_weight.value()) test*=2;
361 #endif
362 #ifdef __LOWFATRELATEDDEATH
363  if (m_Age>365) if (m_fatReserve<1.0) {
364  test= (int)(cfg_hare_lowfatextramort.value() * test); // Increase the chance of dying if fat reserves drop to low levels
365  }
366 #endif
368  return false;
369 }

References cfg_hare_lowfatextramort(), cfg_hare_minimum_breeding_weight, g_rand_uni, THare_Population_Manager::m_AdultMortRate, m_Age, m_fatReserve, m_OurPopulationManager, and m_weight.

Member Data Documentation

◆ m_ActivityTime

◆ m_Age

◆ m_CurrentHState

◆ m_ddindex

int THare::m_ddindex
protected

State variable used in alternative density-dependent configurations.

Definition at line 281 of file Hare_all.h.

Referenced by Hare_Juvenile::BeginStep(), Hare_Male::BeginStep(), Hare_Female::BeginStep(), and THareInit().

◆ m_DensitySum

int THare::m_DensitySum
protected

State variable used in alternative density-dependent configurations.

Definition at line 291 of file Hare_all.h.

Referenced by Hare_Juvenile::BeginStep(), Hare_Male::BeginStep(), Hare_Female::BeginStep(), and THareInit().

◆ m_EnergyMax

double THare::m_EnergyMax
protected

State variable - the amount of energy it is possible to eat as a multiplyer or RMR.

Definition at line 223 of file Hare_all.h.

Referenced by Hare_Young::BeginStep(), Hare_Juvenile::BeginStep(), Hare_Male::BeginStep(), Hare_Female::BeginStep(), Forage(), and ForageP().

◆ m_expDensity

int THare::m_expDensity[365]
protected

State variable used in alternative density-dependent configurations.

Definition at line 286 of file Hare_all.h.

Referenced by Hare_Juvenile::BeginStep(), Hare_Male::BeginStep(), Hare_Female::BeginStep(), and THareInit().

◆ m_experiencedDensity

int THare::m_experiencedDensity
protected

State variable used in alternative density-dependent configurations.

Definition at line 271 of file Hare_all.h.

Referenced by Hare_Male::BeginStep(), Hare_Female::BeginStep(), and THareInit().

◆ m_fatReserve

◆ m_foragingenergy

double THare::m_foragingenergy
protected

Energy obtained from foraging/feeding.

Definition at line 252 of file Hare_all.h.

Referenced by Hare_Male::BeginStep(), Hare_Female::BeginStep(), Hare_Female::dumpEnergy(), EnergyBalance(), and THareInit().

◆ m_IamSick

bool THare::m_IamSick
protected

flag for sickness - used in conjunction with disease configurations

Definition at line 295 of file Hare_all.h.

Referenced by Hare_Male::BeginStep(), Hare_Female::BeginStep(), Hare_Female::Init(), and Hare_Female::UpdateOestrous().

◆ m_KJForaging

double THare::m_KJForaging
protected

◆ m_KJRunning

double THare::m_KJRunning
protected

◆ m_KJWalking

double THare::m_KJWalking
protected

◆ m_lastYearsDensity

int THare::m_lastYearsDensity
protected

State variable used in alternative density-dependent configurations.

Definition at line 276 of file Hare_all.h.

Referenced by Hare_Juvenile::BeginStep(), Hare_Male::BeginStep(), Hare_Female::BeginStep(), Hare_Male::st_Foraging(), Hare_Female::st_Foraging(), and THareInit().

◆ m_Lifespan

int THare::m_Lifespan
protected

Physiolocal lifespan, assuming nothing else kills the hare (unlikely to reach this age)

Definition at line 198 of file Hare_all.h.

Referenced by Hare_Male::BeginStep(), Hare_Female::BeginStep(), and THareInit().

◆ m_MyMum

Hare_Female* THare::m_MyMum
protected

◆ m_old_weight

double THare::m_old_weight
protected

◆ m_OurPopulationManager

◆ m_peg_x

int THare::m_peg_x
protected

peg x-coordinate

Definition at line 256 of file Hare_all.h.

Referenced by GetPegDirection(), GetPegDistance(), MovePeg(), Hare_Female::st_Dispersal(), and THareInit().

◆ m_peg_y

int THare::m_peg_y
protected

peg y-coordinate

Definition at line 260 of file Hare_all.h.

Referenced by GetPegDirection(), GetPegDistance(), MovePeg(), Hare_Female::st_Dispersal(), and THareInit().

◆ m_pesticide_burden

double THare::m_pesticide_burden
protected

State variable used to hold the current body-burden of pesticide.

Definition at line 301 of file Hare_all.h.

Referenced by ForageP(), InternalPesticideHandlingAndResponse(), Hare_Male::InternalPesticideHandlingAndResponse(), Hare_Female::InternalPesticideHandlingAndResponse(), and THareInit().

◆ m_pesticidedegradationrate

double THare::m_pesticidedegradationrate
protected

State variable used to hold the daily degredation rate of the pesticide in the body.

Definition at line 306 of file Hare_all.h.

Referenced by InternalPesticideHandlingAndResponse(), Hare_Male::InternalPesticideHandlingAndResponse(), Hare_Female::InternalPesticideHandlingAndResponse(), and THareInit().

◆ m_pesticideInfluenced1

bool THare::m_pesticideInfluenced1
protected

Flag to indicate pesticide effects (e.g. can be used for endocrine distruptors with delayed effects until birth).

Definition at line 311 of file Hare_all.h.

Referenced by Hare_Female::GeneralEndocrineDisruptor(), Hare_Female::GiveBirth(), and THareInit().

◆ m_RefNum

int THare::m_RefNum
protected

Unique hare reference number, also functions as sex flag.

Definition at line 265 of file Hare_all.h.

Referenced by GetRefNum(), Hare_Male::Init(), Hare_Female::Init(), Hare_Juvenile::st_NextStage(), and THareInit().

◆ m_SpeedRunning

double THare::m_SpeedRunning
protected

m/min speed of running per kg hare

Definition at line 243 of file Hare_all.h.

Referenced by THareInit(), and TimeBudget().

◆ m_SpeedWalking

double THare::m_SpeedWalking
protected

m/min speed of walking per kg hare

Definition at line 248 of file Hare_all.h.

Referenced by THareInit(), and TimeBudget().

◆ m_StarvationDays

int THare::m_StarvationDays
protected

State variable - the number of consecutive days in negative energy balance.

Definition at line 208 of file Hare_all.h.

Referenced by Hare_Infant::st_Developing(), Hare_Young::st_Developing(), Hare_Juvenile::st_Developing(), Hare_Male::st_Developing(), Hare_Female::st_Developing(), and THareInit().

◆ m_TodaysEnergy

◆ m_Type

Hare_Object THare::m_Type
protected

State variale - the type of hare.

Definition at line 175 of file Hare_all.h.

Referenced by Hare_Infant::Init(), Hare_Young::Init(), Hare_Juvenile::Init(), Hare_Male::Init(), Hare_Female::Init(), and Hare_Juvenile::st_Dispersal().

◆ m_vegPalatability

double * THare::m_vegPalatability = NULL
static

Will hold and array of palatability for hare for each tov type. Most are 1, but unpalatable vegetation can be specified here.

Definition at line 318 of file Hare_all.h.

Referenced by ForageSquare(), ForageSquareP(), loadVegPalatability(), Hare_Juvenile::st_Dispersal(), and THare_Population_Manager::~THare_Population_Manager().

◆ m_weight


The documentation for this class was generated from the following files:
tole_UrbanNoVeg
Definition: tole_declaration.h:78
THare_Population_Manager::SetPolyFood
void SetPolyFood(int a_poly, double a_value)
Set polygon food quality.
Definition: Hare_all.h:718
tole_Saltwater
Definition: tole_declaration.h:66
THare::m_vegPalatability
static double * m_vegPalatability
Will hold and array of palatability for hare for each tov type. Most are 1, but unpalatable vegetatio...
Definition: Hare_all.h:318
tole_Building
Definition: tole_declaration.h:62
tole_Freshwater
Definition: tole_declaration.h:64
Landscape::SupplyVegType
TTypesOfVegetation SupplyVegType(int a_x, int a_y)
Definition: Landscape.h:1321
Landscape::SupplyElementType
TTypesOfLandscapeElement SupplyElementType(int a_polyref)
Definition: Landscape.h:1110
activity_Running
Definition: Hare_all.h:91
cfg_hare_pesticide_ingestion_exposure_rate
CfgFloat cfg_hare_pesticide_ingestion_exposure_rate("HARE_PESTICIDE_INGESTION_RATE", CFG_CUSTOM, 0.0)
THare::GetPegDirection
int GetPegDirection()
Get direction of peg.
Definition: HareForagenPeg.cpp:460
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::m_SpeedWalking
double m_SpeedWalking
m/min speed of walking per kg hare
Definition: Hare_all.h:248
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
tov_Undefined
Definition: tov_declaration.h:114
THare::m_Lifespan
int m_Lifespan
Physiolocal lifespan, assuming nothing else kills the hare (unlikely to reach this age)
Definition: Hare_all.h:198
tole_BareRock
Definition: tole_declaration.h:75
Population_Manager::SimWH
unsigned SimWH
Definition: PopulationManager.h:512
THare_Population_Manager::m_AdultMortRate
double m_AdultMortRate
Input variable - Adult mortality rate.
Definition: Hare_all.h:734
TAnimal::m_OurLandscape
Landscape * m_OurLandscape
Definition: PopulationManager.h:229
__SQRS
#define __SQRS
cfg_hare_ExtEff
CfgFloat cfg_hare_ExtEff
THare_Population_Manager::GetHareRefNum
int GetHareRefNum()
Get the next ID number available.
Definition: Hare_all.h:548
activity_Recovery
Definition: Hare_all.h:95
THare::m_ActivityTime
int m_ActivityTime
Minutes of potential activity time per day.
Definition: Hare_all.h:203
Hare_Female::ON_YoungKilled
void ON_YoungKilled(THare *a_young)
A leveret has been killed.
Definition: Hare_all.cpp:3850
Population_Manager::SimHH
unsigned SimHH
Definition: PopulationManager.h:512
THare::ForageSquare
double ForageSquare(int a_x, int a_y)
Forage from an area.
Definition: HareForagenPeg.cpp:322
THare::m_OurPopulationManager
THare_Population_Manager * m_OurPopulationManager
Pointer to the hare population manager.
Definition: Hare_all.h:194
cfg_hare_escape_dist
CfgInt cfg_hare_escape_dist
cfg_hare_max_age_var
CfgInt cfg_hare_max_age_var
THare::m_KJForaging
double m_KJForaging
KJ/m cost of foraging per kg hare.
Definition: Hare_all.h:238
tov_OCarrots
Definition: tov_declaration.h:43
Population_Manager::SimW
int SimW
Definition: PopulationManager.h:511
tole_Stream
Definition: tole_declaration.h:89
THare::THareInit
void THareInit(int p_x, int p_y, THare_Population_Manager *p_PPM)
Object Initiation.
Definition: Hare_THare.cpp:72
THare::GetPegDistance
int GetPegDistance()
Get peg distance.
Definition: HareForagenPeg.cpp:435
TAnimal::TAnimal
TAnimal(int x, int y, Landscape *L)
Definition: PopulationManager.cpp:1367
tohs_DestroyObject
Definition: Hare_all.h:80
__FSQRS
#define __FSQRS
Definition: HareForagenPeg.cpp:48
cattle_out
Definition: treatment.h:83
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
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
tole_Pond
Definition: tole_declaration.h:101
Landscape::SupplySimAreaHeight
int SupplySimAreaHeight(void)
Definition: Landscape.h:1637
tov_PotatoesIndustry
Definition: tov_declaration.h:50
activity_Foraging
Definition: Hare_all.h:92
cfg_hare_lowfatextramort
static CfgFloat cfg_hare_lowfatextramort("HARE_LOWFATEXTRAMORT", CFG_CUSTOM, 10.0)
Landscape::SupplySimAreaWidth
int SupplySimAreaWidth(void)
Definition: Landscape.h:1632
TAnimal::m_Location_y
int m_Location_y
Definition: PopulationManager.h:228
THare::m_RefNum
int m_RefNum
Unique hare reference number, also functions as sex flag.
Definition: Hare_all.h:265
tov_PlantNursery
Definition: tov_declaration.h:66
tov_Carrots
Definition: tov_declaration.h:31
THare::m_pesticideInfluenced1
bool m_pesticideInfluenced1
Flag to indicate pesticide effects (e.g. can be used for endocrine distruptors with delayed effects u...
Definition: Hare_all.h:311
THare::Walking
void Walking(int a_dist, int a_direction)
Walking.
Definition: Hare_THare.cpp:183
activity_Dispersal
Definition: Hare_all.h:94
THare::MovePeg
void MovePeg()
Move the peg according to attraction forces.
Definition: HareForagenPeg.cpp:527
THare_Population_Manager::GetRMR
double GetRMR(int a_age, double a_size)
Returns the RMR given a specific age and mass.
Definition: Hare_all.cpp:1034
tole_UrbanPark
Definition: tole_declaration.h:79
THare::m_SpeedRunning
double m_SpeedRunning
m/min speed of running per kg hare
Definition: Hare_all.h:243
THare::m_ddindex
int m_ddindex
State variable used in alternative density-dependent configurations.
Definition: Hare_all.h:281
tov_Potatoes
Definition: tov_declaration.h:50
g_rand_uni
boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni
THare::m_TodaysEnergy
double m_TodaysEnergy
State variable - the amount of energy available today, can be in deficit.
Definition: Hare_all.h:218
cfg_Hare_Recovery_Time
CfgInt cfg_Hare_Recovery_Time
TALMaSSObject::m_StepDone
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
Definition: PopulationManager.h:118
THare::EnergyBalance
void EnergyBalance(TTypeOfActivity a_activity, int dist)
Adjust energy balance for an activity.
Definition: Hare_THare.cpp:277
THare::m_foragingenergy
double m_foragingenergy
Energy obtained from foraging/feeding.
Definition: Hare_all.h:252
tohs_InitialState
Definition: Hare_all.h:71
tole_SandDune
Definition: tole_declaration.h:81
tole_River
Definition: tole_declaration.h:65
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
ppp_1
Definition: farm.h:422
THare::ForageSquareP
double ForageSquareP(int a_x, int a_y, double *a_pestexposure)
Forage from an area and resturn pesticide exposure as well as food.
Definition: HareForagenPeg.cpp:372
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
Landscape::SupplyPesticideP
double SupplyPesticideP(int a_x, int a_y, PlantProtectionProducts a_ppp)
Gets plant pesticide for a location.
Definition: Landscape.cpp:605
cfg_hare_minimum_breeding_weight
CfgInt cfg_hare_minimum_breeding_weight
THare::m_CurrentHState
TTypeOfHareState m_CurrentHState
Defines the current activity.
Definition: Hare_all.h:165
Population_Manager::SimH
int SimH
Definition: PopulationManager.h:511
THare_Population_Manager::GetPolyFood
double GetPolyFood(int a_poly)
Get stored polygon food quality.
Definition: Hare_all.h:713
cfg_hare_pesticide_contact_exposure_rate
CfgFloat cfg_hare_pesticide_contact_exposure_rate("HARE_PESTICIDE_CONTACT_RATE", CFG_CUSTOM, 0.0)
THare::m_StarvationDays
int m_StarvationDays
State variable - the number of consecutive days in negative energy balance.
Definition: Hare_all.h:208
TTypesOfLandscapeElement
TTypesOfLandscapeElement
Definition: tole_declaration.h:36
cfg_hare_pesticidedegradationrate
static CfgFloat cfg_hare_pesticidedegradationrate("HARE_PESTICIDEDEGRADATIONRATE", CFG_CUSTOM, 0.0)
tov_NoGrowth
Definition: tov_declaration.h:38
tov_OPotatoes
Definition: tov_declaration.h:44
cfg_hare_max_age
CfgInt cfg_hare_max_age
THare::GetTotalWeight
double GetTotalWeight()
Provide the wet weight of the hare.
Definition: Hare_all.h:370
cfg_hare_pegmoveto_chance
CfgInt cfg_hare_pegmoveto_chance("HARE_PEGMOVETOCHANCE", CFG_CUSTOM, 250000)
THare::Running
virtual void Running(int a_max_dist)
Run.
Definition: Hare_THare.cpp:152
THare::GetPegPull
int GetPegPull()
Get attractive force of peg.
Definition: HareForagenPeg.cpp:451
THare::m_MyMum
Hare_Female * m_MyMum
Pointer to the hare's mum.
Definition: Hare_all.h:190
activity_Walking
Definition: Hare_all.h:93
THare::m_peg_y
int m_peg_y
peg y-coordinate
Definition: Hare_all.h:260
cfg_Hare_StdSpeedWalking
CfgFloat cfg_Hare_StdSpeedWalking
THare::m_weight
double m_weight
State variale - hare weight g.
Definition: Hare_all.h:180
THare::Run
bool Run(int a_dist, int a_direction)
Run a distance in a direction.
Definition: Hare_THare.cpp:193
TALMaSSObject::m_CurrentStateNo
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
Definition: PopulationManager.h:116
pigs_out
Definition: treatment.h:84
THare::TimeBudget
void TimeBudget(TTypeOfActivity a_activity, int dist)
Adjust time budger for an activity.
Definition: Hare_THare.cpp:314
Landscape::Warn
void Warn(std::string a_msg1, std::string a_msg2)
Definition: Landscape.h:1579
TAnimal::m_Location_x
int m_Location_x
Definition: PopulationManager.h:225
Landscape::SupplyPolyRef
int SupplyPolyRef(int a_x, int a_y)
Definition: Landscape.h:1488
tole_Coast
Definition: tole_declaration.h:67
cfg_Hare_StdSpeedRunning
CfgFloat cfg_Hare_StdSpeedRunning
THare::m_peg_x
int m_peg_x
peg x-coordinate
Definition: Hare_all.h:256
activity_Resting
Definition: Hare_all.h:90
g_hare_peg_inertia
double g_hare_peg_inertia
Definition: Hare_all.cpp:50
Landscape::GetHareFoodQuality
double GetHareFoodQuality(int a_polygon)
Definition: Landscape.cpp:3403
tov_None
Definition: tov_declaration.h:39