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

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

#include <Hare_all.h>

Public Member Functions

virtual void BeginStep (void)
 BeginStep for the Hare_Infant. More...
 
virtual void EndStep (void)
 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 Init ()
 Object initiation. More...
 
void ON_BeingFed (double a_someMilk)
 Get energy from milk given. More...
 
virtual void ON_Dead ()
 This hare has been killed. More...
 
void ReInit (struct_Hare a_data)
 Infant object reinitiation. More...
 
void SetMum (Hare_Female *a_af)
 Set the mother pointer. More...
 
void SetWeight (double w)
 Set the weight. More...
 
virtual void Step (void)
 Step for the Hare_Infant. More...
 
virtual ~Hare_Infant ()
 Hare infant destructor. 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...
 
virtual TTypeOfHareState st_Dispersal ()
 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...
 

Protected Member Functions

bool OnFarmEvent (FarmToDo event)
 Do we require a response to a farm event. More...
 
TTypeOfHareState st_Developing ()
 Developmental behaviour for the infant hare. More...
 
void st_NextStage ()
 'mature' to become a young 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 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 infant hares (stationary, only milk inputs)

Definition at line 817 of file Hare_all.h.

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.

Definition at line 1270 of file Hare_all.cpp.

1272  : THare(p_x,p_y,p_L,p_PPM)
1273 {
1274  Init();
1275 }

References Init().

◆ ~Hare_Infant()

Hare_Infant::~Hare_Infant ( )
virtual

Hare infant destructor.

Definition at line 1295 of file Hare_all.cpp.

1296 {
1297  //Nothing to do
1298 }

Member Function Documentation

◆ BeginStep()

void Hare_Infant::BeginStep ( void  )
virtual

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.

Definition at line 1308 of file Hare_all.cpp.

1309 {
1310  if (m_CurrentStateNo == -1) return;
1311  // These are all the same value - this may change to so I have kept all three
1312  // for now ver 00005
1316  m_ActivityTime=1440; // Start the day
1318 #ifdef __DDEPMORT
1320 #ifdef __THRESHOLD_DD
1321  if (dens<m_OurPopulationManager->m_HareThresholdDD) dens=0;
1322 #endif
1323  double inter=m_OurPopulationManager->GetInterference(dens);
1324  if (g_rand_uni() > inter) {
1325  ON_Dead();
1326  m_StepDone=true; // We need to skip the step code, we are dead
1327  return;
1328  }
1329 #endif
1331  ON_Dead();
1332  m_StepDone=true; // We need to skip the step code, we are dead
1333  }
1334 
1335  if (m_MyMum==NULL) {
1336  ON_Dead();
1337  m_StepDone=true; // We need to skip the step code, we are dead
1338  }
1339  // Set out maximum intake possible
1340  CheckManagement();
1341 }

References TAnimal::CheckManagement(), g_rand_uni, 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  )
virtual

EndStep for the Hare_Infant.

Reimplemented from THare.

Reimplemented in Hare_Young.

Definition at line 1390 of file Hare_all.cpp.

1391 {
1393  // Legal returns are:
1394  // tohs_Developing
1395  // tohs_NextStage
1396  // tohs_Dying
1398  }
1399  if (m_CurrentHState==tohs_Dying) {
1400  ON_Dead();
1401  } else MovePeg();
1402 }

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

◆ Init()

void Hare_Infant::Init ( )

Object initiation.

Definition at line 1285 of file Hare_all.cpp.

1286 {
1287  m_Type = hob_Infant;
1288  m_weight = -1; // just so we know we must set this somewhere else
1289  m_old_weight = 0;
1290  m_Age = 1; // We are 0 day old today
1291 }

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

Definition at line 1698 of file Hare_all.cpp.

1699 {
1704  m_TodaysEnergy+=a_someMilk;
1705 }

References THare::m_TodaysEnergy.

◆ ON_Dead()

void Hare_Infant::ON_Dead ( void  )
virtual

This hare has been killed.

Do the housekeeping necessary before dying

Reimplemented from THare.

Reimplemented in Hare_Young.

Definition at line 1688 of file Hare_all.cpp.

1689 {
1690  st_Dying();
1691 }

References THare::st_Dying().

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

◆ OnFarmEvent()

bool Hare_Infant::OnFarmEvent ( FarmToDo  event)
protectedvirtual

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.

Definition at line 1408 of file Hare_all.cpp.

