1 : |
agomez |
1 |
#ifndef stockpredator_h
|
2 : |
|
|
#define stockpredator_h
|
3 : |
|
|
|
4 : |
|
|
#include "areatime.h" |
5 : |
|
|
#include "lengthgroup.h" |
6 : |
|
|
#include "commentstream.h" |
7 : |
|
|
#include "agebandmatrixptrvector.h" |
8 : |
|
|
#include "poppredator.h" |
9 : |
|
|
|
10 : |
|
|
/**
|
11 : |
|
|
* \class StockPredator
|
12 : |
|
|
* \brief This is the class used to model the predation by stocks
|
13 : |
|
|
*/
|
14 : |
|
|
class StockPredator : public PopPredator {
|
15 : |
|
|
public:
|
16 : |
|
|
/**
|
17 : |
|
|
* \brief This is the StockPredator constructor
|
18 : |
|
|
* \param infile is the CommentStream to read the predator information from
|
19 : |
|
|
* \param givenname is the name of the predator
|
20 : |
|
|
* \param Areas is the IntVector of the areas that the predator will live on
|
21 : |
|
|
* \param OtherLgrpDiv is the LengthGroupDivision of the predator
|
22 : |
|
|
* \param GivenLgrpDiv is the LengthGroupDivision that the predation will be calculated on
|
23 : |
|
|
* \param minage is the minimum age of the predator
|
24 : |
|
|
* \param numage is the number of age groups for the predator
|
25 : |
|
|
* \param TimeInfo is the TimeClass for the current model
|
26 : |
|
|
* \param keeper is the Keeper for the current model
|
27 : |
|
|
*/
|
28 : |
|
|
StockPredator(CommentStream& infile, const char* givenname, const IntVector& Areas,
|
29 : |
|
|
const LengthGroupDivision* const OtherLgrpDiv, const LengthGroupDivision* const GivenLgrpDiv,
|
30 : |
|
|
int minage, int numage, const TimeClass* const TimeInfo, Keeper* const keeper);
|
31 : |
|
|
/**
|
32 : |
|
|
* \brief This is the default StockPredator destructor
|
33 : |
|
|
*/
|
34 : |
|
|
virtual ~StockPredator() {};
|
35 : |
|
|
/**
|
36 : |
|
|
* \brief This will calculate the amount the predator consumes on a given area
|
37 : |
|
|
* \param area is the area that the prey consumption is being calculated on
|
38 : |
|
|
* \param Area is the AreaClass for the current model
|
39 : |
|
|
* \param TimeInfo is the TimeClass for the current model
|
40 : |
|
|
*/
|
41 : |
|
|
virtual void Eat(int area, const AreaClass* const Area, const TimeClass* const TimeInfo);
|
42 : |
|
|
/**
|
43 : |
|
|
* \brief This will calculate the amount of prey that is consumed by the predator on a given area
|
44 : |
|
|
* \param stockAlkeys is the AgeBandMatrix giving the amount of the stock in the area
|
45 : |
|
|
* \param area is the area that the prey consumption is being calculated on
|
46 : |
|
|
*/
|
47 : |
|
|
virtual void Sum(const AgeBandMatrix& stockAlkeys, int area);
|
48 : |
|
|
/**
|
49 : |
|
|
* \brief This will adjust the amount the predator consumes on a given area, to take oversconsumption into consideration
|
50 : |
|
|
* \param area is the area that the prey consumption is being calculated on
|
51 : |
|
|
* \param TimeInfo is the TimeClass for the current model
|
52 : |
|
|
*/
|
53 : |
|
|
virtual void adjustConsumption(int area, const TimeClass* const TimeInfo);
|
54 : |
|
|
/**
|
55 : |
|
|
* \brief This function will reset the predation information for the current model run
|
56 : |
|
|
* \param TimeInfo is the TimeClass for the current model
|
57 : |
|
|
*/
|
58 : |
|
|
virtual void Reset(const TimeClass* const TimeInfo);
|
59 : |
|
|
/**
|
60 : |
|
|
* \brief This function will print the predator information
|
61 : |
|
|
* \param outfile is the ofstream that all the model information gets sent to
|
62 : |
|
|
*/
|
63 : |
|
|
virtual void Print(ofstream& outfile) const;
|
64 : |
|
|
/**
|
65 : |
|
|
* \brief This function will return the feeding level of the predator on a given area
|
66 : |
|
|
* \param area is the area that the prey consumption is being calculated on
|
67 : |
|
|
* \return fphi, a DoubleVector containing the feeding level of the predator
|
68 : |
|
|
*/
|
69 : |
|
|
const DoubleVector& getFPhi(int area) const { return fphi[this->areaNum(area)]; };
|
70 : |
|
|
/**
|
71 : |
|
|
* \brief This function will return the maximum consumption by length group of the predator on a given area
|
72 : |
|
|
* \param area is the area that the prey consumption is being calculated on
|
73 : |
|
|
* \return maxconbylength, a DoubleVector containing the maximum consumption of the predator
|
74 : |
|
|
*/
|
75 : |
|
|
const DoubleVector& getMaxConsumption(int area) const { return maxcons[this->areaNum(area)]; };
|
76 : |
|
|
/**
|
77 : |
|
|
* \brief This will return the minimum age of the predator
|
78 : |
|
|
* \return minimum age
|
79 : |
|
|
*/
|
80 : |
|
|
int minAge() const { return predAlkeys[0].minAge(); };
|
81 : |
|
|
/**
|
82 : |
|
|
* \brief This will return the maximum age of the predator
|
83 : |
|
|
* \return maximum age
|
84 : |
|
|
*/
|
85 : |
|
|
int maxAge() const { return predAlkeys[0].maxAge(); };
|
86 : |
|
|
/**
|
87 : |
|
|
* \brief This will return the population of the predator on a given area
|
88 : |
|
|
* \param area is the area that the consumption is being calculated on
|
89 : |
|
|
* \return alkeys, a AgeBandMatrix containing the population of the predator
|
90 : |
|
|
*/
|
91 : |
|
|
const AgeBandMatrix& getCurrentALK(int area) const { return predAlkeys[this->areaNum(area)]; };
|
92 : |
|
|
protected:
|
93 : |
|
|
/**
|
94 : |
|
|
* \brief This is the identifier of the function to be used to calculate the maximum consumption
|
95 : |
|
|
*/
|
96 : |
|
|
int functionnumber;
|
97 : |
|
|
/**
|
98 : |
|
|
* \brief This is the FormulaVector used to store the consumption parameters
|
99 : |
|
|
*/
|
100 : |
|
|
FormulaVector consParam;
|
101 : |
|
|
/**
|
102 : |
|
|
* \brief This is the DoubleMatrix used to store the sum of the feeding levels (over all preys) on the current timestep
|
103 : |
|
|
* \note The indices for this object are [area][predator length]
|
104 : |
|
|
*/
|
105 : |
|
|
DoubleMatrix Phi;
|
106 : |
|
|
/**
|
107 : |
|
|
* \brief This is the DoubleMatrix used to store the feeding level on the current timestep
|
108 : |
|
|
* \note The indices for this object are [area][predator length]
|
109 : |
|
|
*/
|
110 : |
|
|
DoubleMatrix fphi;
|
111 : |
|
|
/**
|
112 : |
|
|
* \brief This is the DoubleMatrix used to store the feeding level on the current substep of the current timestep
|
113 : |
|
|
* \note The indices for this object are [area][predator length]
|
114 : |
|
|
*/
|
115 : |
|
|
DoubleMatrix subfphi;
|
116 : |
|
|
/**
|
117 : |
|
|
* \brief This is the DoubleMatrix used to store maximum consumption by predator length group on the current timestep
|
118 : |
|
|
* \note The indices for this object are [area][predator length]
|
119 : |
|
|
*/
|
120 : |
|
|
DoubleMatrix maxcons;
|
121 : |
|
|
/**
|
122 : |
|
|
* \brief This is the AgeBandMatrixPtrVector used to store information about the predator population
|
123 : |
|
|
* \note The indices for this object are [area][predator age][predator length]
|
124 : |
|
|
*/
|
125 : |
|
|
AgeBandMatrixPtrVector predAlkeys;
|
126 : |
|
|
};
|
127 : |
|
|
|
128 : |
|
|
#endif
|