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

Class for juvenile hares (after 5 weeks old, fully mobile) More...

#include <Hare_all.h>

Public Member Functions

virtual void BeginStep (void)
 BeginStep for Hare_Juvenile. More...
 
virtual void EndStep (void)
 BeginStep for Hare_Juvenile. More...
 
 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 Init (double p_weight)
 Object initiation. More...
 
virtual void ON_Dead ()
 
void ReInit (struct_Hare a_data)
 Juvenile object reinitiation. More...
 
virtual void Step (void)
 Step for Hare_Juvenile. More...
 
virtual ~Hare_Juvenile ()
 Destructor for the juvenile hare object. More...
 
- Public Member Functions inherited from THare
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...
 
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...
 
 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 ~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...
 

Protected Member Functions

bool ShouldMature ()
 Test for maturation. More...
 
TTypeOfHareState st_Developing ()
 The development code for Hare_Juvenile. More...
 
TTypeOfHareState st_Dispersal ()
 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...
 
virtual bool WasPredated ()
 Test for mortality. More...
 
- Protected Member Functions inherited from THare
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...
 

Additional Inherited Members

- Static Public Attributes inherited from THare
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 Attributes inherited from THare
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

Class for juvenile hares (after 5 weeks old, fully mobile)

Definition at line 924 of file Hare_all.h.

Constructor & Destructor Documentation

◆ 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 at line 2219 of file Hare_all.cpp.

2221  : THare(p_x,p_y,p_L,p_PPM)
2222 {
2223  Init(p_weight);
2224 }

References Init().

◆ ~Hare_Juvenile()

Hare_Juvenile::~Hare_Juvenile ( )
virtual

Destructor for the juvenile hare object.

Definition at line 2247 of file Hare_all.cpp.

2248 {
2249  //Nothing to do
2250 }

Member Function Documentation

◆ BeginStep()

void Hare_Juvenile::BeginStep ( void  )
virtual

BeginStep for Hare_Juvenile.

Resets the day's activity counter and checks for default mortalities and potentially extra mortalities. Calculates energy usage for movement based on todays weight

Reimplemented from THare.

Reimplemented in Hare_Female, and Hare_Male.

Definition at line 2261 of file Hare_all.cpp.

2262 {
2263  if (m_CurrentStateNo == -1) return;
2264  m_ActivityTime=1440; // Start the day
2265  m_old_weight=m_weight-1; // we are not interested in tiny fluctuations
2269 
2270 #ifdef __DDEPMORT
2272 #ifdef __THRESHOLD_DD
2273  if (dens<m_OurPopulationManager->m_HareThresholdDD) dens=0;
2275 #endif
2276  double inter=m_OurPopulationManager->GetInterference(dens);
2277  if (g_rand_uni() > inter) {
2278  ON_Dead();
2279  m_StepDone=true; // We need to skip the step code, we are dead
2280  return;
2281  }
2282 #endif
2283 
2285  ON_Dead();
2286  m_StepDone=true; // We need to skip the step code, we are dead
2287  return;
2288  }
2289 
2290  if (g_rand_uni()<cfg_hare_proximity_alert.value()) {
2291  Running(cfg_hare_escape_dist.value());
2292  }
2293 #ifdef __DISEASEDDM3
2294  m_ddindex++;
2295  if (m_ddindex==365) {
2296  m_ddindex=0;
2297  }
2301  m_lastYearsDensity= int(m_DensitySum * (1.0/365.0));
2302 #endif
2303  // Set the maximum possible energy intake
2305  CheckManagement();
2306 }