1409 {
1410  bool result=false;
1411  switch ( event )
1412  {
1413  case sleep_all_day:
1414  case glyphosate:
1415  break;
1416  case autumn_plough:
1417  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1418  break;
1419  case stubble_plough:
1420  if (random(100) < cfg_hare_i_cut.value()) result = true;
1421  break;
1423  if (random(100) < cfg_hare_i_cut.value()) result = true;
1424  break;
1426  if (random(100) < cfg_hare_i_cut.value()) result = true;
1427  break;
1428  case autumn_harrow:
1429  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1430  break;
1431  case preseeding_cultivator:
1432  if (random(100) < cfg_hare_i_cut.value()) result = true;
1433  break;
1435  if (random(100) < cfg_hare_i_cut.value()) result = true;
1436  break;
1437  case autumn_roll:
1438  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1439  break;
1440  case autumn_sow:
1441  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1442  break;
1443  case winter_plough:
1444  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1445  break;
1446  case deep_ploughing:
1447  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1448  break;
1449  case spring_plough:
1450  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1451  break;
1452  case spring_harrow:
1453  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1454  break;
1455  case shallow_harrow:
1456  if (random(100) < cfg_hare_i_cut.value()) result = true;
1457  break;
1458  case spring_roll:
1459  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1460  break;
1461  case spring_sow:
1462  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1463  break;
1464  case spring_sow_with_ferti:
1465  if (random(100) < cfg_hare_i_cut.value()) result = true;
1466  break;
1467  case fp_npks:
1468  break;
1469  case fp_npk:
1470  break;
1471  case fp_pk:
1472  break;
1473  case fp_liquidNH3:
1474  break;
1475  case fp_slurry:
1476  break;
1477  case fp_ammoniumsulphate:
1478  break;
1479  case fp_manganesesulphate:
1480  break;
1481  case fp_manure:
1482  break;
1483  case fp_greenmanure:
1484  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1485  break;
1486  case fp_sludge:
1487  break;
1488  case fp_rsm:
1489  break;
1490  case fp_calcium:
1491  break;
1492  case fa_npks:
1493  break;
1494  case fa_npk:
1495  break;
1496  case fa_pk:
1497  break;
1498  case fa_slurry:
1499  break;
1500  case fa_ammoniumsulphate:
1501  break;
1502  case fa_manganesesulphate:
1503  break;
1504  case fa_manure:
1505  break;
1506  case fa_greenmanure:
1507  break;
1508  case fa_sludge:
1509  break;
1510  case fa_rsm:
1511  break;
1512  case fa_calcium:
1513  break;
1514  case herbicide_treat:
1515  break;
1516  case growth_regulator:
1517  break;
1518  case fungicide_treat:
1519  break;
1521  case trial_toxiccontrol:
1522  case trial_control:
1523  case syninsecticide_treat:
1524  case insecticide_treat:
1525  case product_treat:
1526  case biocide:
1527  break;
1528  case molluscicide:
1529  break;
1530  case row_cultivation:
1531  break;
1532  case strigling:
1533  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1534  break;
1535  case strigling_hill:
1536  if (random(100) < cfg_hare_i_cut.value()) result = true;
1537  break;
1538  case hilling_up:
1539  break;
1540  case water:
1541  break;
1542  case swathing:
1543  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1544  break;
1545  case harvest:
1546  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1547  break;
1548  case cattle_out:
1549  break;
1550  case cattle_out_low:
1551  break;
1552  case cut_to_hay:
1553  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1554  break;
1555  case cut_to_silage:
1556  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1557  break;
1558  case straw_chopping:
1559  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1560  break;
1561  case hay_turning:
1562  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1563  break;
1564  case hay_bailing:
1565  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1566  break;
1567 
1568  case stubble_harrowing:
1569  break;
1571  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1572  break;
1573  case burn_straw_stubble:
1574  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1575  break;
1576  case mow:
1577  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1578  break;
1579  case cut_weeds:
1580  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1581  break;
1582  case pigs_out:
1583  result=true;
1584  break;
1585  case strigling_sow:
1586  if ( random( 100 ) < cfg_hare_i_cut.value() ) result=true;
1587  break;
1588  case bed_forming:
1589  if (random(100) < cfg_hare_i_cut.value()) result = true;
1590  break;
1591  case flower_cutting:
1592  if (random(100) < cfg_hare_i_cut.value()) result = true;
1593  break;
1594  case bulb_harvest:
1595  if (random(100) < cfg_hare_i_cut.value()) result = true;
1596  break;
1597  case straw_covering:
1598  break;
1599  case straw_removal:
1600  break;
1601  default:
1602  m_OurLandscape->Warn( "Hare_Infant::OnFarmEvent(): Unknown event type:", m_OurLandscape->EventtypeToString( event ) );
1603  exit( 1 );
1604  }
1605  if (result) {
1606  ON_Dead();
1607  }
1608  return result;
1609 }

