OGS
LinearIntervalInterpolation.h
Go to the documentation of this file.
1
15
#pragma once
16
17
#include "
BaseLib/Error.h
"
18
19
namespace
MathLib
{
20
31
template
<
typename
NUMERIC_TYPE>
32
class
LinearIntervalInterpolation
{
33
public
:
43
LinearIntervalInterpolation
(NUMERIC_TYPE a, NUMERIC_TYPE b, NUMERIC_TYPE c, NUMERIC_TYPE d);
50
inline
NUMERIC_TYPE
operator()
(NUMERIC_TYPE x)
const
;
51
52
private
:
56
NUMERIC_TYPE
m_
;
60
NUMERIC_TYPE
n_
;
61
};
62
63
template
<
typename
NUMERIC_TYPE>
64
LinearIntervalInterpolation<NUMERIC_TYPE>::LinearIntervalInterpolation
(
65
NUMERIC_TYPE a, NUMERIC_TYPE b, NUMERIC_TYPE c, NUMERIC_TYPE d)
66
: m_(d - c), n_(0.0)
67
{
68
if
(b == a) {
69
OGS_FATAL
(
"LinearIntervalInterpolation::LinearIntervalInterpolation: a == b, empty interval"
);
70
}
71
m_
/= (b - a);
72
n_
= c -
m_
* a;
73
}
74
75
template
<
typename
NUMERIC_TYPE>
76
inline
NUMERIC_TYPE
LinearIntervalInterpolation<NUMERIC_TYPE>::operator()
(NUMERIC_TYPE x)
const
77
{
78
return
m_ * x + n_;
79
}
80
81
}
// end namespace MathLib
Error.h
OGS_FATAL
#define OGS_FATAL(...)
Definition
Error.h:26
MathLib::LinearIntervalInterpolation
Class (template) LinearIntervalInterpolation is a functional object performing an interval mapping .
Definition
LinearIntervalInterpolation.h:32
MathLib::LinearIntervalInterpolation::m_
NUMERIC_TYPE m_
Definition
LinearIntervalInterpolation.h:56
MathLib::LinearIntervalInterpolation::LinearIntervalInterpolation
LinearIntervalInterpolation(NUMERIC_TYPE a, NUMERIC_TYPE b, NUMERIC_TYPE c, NUMERIC_TYPE d)
Definition
LinearIntervalInterpolation.h:64
MathLib::LinearIntervalInterpolation::operator()
NUMERIC_TYPE operator()(NUMERIC_TYPE x) const
Definition
LinearIntervalInterpolation.h:76
MathLib::LinearIntervalInterpolation::n_
NUMERIC_TYPE n_
Definition
LinearIntervalInterpolation.h:60
MathLib
Definition
CreateComponent.h:32
MathLib
InterpolationAlgorithms
LinearIntervalInterpolation.h
Generated by
1.11.0