36double dGetInterpolatedValue(vector<double>
const* pVdXdata, vector<double>
const* pVdYdata,
double dX,
bool bExtrapolate)
38 int size =
static_cast<int>(pVdXdata->size());
41 if (dX >= pVdXdata->at(size - 2))
47 while (dX > pVdXdata->at(i+1)) i++;
50 double dXL = pVdXdata->at(i);
51 double dYL = pVdYdata->at(i);
52 double dXR = pVdXdata->at(i+1);
53 double dYR = pVdYdata->at(i+1);
64 double ddYdX = (dYR - dYL) / (dXR - dXL);
66 return (dYL + ddYdX * (dX - dXL));
131 int nXSize =
static_cast<int>(pVdX->size());
132 int nXNewSize =
static_cast<int>(pVdXNew->size());
139 vector<double> VdYNew(nXNewSize, 0.0);
141 for (
int i = 0; i < nXNewSize; ++i)
145 if (pVdX->at(idx) > pVdXNew->at(i))
149 dX = pVdX->at(idx) - pVdX->at(idx-1);
150 dY = pVdY->at(idx) - pVdY->at(idx-1);
154 dX = pVdX->at(idx+1) - pVdX->at(idx);
155 dY = pVdY->at(idx+1) - pVdY->at(idx);
162 dX = pVdX->at(idx+1) - pVdX->at(idx);
163 dY = pVdY->at(idx+1) - pVdY->at(idx);
167 dX = pVdX->at(idx) - pVdX->at(idx-1);
168 dY = pVdY->at(idx) - pVdY->at(idx-1);
177 double dB = pVdY->at(idx) - pVdX->at(idx) * dM;
180 VdYNew[nXNewSize-1 - i] = (pVdXNew->at(i) * dM) + dB;
int nFindIndex(vector< double > const *pVdX, double const dValueIn)
This is used by VdInterpolateCShoreProfileOutput, it returns the index of the value in pVdX which is ...
vector< double > VdInterpolateCShoreProfileOutput(vector< double > const *pVdX, vector< double > const *pVdY, vector< double > const *pVdXNew)
Returns a linearly interpolated vector of doubles, to make CShore profile output compatible with CME....