References autumn_harrow, autumn_or_spring_plough, autumn_plough, autumn_roll, autumn_sow, bed_forming, biocide, bulb_harvest, burn_straw_stubble, cattle_out, cattle_out_low, cfg_hare_i_cut(), cut_to_hay, cut_to_silage, cut_weeds, deep_ploughing, Landscape::EventtypeToString(), fa_ammoniumsulphate, fa_calcium, fa_greenmanure, fa_manganesesulphate, fa_manure, fa_npk, fa_npks, fa_pk, fa_rsm, fa_sludge, fa_slurry, flower_cutting, fp_ammoniumsulphate, fp_calcium, fp_greenmanure, fp_liquidNH3, fp_manganesesulphate, fp_manure, fp_npk, fp_npks, fp_pk, fp_rsm, fp_sludge, fp_slurry, fungicide_treat, glyphosate, growth_regulator, harvest, hay_bailing, hay_turning, heavy_cultivator_aggregate, herbicide_treat, hilling_up, insecticide_treat, TAnimal::m_OurLandscape, molluscicide, mow, ON_Dead(), pigs_out, preseeding_cultivator, preseeding_cultivator_sow, product_treat, row_cultivation, shallow_harrow, 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, swathing, syninsecticide_treat, trial_control, trial_insecticidetreat, trial_toxiccontrol, Landscape::Warn(), water, and winter_plough.

◆ ReInit()

void Hare_Infant::ReInit ( struct_Hare  a_data)

Infant object reinitiation.

Definition at line 1276 of file Hare_all.cpp.

1277 {
1278  m_Location_x = a_data.x;
1279  m_Location_y = a_data.y;
1280  m_OurLandscape = a_data.L;
1281  m_CurrentStateNo = 0;
1282  THareInit(a_data.x, a_data.y, a_data.HM);
1283  Init();
1284 }

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.

Referenced by THare_Population_Manager::CreateObjects().

◆ SetMum()

void Hare_Infant::SetMum ( Hare_Female a_af)
inline

Set the mother pointer.

Definition at line 856 of file Hare_all.h.

