Log In | Get Help   
Home My Page Projects Code Snippets Project Openings Mareframe
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files
[mareframe] Annotation of /trunk/gadget/agebandmatrix.h
[mareframe] / trunk / gadget / agebandmatrix.h Repository:
ViewVC logotype

Annotation of /trunk/gadget/agebandmatrix.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (view) (download)

1 : agomez 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 :    
11 :     /**
12 :     * \class AgeBandMatrix
13 :     * \brief This class implements a vector of PopInfoIndexVector values, indexed from minage not 0
14 :     */
15 :     class AgeBandMatrix {
16 :     public:
17 :     /**
18 :     * \brief This is the default AgeBandMatrix constructor
19 :     */
20 :     AgeBandMatrix() { minage = 0; nrow = 0; v = 0; };
21 :     /**
22 :     * \brief This is the AgeBandMatrix constructor for a specified minimum age and size
23 :     * \param age is the minimum index of the vector to be created
24 :     * \param minl is the IntVector of minimum lengths used when constructing the entries of the vector
25 :     * \param size is the IntVector of sizes used when constructing the entries of the vector
26 :     */
27 :     AgeBandMatrix(int age, const IntVector& minl, const IntVector& size);
28 :     /**
29 :     * \brief This is the AgeBandMatrix constructor for a specified minimum age and initial value
30 :     * \param age is the minimum index of the vector to be created
31 :     * \param initial is the initial value for all the entries of the vector
32 :     * \param minl is the minimum length used when constructing the entries of the vector
33 :     */
34 :     AgeBandMatrix(int age, const PopInfoMatrix& initial, int minl);
35 :     /**
36 :     * \brief This is the AgeBandMatrix constructor for a specified minimum age and initial value
37 :     * \param age is the minimum index of the vector to be created
38 :     * \param initial is the initial value for the entry of the vector
39 :     * \note There will only be one entry on the vector created with this constructor
40 :     */
41 :     AgeBandMatrix(int age, const PopInfoIndexVector& initial);
42 :     /**
43 :     * \brief This is the AgeBandMatrix constructor that creates a copy of an existing AgeBandMatrix
44 :     * \param initial is the AgeBandMatrix to copy
45 :     */
46 :     AgeBandMatrix(const AgeBandMatrix& initial);
47 :     /**
48 :     * \brief This is the AgeBandMatrix destructor
49 :     * \note This will free all the memory allocated to all the elements of the vector
50 :     */
51 :     ~AgeBandMatrix();
52 :     /**
53 :     * \brief This will return the minimum age of the population stored in the vector
54 :     * \return minimum age
55 :     */
56 :     int minAge() const { return minage; };
57 :     /**
58 :     * \brief This will return the maximum age of the population stored in the vector
59 :     * \return maximum age
60 :     */
61 :     int maxAge() const { return minage + nrow - 1; };
62 :     /**
63 :     * \brief This will return the number of rows of the vector
64 :     * \return the number of rows of the vector
65 :     */
66 :     int Nrow() const { return nrow; };
67 :     /**
68 :     * \brief This will return the value of an element of the vector
69 :     * \param age is the element of the vector to be returned
70 :     * \return the value of the specified element
71 :     */
72 :     PopInfoIndexVector& operator [] (int age) { return *(v[age - minage]); };
73 :     /**
74 :     * \brief This will return the value of an element of the vector
75 :     * \param age is the element of the vector to be returned
76 :     * \return the value of the specified element
77 :     */
78 :     const PopInfoIndexVector& operator [] (int age) const { return *(v[age - minage]); };
79 :     /**
80 :     * \brief This will return the minimum length of an age group stored in the vector
81 :     * \param age is identifier for the age group
82 :     * \return minimum length
83 :     */
84 :     int minLength(int age) const { return v[age - minage]->minCol(); };
85 :     /**
86 :     * \brief This will return the maximum length of an age group stored in the vector
87 :     * \param age is identifier for the age group
88 :     * \return maximum length
89 :     */
90 :     int maxLength(int age) const { return v[age - minage]->maxCol(); };
91 :     /**
92 :     * \brief This function will sum the columns of each element stored in the vector (ie sum over all ages for each length group of the population)
93 :     * \param Result is the PopInfoVector containing the sum over all ages for each length
94 :     */
95 :     void sumColumns(PopInfoVector& Result) const;
96 :     /**
97 :     * \brief This function will subtract a multiplicative ratio from each element stored in the vector
98 :     * \param Ratio is the DoubleVector of multiplicative constants
99 :     * \param CI is the ConversionIndex that will convert between the length groups of the 2 vectors
100 :     */
101 :     void Subtract(const DoubleVector& Ratio, const ConversionIndex& CI);
102 :     /**
103 :     * \brief This function will multiply each element stored in the vector by a constant
104 :     * \param Ratio is the DoubleVector of multiplicative constants
105 :     */
106 :     void Multiply(const DoubleVector& Ratio);
107 :     /**
108 :     * \brief This function will set the population stored in the vector to zero
109 :     */
110 :     void setToZero();
111 :     /**
112 :     * \brief This function will increase the age of the population stored in the vector to zero
113 :     */
114 :     void IncrementAge();
115 :     /**
116 :     * \brief This function will print the numbers of the population stored in the vector
117 :     * \param outfile is the ofstream that all the model information gets sent to
118 :     */
119 :     void printNumbers(ofstream& outfile) const;
120 :     /**
121 :     * \brief This function will print the mean weights of the population stored in the vector
122 :     * \param outfile is the ofstream that all the model information gets sent to
123 :     */
124 :     void printWeights(ofstream& outfile) const;
125 :     /**
126 :     * \brief This function will increase the length and mean weight of the population stored in the vector, according to values calculated by the GrowthCalc calculations for the population
127 :     * \param Lgrowth is the DoubleMatrix of the calculated change in length due to the growth
128 :     * \param Wgrowth is the DoubleMatrix of the calculated change in mean weight due to the growth
129 :     */
130 :     void Grow(const DoubleMatrix& Lgrowth, const DoubleMatrix& Wgrowth);
131 :     /**
132 :     * \brief This function will increase the length and mean weight of the population stored in the vector, according to values calculated by the GrowthCalc and Maturity calculations for the population
133 :     * \param Lgrowth is the DoubleMatrix of the calculated change in length due to the growth
134 :     * \param Wgrowth is the DoubleMatrix of the calculated change in mean weight due to the growth
135 :     * \param Mat is the Maturity used to calculate (and store) the proportion that population that will mature
136 :     * \param area is the identifier for the are used for the maturation process
137 :     */
138 :     void Grow(const DoubleMatrix& Lgrowth, const DoubleMatrix& Wgrowth, Maturity* const Mat, int area);
139 :     /**
140 :     * \brief This function will increase the length of the population stored in the vector, according to values calculated by the GrowthCalc calculations for the population
141 :     * \param Lgrowth is the DoubleMatrix of the calculated change in length due to the growth
142 :     * \param Weight is the DoubleVector of the specified mean weight of the population
143 :     * \note The mean weight of the population is fixed to values specified in the input file for the population
144 :     */
145 :     void Grow(const DoubleMatrix& Lgrowth, const DoubleVector& Weight);
146 :     /**
147 :     * \brief This function will increase the length and mean weight of the population stored in the vector, according to values calculated by the GrowthCalc and Maturity calculations for the population
148 :     * \param Lgrowth is the DoubleMatrix of the calculated change in length due to the growth
149 :     * \param Weight is the DoubleVector of the specified mean weight of the population
150 :     * \param Mat is the Maturity used to calculate (and store) the proportion that population that will mature
151 :     * \param area is the identifier for the are used for the maturation process
152 :     * \note The mean weight of the population is fixed to values specified in the input file for the population
153 :     */
154 :     void Grow(const DoubleMatrix& Lgrowth, const DoubleVector& Weight, Maturity* const Mat, int area);
155 :     /**
156 :     * \brief This function will add a AgeBandMatrix to the current vector
157 :     * \param Addition is the AgeBandMatrix that will be added to the current vector
158 :     * \param CI is the ConversionIndex that will convert between the length groups of the 2 vectors
159 :     * \param ratio is a multiplicative constant applied to each entry (default value 1.0)
160 :     */
161 :     void Add(const AgeBandMatrix& Addition, const ConversionIndex& CI, double ratio = 1.0);
162 :     protected:
163 :     /**
164 :     * \brief This is the index for the vector
165 :     */
166 :     int minage;
167 :     /**
168 :     * \brief This is number of rows of the vector
169 :     */
170 :     int nrow;
171 :     /**
172 :     * \brief This is the indexed vector of PopInfoIndexVector values
173 :     */
174 :     PopInfoIndexVector** v;
175 :     };
176 :    
177 :     #endif

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge