Gadget
agebandmatrix.h
Go to the documentation of this file.
1 #ifndef agebandmatrix_h
2 #define agebandmatrix_h
3 
4 #include "conversionindex.h"
5 #include "doublematrix.h"
6 #include "popinfomatrix.h"
7 #include "popinfoindexvector.h"
8 
9 class Maturity;
10 
16 public:
20  AgeBandMatrix() { minage = 0; nrow = 0; v = 0; };
27  AgeBandMatrix(int age, const IntVector& minl, const IntVector& size);
34  AgeBandMatrix(int age, const PopInfoMatrix& initial, int minl);
41  AgeBandMatrix(int age, const PopInfoIndexVector& initial);
46  AgeBandMatrix(const AgeBandMatrix& initial);
56  int minAge() const { return minage; };
61  int maxAge() const { return minage + nrow - 1; };
66  int Nrow() const { return nrow; };
72  PopInfoIndexVector& operator [] (int age) { return *(v[age - minage]); };
78  const PopInfoIndexVector& operator [] (int age) const { return *(v[age - minage]); };
84  int minLength(int age) const { return v[age - minage]->minCol(); };
90  int maxLength(int age) const { return v[age - minage]->maxCol(); };
95  void sumColumns(PopInfoVector& Result) const;
101  void Subtract(const DoubleVector& Ratio, const ConversionIndex& CI);
106  void Multiply(const DoubleVector& Ratio);
110  void setToZero();
114  void IncrementAge();
119  void printNumbers(ofstream& outfile) const;
124  void printWeights(ofstream& outfile) const;
130  void Grow(const DoubleMatrix& Lgrowth, const DoubleMatrix& Wgrowth);
138  void Grow(const DoubleMatrix& Lgrowth, const DoubleMatrix& Wgrowth, Maturity* const Mat, int area);
145  void Grow(const DoubleMatrix& Lgrowth, const DoubleVector& Weight);
154  void Grow(const DoubleMatrix& Lgrowth, const DoubleVector& Weight, Maturity* const Mat, int area);
161  void Add(const AgeBandMatrix& Addition, const ConversionIndex& CI, double ratio = 1.0);
162 protected:
166  int minage;
170  int nrow;
175 };
176 
177 #endif
This class implements a vector of PopInfoIndexVector values, indexed from minage not 0.
Definition: agebandmatrix.h:15
int minAge() const
This will return the minimum age of the population stored in the vector.
Definition: agebandmatrix.h:56
PopInfoIndexVector & operator[](int age)
This will return the value of an element of the vector.
Definition: agebandmatrix.h:72
int Nrow() const
This will return the number of rows of the vector.
Definition: agebandmatrix.h:66
void sumColumns(PopInfoVector &Result) const
This function will sum the columns of each element stored in the vector (ie sum over all ages for eac...
Definition: agebandmatrixmemberfunctions.cc:90
int nrow
This is number of rows of the vector.
Definition: agebandmatrix.h:170
int minLength(int age) const
This will return the minimum length of an age group stored in the vector.
Definition: agebandmatrix.h:84
PopInfoIndexVector ** v
This is the indexed vector of PopInfoIndexVector values.
Definition: agebandmatrix.h:174
void IncrementAge()
This function will increase the age of the population stored in the vector to zero.
Definition: agebandmatrixmemberfunctions.cc:99
void printWeights(ofstream &outfile) const
This function will print the mean weights of the population stored in the vector.
Definition: agebandmatrixmemberfunctions.cc:146
void setToZero()
This function will set the population stored in the vector to zero.
Definition: agebandmatrixmemberfunctions.cc:120
void printNumbers(ofstream &outfile) const
This function will print the numbers of the population stored in the vector.
Definition: agebandmatrixmemberfunctions.cc:127
~AgeBandMatrix()
This is the AgeBandMatrix destructor.
Definition: agebandmatrix.cc:60
void Multiply(const DoubleVector &Ratio)
This function will multiply each element stored in the vector by a constant.
Definition: agebandmatrixmemberfunctions.cc:83
int minage
This is the index for the vector.
Definition: agebandmatrix.h:166
int maxAge() const
This will return the maximum age of the population stored in the vector.
Definition: agebandmatrix.h:61
void Add(const AgeBandMatrix &Addition, const ConversionIndex &CI, double ratio=1.0)
This function will add a AgeBandMatrix to the current vector.
Definition: agebandmatrixmemberfunctions.cc:11
void Subtract(const DoubleVector &Ratio, const ConversionIndex &CI)
This function will subtract a multiplicative ratio from each element stored in the vector.
Definition: agebandmatrixmemberfunctions.cc:63
int maxLength(int age) const
This will return the maximum length of an age group stored in the vector.
Definition: agebandmatrix.h:90
AgeBandMatrix()
This is the default AgeBandMatrix constructor.
Definition: agebandmatrix.h:20
void Grow(const DoubleMatrix &Lgrowth, const DoubleMatrix &Wgrowth)
This function will increase the length and mean weight of the population stored in the vector,...
Definition: grow.cc:12
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 class implements a dynamic vector of int values.
Definition: intvector.h:11
This is the base class used to calculate the maturity of a stock within the model.
Definition: maturity.h:22
This class implements a dynamic vector of PopInfo values, indexed from minpos not 0.
Definition: popinfoindexvector.h:11
int minCol() const
This will return the index of the vector.
Definition: popinfoindexvector.h:64
int maxCol() const
This will return the length of the vector.
Definition: popinfoindexvector.h:69
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