42 linearInterpolationWeights,
74 && t <= samples_.first()
78 && index_ < samples_.size() - 1
79 && t >= samples_[index_]
80 && t <= samples_[index_ + 1]
83 index_ == samples_.size() - 1
84 && t >= samples_.last()
98 const label n = index_ == -1 || index_ == samples_.size() - 1 ? 1 : 2;
109 else if (index_ == samples_.size() - 1)
112 indices[0] = samples_.
size() - 1;
119 (t - samples_[index_])/(samples_[index_ + 1] - samples_[index_]);
122 indices[1] = index_ + 1;
151 const label iClip1 =
min(
max(i1, 0), samples_.size() - 2);
152 const label iClip2 =
min(
max(i2, 0), samples_.size() - 2);
153 const label n =
max(i2 - i1 + (i1 == iClip1) + (i2 == iClip2), 1);
156 bool changed =
false;
157 if (indices.
size() !=
n)
165 if (indices[indexi] == indexi +
max(i1, 0))
183 weights[0] += sign*(samples_[0] - t1);
188 weights[0] -= sign*(samples_[0] - t2);
194 const scalar
f = (t1 - samples_[i1])/(samples_[i1 + 1] - samples_[i1]);
195 const scalar d = samples_[i1 + 1] - t1;
197 weights[0] += sign*(1 -
f)*d/2;
199 weights[1] += sign*(1 +
f)*d/2;
203 if (i1 != i2)
for (
label i = i1 + 1; i <= iClip2; i ++)
205 const scalar d = samples_[i + 1] - samples_[i];
206 indices[i - iClip1] = i;
207 weights[i - iClip1] += sign*d/2;
208 indices[i - iClip1 + 1] = i + 1;
209 weights[i - iClip1 + 1] += sign*d/2;
215 const scalar
f = (t2 - samples_[i2])/(samples_[i2 + 1] - samples_[i2]);
216 const scalar d = samples_[i2 + 1] - t2;
218 weights[n - 2] -= sign*(1 -
f)*d/2;
219 indices[n - 1] = i2 + 1;
220 weights[n - 1] -= sign*(1 +
f)*d/2;
224 if (i1 == samples_.size() - 1)
226 indices[n - 1] = samples_.
size() - 1;
227 weights[n - 1] -= sign*(t1 - samples_.last());
229 if (i2 == samples_.size() - 1)
231 indices[n - 1] = samples_.
size() - 1;
232 weights[n - 1] += sign*(t2 - samples_.last());
dimensionedScalar sign(const dimensionedScalar &ds)
#define forAll(list, i)
Loop across all elements in list.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
void size(const label)
Override size to be inconsistent with allocated storage.
void resize(const label)
Alias for setSize(const label)
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.
linearInterpolationWeights(const scalarField &samples)
Construct from components.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
virtual bool integrationWeights(scalar t1, scalar t2, labelList &indices, scalarField &weights) const
Calculate weights and indices to calculate integrand of t1..t2.
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,.