35 int const size =
static_cast<int>(pVdXdata->size());
39 if (dX >= pVdXdata->at(size - 2))
46 while (dX > pVdXdata->at(i + 1))
50 double const dXL = pVdXdata->at(i);
51 double dYL = pVdYdata->at(i);
52 double const dXR = pVdXdata->at(i + 1);
53 double dYR = pVdYdata->at(i + 1);
64 double const ddYdX = (dYR - dYL) / (dXR - dXL);
66 return (dYL + ddYdX * (dX - dXL));
75 unsigned int const nSize =
static_cast<unsigned int>(pVnXdata->size());
79 if (nX >= pVnXdata->at(nSize - 2))
86 while (nX > pVnXdata->at(i + 1))
90 int const nXL = pVnXdata->at(i);
91 int const nXR = pVnXdata->at(i + 1);
93 double dYL = pVdYdata->at(i);
94 double dYR = pVdYdata->at(i + 1);
105 double const ddYdX = (dYR - dYL) /
static_cast<double>(nXR - nXL);
107 return dYL + ddYdX *
static_cast<double>(nX - nXL);
137 int const nXSize =
static_cast<int>(pVdX->size());
138 int const nXNewSize =
static_cast<int>(pVdXNew->size());
145 vector<double> VdYNew(nXNewSize, 0.0);
147 for (
int i = 0; i < nXNewSize; ++i)
149 int const idx =
nFindIndex(pVdX, pVdXNew->at(i));
151 if (pVdX->at(idx) > pVdXNew->at(i))
155 dX = pVdX->at(idx) - pVdX->at(idx - 1);
156 dY = pVdY->at(idx) - pVdY->at(idx - 1);
161 dX = pVdX->at(idx + 1) - pVdX->at(idx);
162 dY = pVdY->at(idx + 1) - pVdY->at(idx);
168 if (idx < nXSize - 1)
170 dX = pVdX->at(idx + 1) - pVdX->at(idx);
171 dY = pVdY->at(idx + 1) - pVdY->at(idx);
176 dX = pVdX->at(idx) - pVdX->at(idx - 1);
177 dY = pVdY->at(idx) - pVdY->at(idx - 1);
185 double const dM = dY / dX;
186 double const dB = pVdY->at(idx) - pVdX->at(idx) * dM;
189 VdYNew[nXNewSize - 1 - i] = (pVdXNew->at(i) * dM) + dB;
vector< double > VdInterpolateCShoreProfileOutput(vector< double > const *, vector< double > const *, vector< double > const *)
Returns a linearly interpolated vector of doubles, to make CShore profile output compatible with CME....
int nFindIndex(vector< double > const *, double const)
This is used by VdInterpolateCShoreProfileOutput, it returns the index of the value in pVdX which is ...