OGS 6.3.0-179-g962fdcd4e.dirty.20200403132553
PiecewiseLinearInterpolation.h
Go to the documentation of this file.
1 
15 #pragma once
16 
17 #include <vector>
18 
19 namespace MathLib
20 {
26 {
27 public:
48  PiecewiseLinearInterpolation(std::vector<double>&& supporting_points,
49  std::vector<double>&& values_at_supp_pnts,
50  bool supp_pnts_sorted = false);
51 
60  double getValue(double pnt_to_interpolate) const;
61 
74  double getDerivative(double const pnt_to_interpolate) const;
75  double getSupportMax() const;
76  double getSupportMin() const;
77 
78 protected:
79  std::vector<double> _supp_pnts;
80  std::vector<double> _values_at_supp_pnts;
81 };
82 } // end namespace MathLib
double getDerivative(double const pnt_to_interpolate) const
Calculates derivative using quadratic interpolation and central difference quotient.
PiecewiseLinearInterpolation(std::vector< double > &&supporting_points, std::vector< double > &&values_at_supp_pnts, bool supp_pnts_sorted=false)
double getValue(double pnt_to_interpolate) const
Calculates the interpolation value.