42 splineInterpolationWeights,
52 const bool checkEqualDistance
58 if (checkEqualDistance && samples_.size() > 2)
60 const scalar interval = samples_[1]-samples[0];
61 for (
label i = 2; i < samples_.size(); i++)
63 scalar d = samples_[i]-samples[i-1];
65 if (
mag(d-interval) > small)
68 <<
"Spline interpolation only valid for constant intervals." 70 <<
"Interval 0-1 : " << interval <<
nl 71 <<
"Interval " << i-1 <<
'-' << i <<
" : " 88 bool indexChanged =
false;
91 if (samples_.size() <= 2)
105 && index_ < samples_.size()
107 samples_[index_] <= t
108 && (index_ == samples_.size()-1 || t <= samples_[index_+1])
132 else if (index_ == samples_.size()-1)
137 indices[0] = samples_.
size()-1;
148 scalar
mu = (t - samples_[lo])/(samples_[hi] - samples_[lo]);
150 scalar
w0 = 0.5*(mu*(-1+mu*(2-
mu)));
151 scalar
w1 = 0.5*(2+mu*(mu*(-5 + mu*(3))));
152 scalar
w2 = 0.5*(mu*(1 + mu*(4 + mu*(-3))));
153 scalar
w3 = 0.5*(mu*mu*(-1 +
mu));
157 if (hi < samples_.size()-1)
184 weights[1] = w1 -
w3;
185 weights[2] = w2 + 2*
w3;
191 if (hi < samples_.size()-1)
200 weights[0] = w1 + 2*
w0;
201 weights[1] = w2 -
w0;
212 weights[0] = w1 + 2*w0 -
w3;
213 weights[1] = w2 - w0 + 2*
w3;
void size(const label)
Override size to be inconsistent with allocated storage.
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.
virtual bool valueWeights(const scalar t, labelList &indices, scalarField &weights) const
Calculate weights and indices to calculate t from samples.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
const dimensionedScalar mu
Atomic mass unit.
defineTypeNameAndDebug(combustionModel, 0)
void setSize(const label)
Reset size of List.
#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.
label findLower(const ListType &, typename ListType::const_reference, const label stary, const BinaryOp &bop)
Find last element < given value in sorted list and return index,.
dimensioned< scalar > mag(const dimensioned< Type > &)