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

Annotation of /trunk/gadget/suitfunc.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (view) (download)

1 : agomez 1 #ifndef suitfunc_h
2 :     #define suitfunc_h
3 :    
4 :     #include "commentstream.h"
5 :     #include "hasname.h"
6 :     #include "keeper.h"
7 :     #include "modelvariablevector.h"
8 :    
9 :     /**
10 :     * \class SuitFunc
11 :     * \brief This is the base class used to calculate the predator prey suitability value
12 :     * \note This will always be overridden by the derived classes that actually calculate the suitability value
13 :     */
14 :     class SuitFunc : public HasName {
15 :     public:
16 :     /**
17 :     * \brief This is the default SuitFunc constructor
18 :     * \param givenname is the name for the SuitFunc selection function
19 :     */
20 :     SuitFunc(const char* givenname) : HasName(givenname) {};
21 :     /**
22 :     * \brief This is the default SuitFunc destructor
23 :     */
24 :     virtual ~SuitFunc() {};
25 :     /**
26 :     * \brief This function will return the value of the selection function parameters
27 :     * \return v, a ModelVariableVector of the parameters
28 :     */
29 :     const ModelVariableVector& getConstants() const;
30 :     /**
31 :     * \brief This function will read the value of the suitability function parameters from file
32 :     * \param infile is the CommentStream to read the parameters from
33 :     * \param TimeInfo is the TimeClass for the current model
34 :     * \param keeper is the Keeper for the current model
35 :     */
36 :     void readConstants(CommentStream& infile, const TimeClass* const TimeInfo, Keeper* const keeper);
37 :     /**
38 :     * \brief This function will update the suitability function parameters
39 :     * \param TimeInfo is the TimeClass for the current model
40 :     */
41 :     void updateConstants(const TimeClass* const TimeInfo);
42 :     /**
43 :     * \brief This function will check to see if the suitability function parameters have changed
44 :     * \param TimeInfo is the TimeClass for the current model
45 :     * \return 1 if the parameters have changed, 0 otherwise
46 :     */
47 :     int didChange(const TimeClass* const TimeInfo);
48 :     /**
49 :     * \brief This will return 1 if the suitability function is based on the predator length, 0 otherwise
50 :     * \return 0 (will be overridden in derived classes)
51 :     */
52 :     virtual int usesPredLength() = 0;
53 :     /**
54 :     * \brief This will return 1 if the suitability function is based on the prey length, 0 otherwise
55 :     * \return 0 (will be overridden in derived classes)
56 :     */
57 :     virtual int usesPreyLength() = 0;
58 :     /**
59 :     * \brief This will set the predator length
60 :     * \param length is the predator length
61 :     */
62 :     virtual void setPredLength(double length);
63 :     /**
64 :     * \brief This will set the prey length
65 :     * \param length is the prey length
66 :     */
67 :     virtual void setPreyLength(double length);
68 :     /**
69 :     * \brief This will return the suitability value that has been calculated
70 :     * \return 0 (will be overridden in derived classes)
71 :     */
72 :     virtual double calculate() = 0;
73 :     /**
74 :     * \brief This will return the number of constants used to calculate the suitability value
75 :     * \return number
76 :     */
77 :     int numConstants() { return coeff.Size(); };
78 :     protected:
79 :     /**
80 :     * \brief This is the ModelVariableVector of suitability function constants
81 :     */
82 :     ModelVariableVector coeff;
83 :     };
84 :    
85 :     /**
86 :     * \class ExpSuitFuncA
87 :     * \brief This is the class used to calculate the suitability based on an exponential function of the predator and prey lengths
88 :     */
89 :     class ExpSuitFuncA : public SuitFunc {
90 :     public:
91 :     /**
92 :     * \brief This is the ExpSuitFuncA constructor
93 :     */
94 :     ExpSuitFuncA();
95 :     /**
96 :     * \brief This is the default ExpSuitFuncA destructor
97 :     */
98 :     virtual ~ExpSuitFuncA() {};
99 :     /**
100 :     * \brief This will return 1 if the suitability function is based on the predator length, 0 otherwise
101 :     * \return 1
102 :     */
103 :     virtual int usesPredLength() { return 1; };
104 :     /**
105 :     * \brief This will return 1 if the suitability function is based on the prey length, 0 otherwise
106 :     * \return 1
107 :     */
108 :     virtual int usesPreyLength() { return 1; };
109 :     /**
110 :     * \brief This will set the predator length
111 :     * \param length is the predator length
112 :     */
113 :     virtual void setPredLength(double length) { predLength = length; };
114 :     /**
115 :     * \brief This will set the prey length
116 :     * \param length is the prey length
117 :     */
118 :     virtual void setPreyLength(double length) { preyLength = length; };
119 :     /**
120 :     * \brief This will return the suitability value that has been calculated
121 :     * \return value
122 :     */
123 :     virtual double calculate();
124 :     private:
125 :     /**
126 :     * \brief This is the length of the prey
127 :     */
128 :     double preyLength;
129 :     /**
130 :     * \brief This is the length of the predator
131 :     */
132 :     double predLength;
133 :     };
134 :    
135 :     /**
136 :     * \class ConstSuitFunc
137 :     * \brief This is the class used to calculate a constant suitability
138 :     */
139 :     class ConstSuitFunc : public SuitFunc {
140 :     public:
141 :     /**
142 :     * \brief This is the ConstSuitFunc constructor
143 :     */
144 :     ConstSuitFunc();
145 :     /**
146 :     * \brief This is the default ConstSuitFunc destructor
147 :     */
148 :     virtual ~ConstSuitFunc() {};
149 :     /**
150 :     * \brief This will return 1 if the suitability function is based on the predator length, 0 otherwise
151 :     * \return 0
152 :     */
153 :     virtual int usesPredLength() { return 0; };
154 :     /**
155 :     * \brief This will return 1 if the suitability function is based on the prey length, 0 otherwise
156 :     * \return 0
157 :     */
158 :     virtual int usesPreyLength() { return 0; };
159 :     /**
160 :     * \brief This will return the suitability value that has been calculated
161 :     * \return value
162 :     */
163 :     virtual double calculate();
164 :     };
165 :    
166 :     /**
167 :     * \class AndersenSuitFunc
168 :     * \brief This is the class used to calculate the suitability based on an Andersen function
169 :     */
170 :     class AndersenSuitFunc : public SuitFunc {
171 :     public:
172 :     /**
173 :     * \brief This is the AndersenSuitFunc constructor
174 :     */
175 :     AndersenSuitFunc();
176 :     /**
177 :     * \brief This is the default AndersenSuitFunc destructor
178 :     */
179 :     virtual ~AndersenSuitFunc() {};
180 :     /**
181 :     * \brief This will return 1 if the suitability function is based on the predator length, 0 otherwise
182 :     * \return 1
183 :     */
184 :     virtual int usesPredLength() { return 1; };
185 :     /**
186 :     * \brief This will return 1 if the suitability function is based on the prey length, 0 otherwise
187 :     * \return 1
188 :     */
189 :     virtual int usesPreyLength() { return 1; };
190 :     /**
191 :     * \brief This will set the predator length
192 :     * \param length is the predator length
193 :     */
194 :     virtual void setPredLength(double length) { predLength = length; };
195 :     /**
196 :     * \brief This will set the prey length
197 :     * \param length is the prey length
198 :     */
199 :     virtual void setPreyLength(double length) { preyLength = length; };
200 :     /**
201 :     * \brief This will return the suitability value that has been calculated
202 :     * \return value
203 :     */
204 :     virtual double calculate();
205 :     private:
206 :     /**
207 :     * \brief This is the length of the prey
208 :     */
209 :     double preyLength;
210 :     /**
211 :     * \brief This is the length of the predator
212 :     */
213 :     double predLength;
214 :     };
215 :    
216 :     /**
217 :     * \class ExpSuitFuncL50
218 :     * \brief This is the class used to calculate the suitability based on an exponential function of the prey length
219 :     */
220 :     class ExpSuitFuncL50 : public SuitFunc {
221 :     public:
222 :     /**
223 :     * \brief This is the ExpSuitFuncL50 constructor
224 :     */
225 :     ExpSuitFuncL50();
226 :     /**
227 :     * \brief This is the default ExpSuitFuncL50 destructor
228 :     */
229 :     virtual ~ExpSuitFuncL50() {};
230 :     /**
231 :     * \brief This will return 1 if the suitability function is based on the predator length, 0 otherwise
232 :     * \return 0
233 :     */
234 :     virtual int usesPredLength() { return 0; };
235 :     /**
236 :     * \brief This will return 1 if the suitability function is based on the prey length, 0 otherwise
237 :     * \return 1
238 :     */
239 :     virtual int usesPreyLength() { return 1; };
240 :     /**
241 :     * \brief This will set the prey length
242 :     * \param length is the prey length
243 :     */
244 :     virtual void setPreyLength(double length) { preyLength = length; };
245 :     /**
246 :     * \brief This will return the suitability value that has been calculated
247 :     * \return value
248 :     */
249 :     virtual double calculate();
250 :     private:
251 :     /**
252 :     * \brief This is the length of the prey
253 :     */
254 :     double preyLength;
255 :     };
256 :    
257 :     /**
258 :     * \class StraightSuitFunc
259 :     * \brief This is the class used to calculate the suitability based on a linear function of the prey length
260 :     */
261 :     class StraightSuitFunc : public SuitFunc {
262 :     public:
263 :     /**
264 :     * \brief This is the StraightSuitFunc constructor
265 :     */
266 :     StraightSuitFunc();
267 :     /**
268 :     * \brief This is the default StraightSuitFunc destructor
269 :     */
270 :     virtual ~StraightSuitFunc() {};
271 :     /**
272 :     * \brief This will return 1 if the suitability function is based on the predator length, 0 otherwise
273 :     * \return 0
274 :     */
275 :     virtual int usesPredLength() { return 0; };
276 :     /**
277 :     * \brief This will return 1 if the suitability function is based on the prey length, 0 otherwise
278 :     * \return 1
279 :     */
280 :     virtual int usesPreyLength() { return 1; };
281 :     /**
282 :     * \brief This will set the prey length
283 :     * \param length is the prey length
284 :     */
285 :     virtual void setPreyLength(double length) { preyLength = length; };
286 :     /**
287 :     * \brief This will return the suitability value that has been calculated
288 :     * \return value
289 :     */
290 :     virtual double calculate();
291 :     private:
292 :     /**
293 :     * \brief This is the length of the prey
294 :     */
295 :     double preyLength;
296 :     };
297 :    
298 :     /**
299 :     * \class InverseSuitFunc
300 :     * \brief This is the class used to calculate the suitability based on an inverse exponential function of the prey length
301 :     */
302 :     class InverseSuitFunc : public SuitFunc {
303 :     public:
304 :     /**
305 :     * \brief This is the InverseSuitFunc constructor
306 :     */
307 :     InverseSuitFunc();
308 :     /**
309 :     * \brief This is the default InverseSuitFunc destructor
310 :     */
311 :     virtual ~InverseSuitFunc() {};
312 :     /**
313 :     * \brief This will return 1 if the suitability function is based on the predator length, 0 otherwise
314 :     * \return 0
315 :     */
316 :     virtual int usesPredLength() { return 0; };
317 :     /**
318 :     * \brief This will return 1 if the suitability function is based on the prey length, 0 otherwise
319 :     * \return 1
320 :     */
321 :     virtual int usesPreyLength() { return 1; };
322 :     /**
323 :     * \brief This will set the prey length
324 :     * \param length is the prey length
325 :     */
326 :     virtual void setPreyLength(double length) { preyLength = length; };
327 :     /**
328 :     * \brief This will return the suitability value that has been calculated
329 :     * \return value
330 :     */
331 :     virtual double calculate();
332 :     private:
333 :     /**
334 :     * \brief This is the length of the prey
335 :     */
336 :     double preyLength;
337 :     };
338 :    
339 :     /**
340 :     * \class StraightUnboundedSuitFunc
341 :     * \brief This is the class used to calculate the suitability based on a linear function of the prey length with no upper bound
342 :     */
343 :     class StraightUnboundedSuitFunc : public SuitFunc {
344 :     public:
345 :     /**
346 :     * \brief This is the StraightUnboundedSuitFunc constructor
347 :     */
348 :     StraightUnboundedSuitFunc();
349 :     /**
350 :     * \brief This is the default StraightUnboundedSuitFunc destructor
351 :     */
352 :     virtual ~StraightUnboundedSuitFunc() {};
353 :     /**
354 :     * \brief This will return 1 if the suitability function is based on the predator length, 0 otherwise
355 :     * \return 0
356 :     */
357 :     virtual int usesPredLength() { return 0; };
358 :     /**
359 :     * \brief This will return 1 if the suitability function is based on the prey length, 0 otherwise
360 :     * \return 1
361 :     */
362 :     virtual int usesPreyLength() { return 1; };
363 :     /**
364 :     * \brief This will set the prey length
365 :     * \param length is the prey length
366 :     */
367 :     virtual void setPreyLength(double length) { preyLength = length; };
368 :     /**
369 :     * \brief This will return the suitability value that has been calculated
370 :     * \return value
371 :     */
372 :     virtual double calculate();
373 :     private:
374 :     /**
375 :     * \brief This is the length of the prey
376 :     */
377 :     double preyLength;
378 :     };
379 :    
380 :     /**
381 :     * \class RichardsSuitFunc
382 :     * \brief This is the class used to calculate the suitability based on a Richards function
383 :     */
384 :     class RichardsSuitFunc : public SuitFunc {
385 :     public:
386 :     /**
387 :     * \brief This is the RichardsSuitFunc constructor
388 :     */
389 :     RichardsSuitFunc();
390 :     /**
391 :     * \brief This is the default RichardsSuitFunc destructor
392 :     */
393 :     virtual ~RichardsSuitFunc() {};
394 :     /**
395 :     * \brief This will return 1 if the suitability function is based on the predator length, 0 otherwise
396 :     * \return 1
397 :     */
398 :     virtual int usesPredLength() { return 1; };
399 :     /**
400 :     * \brief This will return 1 if the suitability function is based on the prey length, 0 otherwise
401 :     * \return 1
402 :     */
403 :     virtual int usesPreyLength() { return 1; };
404 :     /**
405 :     * \brief This will set the predator length
406 :     * \param length is the predator length
407 :     */
408 :     virtual void setPredLength(double length) { predLength = length; };
409 :     /**
410 :     * \brief This will set the prey length
411 :     * \param length is the prey length
412 :     */
413 :     virtual void setPreyLength(double length) { preyLength = length; };
414 :     /**
415 :     * \brief This will return the suitability value that has been calculated
416 :     * \return value
417 :     */
418 :     virtual double calculate();
419 :     private:
420 :     /**
421 :     * \brief This is the length of the prey
422 :     */
423 :     double preyLength;
424 :     /**
425 :     * \brief This is the length of the predator
426 :     */
427 :     double predLength;
428 :     };
429 :    
430 :     /**
431 :     * \class GammaSuitFunc
432 :     * \brief This is the class used to calculate the suitability based on a Gamma function, usually used when calculating suitability curves for gillnet fleets
433 :     */
434 :     class GammaSuitFunc : public SuitFunc {
435 :     public:
436 :     /**
437 :     * \brief This is the GammaSuitFunc constructor
438 :     */
439 :     GammaSuitFunc();
440 :     /**
441 :     * \brief This is the default GammaSuitFunc destructor
442 :     */
443 :     virtual ~GammaSuitFunc() {};
444 :     /**
445 :     * \brief This will return 1 if the suitability function is based on the predator length, 0 otherwise
446 :     * \return 0
447 :     */
448 :     virtual int usesPredLength() { return 0; };
449 :     /**
450 :     * \brief This will return 1 if the suitability function is based on the prey length, 0 otherwise
451 :     * \return 1
452 :     */
453 :     virtual int usesPreyLength() { return 1; };
454 :     /**
455 :     * \brief This will set the prey length
456 :     * \param length is the prey length
457 :     */
458 :     virtual void setPreyLength(double length) { preyLength = length; };
459 :     /**
460 :     * \brief This will return the suitability value that has been calculated
461 :     * \return value
462 :     */
463 :     virtual double calculate();
464 :     private:
465 :     /**
466 :     * \brief This is the length of the prey
467 :     */
468 :     double preyLength;
469 :     };
470 :    
471 :     /**
472 :     * \class AndersenFleetSuitFunc
473 :     * \brief This is the class used to calculate the suitability based on an Andersen function for fleet based predators
474 :     */
475 :     class AndersenFleetSuitFunc : public SuitFunc {
476 :     public:
477 :     /**
478 :     * \brief This is the AndersenFleetSuitFunc constructor
479 :     */
480 :     AndersenFleetSuitFunc();
481 :     /**
482 :     * \brief This is the default AndersenFleetSuitFunc destructor
483 :     */
484 :     virtual ~AndersenFleetSuitFunc() {};
485 :     /**
486 :     * \brief This will return 1 if the suitability function is based on the predator length, 0 otherwise
487 :     * \return 0
488 :     */
489 :     virtual int usesPredLength() { return 0; };
490 :     /**
491 :     * \brief This will return 1 if the suitability function is based on the prey length, 0 otherwise
492 :     * \return 1
493 :     */
494 :     virtual int usesPreyLength() { return 1; };
495 :     /**
496 :     * \brief This will set the prey length
497 :     * \param length is the prey length
498 :     */
499 :     virtual void setPreyLength(double length) { preyLength = length; };
500 :     /**
501 :     * \brief This will return the suitability value that has been calculated
502 :     * \return value
503 :     */
504 :     virtual double calculate();
505 :     private:
506 :     /**
507 :     * \brief This is the length of the prey
508 :     */
509 :     double preyLength;
510 :     };
511 :    
512 :     #endif

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

Powered By FusionForge