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

Annotation of /trunk/gadget/stock.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (view) (download)

1 : agomez 1 #ifndef stock_h
2 :     #define stock_h
3 :    
4 :     #include "areatime.h"
5 :     #include "agebandmatrix.h"
6 :     #include "agebandmatrixratioptrvector.h"
7 :     #include "base.h"
8 :     #include "conversionindex.h"
9 :     #include "stockptrvector.h"
10 :     #include "tagptrvector.h"
11 :     #include "commentstream.h"
12 :    
13 :     class Stock;
14 :     class Keeper;
15 :     class NaturalMortality;
16 :     class Grower;
17 :     class InitialCond;
18 :     class Migration;
19 :     class Transition;
20 :     class PopPredator;
21 :     class StockPrey;
22 :     class Maturity;
23 :     class RenewalData;
24 :     class SpawnData;
25 :     class StrayData;
26 :    
27 :     /**
28 :     * \class Stock
29 :     * \brief This is the class used to model a stock within the Gadget model
30 :     *
31 :     * This class is used to model the population of a stock during a model simulation.
32 :     */
33 :     class Stock : public BaseClass {
34 :     public:
35 :     /**
36 :     * \brief This is the Stock constructor
37 :     * \param infile is the CommentStream to read the stock parameters from
38 :     * \param givenname is the name of the stock
39 :     * \param Area is the AreaClass for the current model
40 :     * \param TimeInfo is the TimeClass for the current model
41 :     * \param keeper is the Keeper for the current model
42 :     */
43 :     Stock(CommentStream& infile, const char* givenname, const AreaClass* const Area,
44 :     const TimeClass* const TimeInfo, Keeper* const keeper);
45 :     /**
46 :     * \brief This is the default Stock constructor
47 :     * \param givenname is the name of the stock
48 :     */
49 :     Stock(const char* givenname);
50 :     /**
51 :     * \brief This is the default Stock destructor
52 :     */
53 :     virtual ~Stock();
54 :     /**
55 :     * \brief This function will update the model population for an area in the model
56 :     * \param area is an integer to denote the internal area of interest
57 :     * \param TimeInfo is the TimeClass for the current model
58 :     */
59 :     virtual void calcNumbers(int area, const TimeClass* const TimeInfo);
60 :     /**
61 :     * \brief This function will reduce the model population for an area in the model
62 :     * \param area is an integer to denote the internal area of interest
63 :     * \param TimeInfo is the TimeClass for the current model
64 :     */
65 :     virtual void reducePop(int area, const TimeClass* const TimeInfo);
66 :     /**
67 :     * \brief This function will calculate the growth of the model population for an area in the model
68 :     * \param area is an integer to denote the internal area of interest
69 :     * \param Area is the AreaClass for the current model
70 :     * \param TimeInfo is the TimeClass for the current model
71 :     */
72 :     virtual void Grow(int area, const AreaClass* const Area, const TimeClass* const TimeInfo);
73 :     /**
74 :     * \brief This function will calculate any transition of the model population for an area in the model
75 :     * \param area is an integer to denote the internal area of interest
76 :     * \param TimeInfo is the TimeClass for the current model
77 :     */
78 :     virtual void updateAgePart1(int area, const TimeClass* const TimeInfo);
79 :     /**
80 :     * \brief This function will calculate the age increase of the model population for an area in the model
81 :     * \param area is an integer to denote the internal area of interest
82 :     * \param TimeInfo is the TimeClass for the current model
83 :     */
84 :     virtual void updateAgePart2(int area, const TimeClass* const TimeInfo);
85 :     /**
86 :     * \brief This function will implement the transiton of the model population for an area in the model
87 :     * \param area is an integer to denote the internal area of interest
88 :     * \param TimeInfo is the TimeClass for the current model
89 :     */
90 :     virtual void updateAgePart3(int area, const TimeClass* const TimeInfo);
91 :     /**
92 :     * \brief This function will calculate the spawning of the model population for an area in the model
93 :     * \param area is an integer to denote the internal area of interest
94 :     * \param TimeInfo is the TimeClass for the current model
95 :     */
96 :     virtual void updatePopulationPart1(int area, const TimeClass* const TimeInfo);
97 :     /**
98 :     * \brief This function will calculate add the newly matured stock into the model population for an area in the model
99 :     * \param area is an integer to denote the internal area of interest
100 :     * \param TimeInfo is the TimeClass for the current model
101 :     */
102 :     virtual void updatePopulationPart2(int area, const TimeClass* const TimeInfo);
103 :     /**
104 :     * \brief This function will calculate add the new recruits into the model population for an area in the model
105 :     * \param area is an integer to denote the internal area of interest
106 :     * \param TimeInfo is the TimeClass for the current model
107 :     */
108 :     virtual void updatePopulationPart3(int area, const TimeClass* const TimeInfo);
109 :     /**
110 :     * \brief This function will calculate calculate the straying of the model population for an area in the model
111 :     * \param area is an integer to denote the internal area of interest
112 :     * \param TimeInfo is the TimeClass for the current model
113 :     */
114 :     virtual void updatePopulationPart4(int area, const TimeClass* const TimeInfo);
115 :     /**
116 :     * \brief This function will calculate add the strayed stock into the model population for an area in the model
117 :     * \param area is an integer to denote the internal area of interest
118 :     * \param TimeInfo is the TimeClass for the current model
119 :     */
120 :     virtual void updatePopulationPart5(int area, const TimeClass* const TimeInfo);
121 :     /**
122 :     * \brief This function will calculate the modelled consumption for an area in the model
123 :     * \param area is an integer to denote the internal area of interest
124 :     * \param Area is the AreaClass for the current model
125 :     * \param TimeInfo is the TimeClass for the current model
126 :     */
127 :     virtual void calcEat(int area, const AreaClass* const Area, const TimeClass* const TimeInfo);
128 :     /**
129 :     * \brief This function will check the modelled consumption for an area in the model
130 :     * \param area is an integer to denote the internal area of interest
131 :     * \param TimeInfo is the TimeClass for the current model
132 :     */
133 :     virtual void checkEat(int area, const TimeClass* const TimeInfo);
134 :     /**
135 :     * \brief This function will adjust the modelled consumption for an area in the model
136 :     * \param area is an integer to denote the internal area of interest
137 :     * \param TimeInfo is the TimeClass for the current model
138 :     */
139 :     virtual void adjustEat(int area, const TimeClass* const TimeInfo);
140 :     /**
141 :     * \brief This function will reset the model population
142 :     * \param TimeInfo is the TimeClass for the current model
143 :     */
144 :     virtual void Reset(const TimeClass* const TimeInfo);
145 :     /**
146 :     * \brief This function will print the model population
147 :     * \param outfile is the ofstream that all the model information gets sent to
148 :     */
149 :     void Print(ofstream& outfile) const;
150 :     /**
151 :     * \brief This function will implement the migration of the model population for the model
152 :     * \param TimeInfo is the TimeClass for the current model
153 :     */
154 :     virtual void Migrate(const TimeClass* const TimeInfo);
155 :     /**
156 :     * \brief This function will add a AgeBandMatrix to the current stock population
157 :     * \param Addition is the AgeBandMatrix that will be added to the population
158 :     * \param CI is the ConversionIndex that will convert between the length groups
159 :     * \param area is an integer to denote the internal area of interest
160 :     * \param ratio is a multiplicative constant applied
161 :     */
162 :     void Add(const AgeBandMatrix& Addition, const ConversionIndex* const CI, int area, double ratio);
163 :     /**
164 :     * \brief This function will add a AgeBandMatrixRatioPtrVector to the current tagged stock population
165 :     * \param Addition is the AgeBandMatrixRatioPtrVector that will be added to the tagged population
166 :     * \param CI is the ConversionIndex that will convert between the length groups
167 :     * \param area is an integer to denote the internal area of interest
168 :     * \param ratio is a multiplicative constant applied
169 :     */
170 :     void Add(const AgeBandMatrixRatioPtrVector& Addition, const ConversionIndex* const CI, int area, double ratio);
171 :     /**
172 :     * \brief This will return the prey information for the stock
173 :     * \return prey
174 :     */
175 :     StockPrey* getPrey() const;
176 :     /**
177 :     * \brief This will return the migration information for the stock
178 :     * \return migration
179 :     */
180 :     Migration* getMigration() const;
181 :     /**
182 :     * \brief This will return the predation information for the stock
183 :     * \return predator
184 :     */
185 :     PopPredator* getPredator() const;
186 :     /**
187 :     * \brief This will return the current population of the stock on a given area
188 :     * \param area is the area identifier
189 :     * \return alkeys, a AgeBandMatrix containing the population of the stock
190 :     */
191 :     AgeBandMatrix& getCurrentALK(int area) { return Alkeys[this->areaNum(area)]; };
192 :     /**
193 :     * \brief This will return the population of the stock on a given area at the start of the current timestep
194 :     * \param area is the area identifier
195 :     * \return alkeys, a AgeBandMatrix containing the population of the stock
196 :     */
197 :     AgeBandMatrix& getConsumptionALK(int area);
198 :     /**
199 :     * \brief This will return the length group information for the stock
200 :     * \return LgrpDiv
201 :     */
202 :     const LengthGroupDivision* getLengthGroupDiv() const { return LgrpDiv; };
203 :     /**
204 :     * \brief This function will initialise the stock and set-up links to any related stocks
205 :     * \param stockvec is the StockPtrVector of all the available stocks
206 :     */
207 :     void setStock(StockPtrVector& stockvec);
208 :     /**
209 :     * \brief This function will check to see if the age of the stock should be increased on the current timestep or not
210 :     * \param TimeInfo is the TimeClass for the current model
211 :     * \return 1 if the age of the stock should be increased, 0 otherwise
212 :     */
213 :     int isBirthday(const TimeClass* const TimeInfo) const;
214 :     /**
215 :     * \brief This function will return the flag used to denote whether the stock is eaten or not
216 :     * \return flag
217 :     */
218 :     int isEaten() const { return iseaten; };
219 :     /**
220 :     * \brief This function will return the flag used to denote whether the stock will spawn or not
221 :     * \return flag
222 :     */
223 :     int doesSpawn() const { return doesspawn; };
224 :     /**
225 :     * \brief This function will return the flag used to denote whether the stock will stray or not
226 :     * \return flag
227 :     */
228 :     int doesStray() const { return doesstray; };
229 :     /**
230 :     * \brief This function will return the flag used to denote whether the stock will move or not
231 :     * \return flag
232 :     */
233 :     int doesMove() const { return doesmove; };
234 :     /**
235 :     * \brief This function will return the flag used to denote whether the stock will eat or not
236 :     * \return flag
237 :     */
238 :     int doesEat() const { return doeseat; };
239 :     /**
240 :     * \brief This function will return the flag used to denote whether the stock will mature or not
241 :     * \return flag
242 :     */
243 :     int doesMature() const { return doesmature; };
244 :     /**
245 :     * \brief This function will return the flag used to denote whether the stock will renew or not
246 :     * \return flag
247 :     */
248 :     int doesRenew() const { return doesrenew; };
249 :     /**
250 :     * \brief This function will return the flag used to denote whether the stock will grow or not
251 :     * \return flag
252 :     */
253 :     int doesGrow() const { return doesgrow; };
254 :     /**
255 :     * \brief This function will return the flag used to denote whether the stock will migrate or not
256 :     * \return flag
257 :     */
258 :     int doesMigrate() const { return doesmigrate; };
259 :     /**
260 :     * \brief This function will return the flag used to denote whether the stock has been tagged or not
261 :     * \return flag
262 :     */
263 :     int isTagged() const { return istagged; };
264 :     /**
265 :     * \brief This function will set the flag to denote that the stock has been tagged
266 :     */
267 :     void setTaggedStock() { istagged = 1; };
268 :     /**
269 :     * \brief This function will initialise the tagging experiments for the stock and any related stocks
270 :     */
271 :     void setTagged();
272 :     /**
273 :     * \brief This will return the minimum age of the stock
274 :     * \return minimum age
275 :     */
276 :     int minAge() const { return Alkeys[0].minAge(); };
277 :     /**
278 :     * \brief This will return the maximum age of the stock
279 :     * \return maximum age
280 :     */
281 :     int maxAge() const { return Alkeys[0].maxAge(); };
282 :     /**
283 :     * \brief This will return the total population size (in numbers) of the stock on a given area
284 :     * \param area is the area identifier
285 :     * \return population size
286 :     */
287 :     double getTotalStockNumber(int area) const;
288 :     /**
289 :     * \brief This will return the total population size (in numbers) of the stock across all areas
290 :     * \return population size
291 :     */
292 :     double getTotalStockNumberAllAreas() const;
293 :     /**
294 :     * \brief This will return the total population biomass of the stock on a given area
295 :     * \param area is the area identifier
296 :     * \return population biomass
297 :     */
298 :     double getTotalStockBiomass(int area) const;
299 :     /**
300 :     * \brief This will return the total population biomass of the stock across all areas
301 :     * \return population biomass
302 :     */
303 :     double getTotalStockBiomassAllAreas() const;
304 :     /**
305 :     * \brief This will return the stocks that this stock will mature in to
306 :     * \return maturestocks, a StockPtrVector of the stocks that this stock will mature into
307 :     */
308 :     const StockPtrVector& getMatureStocks();
309 :     /**
310 :     * \brief This will return the stocks that this stock will move in to
311 :     * \return transitionstocks, a StockPtrVector of the stocks that this stock will move into
312 :     */
313 :     const StockPtrVector& getTransitionStocks();
314 :     /**
315 :     * \brief This will return the stocks that this stock will stray in to
316 :     * \return straystocks, a StockPtrVector of the stocks that this stock will stray into
317 :     */
318 :     const StockPtrVector& getStrayStocks();
319 :     /**
320 :     * \brief This function will add details for a new tagging experiment on the current stock
321 :     * \param tagbyagelength is the AgeBandMatrixPtrVector of the new tagged population
322 :     * \param newtag is the Tags for the new tagging experiment
323 :     * \param tagloss is the proportion of tags that are lost for the new tagging experiment
324 :     */
325 :     void addTags(AgeBandMatrixPtrVector* tagbyagelength, Tags* newtag, double tagloss);
326 :     /**
327 :     * \brief This function will remove a tagging experiment from the current tagged stock population
328 :     * \param tagname is the name of the tagging experiment to be removed
329 :     */
330 :     void deleteTags(const char* tagname);
331 :     protected:
332 :     /**
333 :     * \brief This is the AgeBandMatrixPtrVector used to store information about the stock population
334 :     */
335 :     AgeBandMatrixPtrVector Alkeys;
336 :     /**
337 :     * \brief This is the AgeBandMatrixRatioPtrVector used to store information about the tagged population from any tagging experiments performed on the stock
338 :     */
339 :     AgeBandMatrixRatioPtrVector tagAlkeys;
340 :     /**
341 :     * \brief This is the TagPtrVector used to store information about the tagging experiments
342 :     */
343 :     TagPtrVector allTags;
344 :     /**
345 :     * \brief This is the TagPtrVector used to store information about how the tagging experiments affect the population that mature
346 :     */
347 :     TagPtrVector matureTags;
348 :     /**
349 :     * \brief This is the TagPtrVector used to store information about how the tagging experiments affect the population that move
350 :     */
351 :     TagPtrVector transitionTags;
352 :     /**
353 :     * \brief This is the TagPtrVector used to store information about how the tagging experiments affect the population that stray
354 :     */
355 :     TagPtrVector strayTags;
356 :     /**
357 :     * \brief This is the StrayData used to calculate information about the straying of the stock
358 :     */
359 :     StrayData* stray;
360 :     /**
361 :     * \brief This is the SpawnData used to calculate information about the spawning of the stock
362 :     */
363 :     SpawnData* spawner;
364 :     /**
365 :     * \brief This is the RenewalData used to calculate information about the renewal of the stock
366 :     */
367 :     RenewalData* renewal;
368 :     /**
369 :     * \brief This is the Maturity used to calculate information about the maturation of the stock
370 :     */
371 :     Maturity* maturity;
372 :     /**
373 :     * \brief This is the Transition used to calculate information about the movement of the stock
374 :     */
375 :     Transition* transition;
376 :     /**
377 :     * \brief This is the Migration used to calculate information about the migration of the stock
378 :     */
379 :     Migration* migration;
380 :     /**
381 :     * \brief This is the Prey used to calculate information about the consumption of the stock
382 :     */
383 :     StockPrey* prey;
384 :     /**
385 :     * \brief This is the PopPredator used to calculate information about the consumption by the stock
386 :     */
387 :     PopPredator* predator;
388 :     /**
389 :     * \brief This is the InitialCond used to calculate information about the initial conditions of the stock
390 :     */
391 :     InitialCond* initial;
392 :     /**
393 :     * \brief This is the LengthGroupDivision used to store length information
394 :     */
395 :     LengthGroupDivision* LgrpDiv;
396 :     /**
397 :     * \brief This is the Grower used to calculate information about the growth of the stock
398 :     */
399 :     Grower* grower;
400 :     /**
401 :     * \brief This is the NaturalMortality used to calculate information about the natural mortality of the stock
402 :     */
403 :     NaturalMortality* naturalm;
404 :     /**
405 :     * \brief This is the flag used to denote whether the stock will eat (ie. is a Predator) or not
406 :     */
407 :     int doeseat;
408 :     /**
409 :     * \brief This is the flag used to denote whether the stock will move or not
410 :     */
411 :     int doesmove;
412 :     /**
413 :     * \brief This is the flag used to denote whether the stock is eaten (ie. is a Prey) or not
414 :     */
415 :     int iseaten;
416 :     /**
417 :     * \brief This is the flag used to denote whether the stock will spawn or not
418 :     */
419 :     int doesspawn;
420 :     /**
421 :     * \brief This is the flag used to denote whether the stock will mature or not
422 :     */
423 :     int doesmature;
424 :     /**
425 :     * \brief This is the flag used to denote whether the stock will renew or not
426 :     */
427 :     int doesrenew;
428 :     /**
429 :     * \brief This is the flag used to denote whether the stock will grow or not
430 :     */
431 :     int doesgrow;
432 :     /**
433 :     * \brief This is the flag used to denote whether the stock will migrate or not
434 :     */
435 :     int doesmigrate;
436 :     /**
437 :     * \brief This is the flag used to denote whether the stock will stray or not
438 :     */
439 :     int doesstray;
440 :     /**
441 :     * \brief This is the timestep that the population will increase in age in the simulation
442 :     * \note This is currently set to the last timestep in the year
443 :     */
444 :     int birthdate;
445 :     /**
446 :     * \brief This is the flag used to denote whether the stock has been included in a tagging experiment or not
447 :     */
448 :     int istagged;
449 :     /**
450 :     * \brief This is the PopInfoMatrix used to temporarily store the population during the growth calculation
451 :     */
452 :     PopInfoMatrix tmpPopulation;
453 :     /**
454 :     * \brief This is the PopInfoVector used to temporarily store the population during the migration calculation
455 :     */
456 :     PopInfoVector tmpMigrate;
457 :     };
458 :    
459 :     #endif

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

Powered By FusionForge