File failed to load: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/extensions/ams.js
ALMaSS  1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Hare_Infant Class Reference

Class for infant hares (stationary, only milk inputs) More...

#include <Hare_All.h>

Inheritance diagram for Hare_Infant:
THare TAnimal TALMaSSObject Hare_Young

Public Member Functions

void BeginStep (void) override
 BeginStep for the Hare_Infant. More...
 
void Step (void) override
 Step for the Hare_Infant. More...
 
void EndStep (void) override
 EndStep for the Hare_Infant. More...
 
 Hare_Infant (int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM)
 Hare infant constructor. More...
 
void ReInit (struct_Hare a_data)
 Infant object reinitiation. More...
 
void Init ()
 Object initiation. More...
 
 ~Hare_Infant () override
 Hare infant destructor. More...
 
void ON_Dead () override
 This hare has been killed. More...
 
void ON_BeingFed (double a_someMilk)
 Get energy from milk given. More...
 
void SetWeight (double w)
 Set the weight. More...
 
void SetMum (Hare_Female *a_af)
 Set the mother pointer. More...
 
- Public Member Functions inherited from THare
 THare (int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM)
 Constructor. More...
 
void THareInit (int p_x, int p_y, THare_Population_Manager *p_PPM)
 Object Initiation. More...
 
 ~THare () override
 Destructor. More...
 
virtual TTypeOfHareState st_Dispersal ()
 Base implementation only - reimplemented. More...
 
double GetWeight ()
 
double GetTotalWeight ()
 Provide the wet weight of the hare. More...
 
int GetAge ()
 Provide the age of the hare. More...
 
void ON_MumDead (Hare_Female *a_Mum)
 Inform Mum that we are dead. More...
 
Hare_FemaleGetMum ()
 Get the mother pointer. More...
 
double GetRMR ()
 Get todays RMR. More...
 
virtual bool WasPredated ()
 Test for predation. More...
 
int GetRefNum ()
 Get the refnum for this hare. More...
 
void loadVegPalatability (void)
 Loads static member m_vegPalatability with data. More...
 
- Public Member Functions inherited from TAnimal
 TAnimal (int x, int y, Landscape *L)
 The TAnimal constructor saving the x,y, location and the landscape pointer. More...
 
 TAnimal (int x, int y)
 The TAnimal constructor saving the x,y used if landscape is already set. More...
 
void SetGuardMapIndex (int a_index_x, int a_index_y)
 Set the guard map index, this is used to avoid two animals operating in the same location when using multithread. More...
 
unsigned SupplyFarmOwnerRef () const
 Get the current location farm ref if any. More...
 
AnimalPosition SupplyPosition () const
 Returns the objects location and habitat type and veg type. More...
 
APoint SupplyPoint () const
 Returns the objects location in ALMaSS coordinates. More...
 
int SupplyPolygonRef () const
 Returns the polygon reference where the object is located. More...
 
TTypesOfLandscapeElement SupplyPolygonType () const
 Returns the polygon type where the object is located. More...
 
int Supply_m_Location_x () const
 Returns the ALMaSS x-coordinate. More...
 
int Supply_m_Location_y () const
 Returns the ALMaSS y-coordinate. More...
 
int SupplyGuardCellX () const
 Returns the x-index to the guard cell. More...
 
int SupplyGuardCellY () const
 Returns the y-index to the guard cell. More...
 
int SupplyAge () const
 Returns the animals age in days. More...
 
void SetAge (int a_age)
 Sets the animals age in days. More...
 
virtual void KillThis ()
 Sets all parameters ready for object destruction. More...
 
virtual void CopyMyself ()
 Used to copy the object details to another in descendent classes. More...
 
void SetX (const int a_x)
 Sets the x-coordinate. More...
 
void SetY (const int a_y)
 Sets the y-coordinate. More...
 
virtual void ReinitialiseObject (int a_x, int a_y, Landscape *a_l_ptr)
 
virtual void ReinitialiseObject (int a_x, int a_y)
 Used to re-use an object - must be implemented in descendent classes. More...
 
virtual int WhatState ()
 Returns the objects current state number. More...
 
virtual void Dying ()
 A wrapped for KillThis - ideally should not be used. More...
 
void CheckManagement ()
 Used to start a check for any management related effects at the objects current location. More...
 
void CheckManagementXY (int a_x, int a_y)
 Used to start a check for any management related effects at x,y. More...
 
- Public Member Functions inherited from TALMaSSObject
int GetCurrentStateNo () const
 Returns the current state number. More...
 
void SetCurrentStateNo (int a_num)
 Sets the current state number. More...
 
bool GetStepDone () const
 Returns the step done indicator flag. More...
 
void SetStepDone (bool a_bool)
 Sets the step done indicator flag. More...
 
void ReinitialiseObjectBase ()
 Used to initialise an object. More...
 
 TALMaSSObject ()
 The constructor for TALMaSSObject. More...
 
virtual ~TALMaSSObject ()=default
 The destructor for TALMaSSObject. More...
 

Protected Member Functions

TTypeOfHareState st_Developing ()
 Developmental behaviour for the infant hare. More...
 
void st_NextStage ()
 'mature' to become a young More...
 
bool OnFarmEvent (FarmToDo event) override
 Do we require a response to a farm event. More...
 
