39 int const size =
static_cast<int>(pVdXdata->size());
43 if (dX >= pVdXdata->at(size - 2))
50 while (dX > pVdXdata->at(i + 1))
54 double const dXL = pVdXdata->at(i);
55 double dYL = pVdYdata->at(i);
56 double const dXR = pVdXdata->at(i + 1);
57 double dYR = pVdYdata->at(i + 1);
68 double const ddYdX = (dYR - dYL) / (dXR - dXL);
70 return (dYL + ddYdX * (dX - dXL));
79 unsigned int const nSize =
static_cast<unsigned int>(pVnXdata->size());
83 if (nX >= pVnXdata->at(nSize - 2))
90 while (nX > pVnXdata->at(i + 1))
94 int const nXL = pVnXdata->at(i);
95 int const nXR = pVnXdata->at(i + 1);
97 double dYL = pVdYdata->at(i);
98 double dYR = pVdYdata->at(i + 1);
109 double const ddYdX = (dYR - dYL) /
static_cast<double>(nXR - nXL);
111 return dYL + ddYdX *
static_cast<double>(nX - nXL);
141 int const nXSize =
static_cast<int>(pVdX->size());
142 int const nXNewSize =
static_cast<int>(pVdXNew->size());
149 vector<double> VdYNew(nXNewSize, 0.0);
151 for (
int i = 0; i < nXNewSize; ++i)
153 int const idx =
nFindIndex(pVdX, pVdXNew->at(i));
155 if (pVdX->at(idx) > pVdXNew->at(i))
159 dX = pVdX->at(idx) - pVdX->at(idx - 1);
160 dY = pVdY->at(idx) - pVdY->at(idx - 1);
165 dX = pVdX->at(idx + 1) - pVdX->at(idx);
166 dY = pVdY->at(idx + 1) - pVdY->at(idx);
172 if (idx < nXSize - 1)
174 dX = pVdX->at(idx + 1) - pVdX->at(idx);
175 dY = pVdY->at(idx + 1) - pVdY->at(idx);
180 dX = pVdX->at(idx) - pVdX->at(idx - 1);
181 dY = pVdY->at(idx) - pVdY->at(idx - 1);
189 double const dM = dY / dX;
190 double const dB = pVdY->at(idx) - pVdX->at(idx) * dM;
193 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 ...