References cfg_hare_escape_dist(), cfg_hare_proximity_alert(), cfg_MaxEnergyIntakeScaler(), TAnimal::CheckManagement(), g_rand_uni, THare_Population_Manager::GetInterference(), THare_Population_Manager::GetKJperM(), THare::GetRMR(), THare_Population_Manager::GetTotalDensity(), THare::m_ActivityTime, TALMaSSObject::m_CurrentStateNo, THare::m_ddindex, THare::m_DensitySum, THare::m_EnergyMax, THare::m_expDensity, THare_Population_Manager::m_HareThresholdDD, THare_Population_Manager::m_JuvMortRate, THare::m_KJForaging, THare::m_KJRunning, THare::m_KJWalking, THare::m_lastYearsDensity, TAnimal::m_Location_x, TAnimal::m_Location_y, THare::m_old_weight, THare::m_OurPopulationManager, TALMaSSObject::m_StepDone, THare::m_weight, ON_Dead(), and THare::Running().

◆ EndStep()

void Hare_Juvenile::EndStep ( void  )
virtual

BeginStep for Hare_Juvenile.

Just moves the homerange centre peg closer to where the hare has been active today

Reimplemented from THare.

Reimplemented in Hare_Female, and Hare_Male.

Definition at line 2379 of file Hare_all.cpp.

2380 {
2381  MovePeg();
2383 }

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

◆ Init()

void Hare_Juvenile::Init ( double  p_weight)

Object initiation.

Definition at line 2236 of file Hare_all.cpp.

2237 {
2238  m_Type = hob_Juvenile;
2239  m_weight = p_weight;
2240  m_Age = 35; // By definition we are 35 days old today
2241 }

References hob_Juvenile, THare::m_Age, THare::m_Type, and THare::m_weight.

Referenced by Hare_Juvenile(), and ReInit().

◆ ON_Dead()

void Hare_Juvenile::ON_Dead ( void  )
virtual

Do the housekeeping necessary for removal of the object - in this case minimal.

Reimplemented from THare.

Reimplemented in Hare_Female, and Hare_Male.

Definition at line 2654 of file Hare_all.cpp.

2655 {
2657  m_CurrentStateNo=-1;
2658  m_StepDone=true;
2659 }

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

Referenced by BeginStep(), THare_Population_Manager::Hunting(), THare_Population_Manager::HuntingGrid(), and Step().

◆ ReInit()

void Hare_Juvenile::ReInit ( struct_Hare  a_data)

Juvenile object reinitiation.

Definition at line 2225 of file Hare_all.cpp.

2226 {
2227  m_Location_x = a_data.x;
2228  m_Location_y = a_data.y;
2229  m_OurLandscape = a_data.L;
2230  m_CurrentStateNo = 0;
2231  THareInit(a_data.x, a_data.y, a_data.HM);
2232  Init(a_data.weight);
2233 }

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

Referenced by THare_Population_Manager::CreateObjects().

◆ ShouldMature()

bool Hare_Juvenile::ShouldMature ( )
protected

Test for maturation.

This method will be used to determine whether the hare becomes sexually active - and therefore needs to become an adult hare.

Definition at line 2630 of file Hare_all.cpp.

2631 {
2636  if (++m_Age<180) return false;
2637  // Do not do it below six months
2638  // If 6mths old and it is before October, then can mature
2639  if (m_OurLandscape->SupplyDayInYear() < 270) return true;
2640  if (m_Age>364) return true;
2641  return true;
2642 }

References THare::m_Age, TAnimal::m_OurLandscape, and Landscape::SupplyDayInYear().

Referenced by st_Developing().

◆ st_Developing()

TTypeOfHareState Hare_Juvenile::st_Developing ( )
protected

The development code for Hare_Juvenile.

Tests for the onset of maturation. Also tests for minimum growth attainment if this is switched on - too low growth results in death.

Assumes that the fatReserve has been added to by st_Foraging from yesterday.
This is the last behaviour state called each day, so we can use this to sort out the energetics.

Definition at line 2522 of file Hare_all.cpp.

