ALMaSS Rabbit ODdox  1.1
The rabbit model description following ODdox protocol
Rabbit_Population_Manager.h
Go to the documentation of this file.
1 /*
2 *******************************************************************************************************
3 Copyright (c) 2015, Christopher John Topping, Faarupvej 54, DK-8410 Rønde
4 ADAMA Makhteshim Ltd., PO Box 60, Beer-Sheva 84100, Israel
5 
6 All rights reserved.
7 
8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are met:
10 
11 1. Redistributions of source code must retain the above copyright notice, this
12 list of conditions and the following disclaimer.
13 2. Redistributions in binary form must reproduce the above copyright notice,
14 this list of conditions and the following disclaimer in the documentation
15 and/or other materials provided with the distribution.
16 
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
21 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 The views and conclusions contained in the software and documentation are those
29 of the authors and should not be interpreted as representing official policies,
30 either expressed or implied, of the FreeBSD Project.
31 ********************************************************************************************************
32 
33 */
43 //---------------------------------------------------------------------------
44 #ifndef Rabbit_Population_ManagerH
45 #define Rabbit_Population_ManagerH
46 //---------------------------------------------------------------------------
47 
48 //---------------------------------------------------------------------------
49 
50 class Rabbit_Base;
51 
52 //------------------------------------------------------------------------------
53 
59 {
60 public:
62  int m_x;
64  int m_y;
66  int m_x2;
68  int m_y2;
74  int m_age;
82  int m_soil;
83 };
84 
90 {
91 public:
92 // Methods
96  virtual ~Rabbit_Population_Manager (void);
98  void CreateObjects(RabbitObjectTypes ob_type, TAnimal *pvo, struct_Rabbit* a_data, int a_number);
102  Rabbit_Warren* FindClosestWarren(int a_x, int a_y, int a_rank);
106  bool IsBreedingSeason( void ) { return m_rabbitBreedingSeason; }
110  unsigned SupplyAllBigRabbits() {
111  unsigned sum = 0;
112  for (unsigned r = rob_Male; r < rob_foobar; r++) sum += (unsigned) TheArray[r].size();
113  return sum;
114  }
116  double GetGrowth( int a_age ) {
117 // if ((a_age < 0) || (a_age >= 3650)) {
118 // int rubbish = 1;
119 // }
120  return m_RabbitGrowth[ a_age ];
121  }
123  bool GetForageDay( ) {
124  return m_forageday;
125  }
126 protected:
127 // Attributes
137  double m_RabbitGrowth[3650];
150  // Methods
152  virtual void DoFirst();
154  virtual void DoBefore(){}
156  virtual void DoAfter(){}
158  virtual void DoLast();
162  bool WarrenLegalPos(int &a_x, int a_y);
164  void SaveWarrenLocations( void );
166  void LoadWarrenLocations( void );
168  double AssessPctForage(int a_x, int a_y);
170  void CreateLocalWarrenNetworkLists( void );
184  void WarrenOutputAnalysis();
186  void LifetimeReproAnalysis();
188  void NatalDispersalAnalysis();
198  void AssignStaticVariables();
200  void TheAOROutputProbe();
201 public:
203  void ReproOutputRecordOutput(Rabbit_Female* a_female);
205  void NatalDispersalRecordOutput(Rabbit_Base* a_rabbit);
206 };
207 
208 #endif
Rabbit_Population_Manager::LoadWarrenLocations
void LoadWarrenLocations(void)
Load warren locations.
Definition: Rabbit_Population_Manager.cpp:610
RabbitObjectTypes
RabbitObjectTypes
Definition: Rabbit.h:68
Rabbit_Population_Manager::PesticideDeathRecordOutputClose
void PesticideDeathRecordOutputClose()
Closes the pesticide death output file.
Definition: Rabbit_Population_Manager.cpp:882
struct_Rabbit::m_y
int m_y
y-coord
Definition: Rabbit_Population_Manager.h:64
Rabbit_Population_Manager::PesticideDeathRecord
void PesticideDeathRecord(RabbitObjectTypes ob_type)
Records pesticide poisoning incidents.
Definition: Rabbit_Population_Manager.cpp:768
Population_Manager::TheArray
vector< TListOfAnimals > TheArray
Definition: populationmanager.h:534
Rabbit_Population_Manager::DoLast
virtual void DoLast()
Things to do after the EndStep.
Definition: Rabbit_Population_Manager.cpp:360
Rabbit_Population_Manager::FindClosestWarren
Rabbit_Warren * FindClosestWarren(int a_x, int a_y, int a_rank)
Finds the closest warren as the crow flies.
Definition: Rabbit_Population_Manager.cpp:692
Rabbit_Population_Manager::~Rabbit_Population_Manager
virtual ~Rabbit_Population_Manager(void)
Rabbit_Population_Manager Destructor.
Definition: Rabbit_Population_Manager.cpp:225
Rabbit_Population_Manager::m_forageday
bool m_forageday
Flag to record whether today is a possible forage day.
Definition: Rabbit_Population_Manager.h:149
Rabbit_Female
The rabbit female class. All special female behaviour is described here.
Definition: Rabbit.h:443
Rabbit_Population_Manager::SupplyAllBigRabbits
unsigned SupplyAllBigRabbits()
Returns the total number of rabbits.
Definition: Rabbit_Population_Manager.h:110
Rabbit_Population_Manager::TheAOROutputProbe
void TheAOROutputProbe()
Definition: Rabbit_Population_Manager.cpp:1163
Rabbit_Population_Manager::ReproOutputRecordOutputOpen
void ReproOutputRecordOutputOpen()
Opens the reproductive output file.
Definition: Rabbit_Population_Manager.cpp:898
Rabbit_Population_Manager::IsBreedingSeason
bool IsBreedingSeason(void)
Get whether it is breeding season.
Definition: Rabbit_Population_Manager.h:106
Rabbit_Population_Manager::PreProcessWarrenLocations
void PreProcessWarrenLocations()
This pre-scans the landscape and determines all potential warren locations on start-up.
Definition: Rabbit_Population_Manager.cpp:378
Rabbit_Population_Manager::WarrenOccupancyRecordOutput
void WarrenOccupancyRecordOutput()
Print warren occupancy record to file.
Definition: Rabbit_Population_Manager.cpp:774
Rabbit_Population_Manager::CheckForRabbitBreedingConditions
void CheckForRabbitBreedingConditions(void)
Determines whether it is breeding season.
Definition: Rabbit_Population_Manager.cpp:735
Rabbit_Population_Manager
The class to handle all predator population related matters.
Definition: Rabbit_Population_Manager.h:89
Rabbit_Population_Manager::m_NatalDispersalFile
ofstream m_NatalDispersalFile
For recording the natal dispersal of adults from birth to death.
Definition: Rabbit_Population_Manager.h:143
Rabbit_Population_Manager::m_warrenfixedsizediv2
int m_warrenfixedsizediv2
Half max warren size in m - for speed
Definition: Rabbit_Population_Manager.h:131
rob_Male
Definition: Rabbit.h:72
Rabbit_Population_Manager::CreateLocalWarrenNetworkLists
void CreateLocalWarrenNetworkLists(void)
Forms the local warren network list for this warren.
Definition: Rabbit_Population_Manager.cpp:640
struct_Rabbit
Used for creation of a new Rabbit object.
Definition: Rabbit_Population_Manager.h:58
Rabbit_Population_Manager::NatalDispersalRecordOutput
void NatalDispersalRecordOutput(Rabbit_Base *a_rabbit)
Records the natal dispersal.
Definition: Rabbit_Population_Manager.cpp:912
Rabbit_Population_Manager::m_rabbitBreedingSeason
bool m_rabbitBreedingSeason
The breeding season flag.
Definition: Rabbit_Population_Manager.h:133
Rabbit_Population_Manager::WarrenOccupancyRecordOutputOpen
void WarrenOccupancyRecordOutputOpen()
Opens the warren occupancy output file.
Definition: Rabbit_Population_Manager.cpp:872
Rabbit_Population_Manager::m_ReproOutputFile
ofstream m_ReproOutputFile
For recording the lifetime reproductive success.
Definition: Rabbit_Population_Manager.h:145
struct_Rabbit::m_age
int m_age
The rabbit age.
Definition: Rabbit_Population_Manager.h:74
Landscape
The landscape class containing all environmental and topographical data.
Definition: landscape.h:112
Rabbit_Population_Manager::ClassifyHabitat
TTypesOfRabbitHabitat ClassifyHabitat(TTypesOfLandscapeElement a_tole)
Classify a landscape element type according to the rabbit habitat classification.
Definition: Rabbit_Population_Manager.cpp:457
struct_Rabbit::m_NPM
Rabbit_Population_Manager * m_NPM
Rabbit_Population_Manager pointer.
Definition: Rabbit_Population_Manager.h:72
struct_Rabbit::m_rabbit
Rabbit_Young * m_rabbit
A pointer to a rabbit base - useful for extra information.
Definition: Rabbit_Population_Manager.h:78
Rabbit_Population_Manager::NatalDispersalRecordOutputClose
void NatalDispersalRecordOutputClose()
Closes the reproductive output file.
Definition: Rabbit_Population_Manager.cpp:931
Rabbit_Population_Manager::m_RabbitGrowth
double m_RabbitGrowth[3650]
Holds daily growth potential of rabbits for each day
Definition: Rabbit_Population_Manager.h:137
TTypesOfRabbitHabitat
TTypesOfRabbitHabitat
A classification of rabbit habitat types. All landscape elements will be classified into one of the c...
Definition: Rabbit.h:101
rob_foobar
Definition: Rabbit.h:75
Rabbit_Population_Manager::CreateObjects
void CreateObjects(RabbitObjectTypes ob_type, TAnimal *pvo, struct_Rabbit *a_data, int a_number)
Method for creating a new individual Rabbit.
Definition: Rabbit_Population_Manager.cpp:250
Rabbit_Population_Manager::WarrenOutputAnalysis
void WarrenOutputAnalysis()
Does analysis on the warren output file and saves the results to RabbitPOMSummary....
Definition: Rabbit_Population_Manager.cpp:943
Rabbit_Population_Manager::SaveWarrenLocations
void SaveWarrenLocations(void)
Save warren locations.
Definition: Rabbit_Population_Manager.cpp:588
struct_Rabbit::m_L
Landscape * m_L
Landscape pointer.
Definition: Rabbit_Population_Manager.h:70
Rabbit_Population_Manager::GetGrowth
double GetGrowth(int a_age)
Get method for the rabbit growth with age.
Definition: Rabbit_Population_Manager.h:116
struct_Rabbit::m_x2
int m_x2
x-coord of birth
Definition: Rabbit_Population_Manager.h:66
Rabbit_Population_Manager::WarrenLegalPos
bool WarrenLegalPos(int &a_x, int a_y)
Tests the warrens list to see if this position is legal.
Definition: Rabbit_Population_Manager.cpp:431
TAnimal
The base class for all ALMaSS animal classes.
Definition: populationmanager.h:205
Rabbit_Population_Manager::DoBefore
virtual void DoBefore()
Things to do before the Step.
Definition: Rabbit_Population_Manager.h:154
struct_Rabbit::m_Warren
Rabbit_Warren * m_Warren
A pointer to the current warren.
Definition: Rabbit_Population_Manager.h:80
Rabbit_Population_Manager::m_warrenfixedsize
int m_warrenfixedsize
Holds an input variable for max warren size in m
Definition: Rabbit_Population_Manager.h:129
Rabbit_Population_Manager::DoAfter
virtual void DoAfter()
Things to do before the EndStep.
Definition: Rabbit_Population_Manager.h:156
Population_Manager
Base class for all population managers.
Definition: populationmanager.h:424
Rabbit_Population_Manager::DoFirst
virtual void DoFirst()
Things to do before anything else at the start of a timestep
Definition: Rabbit_Population_Manager.cpp:312
Rabbit_Population_Manager::Rabbit_Population_Manager
Rabbit_Population_Manager(Landscape *L)
Rabbit_Population_Manager Constructor.
Definition: Rabbit_Population_Manager.cpp:120
struct_Rabbit::m_weightage
int m_weightage
The rabbit age in terms of weight.
Definition: Rabbit_Population_Manager.h:76
Rabbit_Population_Manager::NatalDispersalRecordOutputOpen
void NatalDispersalRecordOutputOpen()
Opens the reproductive output file.
Definition: Rabbit_Population_Manager.cpp:923
Rabbit_Population_Manager::PesticideDeathRecordOutput
void PesticideDeathRecordOutput()
Print pesticide death record to file.
Definition: Rabbit_Population_Manager.cpp:852
Rabbit_Population_Manager::AssessPctForage
double AssessPctForage(int a_x, int a_y)
Assesses the percentage of forage for a location assuming max warren size.
Definition: Rabbit_Population_Manager.cpp:552
Rabbit_Population_Manager::LifetimeReproAnalysis
void LifetimeReproAnalysis()
Does analysis on the lifetime reproductive output file and saves the results to RabbitPOMSummary....
Definition: Rabbit_Population_Manager.cpp:1061
struct_Rabbit::m_soil
int m_soil
The current warren soil type.
Definition: Rabbit_Population_Manager.h:82
Rabbit_Population_Manager::ReproOutputRecordOutput
void ReproOutputRecordOutput(Rabbit_Female *a_female)
Print reproductive record to file.
Definition: Rabbit_Population_Manager.cpp:888
Rabbit_Population_Manager::m_PesticideDeathOFile
ofstream m_PesticideDeathOFile
The pesticide death output file.
Definition: Rabbit_Population_Manager.h:147
Rabbit_Population_Manager::m_PesticideDeaths
int m_PesticideDeaths[rob_foobar]
Holds the number of rabbits killed each day by pesticides.
Definition: Rabbit_Population_Manager.h:139
TTypesOfLandscapeElement
TTypesOfLandscapeElement
Definition: tole_declaration.h:36
Rabbit_Population_Manager::WarrenOccupancyRecordOutputClose
void WarrenOccupancyRecordOutputClose()
Closes the warren occupancy output file.
Definition: Rabbit_Population_Manager.cpp:937
Rabbit_Warren
A class to describe the rabbits warren system.
Definition: Rabbit.h:518
Rabbit_Population_Manager::PesticideDeathRecordOutputOpen
void PesticideDeathRecordOutputOpen()
Opens pesticide death output file.
Definition: Rabbit_Population_Manager.cpp:866
Rabbit_Population_Manager::NatalDispersalAnalysis
void NatalDispersalAnalysis()
Does analysis on the natal dispersal output file and saves the results to RabbitPOMSummary....
Definition: Rabbit_Population_Manager.cpp:1133
Rabbit_Population_Manager::ReproOutputRecordOutputClose
void ReproOutputRecordOutputClose()
Closes the reproductive output file.
Definition: Rabbit_Population_Manager.cpp:906
Rabbit_Population_Manager::GetForageDay
bool GetForageDay()
Get method for the forage day flag.
Definition: Rabbit_Population_Manager.h:123
struct_Rabbit::m_y2
int m_y2
y-coord of birth
Definition: Rabbit_Population_Manager.h:68
Rabbit_Population_Manager::AssignStaticVariables
void AssignStaticVariables()
Assigns any static variables needing config variable assignment.
Definition: Rabbit_Population_Manager.cpp:203
Rabbit_Base
Definition: Rabbit.h:166
Rabbit_Young
The rabbit young class. All special young behaviour is described here.
Definition: Rabbit.h:319
struct_Rabbit::m_x
int m_x
x-coord
Definition: Rabbit_Population_Manager.h:62
Rabbit_Population_Manager::m_reproswitchbuffer
int m_reproswitchbuffer
Prevents continuous breeding season switching.
Definition: Rabbit_Population_Manager.h:135
Rabbit_Population_Manager::m_WarrenOccupancyFile
ofstream m_WarrenOccupancyFile
The warren occupancy output file.
Definition: Rabbit_Population_Manager.h:141