Go to the documentation of this file.
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;
const dimensionedScalar mu
Atomic mass unit.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< scalar > mag(const dimensioned< Type > &)
scalarField samples(nIntervals, 0)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
label findLower(const ListType &, typename ListType::const_reference, const label start, const BinaryOp &bop)
Find last element < given value in sorted list and return index,.
splineInterpolationWeights(const scalarField &samples, const bool checkEqualDistance=true)
Construct from components. By default make sure samples are.
virtual bool valueWeights(const scalar t, labelList &indices, scalarField &weights) const
Calculate weights and indices to calculate t from samples.
Abstract base class for interpolating in 1D.
virtual bool valueWeights(const scalar t, labelList &indices, scalarField &weights) const
Calculate weights and indices to calculate t from samples.
Macros for easy insertion into run-time selection tables.
void setSize(const label)
Reset size of List.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Various functions to operate on Lists.
void size(const label)
Override size to be inconsistent with allocated storage.
defineTypeNameAndDebug(combustionModel, 0)
#define WarningInFunction
Report a warning using Foam::Warning.