2523 {
2524  // Test for the onset of reproductive activity
2525  // This should be done now because otherwise it is possible to skip this test and get too old
2526  if (ShouldMature()) {
2527  return tohs_NextStage;
2528  }
2529 #ifdef __MINGROWTHATTAIN
2530  // Take a check on our growth - if we are below X% of the min repro weight, assume we died
2531  //if (m_weight < (cfg_hare_minimum_breeding_weight.value()*cfg_min_growth_attain.value())) return tohs_Dying;
2532  if (m_weight< m_OurPopulationManager->m_DMWeight[m_Age]) {
2533  return tohs_Dying;
2534  }
2535 #endif
2536 
2543  if (m_TodaysEnergy<Target) Target=m_TodaysEnergy;
2544  double addedtoday=Target*m_OurPopulationManager->GetGrowthEfficiencyP(m_Age);
2545  m_weight+=addedtoday;
2546  m_TodaysEnergy-=Target;
2548  if (m_TodaysEnergy<Target) Target=m_TodaysEnergy;
2550  m_weight+=addedtoday;
2551  m_TodaysEnergy-=Target;
2552  if (m_TodaysEnergy>0) {
2553  // Put what remains back into fat reserve
2554  m_fatReserve+=m_TodaysEnergy*m_OurPopulationManager->GetGrowthEfficiencyF(366); // 366 is the fat conversion efficiency
2555  m_TodaysEnergy=0;
2556  // Cap the fat reserve and store surplus energy for today
2557  if (m_fatReserve>(cfg_AdultMaxFat.value() * m_weight)) {
2559  }
2560  m_StarvationDays=0; // Not starving
2561  return tohs_Foraging;
2562  }
2563  else {
2564  m_fatReserve+=m_TodaysEnergy*m_OurPopulationManager->GetGrowthEfficiencyF(366); // 366 is the fat conversion efficiency
2565  if (m_fatReserve<0) {
2567  m_fatReserve=0.0;
2568  }
2569  else m_TodaysEnergy=0;
2570  // What should the criteria for a starvation day be? Here chosen to be any negative energy balance.
2571  // Have also considered and rejected a proportion of rmr:
2572  //double rmr=m_OurPopulationManager->GetRMR(m_Age, GetTotalWeight());
2573 // if (m_TodaysEnergy<(0.0-(rmr*0.25)))
2574  if (m_TodaysEnergy<0.0)
2575  {
2576 #ifndef __NOJUVSTARVE
2577  // Oh oh, we are starving need to lose body weight and maybe we will die?
2578 #ifdef __ADULT_WT_STARVE_CHANCE
2580  if ((g_rand_uni() * 10000) > (cfg_juv_starve.value()))
2581  {
2582  return tohs_Dying;
2583  }
2584  }
2585 #else
2587  return tohs_Dying;
2588  }
2589 #endif
2590 #endif
2591  }
2592  else {
2593  m_StarvationDays--; // Not starving
2595  m_TodaysEnergy=0;
2596  }
2597  }
2598  return tohs_Foraging;
2599 
2600 }

References cfg_AdultMaxFat(), cfg_juv_starve(), cfg_juvenile_starvation_threshold(), g_rand_uni, 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, ShouldMature(), tohs_Dying, tohs_Foraging, and tohs_NextStage.

Referenced by Step().

◆ st_Dispersal()

TTypeOfHareState Hare_Juvenile::st_Dispersal ( )
protectedvirtual

Juvenile Dispersal.

Makes a test of habitat quality (basically food) in 8 directions, then moves to the best one. This is basically a teleport move, so testing for barriers is not done. This will need to be added if it becomes a problem (e.g. hares appearing on islands they could not otherwise get too), however, this will also confer an extreme performance penalty!

Reimplemented from THare.

Reimplemented in Hare_Female.

Definition at line 2449 of file Hare_all.cpp.

