OGS
PiecewiseLinearInterpolation.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
6#include <vector>
7
8namespace MathLib
9{
15{
16public:
37 PiecewiseLinearInterpolation(std::vector<double> supporting_points,
38 std::vector<double> values_at_supp_pnts,
39 bool supp_pnts_sorted = false);
40
41 PiecewiseLinearInterpolation(std::vector<int> const& supporting_points,
42 std::vector<double> const& values_at_supp_pnts,
43 bool supp_pnts_sorted = false);
44
53 double getValue(double pnt_to_interpolate) const;
54
67 double getDerivative(double const pnt_to_interpolate) const;
68 double getSupportMax() const;
69 double getSupportMin() const;
70
71protected:
72 std::vector<double> supp_pnts_;
73 std::vector<double> values_at_supp_pnts_;
74};
75} // end namespace MathLib
PiecewiseLinearInterpolation(std::vector< double > supporting_points, std::vector< double > values_at_supp_pnts, bool supp_pnts_sorted=false)
double getDerivative(double const pnt_to_interpolate) const
Calculates derivative using quadratic interpolation and central difference quotient.
double getValue(double pnt_to_interpolate) const
Calculates the interpolation value.