Gadget
prey.h
Go to the documentation of this file.
1 #ifndef prey_h
2 #define prey_h
3 
4 #include "popinfovector.h"
5 #include "conversionindex.h"
6 #include "commentstream.h"
7 #include "charptrvector.h"
8 #include "hasname.h"
9 #include "livesonareas.h"
10 #include "doublematrix.h"
11 #include "areatime.h"
12 #include "agebandmatrix.h"
13 #include "keeper.h"
14 #include "gadget.h"
15 #include "modelvariable.h"
16 
18 
27 class Prey : public HasName, public LivesOnAreas {
28 public:
38  Prey(CommentStream& infile, const IntVector& areas, const char* givenname,
39  const TimeClass* const TimeInfo, Keeper* const keeper);
49  Prey(CommentStream& infile, const char* givenname, const IntVector& areas,
50  const TimeClass* const TimeInfo, Keeper* const keeper);
54  virtual ~Prey() = 0;
61  virtual void Sum(const AgeBandMatrix& Alkeys, int area) {};
68  virtual void Sum(const PopInfoVector& NumberInArea, int area) {};
73  virtual void Reset(const TimeClass* const TimeInfo);
78  virtual void Print(ofstream& outfile) const;
83  virtual void setCI(const LengthGroupDivision* const GivenLDiv);
89  virtual void Subtract(AgeBandMatrix& Alkeys, int area);
95  void addBiomassConsumption(int area, const DoubleVector& predcons);
101  void addNumbersConsumption(int area, const DoubleVector& predcons);
107  virtual void checkConsumption(int area, const TimeClass* const TimeInfo);
114  double getBiomass(int area, int length) const { return biomass[this->areaNum(area)][length]; };
121  double getNumber(int area, int length) const { return preynumber[this->areaNum(area)][length].N; };
127  double getTotalBiomass(int area) const { return total[this->areaNum(area)]; };
133  int isOverConsumption(int area);
139  const DoubleVector& getRatio(int area) const { return ratio[this->areaNum(area)]; };
145  const DoubleVector& getUseRatio(int area) const { return useratio[this->areaNum(area)]; };
151  const DoubleVector& getConsumption(int area) const { return consumption[this->areaNum(area)]; };
157  const DoubleVector& getOverConsumption(int area) const { return overconsumption[this->areaNum(area)]; };
163  double getTotalOverConsumption(int area) const;
168  const LengthGroupDivision* getLengthGroupDiv() const { return LgrpDiv; };
174  const PopInfoVector& getConsumptionPopInfo(int area) const { return preynumber[this->areaNum(area)]; };
179  double getEnergy() const { return energy; };
185  int isPreyArea(int area);
190  PreyType getType() const { return type; };
191 protected:
256 };
257 
258 #endif
This class implements a vector of PopInfoIndexVector values, indexed from minage not 0.
Definition: agebandmatrix.h:15
This is the class used to strip comments (and whitespace) from any input stream.
Definition: commentstream.h:40
This is the class used to convert information from one LengthGroupDivision length structure to a seco...
Definition: conversionindex.h:12
This class implements a dynamic vector of DoubleVector values.
Definition: doublematrix.h:11
This class implements a dynamic vector of double values.
Definition: doublevector.h:11
This is the base class for any object that has a name.
Definition: hasname.h:10
This class implements a dynamic vector of int values.
Definition: intvector.h:11
This is the class used to store information about the variables that are used in model simulation.
Definition: keeper.h:17
This is the class used to store information about the length groups of the modelled stock population.
Definition: lengthgroup.h:10
This is the class used to store information about the areas an object is defined on for the current m...
Definition: livesonareas.h:10
IntVector areas
This is the IntVector of internal areas that the object is defined on.
Definition: livesonareas.h:51
int areaNum(int area) const
This function will return the area associated with an internal area.
Definition: livesonareas.cc:33
This is the base class used to calculate the value of variables used in the model simulation that are...
Definition: modelvariable.h:19
This class implements a dynamic vector of PopInfoVector values.
Definition: popinfomatrix.h:11
This class implements a dynamic vector of PopInfo values.
Definition: popinfovector.h:11
This is the base class used to model the consumption of a prey.
Definition: prey.h:27
double getTotalOverConsumption(int area) const
This will return the total amount of the prey that has been overconsumed on a given area.
Definition: prey.cc:259
virtual ~Prey()=0
This is the default Prey destructor.
Definition: prey.cc:113
virtual void Reset(const TimeClass *const TimeInfo)
This will reset the consumption information for the current model run.
Definition: prey.cc:229
DoubleMatrix biomass
This is the DoubleMatrix used to store information on the biomass of the prey that is available for t...
Definition: prey.h:213
int isPreyArea(int area)
This will check if there is any prey to consume on a given area.
Definition: prey.cc:243
void addBiomassConsumption(int area, const DoubleVector &predcons)
This function will add predation (by biomass) to the amount of the prey that is consumed.
Definition: prey.cc:162
virtual void Sum(const AgeBandMatrix &Alkeys, int area)
This will calculate the amount of prey that is consumed for a given area and timestep.
Definition: prey.h:61
const DoubleVector & getUseRatio(int area) const
This will return the ratio of the prey that has been consumed on a given area.
Definition: prey.h:145
DoubleMatrix overconsumption
This is the DoubleMatrix used to store information on the overconsumption of the prey on the current ...
Definition: prey.h:242
DoubleMatrix useratio
This is the DoubleMatrix used to store information on the ratio of the available biomass of the prey ...
Definition: prey.h:227
virtual void Subtract(AgeBandMatrix &Alkeys, int area)
This function will subtract the prey that is consumed from the stock.
Definition: prey.cc:157
DoubleVector total
This is the DoubleVector used to store information on the total biomass of the prey that is available...
Definition: prey.h:217
DoubleMatrix consumption
This is the DoubleMatrix used to store information on the consumption of the prey on the current time...
Definition: prey.h:232
DoubleMatrix consratio
This is the DoubleMatrix used to store information on the ratio of the prey to subtract on the curren...
Definition: prey.h:251
const DoubleVector & getConsumption(int area) const
This will return the amount of the prey that has been consumed on a given area.
Definition: prey.h:151
const DoubleVector & getOverConsumption(int area) const
This will return the amount of the prey that has been overconsumed on a given area.
Definition: prey.h:157
virtual void Sum(const PopInfoVector &NumberInArea, int area)
This will calculate the amount of prey that is consumed for a given area and timestep.
Definition: prey.h:68
Prey(CommentStream &infile, const IntVector &areas, const char *givenname, const TimeClass *const TimeInfo, Keeper *const keeper)
This is the Prey constructor to create a prey by reading data from a file.
Definition: prey.cc:10
const DoubleVector & getRatio(int area) const
This will return the ratio of the prey that has been consumed on a given area.
Definition: prey.h:139
ModelVariable energy
This is the ModelVariable used to store the energy content of the prey (in kilojoules per kilogramme)
Definition: prey.h:208
virtual void setCI(const LengthGroupDivision *const GivenLDiv)
This will set the ConversionIndex required for to calculate the consumption.
Definition: prey.cc:118
double getTotalBiomass(int area) const
This will return the total biomass of prey that is available for consumption.
Definition: prey.h:127
IntVector isoverconsumption
This is the IntVector used to store information on whether any overconsumption has occured on the cur...
Definition: prey.h:246
void addNumbersConsumption(int area, const DoubleVector &predcons)
This function will add predation (by numbers) to the amount of the prey that is consumed.
Definition: prey.cc:171
virtual void Print(ofstream &outfile) const
This function will print the consumption data.
Definition: prey.cc:135
ConversionIndex * CI
This is the ConversionIndex used to convert from the stock LengthGroupDivision to the LengthGroupDivi...
Definition: prey.h:190
double getEnergy() const
This will return the energy content of the prey.
Definition: prey.h:179
DoubleMatrix cons
This is the DoubleMatrix used to store information on the consumption of the prey on the current subs...
Definition: prey.h:237
PreyType getType() const
This will return the type of prey class.
Definition: prey.h:190
PopInfoMatrix preynumber
This is the PopInfoMatrix used to store information on the number of preys for the current timestep.
Definition: prey.h:204
const LengthGroupDivision * getLengthGroupDiv() const
This will return the length group information for the prey.
Definition: prey.h:168
double getBiomass(int area, int length) const
This will return the biomass of prey that is available for consumption by predators.
Definition: prey.h:114
int isOverConsumption(int area)
This will return the flag that denotes if the prey has been overconsumed on a given area.
Definition: prey.cc:253
PreyType type
This denotes what type of prey class has been created.
Definition: prey.h:255
DoubleMatrix ratio
This is the DoubleMatrix used to store information on the ratio of the available biomass of the prey ...
Definition: prey.h:222
const PopInfoVector & getConsumptionPopInfo(int area) const
This will return the amount of prey on a given area prior to any consumption by the predators.
Definition: prey.h:174
LengthGroupDivision * LgrpDiv
This is the LengthGroupDivision used to store length information.
Definition: prey.h:199
double getNumber(int area, int length) const
This will return the number of prey that is available for consumption by predators.
Definition: prey.h:121
virtual void checkConsumption(int area, const TimeClass *const TimeInfo)
This function will check for overconsumption of the prey.
Definition: prey.cc:183
This is the class used to store information about the timesteps used for the current model.
Definition: areatime.h:87
PreyType
Definition: prey.h:17
@ STOCKPREY
Definition: prey.h:17
@ LENGTHPREY
Definition: prey.h:17