856 { 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

Definition at line 851 of file Hare_all.h.

851 { 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

Definition at line 1615 of file Hare_all.cpp.

1616 {
1622  //int weight=(int) (floor(m_weight+0.5));
1623  double lost = m_OurPopulationManager->GetRMR(m_Age,GetTotalWeight()); // Uses age, weight and ambient temperature
1625  //** Then grow if possible, or shrink if -ve energy
1626  double gained=(m_TodaysEnergy-lost);
1628  m_weight+=gained*eff;
1629 
1630  // We need to know whether the growth rate is positive or negative.
1631  // We could look at lost here, but it is probably easier to use the same
1632  // approach for Young as well, and they need the oldweight variable, so might as well use this.
1633 #ifdef __MINGROWTHATTAIN
1634  // Take a check on our growth - if we are below X% of the max expected weight then die
1635  if (m_weight< m_OurPopulationManager->m_DMWeight[m_Age]) return tohs_Dying;
1636 #else
1637  if (m_weight<m_old_weight) {
1638  m_StarvationDays++;
1639  }
1640  else m_StarvationDays=0;
1645  return tohs_Dying;
1646  }
1647 #endif
1648 
1650  m_TodaysEnergy=0;
1652  if (++m_Age>10) return tohs_NextStage;
1653  return tohs_Developing;
1654 }

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, and tohs_NextStage.

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.

Definition at line 1659 of file Hare_all.cpp.

1660 {
1664  struct_Hare* sp;
1665  sp = new struct_Hare;
1666  sp->HM = m_OurPopulationManager;
1667  sp->L = m_OurLandscape;
1668  sp->x = m_Location_x;
1669  sp->y = m_Location_y;
1670  sp->weight = m_weight;
1671  sp->age = m_Age;
1672  // Updating of Mum is done through the population manager
1673  sp->Mum = m_MyMum;
1674  // *** Debug ***
1675  //sp->oldMum = m_MyOldMum;
1676  //
1677  m_OurPopulationManager->CreateObjects(1,this,NULL,sp,1);
1678  // Clean-up
1679  m_CurrentStateNo=-1; // Destroys the object at the next opportunity
1681  m_MyMum=NULL;
1682  delete sp;
1683 }

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, THare::m_MyMum, TAnimal::m_OurLandscape, THare::m_OurPopulationManager, THare::m_weight, struct_Hare::Mum, tohs_DestroyObject, struct_Hare::weight, struct_Hare::x, and struct_Hare::y.

Referenced by Step().

◆ Step()

void Hare_Infant::Step ( void  )
virtual

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.

Definition at line 1355 of file Hare_all.cpp.

1356 {
1357  if (m_StepDone || m_CurrentStateNo == -1) return;
1358  // The next line causes a jump to the correct behavioural state
1359  switch (m_CurrentHState)
1360  {
1361  case tohs_InitialState: // Initial state
1363  break;
1364  case tohs_Developing:
1365  m_StepDone=true;
1366  break;
1367  case tohs_NextStage:
1368  // Legal returns are:
1369  // NONE
1370  st_NextStage();
1371  m_StepDone=true;
1372  break;
1373  case tohs_Running:
1375  break;
1376  case tohs_Dying:
1377  m_StepDone=true;
1378  break;
1379  default:
1380  m_OurLandscape->Warn("Hare_Infant::Step - unknown state",NULL);
1381  exit(1);
1382  }
1383 }

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:
insecticide_treat
Definition: treatment.h:74
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
strigling
Definition: treatment.h:77
hay_bailing
Definition: treatment.h:89
flower_cutting
Definition: treatment.h:109
tohs_NextStage
Definition: Hare_all.h:72
autumn_roll
Definition: treatment.h:38
spring_sow_with_ferti
Definition: treatment.h:103
struct_Hare::y
int y
Definition: Hare_all.h:138
fa_ammoniumsulphate
Definition: treatment.h:65
autumn_harrow
Definition: treatment.h:37
preseeding_cultivator
Definition: treatment.h:39
tohs_Developing
Definition: Hare_all.h:73
Hare_Infant::st_NextStage
void st_NextStage()
'mature' to become a young
Definition: Hare_all.cpp:1659
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
autumn_sow
Definition: treatment.h:41
struct_Hare::age
int age
Definition: Hare_all.h:139
glyphosate
Definition: treatment.h:102
harvest
Definition: treatment.h:82
TAnimal::m_OurLandscape
Landscape * m_OurLandscape
Definition: PopulationManager.h:229
fp_slurry
Definition: treatment.h:52
fp_rsm
Definition: treatment.h:58
THare::m_ActivityTime
int m_ActivityTime
Minutes of potential activity time per day.
Definition: Hare_all.h:203
fa_sludge
Definition: treatment.h:68
fa_rsm
Definition: treatment.h:69
fp_greenmanure
Definition: treatment.h:56
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
straw_removal
Definition: treatment.h:112
hay_turning
Definition: treatment.h:88
bulb_harvest
Definition: treatment.h:110
Hare_Infant::Init
void Init()
Object initiation.
Definition: Hare_all.cpp:1285
straw_covering
Definition: treatment.h:111
shallow_harrow
Definition: treatment.h:107
heavy_cultivator_aggregate
Definition: treatment.h:108
THare::m_KJForaging
double m_KJForaging
KJ/m cost of foraging per kg hare.
Definition: Hare_all.h:238
water
Definition: treatment.h:80
fp_liquidNH3
Definition: treatment.h:51
molluscicide
Definition: treatment.h:75
burn_straw_stubble
Definition: treatment.h:92
THare::THareInit
void THareInit(int p_x, int p_y, THare_Population_Manager *p_PPM)
Object Initiation.
Definition: Hare_THare.cpp:72
cfg_infant_starvation_threshold
static CfgInt cfg_infant_starvation_threshold("HARE_INFANT_STARVE_THRESHOLD", CFG_CUSTOM, 4)
cfg_hare_i_cut
CfgInt cfg_hare_i_cut("HARE_CUTTING_MORT_INFANT", CFG_CUSTOM, 50)
cattle_out_low
Definition: treatment.h:100
tohs_DestroyObject
Definition: Hare_all.h:80
fp_pk
Definition: treatment.h:50
fa_npk
Definition: treatment.h:61
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
fp_npk
Definition: treatment.h:49
fa_npks
Definition: treatment.h:60
stubble_harrowing
Definition: treatment.h:90
stubble_plough
Definition: treatment.h:35
THare::m_KJRunning
double m_KJRunning
KJ/m cost of running per kg hare.
Definition: Hare_all.h:228
autumn_plough
Definition: treatment.h:34
fp_manure
Definition: treatment.h:55
TAnimal::m_Location_y
int m_Location_y
Definition: PopulationManager.h:228
strigling_sow
Definition: treatment.h:95
struct_Hare::L
Landscape * L
Definition: Hare_all.h:140
winter_plough
Definition: treatment.h:42
Hare_Infant::ON_Dead
virtual void ON_Dead()
This hare has been killed.
Definition: Hare_all.cpp:1688
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
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
THare::m_old_weight
double m_old_weight
State variale - last hare weight.
Definition: Hare_all.h:185
fp_sludge
Definition: treatment.h:57
straw_chopping
Definition: treatment.h:87
THare::m_TodaysEnergy
double m_TodaysEnergy
State variable - the amount of energy available today, can be in deficit.
Definition: Hare_all.h:218
fungicide_treat
Definition: treatment.h:73
deep_ploughing
Definition: treatment.h:43
preseeding_cultivator_sow
Definition: treatment.h:40
mow
Definition: treatment.h:93
fa_pk
Definition: treatment.h:62
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
spring_harrow
Definition: treatment.h:45
tohs_InitialState
Definition: Hare_all.h:71
THare_Population_Manager::m_YoungMortRate
double m_YoungMortRate
Input variable - Young mortality rate.
Definition: Hare_all.h:738
THare::st_Dying
void st_Dying()
Tidy up before removing the object on death.
Definition: Hare_THare.cpp:172
hilling_up
Definition: treatment.h:79
Landscape::EventtypeToString
std::string EventtypeToString(int a_event)
Definition: Landscape.cpp:3918
biocide
Definition: treatment.h:104
fa_calcium
Definition: treatment.h:70
syninsecticide_treat
Definition: treatment.h:99
fa_manure
Definition: treatment.h:66
fp_npks
Definition: treatment.h:48
THare::m_Age
int m_Age
State variale - hare age.
Definition: Hare_all.h:170
row_cultivation
Definition: treatment.h:76
trial_insecticidetreat
Definition: treatment.h:96
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
hob_Infant
Definition: Hare_all.h:57
fp_ammoniumsulphate
Definition: treatment.h:54
stubble_cultivator_heavy
Definition: treatment.h:36
THare::THare
THare(int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM)
Constructor.
Definition: Hare_THare.cpp:66
spring_plough
Definition: treatment.h:44
fa_greenmanure
Definition: treatment.h:67
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
fp_calcium
Definition: treatment.h:59
trial_toxiccontrol
Definition: treatment.h:97
spring_roll
Definition: treatment.h:46
fa_manganesesulphate
Definition: treatment.h:64
bed_forming
Definition: treatment.h:106
cut_weeds
Definition: treatment.h:94
Hare_Infant::st_Developing
TTypeOfHareState st_Developing()
Developmental behaviour for the infant hare.
Definition: Hare_all.cpp:1615
fp_manganesesulphate
Definition: treatment.h:53
THare::GetTotalWeight
double GetTotalWeight()
Provide the wet weight of the hare.
Definition: Hare_all.h:370
herbicide_treat
Definition: treatment.h:71
THare::m_MyMum
Hare_Female * m_MyMum
Pointer to the hare's mum.
Definition: Hare_all.h:190
growth_regulator
Definition: treatment.h:72
cut_to_silage
Definition: treatment.h:86
product_treat
Definition: treatment.h:101
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
g_rand_uni
boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni
TALMaSSObject::m_CurrentStateNo
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
Definition: PopulationManager.h:116
THare_Population_Manager::GetGrowthEfficiency
double GetGrowthEfficiency(int a_age)
Get the growth efficiency for this a_age.
Definition: Hare_all.h:590
pigs_out
Definition: treatment.h:84
struct_Hare::weight
double weight
Definition: Hare_all.h:144
trial_control
Definition: treatment.h:98
cut_to_hay
Definition: treatment.h:85
spring_sow
Definition: treatment.h:47
tohs_Running
Definition: Hare_all.h:78
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
sleep_all_day
Definition: treatment.h:33
TAnimal::m_Location_x
int m_Location_x
Definition: PopulationManager.h:225
autumn_or_spring_plough
Definition: treatment.h:91
strigling_hill
Definition: treatment.h:105
fa_slurry
Definition: treatment.h:63
swathing
Definition: treatment.h:81