- Protected Member Functions inherited from THare
bool Run (int a_dist, int a_direction)
 Run a distance in a direction. More...
 
void EnergyBalance (TTypeOfActivity a_activity, int dist)
 Adjust energy balance for an activity. More...
 
void TimeBudget (TTypeOfActivity a_activity, int dist)
 Adjust time budger for an activity. More...
 
void st_Dying ()
 Tidy up before removing the object on death. More...
 
virtual void Running (int a_max_dist)
 Run. More...
 
void Walking (int a_dist, int a_direction)
 Walking. More...
 
double Forage (int &time)
 Foraging. More...
 
double ForageP (int &time)
 Foraging but also incorporating pesticide exposure. More...
 
virtual void InternalPesticideHandlingAndResponse ()
 Handles internal effects of pesticide exposure. If any effects are needed this method must be re-implemented by descendent classes. 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...
 
double ForageSquare (int a_x, int a_y)
 Forage from an area. More...
 
double ForageSquareP (int a_x, int a_y, double *a_pestexposure)
 Forage from an area and resturn pesticide exposure as well as food. More...
 
int GetPegDistance ()
 Get peg distance. More...
 
int GetPegPull ()
 Get attractive force of peg. More...
 
int GetPegDirection ()
 Get direction of peg. More...
 
void MovePeg ()
 Move the peg according to attraction forces. More...
 
- Protected Member Functions inherited from TAnimal
void CorrectWrapRound ()
 Corrects wrap around co-ordinate problems. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from THare
static void SetMum (Hare_Female *)
 Set the mother pointer. Reimplemented in Hare_Infant. More...
 
- Static Public Member Functions inherited from TAnimal
static void SetSimulationWidth (int a_value)
 Sets the simulation width. More...
 
static void SetSimulationHeight (int a_value)
 Sets the simulation height. More...
 
static void SetDayInYear (int a_value)
 Sets the day in year attribute. More...
 
static void SetOurLandscape (Landscape *a_value)
 Sets the landscape pointer. More...
 
static void SetTempToday (double a_value)
 Sets the temperature today attribute. More...
 
- Static Public Member Functions inherited from TALMaSSObject
static void OnArrayBoundsError ()
 Used for debugging only, tests basic object properties. More...
 
- Static Public Attributes inherited from THare
static double * m_vegPalatability = nullptr
 Will hold and array of palatability for hare for each tov type. Most are 1, but unpalatable vegetation can be specified here. More...
 
- Protected Attributes inherited from THare
TTypeOfHareState m_CurrentHState
 Defines the current activity. More...
 
int m_Age = 0
 State variale - hare age. More...
 
Hare_Object m_Type
 State variale - the type of hare. More...
 
double m_weight = 0.0
 State variale - hare weight g. More...
 
double m_old_weight = 0.0
 State variale - last hare weight. More...
 
Hare_Femalem_MyMum = nullptr
 Pointer to the hare's mum. More...
 
THare_Population_Managerm_OurPopulationManager
 Pointer to the hare population manager. More...
 
int m_Lifespan = 0
 Physiolocal lifespan, assuming nothing else kills the hare (unlikely to reach this age) More...
 
int m_ActivityTime = 0
 Minutes of potential activity time per day. More...
 
int m_StarvationDays = 0
 State variable - the number of consecutive days in negative energy balance. More...
 
double m_fatReserve = 0.0
 State variable - the energy reserve of the hare. More...
 
double m_TodaysEnergy = 0.0
 State variable - the amount of energy available today, can be in deficit. More...
 
double m_EnergyMax = 0.0
 State variable - the amount of energy it is possible to eat as a multiplyer or RMR. More...
 
double m_KJRunning = 0.0
 KJ/m cost of running per kg hare. More...
 
double m_KJWalking = 0.0
 KJ/m cost of walking per kg hare. More...
 
double m_KJForaging = 0.0
 KJ/m cost of foraging per kg hare. More...
 
double m_SpeedRunning = 0.0
 m/min speed of running per kg hare More...
 
double m_SpeedWalking = 0.0
 m/min speed of walking per kg hare More...
 
double m_foragingenergy = 0.0
 Energy obtained from foraging/feeding. More...
 
int m_peg_x = 0
 peg x-coordinate More...
 
int m_peg_y = 0
 peg y-coordinate More...
 
int m_RefNum = 0
 Unique hare reference number, also functions as sex flag. More...
 
int m_experiencedDensity = 0
 State variable used in alternative density-dependent configurations. More...
 
int m_lastYearsDensity = 0
 State variable used in alternative density-dependent configurations. More...
 
int m_ddindex = 0
 State variable used in alternative density-dependent configurations. More...
 
int m_expDensity [365] = {}
 State variable used in alternative density-dependent configurations. More...
 
int m_DensitySum = 0
 State variable used in alternative density-dependent configurations. More...
 
bool m_IamSick = false
 flag for sickness - used in conjunction with disease configurations More...
 
double m_pesticide_burden = 0.0
 State variable used to hold the current body-burden of pesticide. More...
 
double m_pesticidedegradationrate = 0.0
 State variable used to hold the daily degredation rate of the pesticide in the body. More...
 
bool m_pesticideInfluenced1 = false
 Flag to indicate pesticide effects (e.g. can be used for endocrine distruptors with delayed effects until birth). More...
 
