1 : |
agomez |
1 |
#ifndef lengthgroup_h
|
2 : |
|
|
#define lengthgroup_h
|
3 : |
|
|
|
4 : |
|
|
#include "doublevector.h" |
5 : |
|
|
|
6 : |
|
|
/**
|
7 : |
|
|
* \class LengthGroupDivision
|
8 : |
|
|
* \brief This is the class used to store information about the length groups of the modelled stock population
|
9 : |
|
|
*/
|
10 : |
|
|
class LengthGroupDivision {
|
11 : |
|
|
public:
|
12 : |
|
|
/**
|
13 : |
|
|
* \brief This is the LengthGroupDivision constructor with evenly spaced length groups
|
14 : |
|
|
* \param minlength is the minimum length of the smallest length group
|
15 : |
|
|
* \param maxlength is the maximum length of the biggest length group
|
16 : |
|
|
* \param dl is the step length for each length group
|
17 : |
|
|
*/
|
18 : |
|
|
LengthGroupDivision(double minlength, double maxlength, double dl);
|
19 : |
|
|
/**
|
20 : |
|
|
* \brief This is the LengthGroupDivision constructor with length groups that are possibly not evenly spaced
|
21 : |
|
|
* \param vec is the DoubleVector containing the end point of each length group
|
22 : |
|
|
*/
|
23 : |
|
|
LengthGroupDivision(const DoubleVector& vec);
|
24 : |
|
|
/**
|
25 : |
|
|
* \brief This is the LengthGroupDivision constructor that creates a copy of an existing LengthGroupDivision
|
26 : |
|
|
* \param lgrpdiv is the LengthGroupDivision to copy
|
27 : |
|
|
*/
|
28 : |
|
|
LengthGroupDivision(const LengthGroupDivision& lgrpdiv);
|
29 : |
|
|
/**
|
30 : |
|
|
* \brief This is the default LengthGroupDivision destructor
|
31 : |
|
|
*/
|
32 : |
|
|
~LengthGroupDivision() {};
|
33 : |
|
|
/**
|
34 : |
|
|
* \brief This function will return the mean length of a specified length group
|
35 : |
|
|
* \param i is the identifier of the length group
|
36 : |
|
|
* \return the mean length of the length group
|
37 : |
|
|
*/
|
38 : |
|
|
double meanLength(int i) const;
|
39 : |
|
|
/**
|
40 : |
|
|
* \brief This function will return the minimum length of a specified length group
|
41 : |
|
|
* \param i is the identifier of the length group
|
42 : |
|
|
* \return the minimum length of the length group
|
43 : |
|
|
*/
|
44 : |
|
|
double minLength(int i) const;
|
45 : |
|
|
/**
|
46 : |
|
|
* \brief This function will return the maximum length of a specified length group
|
47 : |
|
|
* \param i is the identifier of the length group
|
48 : |
|
|
* \return the maximum length of the length group
|
49 : |
|
|
*/
|
50 : |
|
|
double maxLength(int i) const;
|
51 : |
|
|
/**
|
52 : |
|
|
* \brief This function will return the minimum length of the smallest length group
|
53 : |
|
|
* \return the minimum length
|
54 : |
|
|
*/
|
55 : |
|
|
double minLength() const { return minlen; };
|
56 : |
|
|
/**
|
57 : |
|
|
* \brief This function will return the maximum length of the biggest length group
|
58 : |
|
|
* \return the maximum length
|
59 : |
|
|
*/
|
60 : |
|
|
double maxLength() const { return maxlen; };
|
61 : |
|
|
/**
|
62 : |
|
|
* \brief This function will return the step length of the length groups
|
63 : |
|
|
* \return the step length
|
64 : |
|
|
*/
|
65 : |
|
|
double dl() const { return Dl; };
|
66 : |
|
|
/**
|
67 : |
|
|
* \brief This function will return the total number of the length groups
|
68 : |
|
|
* \return the number of length groups
|
69 : |
|
|
*/
|
70 : |
|
|
int numLengthGroups() const { return size; };
|
71 : |
|
|
/**
|
72 : |
|
|
* \brief This function will return the identifier of a length group containing a specified length
|
73 : |
|
|
* \param len is the length to find in the length group
|
74 : |
|
|
* \return the identifier of the length group
|
75 : |
|
|
*/
|
76 : |
|
|
int numLengthGroup(double len) const;
|
77 : |
|
|
/**
|
78 : |
|
|
* \brief This function will combine a second LengthGroupDivision with the current LengthGroupDivision
|
79 : |
|
|
* \return 1 if the LengthGroupDivision has been combined sucessfully, 0 otherwise
|
80 : |
|
|
*/
|
81 : |
|
|
int Combine(const LengthGroupDivision* const addition);
|
82 : |
|
|
/**
|
83 : |
|
|
* \brief This function will return the flag denoting whether an error has occured or not
|
84 : |
|
|
* \return error
|
85 : |
|
|
*/
|
86 : |
|
|
int Error() const { return error; }
|
87 : |
|
|
/**
|
88 : |
|
|
* \brief This function will print an error message about the LengthGroupDivision
|
89 : |
|
|
*/
|
90 : |
|
|
void printError() const;
|
91 : |
|
|
/**
|
92 : |
|
|
* \brief This function will print the LengthGroupDivision information
|
93 : |
|
|
* \param outfile is the ofstream that the information gets sent to
|
94 : |
|
|
*/
|
95 : |
|
|
void Print(ofstream& outfile) const;
|
96 : |
|
|
protected:
|
97 : |
|
|
/**
|
98 : |
|
|
* \brief This is the flag to denote whether an error has occured or not
|
99 : |
|
|
*/
|
100 : |
|
|
int error;
|
101 : |
|
|
/**
|
102 : |
|
|
* \brief This is the size of the length group
|
103 : |
|
|
*/
|
104 : |
|
|
int size;
|
105 : |
|
|
/**
|
106 : |
|
|
* \brief This is the step length for each length group
|
107 : |
|
|
*/
|
108 : |
|
|
double Dl;
|
109 : |
|
|
/**
|
110 : |
|
|
* \brief This is the minimum length of the smallest length group
|
111 : |
|
|
*/
|
112 : |
|
|
double minlen;
|
113 : |
|
|
/**
|
114 : |
|
|
* \brief This is the maximum length of the biggest length group
|
115 : |
|
|
*/
|
116 : |
|
|
double maxlen;
|
117 : |
|
|
/**
|
118 : |
|
|
* \brief This is the DoubleVector of the mean lengths for each length group
|
119 : |
|
|
*/
|
120 : |
|
|
DoubleVector meanlength;
|
121 : |
|
|
/**
|
122 : |
|
|
* \brief This is the DoubleVector of the minimum lengths for each length group
|
123 : |
|
|
*/
|
124 : |
|
|
DoubleVector minlength;
|
125 : |
|
|
};
|
126 : |
|
|
|
127 : |
|
|
/**
|
128 : |
|
|
* \brief This is the function that will check whether one LengthGroupDivision has length groups that are finer than a second LengthGroupDivision, and print an error if this is not the case
|
129 : |
|
|
* \param finer is the LengthGroupDivision that should be on a finer scale
|
130 : |
|
|
* \param coarser is the LengthGroupDivision that should be on a coarser scale
|
131 : |
|
|
* \return 1 if the structure of the LengthGroupDivision objects are compatible, 0 otherwise
|
132 : |
|
|
*/
|
133 : |
|
|
extern int checkLengthGroupStructure(const LengthGroupDivision* finer,
|
134 : |
|
|
const LengthGroupDivision* coarser);
|
135 : |
|
|
|
136 : |
|
|
#endif
|