2450 {
2451 #ifdef __DISPMORTALITY
2452  if (WasPredated()) return tohs_Dying;
2453 #endif
2454  // Now to make this a little more clever we need to test all 8 directions
2455  int ttx, tty;
2456  int tx=m_Location_x;
2457  int ty=m_Location_y;
2458  ttx=tx;
2459  tty=ty;
2460  double fv=0.0;
2461  double oldfv = -99999999.0;
2462  int dstart=random(8);
2463  int d2=0;
2464  for (int j=0; j<100; j++) {
2465  int dist=100+random(cfg_hare_max_dispersal.value());
2466  for (int d=dstart; d<8+dstart; d++) {
2467  // We need to avoid a bias movement now too
2468  int d1=d & 7; // 0-7
2469  Walking(dist, d1); // This modifies m_Location_x, m_Location_y
2470  // How much food here?
2473  if (oldfv<=fv) {
2474  oldfv=fv;
2475  ttx=m_Location_x;
2476  tty=m_Location_y;
2477  d2=dist;
2478  // The best we can ever get is 0.8 so we can speed things up by dropping out if we are close to this.
2479  if (fv>=0.75) {
2480  j=101;
2481  break;
2482  }
2483  }
2484  // Set the xy back before trying the next direction
2485  m_Location_x=tx;
2486  m_Location_y=ty;
2487  }
2488  }
2489  // Now do it for real
2490  // We need to update the density maps temporarily to stop all the animals responding to old data until the beginning of the next timestep
2492  m_Location_x = ttx;
2493  m_Location_y = tty;
2495  d2 *= 5; // Lets assume it is not a beeline, and 5x distance is needed to find the place.
2498  // Move the peg with us.
2499  //m_peg_x = m_Location_x; /** Testing whether the peg will be dragged anyway if we don't set this 31/7/2014 */
2500  //m_peg_y = m_Location_y;
2501  return tohs_Foraging;
2502 }

References activity_Dispersal, THare_Population_Manager::AddHareDensity(), cfg_hare_max_dispersal(), THare::EnergyBalance(), THare_Population_Manager::GetAdultDensity(), Landscape::GetHareFoodQuality(), THare_Population_Manager::GetInterference(), TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, THare::m_OurPopulationManager, THare::m_Type, THare::m_vegPalatability, THare_Population_Manager::SubtractHareDensity(), Landscape::SupplyPolyRef(), Landscape::SupplyVegType(), THare::TimeBudget(), tohs_Dying, tohs_Foraging, THare::Walking(), and WasPredated().

Referenced by Hare_Female::st_Dispersal(), Step(), and Hare_Male::Step().

◆ st_Foraging()

TTypeOfHareState Hare_Juvenile::st_Foraging ( )
protected

Juvenile foraging.

Given the time we have then we need to feed, which will return an energy value obtained.

Definition at line 2385 of file Hare_all.cpp.

2386 {
2390  double atime= m_ActivityTime*cfg_ForageRestingRatio.value();
2391  // We need to rest if there is no more time
2392  if (atime < 30) return tohs_Resting;
2393  // This version uses adult density for interference, other densities seem not to work so well
2394  //int hares=(m_OurPopulationManager->GetAdultDensity(m_Location_x, m_Location_y));
2395  //int hares=(m_OurPopulationManager->GetTotalDensity(m_Location_x, m_Location_y));
2396  int hares = 1;
2397 #ifdef __THRESHOLD_AD_DD
2398  if (hares<m_OurPopulationManager->m_HareThresholdDD) {
2399  hares=0;
2400  } else {
2402  }
2403 #endif
2404 #ifdef __THRESHOLD_DDJ
2405 // this section has been altered so many times it was not worth making it general - if it is used in release versions this can be implemented when we know how it should look - right now remember to change in code before compile-
2406  if (hares<6) hares=0;
2407  else hares*=hares;
2408 #endif
2409 
2410 #ifdef __SCALINGYOUNGDDM
2411  hares = (int) floor (0.5+(double)hares*cfg_JuvDDScale.value());
2412 #endif
2413 
2414  //interfer is between 1.0 and 0
2415  //double slope = 1.0+(cfg_AgeRelatedInterferenceScaling.value() * (1.0-(double(m_Age/365.0))));
2416  //double hs=hares*slope;
2417 #ifndef __DDEPMORT
2418  double inter = m_OurPopulationManager->GetInterference((int)(hares));
2419 #else
2420  double inter=1.0;
2421 #endif
2422  if ((inter<0.5) && (atime > 300)){
2423  if (g_rand_uni() > inter) // added to reduce rate of dispersal
2424  {
2425  //m_ActivityTime = (int)(atime / cfg_ForageRestingRatio.value());
2426  return tohs_Dispersal; // Added Sat 15th Dec 2007
2427  }
2428  }
2429  atime*= inter;
2430  int a_time = (int) atime;
2431  if (cfg_hare_pesticideresponse_on.value())
2432  {
2433  m_TodaysEnergy = ForageP(a_time);
2434  }
2435  else
2436  {
2437  m_TodaysEnergy = Forage(a_time);
2438  }
2439  // We need to spend energy on foraging and associated movement
2440  //
2441  TimeBudget(activity_Foraging, (int)atime-a_time);
2442  return tohs_Resting;
2443 }

