Gadget
maturity.h
Go to the documentation of this file.
1 #ifndef maturity_h
2 #define maturity_h
3 
4 #include "keeper.h"
5 #include "agebandmatrix.h"
6 #include "livesonareas.h"
8 #include "charptrvector.h"
9 #include "commentstream.h"
10 #include "agebandmatrixptrvector.h"
12 #include "modelvariablevector.h"
13 
22 class Maturity: public HasName, protected LivesOnAreas {
23 public:
36  Maturity(const IntVector& areas, int minage, int numage,
37  const LengthGroupDivision* const LgrpDiv, const char* givenname);
41  virtual ~Maturity();
46  virtual void setStock(StockPtrVector& stockvec);
51  virtual void Print(ofstream& outfile) const;
56  virtual void Reset(const TimeClass* const TimeInfo);
62  virtual int isMaturationStep(const TimeClass* const TimeInfo) = 0;
71  virtual double calcMaturation(int age, int length, int growth, double weight) = 0;
80  void storeMatureStock(int area, int age, int length, double number, double weight);
89  void storeMatureTagStock(int area, int age, int length, double number, int id);
95  void Move(int area, const TimeClass* const TimeInfo);
104  void setTagged();
109  void addMaturityTag(const char* tagname);
114  void deleteMaturityTag(const char* tagname);
115 protected:
119  double tmpratio;
135  double ratioscale;
148 private:
152  AgeBandMatrixPtrVector Storage;
156  AgeBandMatrixRatioPtrVector tagStorage;
160  int istagged;
161 };
162 
167 class MaturityA : public Maturity {
168 public:
180  MaturityA(CommentStream& infile, const TimeClass* const TimeInfo,
181  Keeper* const keeper, int minage, int numage, const IntVector& areas,
182  const char* givenname, const LengthGroupDivision* const LgrpDiv);
186  virtual ~MaturityA() {};
191  virtual void setStock(StockPtrVector& stockvec);
196  virtual void Reset(const TimeClass* const TimeInfo);
202  virtual int isMaturationStep(const TimeClass* const TimeInfo);
211  virtual double calcMaturation(int age, int length, int growth, double weight);
216  virtual void Print(ofstream& outfile) const;
217 protected:
242 };
243 
248 class MaturityB : public Maturity {
249 public:
261  MaturityB(CommentStream& infile, const TimeClass* const TimeInfo,
262  Keeper* const keeper, int minage, int numage, const IntVector& areas,
263  const char* givenname, const LengthGroupDivision* const LgrpDiv);
267  virtual ~MaturityB() {};
272  virtual void setStock(StockPtrVector& stockvec);
277  virtual void Reset(const TimeClass* const TimeInfo);
283  virtual int isMaturationStep(const TimeClass* const TimeInfo);
292  virtual double calcMaturation(int age, int length, int growth, double weight);
297  virtual void Print(ofstream& outfile) const;
298 protected:
311 };
312 
317 class MaturityC : public Maturity {
318 public:
331  MaturityC(CommentStream& infile, const TimeClass* const TimeInfo,
332  Keeper* const keeper, int minage, int numage, const IntVector& areas,
333  const char* givenname, const LengthGroupDivision* const LgrpDiv, int numMatConst);
337  virtual ~MaturityC() {};
342  virtual void setStock(StockPtrVector& stockvec);
347  virtual void Reset(const TimeClass* const TimeInfo);
353  virtual int isMaturationStep(const TimeClass* const TimeInfo);
362  virtual double calcMaturation(int age, int length, int growth, double weight);
367  virtual void Print(ofstream& outfile) const;
368 protected:
393 };
394 
399 class MaturityD : public MaturityC {
400 public:
414  MaturityD(CommentStream& infile, const TimeClass* const TimeInfo,
415  Keeper* const keeper, int minage, int numage, const IntVector& areas,
416  const char* givenname, const LengthGroupDivision* const LgrpDiv, int numMatConst, const char* refWeightFile);
420  virtual ~MaturityD() {};
425  virtual void setStock(StockPtrVector& stockvec);
430  virtual void Reset(const TimeClass* const TimeInfo);
436  virtual int isMaturationStep(const TimeClass* const TimeInfo);
445  virtual double calcMaturation(int age, int length, int growth, double weight);
450  virtual void Print(ofstream& outfile) const;
451 protected:
456 };
457 
458 #endif
This class implements a dynamic vector of AgeBandMatrix values.
Definition: agebandmatrixptrvector.h:12
Definition: agebandmatrixratioptrvector.h:16
This class implements a dynamic vector of char values.
Definition: charptrvector.h:8
This is the class used to strip comments (and whitespace) from any input stream.
Definition: commentstream.h:40
This class implements a dynamic vector of ConversionIndex values.
Definition: conversionindexptrvector.h:10
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 class implements a dynamic vector of Formula values.
Definition: formulavector.h:10
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
This is the class used to calculate the maturity based on the 'continuous' maturity function.
Definition: maturity.h:167
int minMatureAge
This is the minimum age when maturation will take place.
Definition: maturity.h:233
virtual void setStock(StockPtrVector &stockvec)
This will select the stocks required for the maturation process.
Definition: maturity.cc:284
int minStockAge
This is the minimum age of the maturing stock, used as an index for preCalcMaturation.
Definition: maturity.h:229
virtual int isMaturationStep(const TimeClass *const TimeInfo)
This will check if the maturation process will take place on the current timestep.
Definition: maturity.cc:315
ModelVariableVector maturityParameters
This is the ModelVariableVector of maturation parameters.
Definition: maturity.h:225
virtual void Print(ofstream &outfile) const
This function will print the maturation information.
Definition: maturity.cc:309
virtual void Reset(const TimeClass *const TimeInfo)
This will reset the maturation information for the current model run.
Definition: maturity.cc:257
virtual double calcMaturation(int age, int length, int growth, double weight)
This will calculate the probability of maturation for a given age and length of the immature stock.
Definition: maturity.cc:299
int minMatureLength
This is the minimum length group division when maturation will take place.
Definition: maturity.h:237
double timesteplength
This is the length of the current timestep.
Definition: maturity.h:241
virtual ~MaturityA()
This is the default MaturityA destructor.
Definition: maturity.h:186
DoubleMatrix preCalcMaturation
This is the DoubleMatrix of maturation parameters.
Definition: maturity.h:221
MaturityA(CommentStream &infile, const TimeClass *const TimeInfo, Keeper *const keeper, int minage, int numage, const IntVector &areas, const char *givenname, const LengthGroupDivision *const LgrpDiv)
This is the MaturityA constructor.
Definition: maturity.cc:211
This is the class used to calculate the maturity based on the 'fixedlength' maturity function.
Definition: maturity.h:248
virtual int isMaturationStep(const TimeClass *const TimeInfo)
This will check if the maturation process will take place on the current timestep.
Definition: maturity.cc:430
virtual void setStock(StockPtrVector &stockvec)
This will select the stocks required for the maturation process.
Definition: maturity.cc:401
virtual ~MaturityB()
This is the default MaturityB destructor.
Definition: maturity.h:267
IntVector maturitystep
This is the IntVector of timesteps when maturation will take place.
Definition: maturity.h:306
int currentmaturitystep
This is the current time step for the maturation process within the model simulation.
Definition: maturity.h:302
MaturityB(CommentStream &infile, const TimeClass *const TimeInfo, Keeper *const keeper, int minage, int numage, const IntVector &areas, const char *givenname, const LengthGroupDivision *const LgrpDiv)
This is the MaturityB constructor.
Definition: maturity.cc:322
virtual void Reset(const TimeClass *const TimeInfo)
This will reset the maturation information for the current model run.
Definition: maturity.cc:405
virtual double calcMaturation(int age, int length, int growth, double weight)
This will calculate the probability of maturation for a given age and length of the immature stock.
Definition: maturity.cc:423
virtual void Print(ofstream &outfile) const
This function will print the maturation information.
Definition: maturity.cc:389
ModelVariableVector maturitylength
This is the ModelVariableVector of lengths when maturation will take place.
Definition: maturity.h:310
This is the class used to calculate the maturity based on the 'constant' maturity function.
Definition: maturity.h:317
ModelVariableVector maturityParameters
This is the ModelVariableVector of maturation parameters.
Definition: maturity.h:376
virtual int isMaturationStep(const TimeClass *const TimeInfo)
This will check if the maturation process will take place on the current timestep.
Definition: maturity.cc:555
MaturityC(CommentStream &infile, const TimeClass *const TimeInfo, Keeper *const keeper, int minage, int numage, const IntVector &areas, const char *givenname, const LengthGroupDivision *const LgrpDiv, int numMatConst)
This is the MaturityC constructor.
Definition: maturity.cc:444
virtual void setStock(StockPtrVector &stockvec)
This will select the stocks required for the maturation process.
Definition: maturity.cc:502
virtual void Reset(const TimeClass *const TimeInfo)
This will reset the maturation information for the current model run.
Definition: maturity.cc:517
virtual ~MaturityC()
This is the default MaturityC destructor.
Definition: maturity.h:337
int minMatureAge
This is the minimum age when maturation will take place.
Definition: maturity.h:384
virtual void Print(ofstream &outfile) const
This function will print the maturation information.
Definition: maturity.cc:563
int minStockAge
This is the minimum age of the maturing stock, used as an index for preCalcMaturation.
Definition: maturity.h:380
DoubleMatrix preCalcMaturation
This is the DoubleMatrix of maturation parameters.
Definition: maturity.h:372
int minMatureLength
This is the minimum length group division when maturation will take place.
Definition: maturity.h:388
virtual double calcMaturation(int age, int length, int growth, double weight)
This will calculate the probability of maturation for a given age and length of the immature stock.
Definition: maturity.cc:549
IntVector maturitystep
This is the IntVector of timesteps when maturation will take place.
Definition: maturity.h:392
This is the class used to calculate the maturity based on the 'constantweight' maturity function.
Definition: maturity.h:399
virtual int isMaturationStep(const TimeClass *const TimeInfo)
This will check if the maturation process will take place on the current timestep.
Definition: maturity.cc:665
virtual void Reset(const TimeClass *const TimeInfo)
This will reset the maturation information for the current model run.
Definition: maturity.cc:631
virtual double calcMaturation(int age, int length, int growth, double weight)
This will calculate the probability of maturation for a given age and length of the immature stock.
Definition: maturity.cc:646
DoubleVector refWeight
This is the DoubleVector of reference weight information.
Definition: maturity.h:455
virtual void Print(ofstream &outfile) const
This function will print the maturation information.
Definition: maturity.cc:673
MaturityD(CommentStream &infile, const TimeClass *const TimeInfo, Keeper *const keeper, int minage, int numage, const IntVector &areas, const char *givenname, const LengthGroupDivision *const LgrpDiv, int numMatConst, const char *refWeightFile)
This is the MaturityD constructor.
Definition: maturity.cc:577
virtual void setStock(StockPtrVector &stockvec)
This will select the stocks required for the maturation process.
Definition: maturity.cc:616
virtual ~MaturityD()
This is the default MaturityD destructor.
Definition: maturity.h:420
This is the base class used to calculate the maturity of a stock within the model.
Definition: maturity.h:22
const StockPtrVector & getMatureStocks()
This will calculate the mature stocks the immature stock can mature into.
Definition: maturity.cc:160
LengthGroupDivision * LgrpDiv
This is the LengthGroupDivision of the stock.
Definition: maturity.h:147
virtual int isMaturationStep(const TimeClass *const TimeInfo)=0
This will check if the maturation process will take place on the current timestep.
Maturity()
This is the default Maturity constructor.
void storeMatureStock(int area, int age, int length, double number, double weight)
This will store the calculated mature stock.
Definition: maturity.cc:140
StockPtrVector matureStocks
This is the StockPtrVector of the mature stocks.
Definition: maturity.h:123
FormulaVector matureRatio
This is the FormulaVector of the ratio of the immature stock to mature into each mature stock.
Definition: maturity.h:131
virtual double calcMaturation(int age, int length, int growth, double weight)=0
This will calculate the probability of maturation for a given age and length of the immature stock.
CharPtrVector matureStockNames
This is the CharPtrVector of the names of the mature stocks.
Definition: maturity.h:127
virtual void Reset(const TimeClass *const TimeInfo)
This will reset the maturation information for the current model run.
Definition: maturity.cc:101
void storeMatureTagStock(int area, int age, int length, double number, int id)
This will store the calculated mature tagged stock.
Definition: maturity.cc:149
ConversionIndexPtrVector CI
This is the ConversionIndexPtrVector used to convert from the immature stock lengths to the mature st...
Definition: maturity.h:143
virtual void Print(ofstream &outfile) const
This function will print the maturation information.
Definition: maturity.cc:86
double ratioscale
This is used to scale the ratios to ensure that they will always sum to 1.
Definition: maturity.h:135
void deleteMaturityTag(const char *tagname)
This will remove a tagging experiment from the maturation calculations.
Definition: maturity.cc:183
virtual ~Maturity()
This is the default Maturity destructor.
Definition: maturity.cc:33
virtual void setStock(StockPtrVector &stockvec)
This will select the stocks required for the maturation process.
Definition: maturity.cc:42
void addMaturityTag(const char *tagname)
This will add a tagging experiment to the maturation calculations.
Definition: maturity.cc:177
IntVector ratioindex
This is the IntVector used as an index for the ratio vector.
Definition: maturity.h:139
void setTagged()
This function will initialise the tagging experiments for the maturation calculations.
Definition: maturity.cc:164
void Move(int area, const TimeClass *const TimeInfo)
This will move the calculated mature stock into the mature stock age-length cells.
Definition: maturity.cc:121
double tmpratio
This is used to temporarily store the maturation ratio.
Definition: maturity.h:119
This class implements a dynamic vector of ModelVariable values.
Definition: modelvariablevector.h:10
This class implements a dynamic vector of Stock values.
Definition: stockptrvector.h:10
This is the class used to store information about the timesteps used for the current model.
Definition: areatime.h:87