OGS
|
This class implements a one dimensional piecewise linear interpolation algorithm.
Definition at line 25 of file PiecewiseLinearInterpolation.h.
#include <PiecewiseLinearInterpolation.h>
Public Member Functions | |
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. | |
double | getDerivative (double const pnt_to_interpolate) const |
Calculates derivative using quadratic interpolation and central difference quotient. | |
double | getSupportMax () const |
double | getSupportMin () const |
Protected Attributes | |
std::vector< double > | supp_pnts_ |
std::vector< double > | values_at_supp_pnts_ |
MathLib::PiecewiseLinearInterpolation::PiecewiseLinearInterpolation | ( | std::vector< double > | supporting_points, |
std::vector< double > | values_at_supp_pnts, | ||
bool | supp_pnts_sorted = false ) |
The constructor copies the entries of the vector of supporting points \((x_0, x_1, \dots, x_n)\) and the entries of the vector of values at the supporting points \((y_0, y_1, \dots, y_n)\) where \(n\) is the number of entries of the vector. The number of supporting points must be the same like the number of values at the supporting points. It is assumed that \(x_j\) corresponds to \(y_j\) for all \(j \in [0, n]\).
It is not assumed that the supporting points are sorted, i.e. \(x_0 < x_1 < \dots < x_n\). It is assumed, that the supporting points are pairwise different. The user can set the flag supp_pnts_sorted to true, if the supporting points are sorted. This will save some setup time.
supporting_points | vector of supporting points |
values_at_supp_pnts | vector of values at the supporting points |
supp_pnts_sorted | false (default), if it is sure the supporting points are sorted one can set the switch to true |
Definition at line 25 of file PiecewiseLinearInterpolation.cpp.
References OGS_FATAL, supp_pnts_, and values_at_supp_pnts_.
double MathLib::PiecewiseLinearInterpolation::getDerivative | ( | double const | pnt_to_interpolate | ) | const |
Calculates derivative using quadratic interpolation and central difference quotient.
pnt_to_interpolate | The point should be located within the range \([x_{\min}, x_{\max}]\), where \(x_{\min} = \min_{1 \le j \le n} x_j\) and \(x_{\max} = \max_{1 \le j \le n} x_j\). when points are located outside of this interval, the derivative is set to 0. |
Definition at line 82 of file PiecewiseLinearInterpolation.cpp.
References supp_pnts_, and values_at_supp_pnts_.
Referenced by MaterialPropertyLib::Curve::dValue(), and MathLib::PiecewiseLinearMonotonicCurve::isStrongMonotonic().
double MathLib::PiecewiseLinearInterpolation::getSupportMax | ( | ) | const |
Definition at line 125 of file PiecewiseLinearInterpolation.cpp.
References supp_pnts_.
Referenced by ProcessLib::DeactivatedSubdomainDirichlet::getEssentialBCValues(), and ProcessLib::DeactivatedSubdomain::isInTimeSupportInterval().
double MathLib::PiecewiseLinearInterpolation::getSupportMin | ( | ) | const |
Definition at line 130 of file PiecewiseLinearInterpolation.cpp.
References supp_pnts_.
Referenced by ProcessLib::DeactivatedSubdomainDirichlet::getEssentialBCValues(), and ProcessLib::DeactivatedSubdomain::isInTimeSupportInterval().
double MathLib::PiecewiseLinearInterpolation::getValue | ( | double | pnt_to_interpolate | ) | const |
Calculates the interpolation value.
pnt_to_interpolate | The point should be located within the range \([x_{\min}, x_{\max}]\), where \(x_{\min} = \min_{1 \le j \le n} x_j\) and \(x_{\max} = \max_{1 \le j \le n} x_j\). Points outside of this interval are set to \(x_{\min}\) or \(x_{\max}\). |
Definition at line 51 of file PiecewiseLinearInterpolation.cpp.
References supp_pnts_, and values_at_supp_pnts_.
Referenced by ProcessLib::DeactivatedSubdomain::isDeactivated(), ParameterLib::FunctionParameter< T >::CurveWrapper::operator()(), ParameterLib::CurveScaledParameter< T >::operator()(), ProcessLib::HeatTransportBHE::BHE::FixedPowerFlowCurve::operator()(), ProcessLib::HeatTransportBHE::BHE::PowerCurveConstantFlow::operator()(), ProcessLib::HeatTransportBHE::BHE::PowerCurveFlowCurve::operator()(), ProcessLib::HeatTransportBHE::BHE::BuildingPowerCurveConstantFlow::operator()(), ProcessLib::HeatTransportBHE::BHE::TemperatureCurveConstantFlow::operator()(), ProcessLib::HeatTransportBHE::BHE::TemperatureCurveFlowCurve::operator()(), and MaterialPropertyLib::Curve::value().
|
protected |
Definition at line 79 of file PiecewiseLinearInterpolation.h.
Referenced by PiecewiseLinearInterpolation(), getDerivative(), MathLib::PiecewiseLinearMonotonicCurve::getInverseVariable(), getSupportMax(), getSupportMin(), getValue(), and MathLib::PiecewiseLinearMonotonicCurve::isStrongMonotonic().
|
protected |
Definition at line 80 of file PiecewiseLinearInterpolation.h.
Referenced by PiecewiseLinearInterpolation(), getDerivative(), MathLib::PiecewiseLinearMonotonicCurve::getInverseVariable(), and getValue().