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/spawner.h
[mareframe] / trunk / gadget / spawner.h Repository:
ViewVC logotype

Annotation of /trunk/gadget/spawner.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (view) (download)

1 : agomez 1 #ifndef spawner_h
2 :     #define spawner_h
3 :    
4 :     #include "areatime.h"
5 :     #include "formulavector.h"
6 :     #include "modelvariablevector.h"
7 :     #include "commentstream.h"
8 :     #include "agebandmatrix.h"
9 :     #include "intmatrix.h"
10 :     #include "livesonareas.h"
11 :     #include "selectfunc.h"
12 :     #include "stock.h"
13 :    
14 :     /**
15 :     * \class SpawnData
16 :     * \brief This is the class used to calculate the affect of the spawning process on the stock, possibly including the creation of new recruits into the model
17 :     *
18 :     * This class calculates the proportion of the stock that should be removed from the model due to the spawning process, and the affect that the spawning process has on the remaining stock. This class can optionally add new recruits into the model due to the spawning process, implementing a closed life cycle model. For the 'parent' stock, the spawning process can remove a proportion of the stock due to a spawning mortality, and reduce the weight of those that survive. For the 'child' stock, the spawning process will create a number of recruits based on a recruitment function, and then add these into the model in a similar way to the RenewalData class.
19 :     */
20 :     class SpawnData : public HasName, protected LivesOnAreas {
21 :     public:
22 :     /**
23 :     * \brief This is the SpawnData constructor
24 :     * \param infile is the CommentStream to read the spawning data from
25 :     * \param maxage is the maximum age of the spawning stock
26 :     * \param LgrpDiv is the LengthGroupDivision that the spawning stock will be calculated on
27 :     * \param Areas is the IntVector of areas that the spawning stock will be calculated on
28 :     * \param Area is the AreaClass for the current model
29 :     * \param givenname is the name of the stock for this SpawnData class
30 :     * \param TimeInfo is the TimeClass for the current model
31 :     * \param keeper is the Keeper for the current model
32 :     */
33 :     SpawnData(CommentStream& infile, int maxage, const LengthGroupDivision* const LgrpDiv,
34 :     const IntVector& Areas, const AreaClass* const Area, const char* givenname,
35 :     const TimeClass* const TimeInfo, Keeper* const keeper);
36 :     /**
37 :     * \brief This is the default SpawnData destructor
38 :     */
39 :     ~SpawnData();
40 :     /**
41 :     * \brief This will select the stocks required for the spawning process
42 :     * \param stockvec is the StockPtrVector of all the available stocks
43 :     */
44 :     void setStock(StockPtrVector& stockvec);
45 :     /**
46 :     * \brief This will add the calculated spawned stock into the new stock age-length cells
47 :     * \param area is the area that the spawning process is being calculated on
48 :     * \param TimeInfo is the TimeClass for the current model
49 :     */
50 :     void addSpawnStock(int area, const TimeClass* const TimeInfo);
51 :     /**
52 :     * \brief This will calculate the
53 :     * \param Alkeys is the AgeBandMatrix of the spawning stock
54 :     * \param area is the area that the transition is being calculated on
55 :     * \param TimeInfo is the TimeClass for the current model
56 :     */
57 :     void Spawn(AgeBandMatrix& Alkeys, int area, const TimeClass* const TimeInfo);
58 :     /**
59 :     * \brief This will check if the spawning process will take place on the current timestep and area
60 :     * \param area is the area that the spawning is being calculated on
61 :     * \param TimeInfo is the TimeClass for the current model
62 :     * \return 1 if the spawning process will take place, 0 otherwise
63 :     */
64 :     int isSpawnStepArea(int area, const TimeClass* const TimeInfo);
65 :     /**
66 :     * \brief This function will print the spawning information
67 :     * \param outfile is the ofstream that all the model information gets sent to
68 :     */
69 :     void Print(ofstream& outfile) const;
70 :     /**
71 :     * \brief This function will reset the spawning data
72 :     */
73 :     void Reset(const TimeClass* const TimeInfo);
74 :     protected:
75 :     /**
76 :     * \brief This function will calculate the number of recruits that will be created by the spawning process on the current timestep, for a given age-length cell of the spawning stock
77 :     * \param age is the age of the spawning stock
78 :     * \param len is the length of the spawning stock
79 :     * \param number is the number of the spawning stock in the age-length cell
80 :     * \param weight is the weight of the spawning stock in the age-length cell
81 :     * \return number of recruits
82 :     */
83 :     double calcSpawnNumber(int age, int len, double number, double weight);
84 :     /**
85 :     * \brief This function will calculate the total number of recruits that have been created by the spawning process on the current timestep
86 :     * \param temp is the current temperature
87 :     * \param inarea is the current area identifier
88 :     * \return total number of recruits
89 :     */
90 :     double calcRecruitNumber(double temp, int inarea);
91 :     /**
92 :     * \brief This is the StockPtrVector of the stocks that will be spawned
93 :     */
94 :     StockPtrVector spawnStocks;
95 :     /**
96 :     * \brief This is the CharPtrVector of the names of the spawned stocks
97 :     */
98 :     CharPtrVector spawnStockNames;
99 :     /**
100 :     * \brief This is the FormulaVector of the ratio of the new stock to move into each spawned stock
101 :     */
102 :     FormulaVector spawnRatio;
103 :     /**
104 :     * \brief This is used to scale the ratios to ensure that they will always sum to 1
105 :     */
106 :     double ratioscale;
107 :     /**
108 :     * \brief This is the IntVector used as an index for the ratio vector
109 :     */
110 :     IntVector ratioindex;
111 :     /**
112 :     * \brief This is the first year of the simulation that the spawning will take place on
113 :     * \note This is optional, and will default to the first year of the simulation if it is not specified
114 :     */
115 :     int spawnFirstYear;
116 :     /**
117 :     * \brief This is the last year of the simulation that the spawning will take place on
118 :     * \note This is optional, and will default to the last year of the simulation if it is not specified
119 :     */
120 :     int spawnLastYear;
121 :     /**
122 :     * \brief This is the IntVector used to store information about the steps when the spawning takes place
123 :     */
124 :     IntVector spawnStep;
125 :     /**
126 :     * \brief This is the IntVector used to store information about the areas where the spawning takes place
127 :     */
128 :     IntVector spawnArea;
129 :     /**
130 :     * \brief This is the LengthGroupDivision of the stock
131 :     */
132 :     LengthGroupDivision* LgrpDiv;
133 :     /**
134 :     * \brief This is the DoubleVector of the proportion of each length group of the stock that will spawn
135 :     */
136 :     DoubleVector spawnProportion;
137 :     /**
138 :     * \brief This is the DoubleVector of the proportion of each length group of the stock that will die due to the spawning process
139 :     */
140 :     DoubleVector spawnMortality;
141 :     /**
142 :     * \brief This is the DoubleVector of the weight loss of each length group of the stock due to the spawning process
143 :     */
144 :     DoubleVector spawnWeightLoss;
145 :     /**
146 :     * \brief This is the SelectFunc used to calculate of the proportion of each length group of the stock that will spawn
147 :     */
148 :     SelectFunc* fnProportion;
149 :     /**
150 :     * \brief This is the SelectFunc used to calculate of the proportion of each length group of the stock that will die due to the spawning process
151 :     */
152 :     SelectFunc* fnMortality;
153 :     /**
154 :     * \brief This is the SelectFunc used to calculate of the weight loss of each length group of the stock due to the spawning process
155 :     */
156 :     SelectFunc* fnWeightLoss;
157 :     /**
158 :     * \brief This is the AgeBandMatrixPtrVector used to store the calculated spawned stocks
159 :     */
160 :     AgeBandMatrixPtrVector Storage;
161 :     /**
162 :     * \brief This is the ConversionIndexPtrVector used to convert to the stock lengths for the spawned stock
163 :     */
164 :     ConversionIndexPtrVector CI;
165 :     /**
166 :     * \brief This is the LengthGroupDivision of the spawned stock
167 :     */
168 :     LengthGroupDivision* spawnLgrpDiv;
169 :     /**
170 :     * \brief This is the DoubleMatrix used to store the numbers of the recruits, if the spawning process is to include the creation of the recruits
171 :     */
172 :     DoubleMatrixPtrVector spawnNumbers;
173 :     /**
174 :     * \brief This is the ModelVariableVector used to store the parameters when calculating the recruitment from the spawning process, if the spawning process is to include the creation of the recruits
175 :     */
176 :     ModelVariableVector spawnParameters;
177 :     /**
178 :     * \brief This is the ModelVariableVector used to store the parameters when calculating the recruits, if the spawning process is to include the creation of the recruits
179 :     */
180 :     ModelVariableVector stockParameters;
181 :     /**
182 :     * \brief This is the flag used to denote whether the spawning process should include the creation of the recruits
183 :     */
184 :     int onlyParent;
185 :     /**
186 :     * \brief This is the age that the spawned stock will move into the new stocks
187 :     */
188 :     int spawnAge;
189 :     /**
190 :     * \brief This is the identifier of the function to be used to calculate the number of recruits
191 :     */
192 :     int functionnumber;
193 :     /**
194 :     * \brief This is the name of the function to be used to calculate the number of recruits
195 :     */
196 :     char* functionname;
197 :     };
198 :    
199 :     #endif

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

Powered By FusionForge