- Protected Attributes inherited from TAnimal
int m_Location_x
 The objects ALMaSS x coordinate. More...
 
int m_Location_y
 The objects ALMaSS y coordinate. More...
 
int m_guard_cell_x
 The index x to the guard cell. More...
 
int m_guard_cell_y
 The index y to the guard cell. More...
 
int m_AgeDays {0}
 To hold the age in days. More...
 
PesticideToxicity m_my_pesticide
 
- Protected Attributes inherited from TALMaSSObject
int m_CurrentStateNo
 The basic state number for all objects - '-1' indicates death. More...
 
bool m_StepDone
 Indicates whether the iterative step code is done for this timestep. More...
 
- Static Protected Attributes inherited from TAnimal
static Landscapem_OurLandscape = nullptr
 A pointer to the landscape object shared with all TAnimal objects. More...
 
static int m_SimulationWidth = 0
 A static member for the simulation width because it is often used by descendent classes. More...
 
static int m_SimulationHeight = 0
 A static member for the simulation height because it is often used by descendent classes. More...
 
static double m_TemperatureToday = 0.0
 A holder for the temperature today shared with all TAnimal objects. More...
 
static int m_DayInYear = 0
 A holder for the day in year shared with all TAnimal objects. More...
 

Detailed Description

Class for infant hares (stationary, only milk inputs)

Constructor & Destructor Documentation

◆ Hare_Infant()

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

Hare infant constructor.

1183  : THare(
1184  p_x, p_y, p_L, p_PPM) { Init(); }

References Init().

◆ ~Hare_Infant()

Hare_Infant::~Hare_Infant ( )
override

Hare infant destructor.

1201  {
1202  //Nothing to do
1203 }

Member Function Documentation

◆ BeginStep()

void Hare_Infant::BeginStep ( void  )
overridevirtual

BeginStep for the Hare_Infant.

Tests for mortality. Both standard mortality tests and optional density dependent mortality. NB this differs from all other ALMaSS models in that the farm events do not have any direct impact on any hare stage except this one. I assume that all other stages can run away - seems not to cause a problem with fitting to Illum�

Reimplemented from THare.

Reimplemented in Hare_Young.

1213  {
1214  if (m_CurrentStateNo == -1) return;
1215  // These are all the same value - this may change to so I have kept all three
1216  // for now ver 00005
1217  m_KJWalking = m_OurPopulationManager->GetKJperM(static_cast<int>(m_weight));
1218  m_KJRunning = m_KJWalking * 2;
1220  m_ActivityTime = 1440; // Start the day
1222 #ifdef __DDEPMORT
1224 #ifdef __THRESHOLD_DD
1225  if (dens<m_OurPopulationManager->m_HareThresholdDD) dens=0;
1226 #endif
1227  double inter=m_OurPopulationManager->GetInterference(dens);
1228  if (g_rand_uni() > inter) {
1229  ON_Dead();
1230  m_StepDone=true; // We need to skip the step code, we are dead
1231  return;
1232  }
1233 #endif
1235  {
1236  ON_Dead();
1237  m_StepDone = true; // We need to skip the step code, we are dead
1238  }
1239 
1240  if (m_MyMum == nullptr)
1241  {
1242  ON_Dead();
1243  m_StepDone = true; // We need to skip the step code, we are dead
1244  }
1245  // Set out maximum intake possible
1246  CheckManagement();
1247 }

References TAnimal::CheckManagement(), g_rand_uni_fnc(), THare_Population_Manager::GetInterference(), THare_Population_Manager::GetKJperM(), THare_Population_Manager::GetTotalDensity(), THare::m_ActivityTime, TALMaSSObject::m_CurrentStateNo, THare::m_KJForaging, THare::m_KJRunning, THare::m_KJWalking, TAnimal::m_Location_x, TAnimal::m_Location_y, THare::m_MyMum, THare::m_old_weight, THare::m_OurPopulationManager, TALMaSSObject::m_StepDone, THare::m_weight, THare_Population_Manager::m_YoungMortRate, and ON_Dead().

◆ EndStep()

void Hare_Infant::EndStep ( void  )
overridevirtual

EndStep for the Hare_Infant.

Reimplemented from THare.

Reimplemented in Hare_Young.

1295  {
1297  {
1298  // Legal returns are:
1299  // tohs_Developing
1300  // tohs_NextStage
1301  // tohs_Dying
1303  }
1304  if (m_CurrentHState == tohs_Dying) { ON_Dead(); }
1305  else MovePeg();
1306 }

References THare::m_CurrentHState, THare::MovePeg(), ON_Dead(), st_Developing(), tohs_Developing, and tohs_Dying.

◆ Init()

void Hare_Infant::Init ( void  )

Object initiation.

1193  {
1194  m_Type = hob_Infant;
1195  m_weight = -1; // just so we know we must set this somewhere else
1196  m_old_weight = 0;
1197  m_Age = 1; // We are 0 day old today
1198 }

References hob_Infant, THare::m_Age, THare::m_old_weight, THare::m_Type, and THare::m_weight.

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

◆ ON_BeingFed()

void Hare_Infant::ON_BeingFed ( double  a_someMilk)

Get energy from milk given.

The conversion efficiency is pre-calcualted in GetgperKJ so this function is quite simply a conversion from KJ to g
NOTE There are no limits here - the limit to growth has to be by the limited amount of milk supplied - the ultimate limit to this has got to be defined somewhere else (e.g. female forage).

