![]() |
ALMaSS
1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
|
The generic base class for juvenile spiders
More...
#include <Spider_BaseClasses.h>
Public Member Functions | |
void | EndStep () |
EndStep behaviour - must be implemented in descendent classes. More... | |
Spider_Juvenile (int x, int y, Landscape *L, Spider_Population_Manager *SpPM) | |
the constructor More... | |
virtual void | ReInit (int x, int y, Landscape *L, Spider_Population_Manager *SpPM) |
Used to reinitialise reused objects More... | |
virtual void | BeginStep () |
The BeginStep code More... | |
virtual void | Step () |
The Step code More... | |
virtual bool | OnFarmEvent (FarmToDo event) |
Determines the impact of any farm management events at the juvenile's location More... | |
virtual void | SpecialWinterMort () |
Used to impose extra mortaltiy to those spiderlings that don't reach a minimum developmental stage by the end of the year More... | |
![]() | |
Spider_Base (int x, int y, Landscape *L, Spider_Population_Manager *SpMan) | |
Constructor More... | |
void | ReInit (int x, int y, Landscape *L, Spider_Population_Manager *SpMan) |
Reinitialise object code More... | |
void | Init (Spider_Population_Manager *p_spMan) |
Used it initialise objects (also used by ReInit) More... | |
virtual int | WhatState () |
Returns the current spider behavioural state More... | |
virtual void | KillThis () |
Destroys the spider 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 | 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 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... | |
Static Public Attributes | |
static int | m_JuvDensityDepMortConst = 0 |
Juvenile density dependent mortality threshold More... | |
static std::array< int, 40 > | m_DispersalChance = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } |
Disperals probability as a function of bad habitat days More... | |
static double | m_JuvDevelConst = 0 |
Day degrees maturation threshold More... | |
![]() | |
static int | m_DenDependenceConst0 = 0 |
This is the number of local spiders needed before density dependent mortality will kill More... | |
static int | m_SimW = 0 |
The width of the landscape More... | |
static int | m_SimH = 0 |
The height of the landscape More... | |
Protected Member Functions | |
virtual TTypesOfSpiderState | st_Develop () |
The behavioural state development More... | |
virtual TTypesOfSpiderState | st_AssessHabitat () |
The behavioural state assess habitat More... | |
virtual TTypesOfSpiderState | st_Balloon () |
The behavioural state balloon More... | |
virtual TTypesOfSpiderState | st_Walk () |
The bheavioural state walk More... | |
virtual void | Maturation () |
The behavioural state maturation More... | |
virtual bool | BallooningMortality (int dist) |
Determines the ballooning mortality associated with distance dist More... | |
virtual int | BalloonTo (int direction, int distance) |
Carry out ballooning in a given direction and distance More... | |
virtual int | WalkTo (int direction) |
Walk in a given direction More... | |
virtual TTypesOfSpiderState | AssessHabitat () |
Evaluates the habitat at current location More... | |
virtual int | Balloon () |
Carries out ballooning More... | |
virtual int | Walk () |
Carries out walking More... | |
virtual SpiderFoodQuality | AssessFood () |
Evaluates food status at current location More... | |
virtual SpiderFoodQuality | CheckToleTovIndex () |
Returns the movement map value at current location More... | |
virtual void | AddToBadHabitatDays () |
Increments bad habitat days up to max of 39 More... | |
virtual void | CalcDrought () |
For extension in descendent classes to calculate drought days for mortality More... | |
![]() | |
virtual bool | EggPosValid (unsigned a_x, unsigned a_y) |
Checks if its possible to create an eggsac here More... | |
bool | HatchDensityMort (int a_x, int a_y, int a_range) |
Checks for density-dependent mortality at this location More... | |
virtual int | CheckPosMap (unsigned x, unsigned y) |
Returns the value in m_OurPosMap for this location More... | |
virtual bool | GetPosMapPositive (unsigned x, unsigned y, unsigned range) |
Returns whether there are any non-zero values within range of this coordinate (TL corner) More... | |
virtual int | GetPosMapDensity (unsigned x, unsigned y, unsigned range) |
Returns total number of non-zero locations within range of this coordinate (TL corner) More... | |
virtual void | ClearPosMap (unsigned x, unsigned y) |
Clears a PosMap location More... | |
virtual void | SetPosMap (unsigned x, unsigned y) |
Sets a PosMap location to non-zero More... | |
![]() | |
void | CorrectWrapRound () |
Corrects wrap around co-ordinate problems. More... | |
Protected Attributes | |
char | m_MyDirection |
The currrent movement direction More... | |
bool | m_MustBalloon |
Flag to force ballooning if possible More... | |
int | m_BadHabitatDays |
The number of days in bad conditions More... | |
double | m_droughtFactor |
The running score of drought conditions More... | |
![]() | |
double | m_AgeDegrees |
A local pointer the population manager More... | |
int | m_Age |
Stores the spiders age in days More... | |
TTypesOfSpiderState | m_CurrentSpState |
Stores the current behavioural state More... | |
unsigned | m_Lifestage { 0 } |
This is a useful parameter holding the spider type. More... | |
SimplePositionMap * | m_OurPosMap |
Contains a pointer to the relevant position map - allocation of this must be controlled by the descendent class init. 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... | |
Additional Inherited Members | |
![]() | |
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... | |
![]() | |
double | m_pesticide_accum |
Body-burden of pesticde More... | |
Spider_Population_Manager * | m_OurPopulationManager |
![]() | |
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... | |
The generic base class for juvenile spiders
Spider_Juvenile::Spider_Juvenile | ( | int | x, |
int | y, | ||
Landscape * | L, | ||
Spider_Population_Manager * | SpPM | ||
) |
|
inlineprotectedvirtual |
Increments bad habitat days up to max of 39
References m_BadHabitatDays.
Referenced by AssessHabitat(), st_Develop(), and Spider_Female::st_Reproduce().
|
protectedvirtual |
Evaluates food status at current location
References cfg_HighFoodLevel, cfg_LowFoodLevel, cfg_NoFoodLevel, CheckToleTovIndex(), TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, sfq_Best, sfq_None, sfq_Ok, sfq_Poor, Landscape::SupplyInsects(), and CfgFloat::value().
Referenced by st_Develop(), and Spider_Female::st_Reproduce().
|
protectedvirtual |
Evaluates the habitat at current location
References AddToBadHabitatDays(), cfg_ExtraCompetionMortality, Spider_Population_Manager::CheckHumidity(), CheckToleTovIndex(), g_random_fnc(), Spider_Population_Manager::IsBallooningWeather(), Spider_Base::m_CurrentSpState, TAnimal::m_Location_x, TAnimal::m_Location_y, m_MustBalloon, TAnimal::m_OurLandscape, Spider_Base::m_OurPopulationManager, sfq_Best, sfq_Lethal, sfq_None, sfq_Ok, sfq_Poor, tosps_Develop, tosps_Dying, tosps_Move, CfgInt::value(), and Landscape::Warn().
Referenced by st_AssessHabitat().
|
protectedvirtual |
Carries out ballooning
References BallooningMortality(), BalloonTo(), g_random_fnc(), Spider_Population_Manager::GetBTimeToday(), Spider_Population_Manager::GetDispDist(), Spider_Population_Manager::GetWindDirection(), and Spider_Base::m_OurPopulationManager.
Referenced by st_Balloon(), and Spider_Female::st_Balloon().
|
protectedvirtual |
Determines the ballooning mortality associated with distance dist
References g_random_fnc(), Spider_Population_Manager::GetBallooningMortalityPerMeter(), and Spider_Base::m_OurPopulationManager.
Referenced by Balloon().
|
protectedvirtual |
Carry out ballooning in a given direction and distance
References cfg_BalDensityDepMortConst, Spider_Base::GetPosMapPositive(), TAnimal::m_guard_cell_x, TAnimal::m_guard_cell_y, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, Spider_Base::m_OurPopulationManager, Spider_Base::m_SimH, Spider_Base::m_SimW, spider_tole_lethal(), Population_Manager::UpdateGuardMap(), and CfgInt::value().
Referenced by Balloon().
|
virtual |
The BeginStep code
Reimplemented from TALMaSSObject.
Reimplemented in Spider_Female.
References CalcDrought(), TAnimal::CheckManagement(), Spider_Base::ClearPosMap(), Spider_Base::GetPosMapPositive(), Spider_Base::m_Age, TALMaSSObject::m_CurrentStateNo, m_JuvDensityDepMortConst, TAnimal::m_Location_x, TAnimal::m_Location_y, Spider_Base::m_OurPopulationManager, Spider_Base::m_SimH, TALMaSSObject::m_StepDone, and Spider_Base::SetPosMap().
|
inlineprotectedvirtual |
For extension in descendent classes to calculate drought days for mortality
Reimplemented in Erigone_Female, Oedothorax_Female, Erigone_Juvenile, and Oedothorax_Juvenile.
Referenced by BeginStep(), and Spider_Female::BeginStep().
|
protectedvirtual |
Returns the movement map value at current location
Reimplemented in Oedothorax_Juvenile.
References MovementMapUnsigned::GetMapValue(), TAnimal::m_Location_x, TAnimal::m_Location_y, Spider_Population_Manager::m_MoveMap, TAnimal::m_OurLandscape, Spider_Base::m_OurPopulationManager, sfq_Chameleon, and spider_toc_index().
Referenced by AssessFood(), and AssessHabitat().
|
virtual |
EndStep behaviour - must be implemented in descendent classes.
Reimplemented from TALMaSSObject.
Reimplemented in Spider_Female.
References cfg_SpiderJuvPPPEffectProb, cfg_SpiderJuvPPPElimiationRate, cfg_SpiderJuvPPPThreshold, g_rand_uni_fnc(), Spider_Base::m_CurrentSpState, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, Spider_Base::m_pesticide_accum, ppp_1, Landscape::SupplyPesticide(), tosps_Dying, and CfgFloat::value().
|
protectedvirtual |
The behavioural state maturation
References Spider_Population_Manager::CreateObjects(), SimplePositionMap::GetMapValue(), struct_Spider::L, Spider_Population_Manager::m_AdultPosMap, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, Spider_Base::m_OurPopulationManager, SimplePositionMap::SetMapValue(), spider_tole_juvenile_maturation_valid(), struct_Spider::SpPM, tspi_Female, struct_Spider::x, and struct_Spider::y.
Referenced by Step().
|
inlinevirtual |
Determines the impact of any farm management events at the juvenile's location
Reimplemented from Spider_Base.
Reimplemented in Spider_Female, Oedothorax_Female, Erigone_Female, Oedothorax_Juvenile, and Erigone_Juvenile.
|
virtual |
Used to reinitialise reused objects
Reimplemented in Spider_Female.
References Spider_Base::m_Age, Spider_Base::m_AgeDegrees, Spider_Population_Manager::m_JuvPosMap, Spider_Base::m_OurPopulationManager, Spider_Base::m_OurPosMap, and Spider_Base::ReInit().
Referenced by Spider_Female::ReInit().
|
virtual |
Used to impose extra mortaltiy to those spiderlings that don't reach a minimum developmental stage by the end of the year
References Spider_Base::m_AgeDegrees, Spider_Base::m_CurrentSpState, m_JuvDevelConst, Spider_Base::m_OurPopulationManager, and tosps_Dying.
|
inlineprotectedvirtual |
The behavioural state assess habitat
References AssessHabitat().
Referenced by Step(), and Spider_Female::Step().
|
protectedvirtual |
The behavioural state balloon
Reimplemented in Spider_Female.
References Balloon(), Spider_Base::ClearPosMap(), Spider_Base::m_CurrentSpState, TAnimal::m_Location_x, TAnimal::m_Location_y, m_MustBalloon, Spider_Base::m_OurPopulationManager, Spider_Base::m_OurPosMap, SimplePositionMap::SetMapValue(), tosps_Develop, and tosps_Dying.
Referenced by Step().
|
protectedvirtual |
The behavioural state development
References AddToBadHabitatDays(), AssessFood(), g_rand_uni_fnc(), g_random_fnc(), Spider_Population_Manager::GetJuvDegrees_good(), Spider_Population_Manager::GetJuvDegrees_intermediate(), Spider_Population_Manager::GetJuvDegrees_poor(), Spider_Population_Manager::GetJuvMort(), Spider_Base::m_AgeDegrees, m_BadHabitatDays, Spider_Base::m_CurrentSpState, m_DispersalChance, m_JuvDevelConst, Spider_Base::m_OurPopulationManager, sfq_Best, sfq_None, sfq_Ok, sfq_Poor, tosps_Develop, tosps_Dying, tosps_Mature, and tosps_Move.
Referenced by Step().
|
protectedvirtual |
The bheavioural state walk
Reimplemented in Spider_Female.
References SimplePositionMap::ClearMapValue(), TAnimal::m_Location_x, TAnimal::m_Location_y, Spider_Base::m_OurPopulationManager, Spider_Base::m_OurPosMap, TALMaSSObject::m_StepDone, SimplePositionMap::SetMapValue(), tosps_Develop, tosps_Dying, and Walk().
Referenced by Step().
|
virtual |
The Step code
Reimplemented from TALMaSSObject.
Reimplemented in Spider_Female.
References SimplePositionMap::ClearMapValue(), Spider_Population_Manager::GetWalking(), Spider_Base::m_CurrentSpState, TALMaSSObject::m_CurrentStateNo, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, Spider_Base::m_OurPopulationManager, Spider_Base::m_OurPosMap, TALMaSSObject::m_StepDone, Maturation(), st_AssessHabitat(), st_Balloon(), st_Develop(), st_Walk(), tosps_AssessHabitat, tosps_Develop, tosps_Dying, tosps_Initiation, tosps_JBalloon, tosps_JWalk, tosps_Mature, tosps_Move, and Landscape::Warn().
|
protectedvirtual |
Carries out walking
References g_random_fnc(), Spider_Population_Manager::GetMinWalkTemp(), m_BadHabitatDays, m_DispersalChance, m_MyDirection, Spider_Base::m_OurPopulationManager, and WalkTo().
Referenced by st_Walk(), and Spider_Female::st_Walk().
|
protectedvirtual |
Walk in a given direction
References cfg_WalDensityDepMortConst, Spider_Base::CheckPosMap(), Spider_Base::m_DenDependenceConst0, TAnimal::m_guard_cell_x, TAnimal::m_guard_cell_y, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, Spider_Base::m_OurPopulationManager, Spider_Base::m_SimH, Spider_Base::m_SimW, spider_tole_lethal(), Landscape::SupplyElementType(), Population_Manager::UpdateGuardMap(), and CfgInt::value().
Referenced by Walk().
|
protected |
The number of days in bad conditions
Referenced by AddToBadHabitatDays(), Spider_Juvenile(), st_Develop(), Spider_Female::st_Reproduce(), Spider_Female::Step(), and Walk().
|
static |
Disperals probability as a function of bad habitat days
Referenced by Erigone_Population_Manager::Init(), Oedothorax_Population_Manager::Init(), st_Develop(), Spider_Female::Step(), and Walk().
|
protected |
The running score of drought conditions
|
static |
Juvenile density dependent mortality threshold
Referenced by BeginStep(), Erigone_Population_Manager::Init(), and Oedothorax_Population_Manager::Init().
|
static |
Day degrees maturation threshold
Referenced by Erigone_Population_Manager::Init(), Oedothorax_Population_Manager::Init(), SpecialWinterMort(), and st_Develop().
|
protected |
Flag to force ballooning if possible
Referenced by AssessHabitat(), Spider_Female::CreateEggSac(), Erigone_Juvenile::OnFarmEvent(), Oedothorax_Juvenile::OnFarmEvent(), Erigone_Female::OnFarmEvent(), Oedothorax_Female::OnFarmEvent(), Spider_Juvenile(), st_Balloon(), and Spider_Female::st_Balloon().
|
protected |
The currrent movement direction
Referenced by Spider_Juvenile(), and Walk().