![]() |
ALMaSS
1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
|
Class for young hares (low mobility, milk and solid food inputs) More...
#include <Hare_All.h>
Public Member Functions | |
void | BeginStep (void) override |
BeginStep for Hare_Young. More... | |
void | Step (void) override |
Step code for Hare_Young. More... | |
void | EndStep (void) override |
EndStep code for Hare_Young. More... | |
Hare_Young (int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM, double p_weight) | |
Constructor for Hare_Young. More... | |
void | ReInit (struct_Hare a_data) |
Young object reinitiation. More... | |
void | Init (double p_weight) |
Object initiation. More... | |
~Hare_Young () override | |
Destructor for Hare_Young. More... | |
void | ON_Dead () override |
This hare has been killed. 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_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... | |
![]() | |
THare (int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM) | |
Constructor. More... | |
void | THareInit (int p_x, int p_y, THare_Population_Manager *p_PPM) |
Object Initiation. More... | |
~THare () override | |
Destructor. More... | |
double | GetWeight () |
double | GetTotalWeight () |
Provide the wet weight of the hare. More... | |
int | GetAge () |
Provide the age of the hare. More... | |
void | ON_MumDead (Hare_Female *a_Mum) |
Inform Mum that we are dead. More... | |
Hare_Female * | GetMum () |
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... | |
![]() | |
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... | |
![]() | |
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 code for the young hare. More... | |
TTypeOfHareState | st_Dispersal () override |
Not used. More... | |
TTypeOfHareState | st_Foraging () |
Young foraging. More... | |
void | st_NextStage () |
Maturation to Hare_Juvenile. More... | |
TTypeOfHareState | st_Resting () |
Resting. More... | |
bool | OnFarmEvent (FarmToDo event) override |
Response to farm actions. More... | |
![]() | |
TTypeOfHareState | st_Developing () |
Developmental behaviour for the infant hare. More... | |
void | st_NextStage () |
'mature' to become a young More... | |
![]() | |
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... | |
![]() | |
void | CorrectWrapRound () |
Corrects wrap around co-ordinate problems. More... | |
Additional Inherited Members | |
![]() | |
static void | SetMum (Hare_Female *) |
Set the mother pointer. Reimplemented in Hare_Infant. More... | |
![]() | |
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 void | OnArrayBoundsError () |
Used for debugging only, tests basic object properties. More... | |
![]() | |
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... | |
![]() | |
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_Female * | m_MyMum = nullptr |
Pointer to the hare's mum. More... | |
THare_Population_Manager * | m_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... | |
![]() | |
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 |
![]() | |
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 Landscape * | m_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... | |
Class for young hares (low mobility, milk and solid food inputs)
Hare_Young::Hare_Young | ( | int | p_x, |
int | p_y, | ||
Landscape * | p_L, | ||
THare_Population_Manager * | p_PPM, | ||
double | p_weight | ||
) |
|
override |
Destructor for Hare_Young.
|
overridevirtual |
BeginStep for Hare_Young.
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 Hare_Infant.
References cfg_hare_escape_dist, cfg_hare_proximity_alert, cfg_MaxEnergyIntakeScaler, TAnimal::CheckManagement(), g_rand_uni_fnc(), THare_Population_Manager::GetInterference(), THare_Population_Manager::GetKJperM(), THare::GetRMR(), THare_Population_Manager::GetTotalDensity(), THare::m_ActivityTime, THare::m_CurrentHState, TALMaSSObject::m_CurrentStateNo, THare::m_EnergyMax, THare_Population_Manager::m_HareThresholdDD, THare::m_KJForaging, THare::m_KJRunning, THare::m_KJWalking, TAnimal::m_Location_x, TAnimal::m_Location_y, THare::m_old_weight, THare::m_OurPopulationManager, TALMaSSObject::m_StepDone, THare::m_weight, THare_Population_Manager::m_YoungMortRate, ON_Dead(), THare::Running(), st_NextStage(), tohs_NextStage, CfgInt::value(), and CfgFloat::value().
|
overridevirtual |
EndStep code for Hare_Young.
NB development must be called here because they hares may be still getting milk from Mum.
In EndStep, the home-range centre peg gravitates a little way towards the daily activity area for today.
Reimplemented from Hare_Infant.
References cfg_hare_pesticideresponse_on, THare::InternalPesticideHandlingAndResponse(), THare::m_CurrentHState, THare::MovePeg(), ON_Dead(), st_Developing(), tohs_Developing, tohs_Dying, and CfgBool::value().
void Hare_Young::Init | ( | double | p_weight | ) |
|
overridevirtual |
This hare has been killed.
Housekeeping for removal of the object, lets Mum know if there is a Mum
Reimplemented from Hare_Infant.
References THare::st_Dying().
Referenced by BeginStep(), EndStep(), and OnFarmEvent().
|
overrideprotectedvirtual |
Response to farm actions.
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 Hare_Infant.
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_y_cut, cfg_hare_y_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.
void Hare_Young::ReInit | ( | struct_Hare | a_data | ) |
Young object reinitiation.
References struct_Hare::HM, Hare_Infant::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.
|
protected |
Developmental code for the young hare.
References cfg_young_starvation_threshold, THare_Population_Manager::GetGrowthEfficiencyP(), THare_Population_Manager::GetMaxDailyGrowthEnergyP(), THare::m_Age, THare::m_old_weight, THare::m_OurPopulationManager, THare::m_StarvationDays, THare::m_TodaysEnergy, THare::m_weight, tohs_Dying, tohs_Foraging, tohs_NextStage, and CfgInt::value().
Referenced by EndStep().
|
overrideprotectedvirtual |
Not used.
Unused at present
Reimplemented from THare.
References tohs_Foraging.
Referenced by Step().
|
protected |
Young foraging.
The amount of time spent on this is dependent upon age. They can take in food up to a proportion of their needs increasing with age. This gives us a little problem because we don't explicitly define their needs. We assume therefore that the milk supply is maximal and that the the time available is all day - but that the max solid food intake possible is defined by age, following the data from Hacklander - this gives no flexibility in the proportion of max food but will cause differential growth w.r.t. milk supply.
References activity_Foraging, cfg_ForageRestingRatio, cfg_hare_pesticideresponse_on, THare::Forage(), THare::ForageP(), g_MaxLeveretGrowthEnergy, g_PropSolidFood, THare_Population_Manager::GetRMR(), THare::GetTotalWeight(), THare::m_ActivityTime, THare::m_Age, THare::m_OurPopulationManager, THare::m_TodaysEnergy, THare::TimeBudget(), tohs_Resting, CfgFloat::value(), and CfgBool::value().
Referenced by Step().
|
protected |
Maturation to Hare_Juvenile.
Young 'matures' to become a Hare_Juvenile.
This creats a Hare_Juvenile object via a call to create objects, then sets the flag for destruction of this object.
References THare_Population_Manager::CreateObjects(), struct_Hare::HM, THare::m_CurrentHState, TALMaSSObject::m_CurrentStateNo, TAnimal::m_Location_x, TAnimal::m_Location_y, THare::m_MyMum, TAnimal::m_OurLandscape, THare::m_OurPopulationManager, TALMaSSObject::m_StepDone, THare::m_weight, Hare_Female::ON_RemoveYoung(), and tohs_DestroyObject.
Referenced by BeginStep().
|
protected |
Resting.
Just uses some time and energy sitting around. The time used is important because it removes time for foraging.
References activity_Resting, THare::EnergyBalance(), THare::m_ActivityTime, THare::TimeBudget(), and tohs_Developing.
Referenced by Step().
|
overridevirtual |
Step code for Hare_Young.
Reimplemented from Hare_Infant.
References THare::m_CurrentHState, TALMaSSObject::m_CurrentStateNo, TAnimal::m_OurLandscape, TALMaSSObject::m_StepDone, st_Dispersal(), st_Foraging(), st_Resting(), tohs_Developing, tohs_Dispersal, tohs_Dying, tohs_Foraging, tohs_InitialState, tohs_Resting, and Landscape::Warn().