1539  {
1544  m_TodaysEnergy += a_someMilk;
1545 }

References THare::m_TodaysEnergy.

◆ ON_Dead()

void Hare_Infant::ON_Dead ( void  )
overridevirtual

This hare has been killed.

Do the housekeeping necessary before dying

Reimplemented from THare.

Reimplemented in Hare_Young.

1532 { st_Dying(); }

References THare::st_Dying().

Referenced by BeginStep(), EndStep(), and OnFarmEvent().

◆ OnFarmEvent()

bool Hare_Infant::OnFarmEvent ( FarmToDo  event)
overrideprotectedvirtual

Do we require a response to a farm event.

Checks to see if any nasty farm event has caused the death of the infant.
Currently there is only one response to those events where death is possible. However, this may not always be the case so the code is structured as for the other ALMaSS animals (i.e. it could be a bit easier to overview if it were written differently).

Reimplemented from THare.

Reimplemented in Hare_Young.

1312  {
1313  bool result = false;
1314  switch (event)
1315  {
1316  case sleep_all_day:
1317  break;
1318 // Here begins cutting and soil cultivation mortality
1319  case burn_straw_stubble:
1320  case burn_top: /*\todo is this alright? */
1321  case cut_to_hay:
1322  case cut_to_silage:
1323  case cut_weeds:
1324  case flower_cutting:
1325  case green_harvest: /*\todo is this alright? */
1326  case harvest:
1327  case harvestshoots: /*\todo is this alright? */
1328  case hay_bailing:
1329  case hay_turning:
1330  case mow: /*\todo is this alright? */
1331  case shredding:
1332  case straw_chopping:
1333  case strigling:
1334  case strigling_hill:
1335  case strigling_sow:
1337  case swathing:
1338  case fiber_covering:
1339  case fiber_removal:
1340  case fa_greenmanure:
1341  case fp_greenmanure:
1342  if (g_random_fnc(100) < cfg_hare_i_cut.value()) result = true;
1343  break;
1344  case deep_ploughing:
1345  case spring_sow:
1346  case spring_sow_with_ferti:
1347  case stubble_harrowing:
1348  case stubble_plough:
1349  case flammebehandling: /*\todo is this alright? */
1350  case autumn_harrow:
1352  case autumn_plough:
1353  case autumn_roll:
1354  case autumn_sow:
1355  case autumn_sow_with_ferti:
1356  case bed_forming:
1357  case bulb_harvest:
1358  case spring_harrow:
1359  case spring_plough:
1360  case spring_roll:
1361  case summer_harrow:
1362  case summer_plough:
1363  case summer_sow:
1364  case winter_harrow:
1365  case winter_plough:
1366  case preseeding_cultivator:
1368  case row_cultivation:
1369  case shallow_harrow:
1371  case hilling_up:
1372  if (g_random_fnc(100) < cfg_hare_i_tillage.value()) result = true;
1373  break;
1374 
1375 // Here begins grazing mortality
1376  case pigs_out: /*\todo why does this have 100% probability */
1377  result = true;
1378  break;
1379 // Here begin LOW-mortality events
1380  case cattle_out:
1381  case cattle_out_low:
1382  case biocide:
1383  case fa_ammoniumsulphate:
1384  case fa_boron:
1385  case fa_calcium:
1386  case fa_cu:
1387  case fa_k:
1388  case fa_manganesesulphate:
1389  case fa_manure:
1390  case fa_n:
1391  case fa_nk:
1392  case fa_npk:
1393  case fa_npks:
1394  case fa_p:
1395  case fa_pk:
1396  case fa_pks:
1397  case fa_rsm:
1398  case fa_sk:
1399  case fa_sludge:
1400  case fa_slurry:
1401  case fp_ammoniumsulphate:
1402  case fp_boron:
1403  case fp_calcium:
1404  case fp_cu:
1405  case fp_k:
1406  case fp_liquidNH3:
1407  case fp_manganesesulphate:
1408  case fp_manure:
1409  case fp_n:
1410  case fp_nc:
1411  case fp_nk:
1412  case fp_npk:
1413  case fp_npks:
1414  case fp_ns:
1415  case fp_p:
1416  case fp_pk:
1417  case fp_pks:
1418  case fp_rsm:
1419  case fp_sk:
1420  case fp_sludge:
1421  case fp_slurry:
1422  case fungicide_treat:
1423  case glyphosate:
1424  case growth_regulator:
1425  case herbicide_treat:
1426  case insecticide_treat:
1427  case last_treatment:
1428  case manual_weeding:
1429  case molluscicide:
1430  case org_fungicide:
1431  case org_herbicide:
1432  case org_insecticide:
1433  case pheromone:
1434  case product_treat:
1435  case pruning:
1436  case straw_covering:
1437  case straw_removal:
1438  case suckering:
1439  case syninsecticide_treat:
1440  case trial_control:
1442  case trial_toxiccontrol:
1443  case water:
1444  case harvest_bushfruit:
1445  if (g_random_fnc(100) < cfg_hare_i_tractor.value()) result = true;
1446  break;
1447  default:
1448  m_OurLandscape->Warn( "Hare_Infant::OnFarmEvent(): Unknown event type:", m_OurLandscape->EventtypeToString( event ) );
1449  exit( 1 );
1450  }
1451  if (result) {
1452  ON_Dead();
1453  }
1454  return result;
1455 }

