1 : |
agomez |
1 |
#ifndef poppredator_h
|
2 : |
|
|
#define poppredator_h
|
3 : |
|
|
|
4 : |
|
|
#include "areatime.h" |
5 : |
|
|
#include "conversionindex.h" |
6 : |
|
|
#include "commentstream.h" |
7 : |
|
|
#include "agebandmatrix.h" |
8 : |
|
|
#include "doublematrixptrmatrix.h" |
9 : |
|
|
#include "predator.h" |
10 : |
|
|
#include "keeper.h" |
11 : |
|
|
|
12 : |
|
|
/**
|
13 : |
|
|
* \class PopPredator
|
14 : |
|
|
* \brief This is the class used to model the predation of a population
|
15 : |
|
|
*/
|
16 : |
|
|
class PopPredator : public Predator {
|
17 : |
|
|
public:
|
18 : |
|
|
/**
|
19 : |
|
|
* \brief This is the PopPredator constructor to create a predator with a specified length group
|
20 : |
|
|
* \param givenname is the name of the predator
|
21 : |
|
|
* \param areas is the IntVector of the areas that the predator will live on
|
22 : |
|
|
* \param OtherLgrpDiv is the LengthGroupDivision of the predator
|
23 : |
|
|
* \param GivenLgrpDiv is the LengthGroupDivision that the predation will be calculated on
|
24 : |
|
|
* \note This constructor is used when creating a dynamic predator (ie. StockPredator class)
|
25 : |
|
|
*/
|
26 : |
|
|
PopPredator(const char* givenname, const IntVector& areas,
|
27 : |
|
|
const LengthGroupDivision* const OtherLgrpDiv, const LengthGroupDivision* const GivenLgrpDiv);
|
28 : |
|
|
/**
|
29 : |
|
|
* \brief This is the PopPredator constructor to create a predator without a specified length group
|
30 : |
|
|
* \param givenname is the name of the predator
|
31 : |
|
|
* \param areas is the IntVector of the areas that the predator will live on
|
32 : |
|
|
* \note This constructor is used when creating a non-dynamic predator (ie. LengthPredator class)
|
33 : |
|
|
*/
|
34 : |
|
|
PopPredator(const char* givenname, const IntVector& areas);
|
35 : |
|
|
/**
|
36 : |
|
|
* \brief This is the default PopPredator destructor
|
37 : |
|
|
*/
|
38 : |
|
|
virtual ~PopPredator();
|
39 : |
|
|
/**
|
40 : |
|
|
* \brief This function will print the predation data
|
41 : |
|
|
* \param outfile is the ofstream that all the model information gets sent to
|
42 : |
|
|
*/
|
43 : |
|
|
virtual void Print(ofstream& outfile) const;
|
44 : |
|
|
/**
|
45 : |
|
|
* \brief This function will return the number of a prey on a specified area before the consumption calculation takes place
|
46 : |
|
|
* \param area is the area that the prey consumption is being calculated on
|
47 : |
|
|
* \param preyname is the name of the prey
|
48 : |
|
|
* \return PopInfoVector containing the number of prey before the consumption takes place
|
49 : |
|
|
*/
|
50 : |
|
|
virtual const PopInfoVector& getConsumptionPopInfo(int area, const char* preyname) const;
|
51 : |
|
|
/**
|
52 : |
|
|
* \brief This function will return the population number of the predator on a given area
|
53 : |
|
|
* \param area is the area that the consumption is being calculated on
|
54 : |
|
|
* \return PopInfoVector containing the population number of the predator
|
55 : |
|
|
*/
|
56 : |
|
|
virtual const PopInfoVector& getPredatorNumber(int area) const { return prednumber[this->areaNum(area)]; };
|
57 : |
|
|
/**
|
58 : |
|
|
* \brief This will return the amount the predator consumes of a given prey on a given area
|
59 : |
|
|
* \param area is the area that the consumption is being calculated on
|
60 : |
|
|
* \param preyname is the name of the prey that is being consumed
|
61 : |
|
|
* \return DoubleMatrix containing the amount the predator consumes
|
62 : |
|
|
*/
|
63 : |
|
|
virtual const DoubleMatrix& getConsumption(int area, const char* preyname) const;
|
64 : |
|
|
/**
|
65 : |
|
|
* \brief This will return the flag that denotes if the predator has overconsumed on a given area
|
66 : |
|
|
* \param area is the area that the consumption is being calculated on
|
67 : |
|
|
* \return 1 if the predator has been overconsumed, 0 otherwise
|
68 : |
|
|
*/
|
69 : |
|
|
virtual int hasOverConsumption(int area) const { return hasoverconsumption[this->areaNum(area)]; };
|
70 : |
|
|
/**
|
71 : |
|
|
* \brief This will return the amount the predator overconsumes on a given area
|
72 : |
|
|
* \param area is the area that the consumption is being calculated on
|
73 : |
|
|
* \return overconsumption, a DoubleVector containing the overconsumption by the predator
|
74 : |
|
|
*/
|
75 : |
|
|
virtual const DoubleVector& getOverConsumption(int area) const { return overconsumption[this->areaNum(area)]; };
|
76 : |
|
|
/**
|
77 : |
|
|
* \brief This will return the total amount the predator overconsumes on a given area
|
78 : |
|
|
* \param area is the area that the consumption is being calculated on
|
79 : |
|
|
* \return total overconsumption by of the predator
|
80 : |
|
|
*/
|
81 : |
|
|
virtual double getTotalOverConsumption(int area) const;
|
82 : |
|
|
/**
|
83 : |
|
|
* \brief This will return the length group information for the predator
|
84 : |
|
|
* \return LgrpDiv
|
85 : |
|
|
*/
|
86 : |
|
|
virtual const LengthGroupDivision* getLengthGroupDiv() const { return LgrpDiv; };
|
87 : |
|
|
/**
|
88 : |
|
|
* \brief This function will reset the predation information for the current model run
|
89 : |
|
|
* \param TimeInfo is the TimeClass for the current model
|
90 : |
|
|
*/
|
91 : |
|
|
virtual void Reset(const TimeClass* const TimeInfo);
|
92 : |
|
|
/**
|
93 : |
|
|
* \brief This will return the biomass the predator consumes of a given prey on a given area
|
94 : |
|
|
* \param prey is the index for the prey
|
95 : |
|
|
* \param area is the area that the consumption is being calculated on
|
96 : |
|
|
* \return amount consumed by the predator of the prey
|
97 : |
|
|
*/
|
98 : |
|
|
virtual double getConsumptionBiomass(int prey, int area) const;
|
99 : |
|
|
/**
|
100 : |
|
|
* \brief This will return the ratio used to split the predation between the areas and length groups
|
101 : |
|
|
* \param area is the area that the consumption is being calculated on
|
102 : |
|
|
* \param prey is the index for the prey
|
103 : |
|
|
* \param len is the length group of the predator
|
104 : |
|
|
* \return ratio used to split the predation between the various areas and length groups
|
105 : |
|
|
*/
|
106 : |
|
|
virtual double getConsumptionRatio(int area, int prey, int len) const { return (*predratio[this->areaNum(area)])[prey][len]; };
|
107 : |
|
|
/**
|
108 : |
|
|
* \brief This will return the suitability used by the predator for a given prey on a given area, adjusted to take any overconsumption into account
|
109 : |
|
|
* \param area is the area that the consumption is being calculated on
|
110 : |
|
|
* \param prey is the index for the prey
|
111 : |
|
|
* \return usesuit, a DoubleMatrix containing the suitability by the predator
|
112 : |
|
|
*/
|
113 : |
|
|
const DoubleMatrix& getUseSuitability(int area, int prey) const { return (*usesuit[this->areaNum(area)][prey]); };
|
114 : |
|
|
/**
|
115 : |
|
|
* \brief This will select the preys that will be consumed by the predator
|
116 : |
|
|
* \param preyvec is the PreyPtrVector of all the available preys
|
117 : |
|
|
* \param keeper is the Keeper for the current model
|
118 : |
|
|
*/
|
119 : |
|
|
void setPrey(PreyPtrVector& preyvec, Keeper* const keeper);
|
120 : |
|
|
protected:
|
121 : |
|
|
/**
|
122 : |
|
|
* \brief This is the LengthGroupDivision used to store length information
|
123 : |
|
|
*/
|
124 : |
|
|
LengthGroupDivision* LgrpDiv;
|
125 : |
|
|
/**
|
126 : |
|
|
* \brief This is the ConversionIndexPtrVector used to convert to the lengths groups for the length-based predator
|
127 : |
|
|
*/
|
128 : |
|
|
ConversionIndex* CI;
|
129 : |
|
|
/**
|
130 : |
|
|
* \brief This is the PopInfoMatrix used to store information on the number of predators for the current timestep
|
131 : |
|
|
* \note The indices for this object are [area][predator length]
|
132 : |
|
|
*/
|
133 : |
|
|
PopInfoMatrix prednumber;
|
134 : |
|
|
/**
|
135 : |
|
|
* \brief This is the DoubleMatrix used to store information on the overconsumption by the predators on the current timestep
|
136 : |
|
|
* \note The indices for this object are [area][predator length]
|
137 : |
|
|
*/
|
138 : |
|
|
DoubleMatrix overconsumption;
|
139 : |
|
|
/**
|
140 : |
|
|
* \brief This is the DoubleMatrixPtrMatrix used to store information on the consumption by the predators on the current timestep
|
141 : |
|
|
* \note The indices for this object are [area][prey][predator length][prey length]
|
142 : |
|
|
*/
|
143 : |
|
|
DoubleMatrixPtrMatrix consumption;
|
144 : |
|
|
/**
|
145 : |
|
|
* \brief This is the DoubleMatrix used to store information on the total consumption by the predators on the current timestep
|
146 : |
|
|
* \note The indices for this object are [area][predator length]
|
147 : |
|
|
*/
|
148 : |
|
|
DoubleMatrix totalconsumption;
|
149 : |
|
|
/**
|
150 : |
|
|
* \brief This is the DoubleMatrix used to store information on the overconsumption by the predators on the current substep of the current timestep
|
151 : |
|
|
* \note The indices for this object are [area][predator length]
|
152 : |
|
|
*/
|
153 : |
|
|
DoubleMatrix overcons;
|
154 : |
|
|
/**
|
155 : |
|
|
* \brief This is the DoubleMatrixPtrMatrix used to store information on the consumption by the predators on the current substep of the current timestep
|
156 : |
|
|
* \note The indices for this object are [area][prey][predator length][prey length]
|
157 : |
|
|
*/
|
158 : |
|
|
DoubleMatrixPtrMatrix cons;
|
159 : |
|
|
/**
|
160 : |
|
|
* \brief This is the DoubleMatrix used to store information on the total consumption by the predators on the current substep of the current timestep
|
161 : |
|
|
* \note The indices for this object are [area][predator length]
|
162 : |
|
|
*/
|
163 : |
|
|
DoubleMatrix totalcons;
|
164 : |
|
|
/**
|
165 : |
|
|
* \brief This is the DoubleMatrixPtrVector used to store the ratio used to split the predation between the areas and length groups
|
166 : |
|
|
* \note The indices for this object are [area][prey][predator length]
|
167 : |
|
|
*/
|
168 : |
|
|
DoubleMatrixPtrVector predratio;
|
169 : |
|
|
/**
|
170 : |
|
|
* \brief This is the DoubleMatrixPtrMatrix used to store suitability information for the predators on the current timestep, adjusted to take account of any overconsumption
|
171 : |
|
|
* \note The indices for this object are [area][prey][predator length][prey length]
|
172 : |
|
|
*/
|
173 : |
|
|
DoubleMatrixPtrMatrix usesuit;
|
174 : |
|
|
/**
|
175 : |
|
|
* \brief This is the IntVector used to store information on whether any overconsumption has occured on the current timestep
|
176 : |
|
|
*/
|
177 : |
|
|
IntVector hasoverconsumption;
|
178 : |
|
|
};
|
179 : |
|
|
|
180 : |
|
|
#endif
|