References activity_Foraging, cfg_ForageRestingRatio(), cfg_hare_pesticideresponse_on(), cfg_JuvDDScale(), THare::Forage(), THare::ForageP(), g_rand_uni, THare_Population_Manager::GetInterference(), THare::m_ActivityTime, THare_Population_Manager::m_HareThresholdDD, THare::m_OurPopulationManager, THare::m_TodaysEnergy, THare::TimeBudget(), tohs_Dispersal, and tohs_Resting.

Referenced by Step().

◆ st_NextStage()

void Hare_Juvenile::st_NextStage ( )
protected

Maturation to Hare_Male or Hare_Female.

This creates a Hare_Juvenile object via a call to create objects, then sets the flag for destruction of this object.

Definition at line 2607 of file Hare_all.cpp.

2608 {
2609  struct_Hare* sp;
2610  sp = new struct_Hare;
2611  sp->HM = m_OurPopulationManager;
2612  sp->L = m_OurLandscape;
2613  sp->x = m_Location_x;
2614  sp->y = m_Location_y;
2615  sp->weight = m_weight;
2616  sp->Mum = NULL;
2617  sp->age = m_Age;
2618  sp->RefNum = m_RefNum;
2619  // Sex ratio is set to be 50:50 at birth
2620  if ((m_RefNum & 0x01) == 0) // Male
2621  m_OurPopulationManager->CreateObjects(3,this,NULL,sp,1);
2622  else m_OurPopulationManager->CreateObjects(4,this,NULL,sp,1);
2623  // Clean-up
2624  m_CurrentStateNo=-1; // Destroys the object at the next opportunity
2626  delete sp;
2627 }

References struct_Hare::age, THare_Population_Manager::CreateObjects(), struct_Hare::HM, struct_Hare::L, THare::m_Age, THare::m_CurrentHState, TALMaSSObject::m_CurrentStateNo, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, THare::m_OurPopulationManager, THare::m_RefNum, THare::m_weight, struct_Hare::Mum, struct_Hare::RefNum, tohs_DestroyObject, struct_Hare::weight, struct_Hare::x, and struct_Hare::y.

Referenced by Step().

◆ st_Resting()

TTypeOfHareState Hare_Juvenile::st_Resting ( )
protected

Juvenile Resting.

The hare spends some time resting (using time and a little energy)

Definition at line 2507 of file Hare_all.cpp.

2508 {
2509  EnergyBalance(activity_Resting, 0); // Just removes a days BMR
2511  return tohs_Developing;
2512 }

References activity_Resting, THare::EnergyBalance(), THare::m_ActivityTime, THare::TimeBudget(), and tohs_Developing.

Referenced by Step().

◆ Step()

void Hare_Juvenile::Step ( void  )
virtual

Step for Hare_Juvenile.

As with all other ALMaSS animal objects, Step is where the primary state/transtion work is done