References autumn_harrow, autumn_or_spring_plough, autumn_plough, autumn_roll, autumn_sow, autumn_sow_with_ferti, bed_forming, biocide, bulb_harvest, burn_straw_stubble, burn_top, cattle_out, cattle_out_low, cfg_hare_i_cut, cfg_hare_i_tillage, cfg_hare_i_tractor, cut_to_hay, cut_to_silage, cut_weeds, deep_ploughing, Landscape::EventtypeToString(), fa_ammoniumsulphate, fa_boron, fa_calcium, fa_cu, fa_greenmanure, fa_k, fa_manganesesulphate, fa_manure, fa_n, fa_nk, fa_npk, fa_npks, fa_p, fa_pk, fa_pks, fa_rsm, fa_sk, fa_sludge, fa_slurry, fiber_covering, fiber_removal, flammebehandling, flower_cutting, fp_ammoniumsulphate, fp_boron, fp_calcium, fp_cu, fp_greenmanure, fp_k, fp_liquidNH3, fp_manganesesulphate, fp_manure, fp_n, fp_nc, fp_nk, fp_npk, fp_npks, fp_ns, fp_p, fp_pk, fp_pks, fp_rsm, fp_sk, fp_sludge, fp_slurry, fungicide_treat, g_random_fnc(), glyphosate, green_harvest, growth_regulator, harvest, harvest_bushfruit, harvestshoots, hay_bailing, hay_turning, heavy_cultivator_aggregate, herbicide_treat, hilling_up, insecticide_treat, last_treatment, TAnimal::m_OurLandscape, manual_weeding, molluscicide, mow, ON_Dead(), org_fungicide, org_herbicide, org_insecticide, pheromone, pigs_out, preseeding_cultivator, preseeding_cultivator_sow, product_treat, pruning, row_cultivation, shallow_harrow, shredding, sleep_all_day, spring_harrow, spring_plough, spring_roll, spring_sow, spring_sow_with_ferti, straw_chopping, straw_covering, straw_removal, strigling, strigling_hill, strigling_sow, stubble_cultivator_heavy, stubble_harrowing, stubble_plough, suckering, summer_harrow, summer_plough, summer_sow, swathing, syninsecticide_treat, trial_control, trial_insecticidetreat, trial_toxiccontrol, CfgInt::value(), Landscape::Warn(), water, winter_harrow, and winter_plough.

◆ ReInit()

void Hare_Infant::ReInit ( struct_Hare  a_data)

Infant object reinitiation.

1185  {
1186  m_Location_x = a_data.x;
1187  m_Location_y = a_data.y;
1188  m_OurLandscape = a_data.L;
1189  m_CurrentStateNo = 0;
1190  THareInit(a_data.x, a_data.y, a_data.HM);
1191  Init();
1192 }

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::x, and struct_Hare::y.

◆ SetMum()

void Hare_Infant::SetMum ( Hare_Female a_af)
inline

Set the mother pointer.

862 { m_MyMum = a_af; }

References THare::m_MyMum.

Referenced by THare_Population_Manager::CreateObjects().

◆ SetWeight()

void Hare_Infant::SetWeight ( double  w)
inline

Set the weight.

This is only used when a hare is born, so no need to have it in the base class

857 { m_weight = w; }

References THare::m_weight.

Referenced by THare_Population_Manager::CreateObjects().

◆ st_Developing()

TTypeOfHareState Hare_Infant::st_Developing ( )
protected

Developmental behaviour for the infant hare.

This code must be called by the EndStep.
To do this we need to add growth and energy requirements. The idea is to grow immediately on milk supply - handled via ON_someMilk()but if there are any other adjustments to be made they ought to be done here, e.g. if energy is needed for movement or thermoregululation. The easiest way to manage things is to use weight as a measure of energy, and convert freely between the two. This means that conversion efficiencies need to be applied to the energy inputs (done in on_BeingFed)

First remove our BMR

Make sure m_TodaysEnergy is zero before we run the risk of getting milk from Mum again during Step tomorrow.

If all is well then mature to become a Hare_Young

1461  {
1467  //int weight=(int) (floor(m_weight+0.5));
1468  double lost = m_OurPopulationManager->GetRMR(m_Age, GetTotalWeight()); // Uses age, weight and ambient temperature
1470  //** Then grow if possible, or shrink if -ve energy
1471  double gained = m_TodaysEnergy - lost;
1474  m_weight += gained * eff;
1475 
1476  // We need to know whether the growth rate is positive or negative.
1477  // We could look at lost here, but it is probably easier to use the same
1478  // approach for Young as well, and they need the oldweight variable, so might as well use this.
1479 #ifdef __MINGROWTHATTAIN
1480  // Take a check on our growth - if we are below X% of the max expected weight then die
1481  if (m_weight < m_OurPopulationManager->m_DMWeight[m_Age]) return tohs_Dying;
1482 #else
1483  if (m_weight<m_old_weight) {
1484  m_StarvationDays++;
1485  }
1486  else m_StarvationDays=0;
1491  return tohs_Dying;
1492  }
1493 #endif
1494 
1496  m_TodaysEnergy = 0;
1498  if (++m_Age > 10) return tohs_NextStage;
1499  return tohs_Developing;
1500 }

