21 #ifndef OPM_LINEARINTERPOLATION_HEADER_INCLUDED
22 #define OPM_LINEARINTERPOLATION_HEADER_INCLUDED
31 inline int tableIndex(
const std::vector<double>& table,
double x)
36 int n = table.size() - 1;
42 bool ascend = (table[n] > table[0]);
45 if ( (x >= table[jm]) == ascend) {
56 const std::vector<double>& yv,
double x)
61 return (yv[ix2] - yv[ix1])/(xv[ix2] - xv[ix1]);
65 const std::vector<double>& yv,
double x)
70 return (yv[ix2] - yv[ix1])/(xv[ix2] - xv[ix1])*(x - xv[ix1]) + yv[ix1];
74 const std::vector<double>& yv,
80 return (yv[ix2] - yv[ix1])/(xv[ix2] - xv[ix1])*(x - xv[ix1]) + yv[ix1];
91 #endif // OPM_LINEARINTERPOLATION_HEADER_INCLUDED
double linearInterpolation(const std::vector< double > &xv, const std::vector< double > &yv, double x)
Definition: linearInterpolation.hpp:64
Definition: AnisotropicEikonal.hpp:43
int tableIndex(const std::vector< double > &table, double x)
Definition: linearInterpolation.hpp:31
double linearInterpolationDerivative(const std::vector< double > &xv, const std::vector< double > &yv, double x)
Definition: linearInterpolation.hpp:55