1 : |
agomez |
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 : |
|
|
|
9 : |
|
|
/**
|
10 : |
|
|
* \class SelectFunc
|
11 : |
|
|
* \brief This is the base class used to calculate the selection level as a function of length
|
12 : |
|
|
* \note This will always be overridden by the derived classes that actually calculate the selection level
|
13 : |
|
|
*/
|
14 : |
|
|
class SelectFunc : public HasName {
|
15 : |
|
|
public:
|
16 : |
|
|
/**
|
17 : |
|
|
* \brief This is the default SelectFunc constructor
|
18 : |
|
|
* \param givenname is the name for the SelectFunc selection function
|
19 : |
|
|
*/
|
20 : |
|
|
SelectFunc(const char* givenname) : HasName(givenname) {};
|
21 : |
|
|
/**
|
22 : |
|
|
* \brief This is the default SelectFunc destructor
|
23 : |
|
|
*/
|
24 : |
|
|
virtual ~SelectFunc() {};
|
25 : |
|
|
/**
|
26 : |
|
|
* \brief This function will read the value of the selection function parameters from file
|
27 : |
|
|
* \param infile is the CommentStream to read the parameters from
|
28 : |
|
|
* \param TimeInfo is the TimeClass for the current model
|
29 : |
|
|
* \param keeper is the Keeper for the current model
|
30 : |
|
|
*/
|
31 : |
|
|
void readConstants(CommentStream& infile, const TimeClass* const TimeInfo, Keeper* const keeper);
|
32 : |
|
|
/**
|
33 : |
|
|
* \brief This function will update the selection function parameters
|
34 : |
|
|
* \param TimeInfo is the TimeClass for the current model
|
35 : |
|
|
*/
|
36 : |
|
|
void updateConstants(const TimeClass* const TimeInfo);
|
37 : |
|
|
/**
|
38 : |
|
|
* \brief This function will check to see if the selection function parameters have changed
|
39 : |
|
|
* \param TimeInfo is the TimeClass for the current model
|
40 : |
|
|
* \return 1 if the parameters have changed, 0 otherwise
|
41 : |
|
|
*/
|
42 : |
|
|
int didChange(const TimeClass* const TimeInfo);
|
43 : |
|
|
/**
|
44 : |
|
|
* \brief This will return the selection level that has been calculated
|
45 : |
|
|
* \param len is the length of the length class that is selected
|
46 : |
|
|
* \return 0 (will be overridden in derived classes)
|
47 : |
|
|
*/
|
48 : |
|
|
virtual double calculate(double len) = 0;
|
49 : |
|
|
/**
|
50 : |
|
|
* \brief This will return the number of constants used to calculate the selection value
|
51 : |
|
|
* \return number
|
52 : |
|
|
*/
|
53 : |
|
|
int numConstants() { return coeff.Size(); };
|
54 : |
|
|
protected:
|
55 : |
|
|
/**
|
56 : |
|
|
* \brief This is the ModelVariableVector of the selection function constants
|
57 : |
|
|
*/
|
58 : |
|
|
ModelVariableVector coeff;
|
59 : |
|
|
};
|
60 : |
|
|
|
61 : |
|
|
/**
|
62 : |
|
|
* \class ConstSelectFunc
|
63 : |
|
|
* \brief This is the class used to calculate a constant selection level
|
64 : |
|
|
*/
|
65 : |
|
|
class ConstSelectFunc : public SelectFunc {
|
66 : |
|
|
public:
|
67 : |
|
|
/**
|
68 : |
|
|
* \brief This is the ConstSelectFunc constructor
|
69 : |
|
|
*/
|
70 : |
|
|
ConstSelectFunc();
|
71 : |
|
|
/**
|
72 : |
|
|
* \brief This is the default ConstSelectFunc destructor
|
73 : |
|
|
*/
|
74 : |
|
|
virtual ~ConstSelectFunc() {};
|
75 : |
|
|
/**
|
76 : |
|
|
* \brief This will return the selection level that has been calculated
|
77 : |
|
|
* \param len is the length of the length class that is selected
|
78 : |
|
|
* \return selection level
|
79 : |
|
|
*/
|
80 : |
|
|
virtual double calculate(double len);
|
81 : |
|
|
};
|
82 : |
|
|
|
83 : |
|
|
/**
|
84 : |
|
|
* \class ExpSelectFunc
|
85 : |
|
|
* \brief This is the class used to calculate the selection level based on an exponential function of length
|
86 : |
|
|
*/
|
87 : |
|
|
class ExpSelectFunc : public SelectFunc {
|
88 : |
|
|
public:
|
89 : |
|
|
/**
|
90 : |
|
|
* \brief This is the ExpSelectFunc constructor
|
91 : |
|
|
*/
|
92 : |
|
|
ExpSelectFunc();
|
93 : |
|
|
/**
|
94 : |
|
|
* \brief This is the default ExpSelectFunc destructor
|
95 : |
|
|
*/
|
96 : |
|
|
virtual ~ExpSelectFunc() {};
|
97 : |
|
|
/**
|
98 : |
|
|
* \brief This will return the selection level that has been calculated
|
99 : |
|
|
* \param len is the length of the length class that is selected
|
100 : |
|
|
* \return selection level
|
101 : |
|
|
*/
|
102 : |
|
|
virtual double calculate(double len);
|
103 : |
|
|
};
|
104 : |
|
|
|
105 : |
|
|
/**
|
106 : |
|
|
* \class StraightSelectFunc
|
107 : |
|
|
* \brief This is the class used to calculate the selection level based on a linear function of length
|
108 : |
|
|
*/
|
109 : |
|
|
class StraightSelectFunc : public SelectFunc {
|
110 : |
|
|
public:
|
111 : |
|
|
/**
|
112 : |
|
|
* \brief This is the StraightSelectFunc constructor
|
113 : |
|
|
*/
|
114 : |
|
|
StraightSelectFunc();
|
115 : |
|
|
/**
|
116 : |
|
|
* \brief This is the default StraightSelectFunc destructor
|
117 : |
|
|
*/
|
118 : |
|
|
virtual ~StraightSelectFunc() {};
|
119 : |
|
|
/**
|
120 : |
|
|
* \brief This will return the selection level that has been calculated
|
121 : |
|
|
* \param len is the length of the length class that is selected
|
122 : |
|
|
* \return selection level
|
123 : |
|
|
*/
|
124 : |
|
|
virtual double calculate(double len);
|
125 : |
|
|
};
|
126 : |
|
|
|
127 : |
|
|
#endif
|