References cfg_infant_starvation_threshold, THare_Population_Manager::GetGrowthEfficiency(), THare_Population_Manager::GetMaxDailyGrowthEnergyP(), THare_Population_Manager::GetRMR(), THare::GetTotalWeight(), THare::m_Age, THare::m_old_weight, THare::m_OurPopulationManager, THare::m_StarvationDays, THare::m_TodaysEnergy, THare::m_weight, tohs_Developing, tohs_Dying, tohs_NextStage, and CfgInt::value().

Referenced by EndStep().

◆ st_NextStage()

void Hare_Infant::st_NextStage ( )
protected

'mature' to become a young

This creats a Hare_Young object via a call to create objects then sets the flag for destruction of this object.

1505  {
1509  auto sp = new struct_Hare;
1510  sp->HM = m_OurPopulationManager;
1511  sp->L = m_OurLandscape;
1512  sp->x = m_Location_x;
1513  sp->y = m_Location_y;
1514  sp->weight = m_weight;
1515  sp->age = m_Age;
1516  // Updating of Mum is done through the population manager
1517  sp->Mum = m_MyMum;
1518  // *** Debug ***
1519  //sp->oldMum = m_MyOldMum;
1520  //
1521  m_OurPopulationManager->CreateObjects(1, this, nullptr, sp, 1);
1522  // Clean-up
1523  m_CurrentStateNo = -1; // Destroys the object at the next opportunity
1525  m_MyMum = nullptr;
1526  delete sp;
1527 }

References THare_Population_Manager::CreateObjects(), struct_Hare::HM, THare::m_Age, THare::m_CurrentHState, TALMaSSObject::m_CurrentStateNo, TAnimal::m_Location_x, TAnimal::m_Location_y, THare::m_MyMum, TAnimal::m_OurLandscape, THare::m_OurPopulationManager, THare::m_weight, and tohs_DestroyObject.

Referenced by Step().

◆ Step()

void Hare_Infant::Step ( void  )
overridevirtual

Step for the Hare_Infant.

The step code is the main activity sub-stepfor each time-step. A dead animal will have m_CurrentStateNo set to -1 It is essential that before an animal is killed that it has sent all the necessary messages to others (in this case to its mother).

m_CurrentHState holds the current behavioural state

Reimplemented from THare.

Reimplemented in Hare_Young.

1261  {
1262  if (m_StepDone || m_CurrentStateNo == -1) return;
1263  // The next line causes a jump to the correct behavioural state
1264  switch (m_CurrentHState)
1265  {
1266  case tohs_InitialState: // Initial state
1268  break;
1269  case tohs_Developing:
1270  m_StepDone = true;
1271  break;
1272  case tohs_NextStage:
1273  // Legal returns are:
1274  // NONE
1275  st_NextStage();
1276  m_StepDone = true;
1277  break;
1278  case tohs_Running:
1280  break;
1281  case tohs_Dying:
1282  m_StepDone = true;
1283  break;
1284  default:
1285  m_OurLandscape->Warn("Hare_Infant::Step - unknown state", nullptr);
1286  exit(1);
1287  }
1288 }

References THare::m_CurrentHState, TALMaSSObject::m_CurrentStateNo, TAnimal::m_OurLandscape, TALMaSSObject::m_StepDone, st_NextStage(), tohs_Developing, tohs_Dying, tohs_InitialState, tohs_NextStage, tohs_Running, and Landscape::Warn().