Reimplemented from THare.

Reimplemented in Hare_Female, and Hare_Male.

Definition at line 2316 of file Hare_all.cpp.

2317 {
2318  if (m_StepDone || m_CurrentStateNo == -1) return;
2319  switch (m_CurrentHState)
2320  {
2321  case tohs_InitialState: // Initial state
2323  break;
2324  case tohs_Dispersal:
2325  // Dispersal is risky therefore take a test again
2326  // Legal returns are:
2327  // tohs_Foraging
2328 #ifdef __DISPERSALDDM
2329  if (g_rand_uni()<(cfg_hare_juvenile_predation.value())) {
2330  ON_Dead();
2331  m_StepDone=true; // We need to skip the step code, we are dead
2332  return;
2333  }
2334 #endif
2336  break;
2337  case tohs_Foraging:
2338  // Legal returns are:
2339  // tohs_JResting
2341  break;
2342  case tohs_Resting:
2343  // Legal returns are:
2344  // tohs_Developing
2346  break;
2347  case tohs_Developing:
2348  // Legal returns are:
2349  // tohs_Dispersal
2350  // tohs_NextStage
2351  // tohs_Resting
2354  break;
2355  case tohs_NextStage:
2356  // Legal returns are:
2357  // NONE
2358  st_NextStage();
2359  m_StepDone=true;
2360  break;
2361  case tohs_Dying:
2362  ON_Dead();
2363  m_StepDone=true;
2364  break;
2365  default:
2366  m_OurLandscape->Warn("Hare_Juvenile::Step - unknown state",NULL);
2367  exit(1);
2368  }
2369 }

References cfg_hare_juvenile_predation(), g_rand_uni, THare::m_CurrentHState, TALMaSSObject::m_CurrentStateNo, TAnimal::m_OurLandscape, TALMaSSObject::m_StepDone, ON_Dead(), st_Developing(), st_Dispersal(), st_Foraging(), st_NextStage(), st_Resting(), tohs_Developing, tohs_Dispersal, tohs_Dying, tohs_Foraging, tohs_InitialState, tohs_NextStage, tohs_Resting, and Landscape::Warn().

◆ WasPredated()

bool Hare_Juvenile::WasPredated ( )
protectedvirtual

Test for mortality.

Reimplemented from THare.

Definition at line 2645 of file Hare_all.cpp.

2645  {
2646  if (g_rand_uni()<m_OurPopulationManager->m_JuvMortRate) return true;
2647  return false;
2648 }

References g_rand_uni, THare_Population_Manager::m_JuvMortRate, and THare::m_OurPopulationManager.

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


