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

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

Powered By FusionForge