The documentation for this class was generated from the following files:
tohs_Dying
Definition: Hare_All.h:80
struct_Hare::x
int x
Definition: Hare_All.h:138
fiber_removal
Definition: Treatment.h:129
fp_rsm
Definition: Treatment.h:64
org_insecticide
Definition: Treatment.h:84
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:873
fa_sk
Definition: Treatment.h:71
row_cultivation
Definition: Treatment.h:88
fa_pk
Definition: Treatment.h:68
winter_harrow
Definition: Treatment.h:144
fp_npk
Definition: Treatment.h:52
strigling
Definition: Treatment.h:89
g_rand_uni_fnc
double g_rand_uni_fnc()
Definition: ALMaSS_Random.cpp:56
harvest
Definition: Treatment.h:94
fa_nk
Definition: Treatment.h:142
insecticide_treat
Definition: Treatment.h:83
straw_chopping
Definition: Treatment.h:99
struct_Hare::y
int y
Definition: Hare_All.h:139
fa_greenmanure
Definition: Treatment.h:76
stubble_plough
Definition: Treatment.h:35
growth_regulator
Definition: Treatment.h:81
deep_ploughing
Definition: Treatment.h:43
hilling_up
Definition: Treatment.h:91
green_harvest
Definition: Treatment.h:127
autumn_or_spring_plough
Definition: Treatment.h:103
flower_cutting
Definition: Treatment.h:121
spring_plough
Definition: Treatment.h:44
fp_sk
Definition: Treatment.h:56
pruning
Definition: Treatment.h:125
Hare_Infant::st_NextStage
void st_NextStage()
'mature' to become a young
Definition: Hare_All.cpp:1505
THare_Population_Manager::GetKJperM
double GetKJperM(int a_size)
Get the cost of moving 1m in KJ dependent upon mass (.
Definition: Hare_All.h:628
cfg_hare_i_cut
CfgInt cfg_hare_i_cut("HARE_CUTTING_MORT_INFANT", CFG_CUSTOM, 50)
fp_manure
Definition: Treatment.h:61
herbicide_treat
Definition: Treatment.h:80
fp_ammoniumsulphate
Definition: Treatment.h:60
flammebehandling
Definition: Treatment.h:90
straw_covering
Definition: Treatment.h:123
fp_boron
Definition: Treatment.h:131
fp_cu
Definition: Treatment.h:138
bulb_harvest
Definition: Treatment.h:122
preseeding_cultivator
Definition: Treatment.h:39
trial_control
Definition: Treatment.h:110
fp_npks
Definition: Treatment.h:51
tohs_InitialState
Definition: Hare_All.h:72
burn_top
Definition: Treatment.h:143
THare::m_ActivityTime
int m_ActivityTime
Minutes of potential activity time per day.
Definition: Hare_All.h:203
fp_nk
Definition: Treatment.h:133
burn_straw_stubble
Definition: Treatment.h:104
org_herbicide
Definition: Treatment.h:85
THare::m_OurPopulationManager
THare_Population_Manager * m_OurPopulationManager
Pointer to the hare population manager.
Definition: Hare_All.h:194
struct_Hare::HM
THare_Population_Manager * HM
Definition: Hare_All.h:142
fa_cu
Definition: Treatment.h:140
Hare_Infant::Init
void Init()
Object initiation.
Definition: Hare_All.cpp:1193
autumn_roll
Definition: Treatment.h:38
strigling_hill
Definition: Treatment.h:117
heavy_cultivator_aggregate
Definition: Treatment.h:120
fp_manganesesulphate
Definition: Treatment.h:59
THare::m_KJForaging
double m_KJForaging
KJ/m cost of foraging per kg hare.
Definition: Hare_All.h:238
hay_turning
Definition: Treatment.h:100
last_treatment
Definition: Treatment.h:150
straw_removal
Definition: Treatment.h:124
fa_n
Definition: Treatment.h:139
shredding
Definition: Treatment.h:126
THare::THareInit
void THareInit(int p_x, int p_y, THare_Population_Manager *p_PPM)
Object Initiation.
Definition: Hare_THare.cpp:70
pheromone
Definition: Treatment.h:149
fp_n
Definition: Treatment.h:132
manual_weeding
Definition: Treatment.h:148
fa_npk
Definition: Treatment.h:67
tohs_Running
Definition: Hare_All.h:79
winter_plough
Definition: Treatment.h:42
fp_calcium
Definition: Treatment.h:65
spring_harrow
Definition: Treatment.h:45
cut_to_silage
Definition: Treatment.h:98
fa_sludge
Definition: Treatment.h:77
THare::m_KJWalking
double m_KJWalking
KJ/m cost of walking per kg hare.
Definition: Hare_All.h:233
pigs_out
Definition: Treatment.h:96
fp_p
Definition: Treatment.h:54
suckering
Definition: Treatment.h:130
cut_to_hay
Definition: Treatment.h:97
fa_boron
Definition: Treatment.h:141
tohs_DestroyObject
Definition: Hare_All.h:81
THare::m_KJRunning
double m_KJRunning
KJ/m cost of running per kg hare.
Definition: Hare_All.h:228
TAnimal::m_Location_y
int m_Location_y
The objects ALMaSS y coordinate.
Definition: PopulationManager.h:366
fa_k
Definition: Treatment.h:70
spring_roll
Definition: Treatment.h:46
cfg_hare_i_tillage
CfgInt cfg_hare_i_tillage("HARE_TILLAGE_MORT_INFANT", CFG_CUSTOM, 100)
TAnimal::m_OurLandscape
static Landscape * m_OurLandscape
A pointer to the landscape object shared with all TAnimal objects.
Definition: PopulationManager.h:342
TAnimal::CheckManagement
void CheckManagement()
Used to start a check for any management related effects at the objects current location.
Definition: PopulationManager.cpp:1591
struct_Hare::L
Landscape * L
Definition: Hare_All.h:141
cfg_infant_starvation_threshold
static CfgInt cfg_infant_starvation_threshold("HARE_INFANT_STARVE_THRESHOLD", CFG_CUSTOM, 4)
syninsecticide_treat
Definition: Treatment.h:111
fp_nc
Definition: Treatment.h:135
fungicide_treat
Definition: Treatment.h:82
fp_sludge
Definition: Treatment.h:63
THare_Population_Manager::GetMaxDailyGrowthEnergyP
double GetMaxDailyGrowthEnergyP(int a_age)
Get the maximum daily energy needed for growth for this a_age for use in protein construction.
Definition: Hare_All.h:563
THare::MovePeg
void MovePeg()
Move the peg according to attraction forces.
Definition: HareForagenPeg.cpp:535
fp_greenmanure
Definition: Treatment.h:62
shallow_harrow
Definition: Treatment.h:119
fa_slurry
Definition: Treatment.h:72
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:932
cattle_out_low
Definition: Treatment.h:112
harvest_bushfruit
Definition: Treatment.h:137
preseeding_cultivator_sow
Definition: Treatment.h:40
fp_pk
Definition: Treatment.h:53
THare::m_old_weight
double m_old_weight
State variale - last hare weight.
Definition: Hare_All.h:185
fa_pks
Definition: Treatment.h:145
org_fungicide
Definition: Treatment.h:86
THare::m_TodaysEnergy
double m_TodaysEnergy
State variable - the amount of energy available today, can be in deficit.
Definition: Hare_All.h:218
summer_harrow
Definition: Treatment.h:49
cattle_out
Definition: Treatment.h:95
harvestshoots
Definition: Treatment.h:147
stubble_cultivator_heavy
Definition: Treatment.h:36
hob_Infant
Definition: Hare_All.h:59
TALMaSSObject::m_StepDone
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
Definition: PopulationManager.h:133
biocide
Definition: Treatment.h:116
swathing
Definition: Treatment.h:93
Hare_Infant::ON_Dead
void ON_Dead() override
This hare has been killed.
Definition: Hare_All.cpp:1532
tohs_NextStage
Definition: Hare_All.h:73
glyphosate
Definition: Treatment.h:114
cfg_hare_i_tractor
CfgInt cfg_hare_i_tractor("HARE_TRACTOR_MORT_INFANT", CFG_CUSTOM, 5)
CfgInt::value
int value() const
Definition: Configurator.h:116
THare_Population_Manager::m_YoungMortRate
double m_YoungMortRate
Input variable - Young mortality rate.
Definition: Hare_All.h:745
fa_manure
Definition: Treatment.h:75
spring_sow
Definition: Treatment.h:47
cut_weeds
Definition: Treatment.h:106
trial_toxiccontrol
Definition: Treatment.h:109
summer_plough
Definition: Treatment.h:48
THare::st_Dying
void st_Dying()
Tidy up before removing the object on death.
Definition: Hare_THare.cpp:165
Landscape::EventtypeToString
std::string EventtypeToString(int a_event)
Returns the text representation of a treatment type.
Definition: Landscape.cpp:6024
fp_pks
Definition: Treatment.h:146
fp_ns
Definition: Treatment.h:134
THare::m_Age
int m_Age
State variale - hare age.
Definition: Hare_All.h:170
bed_forming
Definition: Treatment.h:118
product_treat
Definition: Treatment.h:113
tohs_Developing
Definition: Hare_All.h:74
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:136
THare_Population_Manager::GetInterference
double GetInterference(int h)
Return the proportion of time used in communicating with con-specifics.
Definition: Hare_All.h:707
autumn_sow
Definition: Treatment.h:41
THare::THare
THare(int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM)
Constructor.
Definition: Hare_THare.cpp:64
autumn_harrow
Definition: Treatment.h:37
fa_calcium
Definition: Treatment.h:79
THare::m_StarvationDays
int m_StarvationDays
State variable - the number of consecutive days in negative energy balance.
Definition: Hare_All.h:208
fa_ammoniumsulphate
Definition: Treatment.h:74
autumn_sow_with_ferti
Definition: Treatment.h:136
trial_insecticidetreat
Definition: Treatment.h:108
fa_p
Definition: Treatment.h:69
mow
Definition: Treatment.h:105
Hare_Infant::st_Developing
TTypeOfHareState st_Developing()
Developmental behaviour for the infant hare.
Definition: Hare_All.cpp:1461
THare::GetTotalWeight
double GetTotalWeight()
Provide the wet weight of the hare.
Definition: Hare_All.h:370
fa_rsm
Definition: Treatment.h:78
THare::m_MyMum
Hare_Female * m_MyMum
Pointer to the hare's mum.
Definition: Hare_All.h:190
g_random_fnc
int g_random_fnc(const int a_range)
Definition: ALMaSS_Random.cpp:74
fa_npks
Definition: Treatment.h:66
water
Definition: Treatment.h:92
stubble_harrowing
Definition: Treatment.h:102
THare::m_weight
double m_weight
State variale - hare weight g.
Definition: Hare_All.h:180
THare::m_Type
Hare_Object m_Type
State variale - the type of hare.
Definition: Hare_All.h:175
fp_liquidNH3
Definition: Treatment.h:57
molluscicide
Definition: Treatment.h:87
TALMaSSObject::m_CurrentStateNo
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
Definition: PopulationManager.h:131
THare_Population_Manager::GetGrowthEfficiency
double GetGrowthEfficiency(int a_age)
Get the growth efficiency for this a_age.
Definition: Hare_All.h:589
hay_bailing
Definition: Treatment.h:101
fa_manganesesulphate
Definition: Treatment.h:73
fp_k
Definition: Treatment.h:55
Landscape::Warn
void Warn(std::string a_msg1, std::string a_msg2)
Wrapper for the g_msg Warn function.
Definition: Landscape.h:2250
THare_Population_Manager::GetTotalDensity
int GetTotalDensity(int x, int y)
Density function - returns the density of all hares in the square containing by x,...
Definition: Hare_All.h:683
autumn_plough
Definition: Treatment.h:34
TAnimal::m_Location_x
int m_Location_x
The objects ALMaSS x coordinate.
Definition: PopulationManager.h:362
fp_slurry
Definition: Treatment.h:58
fiber_covering
Definition: Treatment.h:128
summer_sow
Definition: Treatment.h:50
spring_sow_with_ferti
Definition: Treatment.h:115
sleep_all_day
Definition: Treatment.h:33
strigling_sow
Definition: Treatment.h:107