1 : |
agomez |
1 |
#ifndef conversionindex_h
|
2 : |
|
|
#define conversionindex_h
|
3 : |
|
|
|
4 : |
|
|
#include "doublevector.h" |
5 : |
|
|
#include "intvector.h" |
6 : |
|
|
#include "lengthgroup.h" |
7 : |
ulcessvp |
2 |
#include "matrix.h" |
8 : |
agomez |
1 |
|
9 : |
|
|
/**
|
10 : |
|
|
* \class ConversionIndex
|
11 : |
|
|
* \brief This is the class used to convert information from one LengthGroupDivision length structure to a second LengthGroupDivision length structure
|
12 : |
|
|
*/
|
13 : |
|
|
class ConversionIndex {
|
14 : |
|
|
public:
|
15 : |
|
|
/**
|
16 : |
|
|
* \brief This is the ConversionIndex constructor
|
17 : |
|
|
* \param L1 is the first LengthGroupDivision
|
18 : |
|
|
* \param L2 is the second LengthGroupDivision
|
19 : |
|
|
* \param interp is the flag to denote whether the ConversionIndex will be used to interpolate between the 2 LengthGroupDivision objects (default value 0)
|
20 : |
|
|
*/
|
21 : |
|
|
ConversionIndex(const LengthGroupDivision* const L1,
|
22 : |
|
|
const LengthGroupDivision* const L2, int interp = 0);
|
23 : |
|
|
/**
|
24 : |
|
|
* \brief This is the default ConversionIndex destructor
|
25 : |
|
|
*/
|
26 : |
|
|
~ConversionIndex() {};
|
27 : |
|
|
/**
|
28 : |
|
|
* \brief This function will return the flag denoting whether an error has occured or not
|
29 : |
|
|
* \return error
|
30 : |
|
|
*/
|
31 : |
|
|
int Error() const { return error; }
|
32 : |
|
|
/**
|
33 : |
|
|
* \brief This function will return the minimum length group that is contained in both LengthGroupDivision objects
|
34 : |
|
|
* \return minlength
|
35 : |
|
|
*/
|
36 : |
|
|
int minLength() const { return minlength; };
|
37 : |
|
|
/**
|
38 : |
|
|
* \brief This function will return the maximum length group that is contained in both LengthGroupDivision objects
|
39 : |
|
|
* \return maxlength
|
40 : |
|
|
*/
|
41 : |
|
|
int maxLength() const { return maxlength; };
|
42 : |
|
|
/**
|
43 : |
|
|
* \brief This function will return the flag denoting whether the 2 LengthGroupDivision objects have the same length group structure or not
|
44 : |
|
|
* \return samedl
|
45 : |
|
|
*/
|
46 : |
|
|
int isSameDl() const { return samedl; };
|
47 : |
|
|
/**
|
48 : |
|
|
* \brief This function will return the offset that specifies the different starting points for 2 LengthGroupDivision objects that have the same length group structure
|
49 : |
|
|
* \return offset
|
50 : |
|
|
*/
|
51 : |
|
|
int getOffset() const { return offset; };
|
52 : |
|
|
/**
|
53 : |
|
|
* \brief This function will return the flag denoting whether the target LengthGroupDivision object has a finer length group structure or not
|
54 : |
|
|
* \return isfiner
|
55 : |
|
|
*/
|
56 : |
|
|
int isFiner() const { return isfiner; };
|
57 : |
|
|
/**
|
58 : |
|
|
* \brief This function will return the index in the coarser length group for an entry in the finer length group
|
59 : |
|
|
* \param i is the index in the finer length group
|
60 : |
|
|
* \return pos for finer length group i
|
61 : |
|
|
*/
|
62 : |
|
|
int getPos(int i) const { return pos[i]; };
|
63 : |
|
|
/**
|
64 : |
|
|
* \brief This function will return the number of finer length groups in the coarser length group for an entry in the finer length group
|
65 : |
|
|
* \param i is the index in the finer length group
|
66 : |
|
|
* \return numpos for finer length group i
|
67 : |
|
|
*/
|
68 : |
|
|
int getNumPos(int i) const { return numpos[i]; };
|
69 : |
|
|
/**
|
70 : |
|
|
* \brief This function will return the minimum index in the finer length group for an entry in the coarser length group
|
71 : |
|
|
* \param i is the index in the coarser length group
|
72 : |
|
|
* \return minpos for coarser length group i
|
73 : |
|
|
*/
|
74 : |
|
|
int minPos(int i) const { return minpos[i]; };
|
75 : |
|
|
/**
|
76 : |
|
|
* \brief This function will return the maximum index in the finer length group for an entry in the coarser length group
|
77 : |
|
|
* \param i is the index in the coarser length group
|
78 : |
|
|
* \return maxpos for coarser length group i
|
79 : |
|
|
*/
|
80 : |
|
|
int maxPos(int i) const { return maxpos[i]; };
|
81 : |
|
|
/**
|
82 : |
|
|
* \brief This function will interpolate values defined for a coarser length division onto a finer length division
|
83 : |
|
|
* \param Vf is the DoubleVector that will contain the finer values after the interpolation
|
84 : |
ulcessvp |
12 |
* \param Vc is the array of doubles of the coarser values to interpolate from
|
85 : |
agomez |
1 |
*/
|
86 : |
ulcessvp |
2 |
void interpolateLengths(DoubleVector& Vf, const double* Vc, int size);
|
87 : |
agomez |
1 |
protected:
|
88 : |
|
|
/**
|
89 : |
|
|
* \brief This is the flag to denote whether an error has occured or not
|
90 : |
|
|
*/
|
91 : |
|
|
int error;
|
92 : |
|
|
/**
|
93 : |
|
|
* \brief This is the flag to denote whether the 2 LengthGroupDivision objects have the same length group structure
|
94 : |
|
|
*/
|
95 : |
|
|
int samedl;
|
96 : |
|
|
/**
|
97 : |
|
|
* \brief This is the difference in the minimum lengths if the 2 LengthGroupDivision objects have the same length group structure
|
98 : |
|
|
*/
|
99 : |
|
|
int offset;
|
100 : |
|
|
/**
|
101 : |
|
|
* \brief This is the flag to denote whether the target (L2) LengthGroupDivision object has a finer or coarser length group structure
|
102 : |
|
|
*/
|
103 : |
|
|
int isfiner;
|
104 : |
|
|
/**
|
105 : |
|
|
* \brief This is the minimum length group that is contained in both LengthGroupDivision objects
|
106 : |
|
|
*/
|
107 : |
|
|
int minlength;
|
108 : |
|
|
/**
|
109 : |
|
|
* \brief This is the maximum length group that is contained in both LengthGroupDivision objects
|
110 : |
|
|
*/
|
111 : |
|
|
int maxlength;
|
112 : |
|
|
/**
|
113 : |
|
|
* \brief This is the flag to denote whether the ConversionIndex will be used to interpolate between the 2 LengthGroupDivision objects
|
114 : |
|
|
*/
|
115 : |
|
|
int interpolate;
|
116 : |
|
|
/**
|
117 : |
|
|
* \brief This is the IntVector of the indices used to convert between the length groups
|
118 : |
|
|
* \note This vector is resized to be the same length as the finer LengthGroupDivision object
|
119 : |
|
|
*/
|
120 : |
|
|
IntVector pos;
|
121 : |
|
|
/**
|
122 : |
|
|
* \brief This is the IntVector of the number of finer length groups in each coarser length group
|
123 : |
|
|
* \note This vector is resized to be the same length as the finer LengthGroupDivision object and is only used if the isfiner flag has been set
|
124 : |
|
|
*/
|
125 : |
|
|
IntVector numpos;
|
126 : |
|
|
/**
|
127 : |
|
|
* \brief This is the IntVector of minimum index in the finer length group for each coarser length group
|
128 : |
|
|
* \note This vector is resized to be the same length as the coarser LengthGroupDivision object
|
129 : |
|
|
*/
|
130 : |
|
|
IntVector minpos;
|
131 : |
|
|
/**
|
132 : |
|
|
* \brief This is the IntVector of maximum index in the finer length group for each coarser length group
|
133 : |
|
|
* \note This vector is resized to be the same length as the coarser LengthGroupDivision object
|
134 : |
|
|
*/
|
135 : |
|
|
IntVector maxpos;
|
136 : |
|
|
/**
|
137 : |
|
|
* \brief This is the DoubleVector of the ratios used when interpolating between the length groups
|
138 : |
|
|
* \note This vector is resized to be the same length as the finer LengthGroupDivision object and is only used if the interpolate flag has been set
|
139 : |
|
|
*/
|
140 : |
|
|
DoubleVector iratio;
|
141 : |
|
|
/**
|
142 : |
|
|
* \brief This is the IntVector of the indices used when interpolating between the length groups
|
143 : |
|
|
* \note This vector is resized to be the same length as the finer LengthGroupDivision object and is only used if the interpolate flag has been set
|
144 : |
|
|
*/
|
145 : |
|
|
IntVector ipos;
|
146 : |
|
|
};
|
147 : |
|
|
|
148 : |
|
|
#endif
|