ALMaSS Rabbit ODdox  1.00
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);
100  TTypesOfRabbitHabitat ClassifyHabitat(TTypesOfLandscapeElement a_tole);
102  Rabbit_Warren* FindClosestWarren(int a_x, int a_y, int a_rank);
104  void CheckForRabbitBreedingConditions( void );
106  bool IsBreedingSeason( void ) { return m_rabbitBreedingSeason; }
108  void PesticideDeathRecord(RabbitObjectTypes ob_type);
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];
139  int m_PesticideDeaths[rob_foobar];
150  // Methods
152  virtual void DoFirst();
154  virtual void DoBefore(){}
156  virtual void DoAfter(){}
158  virtual void DoLast();
160  void PreProcessWarrenLocations();
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 );
172  void WarrenOccupancyRecordOutput();
174  void PesticideDeathRecordOutput();
176  void PesticideDeathRecordOutputOpen();
178  void PesticideDeathRecordOutputClose();
180  void WarrenOccupancyRecordOutputOpen();
182  void WarrenOccupancyRecordOutputClose();
184  void WarrenOutputAnalysis();
186  void LifetimeReproAnalysis();
188  void NatalDispersalAnalysis();
190  void ReproOutputRecordOutputOpen();
192  void ReproOutputRecordOutputClose();
194  void NatalDispersalRecordOutputOpen();
196  void NatalDispersalRecordOutputClose();
198  void AssignStaticVariables();
200  void TheNWordOutputProbe();
201 public:
203  void ReproOutputRecordOutput(Rabbit_Female* a_female);
205  void NatalDispersalRecordOutput(Rabbit_Base* a_rabbit);
206 };
207 
208 #endif
ofstream m_PesticideDeathOFile
The pesticide death output file.
The rabbit young class. All special young behaviour is described here.
Definition: Rabbit.h:319
The landscape class containing all environmental and topographical data.
Definition: landscape.h:109
bool m_forageday
Flag to record whether today is a possible forage day.
bool m_rabbitBreedingSeason
The breeding season flag.
The rabbit female class. All special female behaviour is described here.
Definition: Rabbit.h:443
int m_warrenfixedsizediv2
Half max warren size in m - for speed.
RabbitObjectTypes
Definition: Rabbit.h:68
Rabbit_Warren * m_Warren
A pointer to the current warren.
bool GetForageDay()
Get method for the forage day flag.
Rabbit_Population_Manager * m_NPM
Rabbit_Population_Manager pointer.
A class to describe the rabbits warren system.
Definition: Rabbit.h:518
int m_y2
y-coord of birth
virtual void DoBefore()
Things to do before the Step.
int m_warrenfixedsize
Holds an input variable for max warren size in m.
Base class for all population managers.
Used for creation of a new Rabbit object.
The class to handle all predator population related matters.
TTypesOfRabbitHabitat
A classification of rabbit habitat types. All landscape elements will be classified into one of the c...
Definition: Rabbit.h:101
bool IsBreedingSeason(void)
Get whether it is breeding season.
int m_weightage
The rabbit age in terms of weight.
int m_age
The rabbit age.
The base class for all ALMaSS animal classes.
int m_soil
The current warren soil type.
ofstream m_ReproOutputFile
For recording the lifetime reproductive success.
double GetGrowth(int a_age)
Get method for the rabbit growth with age.
int m_x2
x-coord of birth
TTypesOfLandscapeElement
virtual void DoAfter()
Things to do before the EndStep.
int m_reproswitchbuffer
Prevents continuous breeding season switching.
ofstream m_WarrenOccupancyFile
The warren occupancy output file.
Landscape * m_L
Landscape pointer.
unsigned SupplyAllBigRabbits()
Returns the total number of rabbits.
Rabbit_Young * m_rabbit
A pointer to a rabbit base - useful for extra information.
ofstream m_NatalDispersalFile
For recording the natal dispersal of adults from birth to death.