Loading [MathJax]/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
Weasel Class Reference

The Weasel class is one of two current implementations of TPredator. More...

#include <Predators.h>

Inheritance diagram for Weasel:
TPredator TAnimal TALMaSSObject

Public Member Functions

virtual void BeginStep (void)
 BeingStep behaviour - must be implemented in descendent classes. More...
 
virtual void Step (void)
 Step behaviour - must be implemented in descendent classes. More...
 
virtual void EndStep (void)
 EndStep behaviour - must be implemented in descendent classes. More...
 
 Weasel (Vole_Population_Manager *ThePrey, int p_x, int p_y, Landscape *p_L, TPredator_Population_Manager *p_PPM)
 
virtual ~Weasel ()
 
- Public Member Functions inherited from TPredator
 TPredator (Vole_Population_Manager *ThePrey, int p_x, int p_y, Landscape *p_L, TPredator_Population_Manager *p_PPM)
 
 ~TPredator ()
 
bool OverlapMyTerritory (unsigned x, unsigned y)
 
virtual void st_Dispersal ()
 
virtual void st_Movement ()
 
virtual int st_Hunting ()
 
unsigned SupplySpeciesID ()
 
int SupplyKill ()
 
bool SupplyTerr ()
 
int SupplyKillEff ()
 
int SupplyHomeRange ()
 
- 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...
 
virtual bool OnFarmEvent (FarmToDo)
 Must be reimplemented if used in descendent classes. Sets the action on a management event. 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...
 

Additional Inherited Members

- 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...
 
- Protected Member Functions inherited from TAnimal
void CorrectWrapRound ()
 Corrects wrap around co-ordinate problems. More...
 
- Protected Attributes inherited from TPredator
TTypeOfPredatorState CurrentPState
 
unsigned SpeciesID
 
unsigned m_DispersalMax
 
unsigned m_SearchArea
 
int m_kills_this_season
 
int PreyResponse1
 
int PreyResponse2
 
int m_Search_x
 
int m_Search_y
 
int SimW
 
int SimH
 
unsigned m_FailureCount
 
unsigned m_NoFailuresBeforeDispersal
 
unsigned m_HomeRange
 
bool m_HaveTerritory
 
int m_KillEfficiency
 
Vole_Population_Managerm_Prey
 
TPredator_Population_Managerm_OurPopulationManager
 
vector< Vole_Base * > * CurrentPrey
 
- 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

The Weasel class is one of two current implementations of TPredator.

It is configurable via config parameters and in other than name and default configuration it is identical to the Owl class

Constructor & Destructor Documentation

◆ Weasel()

◆ ~Weasel()

Weasel::~Weasel ( )
virtual
836 {
837  //Nothing to do
838 }

Member Function Documentation

◆ BeginStep()

void Weasel::BeginStep ( void  )
virtual

BeingStep behaviour - must be implemented in descendent classes.

Reimplemented from TPredator.

842 {
843  int day= m_OurLandscape->SupplyDayInYear();
844  if (day==weasel_breed_day)
845  {
847  for (int k=0; k<noToMake; k++)
848  {
849  // make a new weasel
850  struct_Predator* sp;
851  sp = new struct_Predator;
853  sp->L = m_OurLandscape;
854  sp->x = m_Location_x;
855  sp->y = m_Location_y;
856  m_OurPopulationManager->CreateObjects(0,NULL,sp,1); // 0 = weasel
857  delete sp;
858  }
859  }
860  else if (day==364)
861  {
863  {
865  {
867  KillThis();
868  }
869  }
870  m_kills_this_season=0; // reset the count
871  }
872 }

References TPredator_Population_Manager::CreateObjects(), TPredator_Population_Manager::dec_inds(), TAnimal::KillThis(), struct_Predator::L, TPredator::m_kills_this_season, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, TPredator::m_OurPopulationManager, struct_Predator::PM, TPredator_Population_Manager::supply_no_inds(), Landscape::SupplyDayInYear(), WEASEL, weasel_breed_day, weasel_breed_threshold, weasel_death_threshold, struct_Predator::x, and struct_Predator::y.

◆ EndStep()

virtual void Weasel::EndStep ( void  )
inlinevirtual

EndStep behaviour - must be implemented in descendent classes.

Reimplemented from TPredator.

194 {}

◆ Step()

void Weasel::Step ( void  )
virtual

Step behaviour - must be implemented in descendent classes.

Reimplemented from TPredator.

876 {
877  if (m_StepDone || m_CurrentStateNo == -1) return;
878  switch (CurrentPState)
879  {
880  case tops_InitialState: // Initial state
882  m_HaveTerritory=false;
883  break;
884  case tops_Hunting:
886  m_StepDone=true;
887  break;
888  case tops_Dispersal:
889  st_Dispersal();
891  m_StepDone=true;
892  break;
893  case tops_Movement:
894  st_Movement();
895  if (st_Hunting()<PreyResponse2) // alter this figure to increase functional response
896  m_FailureCount++;
897  else m_FailureCount=0;
899  {
900  m_HaveTerritory=false;
902  }
904  m_StepDone=true;
905  break;
906  default:
907  m_OurLandscape->Warn("Weasel::Step()","unknown state - default");
908  exit(1);
909  }
910 }

