Gadget
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
suitfunc.h
Go to the documentation of this file.
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 
14 class SuitFunc : public HasName {
15 public:
20  SuitFunc(const char* givenname) : HasName(givenname) {};
24  virtual ~SuitFunc() {};
29  const ModelVariableVector& getConstants() const;
36  void readConstants(CommentStream& infile, const TimeClass* const TimeInfo, Keeper* const keeper);
41  void updateConstants(const TimeClass* const TimeInfo);
47  int didChange(const TimeClass* const TimeInfo);
52  virtual int usesPredLength() = 0;
57  virtual int usesPreyLength() = 0;
62  virtual void setPredLength(double length);
67  virtual void setPreyLength(double length);
72  virtual double calculate() = 0;
77  int numConstants() { return coeff.Size(); };
78 protected:
83 };
84 
89 class ExpSuitFuncA : public SuitFunc {
90 public:
94  ExpSuitFuncA();
98  virtual ~ExpSuitFuncA() {};
103  virtual int usesPredLength() { return 1; };
108  virtual int usesPreyLength() { return 1; };
113  virtual void setPredLength(double length) { predLength = length; };
118  virtual void setPreyLength(double length) { preyLength = length; };
123  virtual double calculate();
124 private:
128  double preyLength;
132  double predLength;
133 };
134 
139 class ConstSuitFunc : public SuitFunc {
140 public:
144  ConstSuitFunc();
148  virtual ~ConstSuitFunc() {};
153  virtual int usesPredLength() { return 0; };
158  virtual int usesPreyLength() { return 0; };
163  virtual double calculate();
164 };
165 
170 class AndersenSuitFunc : public SuitFunc {
171 public:
179  virtual ~AndersenSuitFunc() {};
184  virtual int usesPredLength() { return 1; };
189  virtual int usesPreyLength() { return 1; };
194  virtual void setPredLength(double length) { predLength = length; };
199  virtual void setPreyLength(double length) { preyLength = length; };
204  virtual double calculate();
205 private:
209  double preyLength;
213  double predLength;
214 };
215 
220 class ExpSuitFuncL50 : public SuitFunc {
221 public:
225  ExpSuitFuncL50();
229  virtual ~ExpSuitFuncL50() {};
234  virtual int usesPredLength() { return 0; };
239  virtual int usesPreyLength() { return 1; };
244  virtual void setPreyLength(double length) { preyLength = length; };
249  virtual double calculate();
250 private:
254  double preyLength;
255 };
256 
261 class StraightSuitFunc : public SuitFunc {
262 public:
270  virtual ~StraightSuitFunc() {};
275  virtual int usesPredLength() { return 0; };
280  virtual int usesPreyLength() { return 1; };
285  virtual void setPreyLength(double length) { preyLength = length; };
290  virtual double calculate();
291 private:
295  double preyLength;
296 };
297 
302 class InverseSuitFunc : public SuitFunc {
303 public:
307  InverseSuitFunc();
311  virtual ~InverseSuitFunc() {};
316  virtual int usesPredLength() { return 0; };
321  virtual int usesPreyLength() { return 1; };
326  virtual void setPreyLength(double length) { preyLength = length; };
331  virtual double calculate();
332 private:
336  double preyLength;
337 };
338 
344 public:
357  virtual int usesPredLength() { return 0; };
362  virtual int usesPreyLength() { return 1; };
367  virtual void setPreyLength(double length) { preyLength = length; };
372  virtual double calculate();
373 private:
377  double preyLength;
378 };
379 
384 class RichardsSuitFunc : public SuitFunc {
385 public:
393  virtual ~RichardsSuitFunc() {};
398  virtual int usesPredLength() { return 1; };
403  virtual int usesPreyLength() { return 1; };
408  virtual void setPredLength(double length) { predLength = length; };
413  virtual void setPreyLength(double length) { preyLength = length; };
418  virtual double calculate();
419 private:
423  double preyLength;
427  double predLength;
428 };
429 
434 class GammaSuitFunc : public SuitFunc {
435 public:
439  GammaSuitFunc();
443  virtual ~GammaSuitFunc() {};
448  virtual int usesPredLength() { return 0; };
453  virtual int usesPreyLength() { return 1; };
458  virtual void setPreyLength(double length) { preyLength = length; };
463  virtual double calculate();
464 private:
468  double preyLength;
469 };
470 
476 public:
489  virtual int usesPredLength() { return 0; };
494  virtual int usesPreyLength() { return 1; };
499  virtual void setPreyLength(double length) { preyLength = length; };
504  virtual double calculate();
505 private:
509  double preyLength;
510 };
511 
512 #endif
This is the class used to calculate the suitability based on an Andersen function for fleet based pre...
Definition: suitfunc.h:475
AndersenFleetSuitFunc()
This is the AndersenFleetSuitFunc constructor.
Definition: suitfunc.cc:292
virtual double calculate()
This will return the suitability value that has been calculated.
Definition: suitfunc.cc:297
virtual ~AndersenFleetSuitFunc()
This is the default AndersenFleetSuitFunc destructor.
Definition: suitfunc.h:484
virtual void setPreyLength(double length)
This will set the prey length.
Definition: suitfunc.h:499
virtual int usesPredLength()
This will return 1 if the suitability function is based on the predator length, 0 otherwise.
Definition: suitfunc.h:489
virtual int usesPreyLength()
This will return 1 if the suitability function is based on the prey length, 0 otherwise.
Definition: suitfunc.h:494
This is the class used to calculate the suitability based on an Andersen function.
Definition: suitfunc.h:170
virtual int usesPreyLength()
This will return 1 if the suitability function is based on the prey length, 0 otherwise.
Definition: suitfunc.h:189
virtual void setPredLength(double length)
This will set the predator length.
Definition: suitfunc.h:194
virtual ~AndersenSuitFunc()
This is the default AndersenSuitFunc destructor.
Definition: suitfunc.h:179
AndersenSuitFunc()
This is the AndersenSuitFunc constructor.
Definition: suitfunc.cc:91
virtual void setPreyLength(double length)
This will set the prey length.
Definition: suitfunc.h:199
virtual int usesPredLength()
This will return 1 if the suitability function is based on the predator length, 0 otherwise.
Definition: suitfunc.h:184
virtual double calculate()
This will return the suitability value that has been calculated.
Definition: suitfunc.cc:97
This is the class used to strip comments (and whitespace) from any input stream.
Definition: commentstream.h:40
This is the class used to calculate a constant suitability.
Definition: suitfunc.h:139
ConstSuitFunc()
This is the ConstSuitFunc constructor.
Definition: suitfunc.cc:73
virtual double calculate()
This will return the suitability value that has been calculated.
Definition: suitfunc.cc:77
virtual int usesPredLength()
This will return 1 if the suitability function is based on the predator length, 0 otherwise.
Definition: suitfunc.h:153
virtual int usesPreyLength()
This will return 1 if the suitability function is based on the prey length, 0 otherwise.
Definition: suitfunc.h:158
virtual ~ConstSuitFunc()
This is the default ConstSuitFunc destructor.
Definition: suitfunc.h:148
This is the class used to calculate the suitability based on an exponential function of the predator ...
Definition: suitfunc.h:89
virtual void setPredLength(double length)
This will set the predator length.
Definition: suitfunc.h:113
virtual ~ExpSuitFuncA()
This is the default ExpSuitFuncA destructor.
Definition: suitfunc.h:98
virtual int usesPredLength()
This will return 1 if the suitability function is based on the predator length, 0 otherwise.
Definition: suitfunc.h:103
ExpSuitFuncA()
This is the ExpSuitFuncA constructor.
Definition: suitfunc.cc:39
virtual int usesPreyLength()
This will return 1 if the suitability function is based on the prey length, 0 otherwise.
Definition: suitfunc.h:108
virtual void setPreyLength(double length)
This will set the prey length.
Definition: suitfunc.h:118
virtual double calculate()
This will return the suitability value that has been calculated.
Definition: suitfunc.cc:45
This is the class used to calculate the suitability based on an exponential function of the prey leng...
Definition: suitfunc.h:220
virtual int usesPredLength()
This will return 1 if the suitability function is based on the predator length, 0 otherwise.
Definition: suitfunc.h:234
virtual ~ExpSuitFuncL50()
This is the default ExpSuitFuncL50 destructor.
Definition: suitfunc.h:229
ExpSuitFuncL50()
This is the ExpSuitFuncL50 constructor.
Definition: suitfunc.cc:128
virtual double calculate()
This will return the suitability value that has been calculated.
Definition: suitfunc.cc:133
virtual int usesPreyLength()
This will return 1 if the suitability function is based on the prey length, 0 otherwise.
Definition: suitfunc.h:239
virtual void setPreyLength(double length)
This will set the prey length.
Definition: suitfunc.h:244
This is the class used to calculate the suitability based on a Gamma function, usually used when calc...
Definition: suitfunc.h:434
virtual void setPreyLength(double length)
This will set the prey length.
Definition: suitfunc.h:458
virtual int usesPredLength()
This will return 1 if the suitability function is based on the predator length, 0 otherwise.
Definition: suitfunc.h:448
virtual int usesPreyLength()
This will return 1 if the suitability function is based on the prey length, 0 otherwise.
Definition: suitfunc.h:453
virtual double calculate()
This will return the suitability value that has been calculated.
Definition: suitfunc.cc:264
virtual ~GammaSuitFunc()
This is the default GammaSuitFunc destructor.
Definition: suitfunc.h:443
GammaSuitFunc()
This is the GammaSuitFunc constructor.
Definition: suitfunc.cc:259
This is the base class for any object that has a name.
Definition: hasname.h:10
This is the class used to calculate the suitability based on an inverse exponential function of the p...
Definition: suitfunc.h:302
virtual ~InverseSuitFunc()
This is the default InverseSuitFunc destructor.
Definition: suitfunc.h:311
InverseSuitFunc()
This is the InverseSuitFunc constructor.
Definition: suitfunc.cc:174
virtual int usesPredLength()
This will return 1 if the suitability function is based on the predator length, 0 otherwise.
Definition: suitfunc.h:316
virtual void setPreyLength(double length)
This will set the prey length.
Definition: suitfunc.h:326
virtual double calculate()
This will return the suitability value that has been calculated.
Definition: suitfunc.cc:179
virtual int usesPreyLength()
This will return 1 if the suitability function is based on the prey length, 0 otherwise.
Definition: suitfunc.h:321
This is the class used to store information about the variables that are used in model simulation.
Definition: keeper.h:17
This class implements a dynamic vector of ModelVariable values.
Definition: modelvariablevector.h:10
int Size() const
This will return the size of the vector.
Definition: modelvariablevector.h:44
This is the class used to calculate the suitability based on a Richards function.
Definition: suitfunc.h:384
virtual int usesPreyLength()
This will return 1 if the suitability function is based on the prey length, 0 otherwise.
Definition: suitfunc.h:403
virtual void setPreyLength(double length)
This will set the prey length.
Definition: suitfunc.h:413
virtual double calculate()
This will return the suitability value that has been calculated.
Definition: suitfunc.cc:226
virtual int usesPredLength()
This will return 1 if the suitability function is based on the predator length, 0 otherwise.
Definition: suitfunc.h:398
virtual void setPredLength(double length)
This will set the predator length.
Definition: suitfunc.h:408
virtual ~RichardsSuitFunc()
This is the default RichardsSuitFunc destructor.
Definition: suitfunc.h:393
RichardsSuitFunc()
This is the RichardsSuitFunc constructor.
Definition: suitfunc.cc:220
This is the class used to calculate the suitability based on a linear function of the prey length.
Definition: suitfunc.h:261
virtual ~StraightSuitFunc()
This is the default StraightSuitFunc destructor.
Definition: suitfunc.h:270
virtual void setPreyLength(double length)
This will set the prey length.
Definition: suitfunc.h:285
virtual int usesPredLength()
This will return 1 if the suitability function is based on the predator length, 0 otherwise.
Definition: suitfunc.h:275
StraightSuitFunc()
This is the StraightSuitFunc constructor.
Definition: suitfunc.cc:154
virtual double calculate()
This will return the suitability value that has been calculated.
Definition: suitfunc.cc:159
virtual int usesPreyLength()
This will return 1 if the suitability function is based on the prey length, 0 otherwise.
Definition: suitfunc.h:280
This is the class used to calculate the suitability based on a linear function of the prey length wit...
Definition: suitfunc.h:343
virtual void setPreyLength(double length)
This will set the prey length.
Definition: suitfunc.h:367
virtual int usesPredLength()
This will return 1 if the suitability function is based on the predator length, 0 otherwise.
Definition: suitfunc.h:357
virtual ~StraightUnboundedSuitFunc()
This is the default StraightUnboundedSuitFunc destructor.
Definition: suitfunc.h:352
virtual double calculate()
This will return the suitability value that has been calculated.
Definition: suitfunc.cc:208
StraightUnboundedSuitFunc()
This is the StraightUnboundedSuitFunc constructor.
Definition: suitfunc.cc:203
virtual int usesPreyLength()
This will return 1 if the suitability function is based on the prey length, 0 otherwise.
Definition: suitfunc.h:362
This is the base class used to calculate the predator prey suitability value.
Definition: suitfunc.h:14
ModelVariableVector coeff
This is the ModelVariableVector of suitability function constants.
Definition: suitfunc.h:77
virtual int usesPredLength()=0
This will return 1 if the suitability function is based on the predator length, 0 otherwise.
virtual double calculate()=0
This will return the suitability value that has been calculated.
void readConstants(CommentStream &infile, const TimeClass *const TimeInfo, Keeper *const keeper)
This function will read the value of the suitability function parameters from file.
Definition: suitfunc.cc:9
virtual void setPredLength(double length)
This will set the predator length.
Definition: suitfunc.cc:16
int numConstants()
This will return the number of constants used to calculate the suitability value.
Definition: suitfunc.h:77
SuitFunc(const char *givenname)
This is the default SuitFunc constructor.
Definition: suitfunc.h:20
virtual ~SuitFunc()
This is the default SuitFunc destructor.
Definition: suitfunc.h:24
virtual int usesPreyLength()=0
This will return 1 if the suitability function is based on the prey length, 0 otherwise.
virtual void setPreyLength(double length)
This will set the prey length.
Definition: suitfunc.cc:20
int didChange(const TimeClass *const TimeInfo)
This function will check to see if the suitability function parameters have changed.
Definition: suitfunc.cc:32
void updateConstants(const TimeClass *const TimeInfo)
This function will update the suitability function parameters.
Definition: suitfunc.cc:28
const ModelVariableVector & getConstants() const
This function will return the value of the selection function parameters.
Definition: suitfunc.cc:24
This is the class used to store information about the timesteps used for the current model.
Definition: areatime.h:87