42 splineInterpolationWeights,
53 const bool checkEqualDistance
66 if (
mag(d-interval) > SMALL)
69 <<
"Spline interpolation only valid for constant intervals." 71 <<
"Interval 0-1 : " << interval <<
nl 72 <<
"Interval " << i-1 <<
'-' << i <<
" : " 89 bool indexChanged =
false;
92 if (samples_.size() <= 2)
94 return linearInterpolationWeights(samples_).valueWeights
106 && index_ < samples_.size()
108 samples_[index_] <= t
109 && (index_ == samples_.size()-1 || t <= samples_[index_+1])
133 else if (index_ == samples_.size()-1)
138 indices[0] = samples_.size()-1;
149 scalar
mu = (t - samples_[lo])/(samples_[hi] - samples_[lo]);
151 scalar
w0 = 0.5*(
mu*(-1+
mu*(2-
mu)));
152 scalar
w1 = 0.5*(2+
mu*(
mu*(-5 +
mu*(3))));
153 scalar
w2 = 0.5*(
mu*(1 +
mu*(4 +
mu*(-3))));
158 if (hi < samples_.size()-1)
185 weights[1] =
w1 -
w3;
186 weights[2] =
w2 + 2*
w3;
192 if (hi < samples_.size()-1)
201 weights[0] =
w1 + 2*
w0;
202 weights[1] =
w2 -
w0;
213 weights[0] =
w1 + 2*
w0 -
w3;
214 weights[1] =
w2 -
w0 + 2*
w3;
void size(const label n)
Older name for setAddressableSize.
label findLower(const ListType &input, const T &val, const label start, const ComparePredicate &comp)
Binary search to find the index of the last element in a sorted list that is less than value...
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
constexpr char nl
The newline '\n' character (0x0a)
scalarField samples(nIntervals, Zero)
Ostream & endl(Ostream &os)
Add newline and flush stream.
splineInterpolationWeights(const scalarField &samples, const bool checkEqualDistance=true)
Construct from components. By default make sure samples are.
Abstract base class for interpolating in 1D.
Macros for easy insertion into run-time selection tables.
Various functions to operate on Lists.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
defineTypeNameAndDebug(combustionModel, 0)
const dimensionedScalar mu
Atomic mass unit.
#define WarningInFunction
Report a warning using Foam::Warning.
virtual bool valueWeights(const scalar t, labelList &indices, scalarField &weights) const
Calculate weights and indices to calculate t from samples.
List< label > labelList
A List of labels.
const scalarField & samples_
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)