1 : |
agomez |
1 |
#ifndef initialcond_h
|
2 : |
|
|
#define initialcond_h
|
3 : |
|
|
|
4 : |
|
|
#include "formulamatrixptrvector.h" |
5 : |
|
|
#include "areatime.h" |
6 : |
|
|
#include "conversionindex.h" |
7 : |
|
|
#include "commentstream.h" |
8 : |
|
|
#include "agebandmatrixptrvector.h" |
9 : |
|
|
#include "livesonareas.h" |
10 : |
|
|
#include "keeper.h" |
11 : |
|
|
|
12 : |
|
|
/**
|
13 : |
|
|
* \class InitialCond
|
14 : |
|
|
* \brief This is the class used to calculate the initial population of a stock
|
15 : |
|
|
*
|
16 : |
|
|
* This class calculates the initial population for a model run. There are 2 ways to do this - either by specifying a normal distribution or by specifying the actual population to be used.
|
17 : |
|
|
*
|
18 : |
|
|
* For the normal distribution, Gadget will calculate a length distribution for a population of 10,000 fish for each age group, which will then be multiplied by age and area factors to give the initial population.
|
19 : |
|
|
*
|
20 : |
|
|
* For the numbers, Gadget will read a list of the population in each age-length cell for each area.
|
21 : |
|
|
*
|
22 : |
|
|
* The initial weight for each age-length cell will be set to the reference weight, multiplied by a conditioning factor.
|
23 : |
|
|
*/
|
24 : |
|
|
class InitialCond : public HasName, protected LivesOnAreas {
|
25 : |
|
|
public:
|
26 : |
|
|
/**
|
27 : |
|
|
* \brief This is the InitialCond constructor
|
28 : |
|
|
* \param infile is the CommentStream to read the initial conditions data from
|
29 : |
|
|
* \param areas is the IntVector of areas that the initial population will be calculated on
|
30 : |
|
|
* \param keeper is the Keeper for the current model
|
31 : |
|
|
* \param refWeightFile is the name of the reference weight file
|
32 : |
|
|
* \param givenname is the name of the stock for this InitialCond class
|
33 : |
|
|
* \param Area is the AreaClass for the current model
|
34 : |
|
|
* \param DL is the step length of the length groups of the stock
|
35 : |
|
|
*/
|
36 : |
|
|
InitialCond(CommentStream& infile, const IntVector& areas, Keeper* const keeper,
|
37 : |
|
|
const char* refWeightFile, const char* givenname, const AreaClass* const Area, double DL);
|
38 : |
|
|
/**
|
39 : |
|
|
* \brief This is the default InitialCond destructor
|
40 : |
|
|
*/
|
41 : |
|
|
~InitialCond();
|
42 : |
|
|
/**
|
43 : |
|
|
* \brief This function will set the initial population of the stock to that specified in the initial conditions file
|
44 : |
|
|
* \param Alkeys is the AgeBandMatrixPtrVector that will contain the initial population of the stock
|
45 : |
|
|
*/
|
46 : |
|
|
void Initialise(AgeBandMatrixPtrVector& Alkeys);
|
47 : |
|
|
/**
|
48 : |
|
|
* \brief This will set the ConversionIndex required for to calculate the initial conditions
|
49 : |
|
|
* \param GivenLDiv is the LengthGroupDivision for the stock
|
50 : |
|
|
*/
|
51 : |
|
|
void setCI(const LengthGroupDivision* const GivenLDiv);
|
52 : |
|
|
/**
|
53 : |
|
|
* \brief This function will print the initial population
|
54 : |
|
|
* \param outfile is the ofstream that all the model information gets sent to
|
55 : |
|
|
*/
|
56 : |
|
|
void Print(ofstream& outfile) const;
|
57 : |
|
|
protected:
|
58 : |
|
|
/**
|
59 : |
|
|
* \brief This is the function used to read the normal distribution and condition factor for the initial condtion data
|
60 : |
|
|
* \param infile is the CommentStream to read the initial conditions data from
|
61 : |
|
|
* \param keeper is the Keeper for the current model
|
62 : |
|
|
* \param numage is the number of age groups for the initial population
|
63 : |
|
|
* \param minage is the minimum age for the initial population
|
64 : |
|
|
* \param Area is the AreaClass for the current model
|
65 : |
|
|
*/
|
66 : |
|
|
void readNormalConditionData(CommentStream& infile, Keeper* const keeper,
|
67 : |
|
|
int numage, int minage, const AreaClass* const Area);
|
68 : |
|
|
/**
|
69 : |
|
|
* \brief This is the function used to read the normal distribution for the initial condtion data
|
70 : |
|
|
* \param infile is the CommentStream to read the initial conditions data from
|
71 : |
|
|
* \param keeper is the Keeper for the current model
|
72 : |
|
|
* \param numage is the number of age groups for the initial population
|
73 : |
|
|
* \param minage is the minimum age for the initial population
|
74 : |
|
|
* \param Area is the AreaClass for the current model
|
75 : |
|
|
*/
|
76 : |
|
|
void readNormalParameterData(CommentStream& infile, Keeper* const keeper,
|
77 : |
|
|
int numage, int minage, const AreaClass* const Area);
|
78 : |
|
|
/**
|
79 : |
|
|
* \brief This is the function used to read the numbers of the initial population
|
80 : |
|
|
* \param infile is the CommentStream to read the initial conditions data from
|
81 : |
|
|
* \param keeper is the Keeper for the current model
|
82 : |
|
|
* \param numage is the number of age groups for the initial population
|
83 : |
|
|
* \param minage is the minimum age for the initial population
|
84 : |
|
|
* \param Area is the AreaClass for the current model
|
85 : |
|
|
*/
|
86 : |
|
|
void readNumberData(CommentStream& infile, Keeper* const keeper,
|
87 : |
|
|
int numage, int minage, const AreaClass* const Area);
|
88 : |
|
|
/**
|
89 : |
|
|
* \brief This is the LengthGroupDivision of the initial population of the stock
|
90 : |
|
|
*/
|
91 : |
|
|
LengthGroupDivision* LgrpDiv;
|
92 : |
|
|
/**
|
93 : |
|
|
* \brief This is the ConversionIndex used to convert from the initial population LengthGroupDivision to the stock LengthGroupDivision
|
94 : |
|
|
*/
|
95 : |
|
|
ConversionIndex* CI;
|
96 : |
|
|
/**
|
97 : |
|
|
* \brief This is the AgeBandMatrixPtrVector used to store the initial population
|
98 : |
|
|
*/
|
99 : |
|
|
AgeBandMatrixPtrVector initialPop;
|
100 : |
|
|
/**
|
101 : |
|
|
* \brief This is the FormulaMatrixPtrVector that contains the number (from the input file) of the initial population
|
102 : |
|
|
*/
|
103 : |
|
|
FormulaMatrixPtrVector initialNumber;
|
104 : |
|
|
/**
|
105 : |
|
|
* \brief This is the FormulaMatrix of the area factor used to calculate the initial population
|
106 : |
|
|
*/
|
107 : |
|
|
FormulaMatrix areaFactor;
|
108 : |
|
|
/**
|
109 : |
|
|
* \brief This is the FormulaMatrix of the age factor used to calculate the initial population
|
110 : |
|
|
*/
|
111 : |
|
|
FormulaMatrix ageFactor;
|
112 : |
|
|
/**
|
113 : |
|
|
* \brief This is the FormulaMatrix of the condition factor used to calculate the weight of the initial population
|
114 : |
|
|
*/
|
115 : |
|
|
FormulaMatrix relCond;
|
116 : |
|
|
/**
|
117 : |
|
|
* \brief This is the FormulaMatrix of the mean length at age used to calculate the initial population
|
118 : |
|
|
*/
|
119 : |
|
|
FormulaMatrix meanLength;
|
120 : |
|
|
/**
|
121 : |
|
|
* \brief This is the FormulaMatrix of the standard deviation of the length at age used to calculate the initial population
|
122 : |
|
|
*/
|
123 : |
|
|
FormulaMatrix sdevLength;
|
124 : |
|
|
/**
|
125 : |
|
|
* \brief This is the FormulaMatrix of the alpha parameter used when calculating the length weight relationship
|
126 : |
|
|
*/
|
127 : |
|
|
FormulaMatrix alpha;
|
128 : |
|
|
/**
|
129 : |
|
|
* \brief This is the FormulaMatrix of the beta parameter used when calculating the length weight relationship
|
130 : |
|
|
*/
|
131 : |
|
|
FormulaMatrix beta;
|
132 : |
|
|
/**
|
133 : |
|
|
* \brief This is the optional factor used when calculating the standard deviation of the length
|
134 : |
|
|
*/
|
135 : |
|
|
Formula sdevMult;
|
136 : |
|
|
/**
|
137 : |
|
|
* \brief This is the DoubleVector of the reference weight values
|
138 : |
|
|
*/
|
139 : |
|
|
DoubleVector refWeight;
|
140 : |
|
|
/**
|
141 : |
|
|
* \brief This is the identifier of the function to be used to read the initial population data from file
|
142 : |
|
|
*/
|
143 : |
|
|
int readoption;
|
144 : |
|
|
};
|
145 : |
|
|
|
146 : |
|
|
#endif
|