References TPredator::CurrentPState, TALMaSSObject::m_CurrentStateNo, TPredator::m_FailureCount, TPredator::m_HaveTerritory, TPredator::m_NoFailuresBeforeDispersal, TAnimal::m_OurLandscape, TALMaSSObject::m_StepDone, TPredator::PreyResponse1, TPredator::PreyResponse2, TPredator::st_Dispersal(), TPredator::st_Hunting(), TPredator::st_Movement(), tops_Dispersal, tops_Hunting, tops_InitialState, tops_Movement, and Landscape::Warn().


The documentation for this class was generated from the following files:
TAnimal::KillThis
virtual void KillThis()
Sets all parameters ready for object destruction.
Definition: PopulationManager.h:263
tops_Dispersal
Definition: Predators.h:57
cfg_weasel_DispersalMax
static CfgInt cfg_weasel_DispersalMax("WEASEL_DISPERSAL_MAX", CFG_CUSTOM, 200)
cfg_weasel_search_area
static CfgInt cfg_weasel_search_area("WEASEL_SEARCH_AREA", CFG_CUSTOM, 100)
struct_Predator::y
int y
Definition: Predators.h:69
TPredator_Population_Manager::supply_no_inds
unsigned supply_no_inds(unsigned list)
Definition: Predators.h:157
TPredator::st_Movement
virtual void st_Movement()
Definition: Predators.cpp:752
struct_Predator::PM
TPredator_Population_Manager * PM
Definition: Predators.h:72
TPredator::PreyResponse2
int PreyResponse2
Definition: Predators.h:109
cfg_weasel_NoFailuresBeforeDispersal
static CfgInt cfg_weasel_NoFailuresBeforeDispersal("WEASEL_FAILURES", CFG_CUSTOM, 10)
struct_Predator::L
Landscape * L
Definition: Predators.h:71
struct_Predator
Used for creation of a new predator object.
Definition: Predators.h:65
weasel_breed_day
int weasel_breed_day
Definition: Predators.cpp:76
TPredator_Population_Manager::dec_inds
void dec_inds(unsigned list)
Definition: Predators.h:156
tops_Movement
Definition: Predators.h:58
TPredator::m_SearchArea
unsigned m_SearchArea
Definition: Predators.h:106
TPredator::st_Hunting
virtual int st_Hunting()
Definition: Predators.cpp:725
TAnimal::m_Location_y
int m_Location_y
The objects ALMaSS y coordinate.
Definition: PopulationManager.h:366
TPredator::m_KillEfficiency
int m_KillEfficiency
Definition: Predators.h:118
TAnimal::m_OurLandscape
static Landscape * m_OurLandscape
A pointer to the landscape object shared with all TAnimal objects.
Definition: PopulationManager.h:342
TPredator::st_Dispersal
virtual void st_Dispersal()
Definition: Predators.cpp:787
TPredator::PreyResponse1
int PreyResponse1
Definition: Predators.h:108
Landscape::SupplyDayInYear
int SupplyDayInYear(void)
Passes a request on to the associated Calendar class function, the day in the year.
Definition: Landscape.h:2267
weasel_death_threshold
int weasel_death_threshold
Definition: Predators.cpp:74
TALMaSSObject::m_StepDone
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
Definition: PopulationManager.h:133
TPredator::m_FailureCount
unsigned m_FailureCount
Definition: Predators.h:114
CfgInt::value
int value() const
Definition: Configurator.h:116
cfg_weasel_kill_efficiency
static CfgInt cfg_weasel_kill_efficiency("WEASEL_KILL_EFF", CFG_CUSTOM, 250)
TPredator_Population_Manager::CreateObjects
void CreateObjects(int ob_type, TAnimal *pvo, struct_Predator *data, int number)
Definition: Predators.cpp:136
TPredator::CurrentPState
TTypeOfPredatorState CurrentPState
Definition: Predators.h:103
cfg_weasel_home_range
static CfgInt cfg_weasel_home_range("WEASEL_HOME_RANGE", CFG_CUSTOM, 250)
TPredator::m_HaveTerritory
bool m_HaveTerritory
Definition: Predators.h:117
TPredator::m_OurPopulationManager
TPredator_Population_Manager * m_OurPopulationManager
Definition: Predators.h:120
TPredator::SpeciesID
unsigned SpeciesID
Definition: Predators.h:104
TPredator::m_DispersalMax
unsigned m_DispersalMax
Definition: Predators.h:105
tops_InitialState
Definition: Predators.h:55
TPredator::TPredator
TPredator(Vole_Population_Manager *ThePrey, int p_x, int p_y, Landscape *p_L, TPredator_Population_Manager *p_PPM)
Definition: Predators.cpp:695
tops_Hunting
Definition: Predators.h:56
TPredator::m_HomeRange
unsigned m_HomeRange
Definition: Predators.h:116
TALMaSSObject::m_CurrentStateNo
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
Definition: PopulationManager.h:131
weasel_breed_threshold
int weasel_breed_threshold
Definition: Predators.cpp:72
WEASEL
#define WEASEL
Definition: Predators.cpp:48
TPredator::m_NoFailuresBeforeDispersal
unsigned m_NoFailuresBeforeDispersal
Definition: Predators.h:115
struct_Predator::x
int x
Definition: Predators.h:68
Landscape::Warn
void Warn(std::string a_msg1, std::string a_msg2)
Wrapper for the g_msg Warn function.
Definition: Landscape.h:2250
TAnimal::m_Location_x
int m_Location_x
The objects ALMaSS x coordinate.
Definition: PopulationManager.h:362
TPredator::m_kills_this_season
int m_kills_this_season
Definition: Predators.h:107