Gadget
selectfunc.h
Go to the documentation of this file.
1 #ifndef selectfunc_h
2 #define selectfunc_h
3 
4 #include "commentstream.h"
5 #include "hasname.h"
6 #include "keeper.h"
7 #include "modelvariablevector.h"
8 
14 class SelectFunc : public HasName {
15 public:
20  SelectFunc(const char* givenname) : HasName(givenname) {};
24  virtual ~SelectFunc() {};
31  void readConstants(CommentStream& infile, const TimeClass* const TimeInfo, Keeper* const keeper);
36  void updateConstants(const TimeClass* const TimeInfo);
42  int didChange(const TimeClass* const TimeInfo);
48  virtual double calculate(double len) = 0;
53  int numConstants() { return coeff.Size(); };
54 protected:
59 };
60 
65 class ConstSelectFunc : public SelectFunc {
66 public:
74  virtual ~ConstSelectFunc() {};
80  virtual double calculate(double len);
81 };
82 
87 class ExpSelectFunc : public SelectFunc {
88 public:
92  ExpSelectFunc();
96  virtual ~ExpSelectFunc() {};
102  virtual double calculate(double len);
103 };
104 
110 public:
118  virtual ~StraightSelectFunc() {};
124  virtual double calculate(double len);
125 };
126 
127 #endif
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 selection level.
Definition: selectfunc.h:65
virtual double calculate(double len)
This will return the selection level that has been calculated.
Definition: selectfunc.cc:29
ConstSelectFunc()
This is the ConstSelectFunc constructor.
Definition: selectfunc.cc:25
virtual ~ConstSelectFunc()
This is the default ConstSelectFunc destructor.
Definition: selectfunc.h:74
This is the class used to calculate the selection level based on an exponential function of length.
Definition: selectfunc.h:87
virtual double calculate(double len)
This will return the selection level that has been calculated.
Definition: selectfunc.cc:40
ExpSelectFunc()
This is the ExpSelectFunc constructor.
Definition: selectfunc.cc:36
virtual ~ExpSelectFunc()
This is the default ExpSelectFunc destructor.
Definition: selectfunc.h:96
This is the base class for any object that has a name.
Definition: hasname.h:10
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 base class used to calculate the selection level as a function of length.
Definition: selectfunc.h:14
void updateConstants(const TimeClass *const TimeInfo)
This function will update the selection function parameters.
Definition: selectfunc.cc:14
virtual double calculate(double len)=0
This will return the selection level that has been calculated.
SelectFunc(const char *givenname)
This is the default SelectFunc constructor.
Definition: selectfunc.h:20
ModelVariableVector coeff
This is the ModelVariableVector of the selection function constants.
Definition: selectfunc.h:53
virtual ~SelectFunc()
This is the default SelectFunc destructor.
Definition: selectfunc.h:24
void readConstants(CommentStream &infile, const TimeClass *const TimeInfo, Keeper *const keeper)
This function will read the value of the selection function parameters from file.
Definition: selectfunc.cc:7
int didChange(const TimeClass *const TimeInfo)
This function will check to see if the selection function parameters have changed.
Definition: selectfunc.cc:18
int numConstants()
This will return the number of constants used to calculate the selection value.
Definition: selectfunc.h:53
This is the class used to calculate the selection level based on a linear function of length.
Definition: selectfunc.h:109
virtual ~StraightSelectFunc()
This is the default StraightSelectFunc destructor.
Definition: selectfunc.h:118
StraightSelectFunc()
This is the StraightSelectFunc constructor.
Definition: selectfunc.cc:47
virtual double calculate(double len)
This will return the selection level that has been calculated.
Definition: selectfunc.cc:51
This is the class used to store information about the timesteps used for the current model.
Definition: areatime.h:87