The documentation for this class was generated from the following files:
struct_Hare::x
int x
Definition: Hare_all.h:137
THare_Population_Manager::CreateObjects
void CreateObjects(int ob_type, TAnimal *pvo, void *null, struct_Hare *data, int number)
Method used to create new hares.
Definition: Hare_all.cpp:928
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
tohs_NextStage
Definition: Hare_all.h:72
Landscape::SupplyVegType
TTypesOfVegetation SupplyVegType(int a_x, int a_y)
Definition: Landscape.h:1321
struct_Hare::y
int y
Definition: Hare_all.h:138
cfg_hare_escape_dist
CfgInt cfg_hare_escape_dist("HARE_ESCAPE_DIST", CFG_CUSTOM, 100)
cfg_hare_max_dispersal
static CfgInt cfg_hare_max_dispersal("HARE_MAX_DISPERSAL", CFG_CUSTOM, 1000)
tohs_Foraging
Definition: Hare_all.h:75
tohs_Resting
Definition: Hare_all.h:76
tohs_Developing
Definition: Hare_all.h:73
THare_Population_Manager::GetKJperM
double GetKJperM(int a_size)
Get the cost of moving 1m in KJ dependent upon mass (.
Definition: Hare_all.h:626
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
struct_Hare::age
int age
Definition: Hare_all.h:139
cfg_hare_proximity_alert
static CfgFloat cfg_hare_proximity_alert("HARE_PROXIMITY_ALERT", CFG_CUSTOM, 0.05)
Hare_Juvenile::WasPredated
virtual bool WasPredated()
Test for mortality.
Definition: Hare_all.cpp:2645
Hare_Juvenile::Init
void Init(double p_weight)
Object initiation.
Definition: Hare_all.cpp:2236
TAnimal::m_OurLandscape
Landscape * m_OurLandscape
Definition: PopulationManager.h:229
cfg_JuvDDScale
CfgFloat cfg_JuvDDScale("HARE_JUVSCALEDD", CFG_CUSTOM, 0.5)
THare::InternalPesticideHandlingAndResponse
virtual void InternalPesticideHandlingAndResponse()
Handles internal effects of pesticide exposure. If any effects are needed this method must be re-impl...
Definition: HareForagenPeg.cpp:551
THare::m_ActivityTime
int m_ActivityTime
Minutes of potential activity time per day.
Definition: Hare_all.h:203
Hare_Juvenile::ON_Dead
virtual void ON_Dead()
Definition: Hare_all.cpp:2654
THare_Population_Manager::AddHareDensity
void AddHareDensity(int x, int y, Hare_Object a_type)
Density function - adds one to the density in the square containing by x,y. Each square is 256x256m i...
Definition: Hare_all.h:641
struct_Hare::Mum
Hare_Female * Mum
Definition: Hare_all.h:142
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:141
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:578
THare::m_KJForaging
double m_KJForaging
KJ/m cost of foraging per kg hare.
Definition: Hare_all.h:238
cfg_juvenile_starvation_threshold
static CfgInt cfg_juvenile_starvation_threshold("HARE_JUVENILE_STARVE_THRESHOLD", CFG_CUSTOM, 16)
Hare_Juvenile::ShouldMature
bool ShouldMature()
Test for maturation.
Definition: Hare_all.cpp:2630
THare_Population_Manager::m_HareThresholdDD
int m_HareThresholdDD
Input variable - Threshold density dependence level.
Definition: Hare_all.h:750
THare::GetRMR
double GetRMR()
Get todays RMR.
Definition: Hare_THare.cpp:349
THare::Forage
double Forage(int &time)
Foraging.
Definition: HareForagenPeg.cpp:54
THare::THareInit
void THareInit(int p_x, int p_y, THare_Population_Manager *p_PPM)
Object Initiation.
Definition: Hare_THare.cpp:72
struct_Hare::RefNum
int RefNum
Definition: Hare_all.h:143
tohs_DestroyObject
Definition: Hare_all.h:80
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
Hare_Juvenile::st_NextStage
void st_NextStage()
Maturation to Hare_Male or Hare_Female.
Definition: Hare_all.cpp:2607
THare::m_lastYearsDensity
int m_lastYearsDensity
State variable used in alternative density-dependent configurations.
Definition: Hare_all.h:276
THare::m_KJRunning
double m_KJRunning
KJ/m cost of running per kg hare.
Definition: Hare_all.h:228
activity_Foraging
Definition: Hare_all.h:92
TAnimal::m_Location_y
int m_Location_y
Definition: PopulationManager.h:228
cfg_hare_juvenile_predation
static CfgFloat cfg_hare_juvenile_predation("HARE_JUVENILE_PREDATION", CFG_CUSTOM, 0.0016)
cfg_ForageRestingRatio
CfgFloat cfg_ForageRestingRatio("HARE_FORAGERESTRATIO", CFG_CUSTOM, 0.67)
THare::m_RefNum
int m_RefNum
Unique hare reference number, also functions as sex flag.
Definition: Hare_all.h:265
THare::Walking
void Walking(int a_dist, int a_direction)
Walking.
Definition: Hare_THare.cpp:183
struct_Hare::L
Landscape * L
Definition: Hare_all.h:140
activity_Dispersal
Definition: Hare_all.h:94
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:565
THare::MovePeg
void MovePeg()
Move the peg according to attraction forces.
Definition: HareForagenPeg.cpp:527
Hare_Juvenile::st_Resting
TTypeOfHareState st_Resting()
Juvenile Resting.
Definition: Hare_all.cpp:2507
THare_Population_Manager::GetGrowthEfficiencyF
double GetGrowthEfficiencyF(int a_age)
Get the growth efficiency for this a_age for creating fat.
Definition: Hare_all.h:614
THare::m_old_weight
double m_old_weight
State variale - last hare weight.
Definition: Hare_all.h:185
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)
Definition: Landscape.h:1596
TALMaSSObject::m_StepDone
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
Definition: PopulationManager.h:118
tohs_Dying
Definition: Hare_all.h:79
THare::EnergyBalance
void EnergyBalance(TTypeOfActivity a_activity, int dist)
Adjust energy balance for an activity.
Definition: Hare_THare.cpp:277
tohs_InitialState
Definition: Hare_all.h:71
cfg_MaxEnergyIntakeScaler
static CfgFloat cfg_MaxEnergyIntakeScaler("HARE_MAXENERGYINTAKESCALER", CFG_CUSTOM, 3.0)
hob_Juvenile
Definition: Hare_all.h:59
Hare_Juvenile::st_Dispersal
TTypeOfHareState st_Dispersal()
Juvenile Dispersal.
Definition: Hare_all.cpp:2449
THare_Population_Manager::m_JuvMortRate
double m_JuvMortRate
Input variable - Juvenile mortality rate.
Definition: Hare_all.h:730
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:681
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_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:181
THare::m_CurrentHState
TTypeOfHareState m_CurrentHState
Defines the current activity.
Definition: Hare_all.h:165
struct_Hare
Class used to pass hare information to CreateObjects.
Definition: Hare_all.h:134
THare_Population_Manager::GetInterference
double GetInterference(int h)
Return the proportion of time used in communicating with con-specifics.
Definition: Hare_all.h:700
THare::THare
THare(int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM)
Constructor.
Definition: Hare_THare.cpp:66
THare::m_StarvationDays
int m_StarvationDays
State variable - the number of consecutive days in negative energy balance.
Definition: Hare_all.h:208
TAnimal::CheckManagement
void CheckManagement(void)
Definition: PopulationManager.cpp:1404
THare::Running
virtual void Running(int a_max_dist)
Run.
Definition: Hare_THare.cpp:152
THare::m_weight
double m_weight
State variale - hare weight g.
Definition: Hare_all.h:180
Hare_Juvenile::st_Foraging
TTypeOfHareState st_Foraging()
Juvenile foraging.
Definition: Hare_all.cpp:2385
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_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
g_rand_uni
boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni
tohs_Dispersal
Definition: Hare_all.h:74
TALMaSSObject::m_CurrentStateNo
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
Definition: PopulationManager.h:116
THare_Population_Manager::SubtractHareDensity
void SubtractHareDensity(int x, int y, Hare_Object a_type)
Density function - subtracts one from the density in the square containing by x,y....
Definition: Hare_all.h:646
cfg_AdultMaxFat
static CfgFloat cfg_AdultMaxFat("HARE_ADULT_MAXFAT", CFG_CUSTOM, 0.04/(0.33 *0.88))
struct_Hare::weight
double weight
Definition: Hare_all.h:144
Hare_Juvenile::st_Developing
TTypeOfHareState st_Developing()
The development code for Hare_Juvenile.
Definition: Hare_all.cpp:2522
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
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:676
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
activity_Resting
Definition: Hare_all.h:90
Landscape::GetHareFoodQuality
double GetHareFoodQuality(int a_polygon)
Definition: Landscape.cpp:3403
cfg_juv_starve
CfgInt cfg_juv_starve("HARE_JUV_STARVE", CFG_CUSTOM, 2500)