Go to the documentation of this file.
42 linearInterpolationWeights,
57 scalar
s = (t-samples_[i])/(samples_[i+1]-samples_[i]);
59 if (s < -SMALL || s > 1+SMALL)
62 <<
"Value " << t <<
" outside range " << samples_[i]
63 <<
" .. " << samples_[i+1]
67 scalar d = samples_[i+1]-t;
94 bool indexChanged =
false;
100 && index_ < samples_.size()
102 samples_[index_] <= t
103 && (index_ == samples_.size()-1 || t <= samples_[index_+1])
125 else if (index_ == samples_.size()-1)
130 indices[0] = samples_.
size()-1;
140 indices[1] = index_+1;
142 scalar t0 = samples_[indices[0]];
143 scalar t1 = samples_[indices[1]];
144 scalar deltaT = t1-t0;
146 weights[0] = (t1-t)/deltaT;
147 weights[1] = 1.0-weights[0];
165 <<
"Integration should be in positive direction."
166 <<
" t1:" << t1 <<
" t2:" << t2
178 if (i1 == -1 || i2 == samples_.size()-1)
181 <<
"Integrating outside table " << samples_[0] <<
".."
182 << samples_.last() <<
" not implemented."
186 label nIndices = i2-i1+2;
190 bool anyChanged =
false;
192 if (nIndices != indices.
size())
203 if (indices[i] != index)
213 weights.setSize(nIndices);
217 for (
label i = i1+1; i <= i2; i++)
219 scalar d = samples_[i+1]-samples_[i];
221 weights[i-i1] += 0.5*d;
222 indices[i+1-i1] = i+1;
223 weights[i+1-i1] += 0.5*d;
230 weights[0] += i1Tot1.
first();
232 weights[1] += i1Tot1.
second();
239 weights[i2-i1] += -wghts.
first();
240 indices[i2-i1+1] = i2+1;
241 weights[i2-i1+1] += -wghts.
second();
#define forAll(list, i)
Loop across all elements in list.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
const Type & first() const
Return first.
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.
linearInterpolationWeights(const scalarField &samples)
Construct from components.
Pre-declare SubField and related Field type.
Pair< scalar > integrationWeights(const label i, const scalar t) const
Get weights of i and i+1 to calculate integration from t to.
const Type & second() const
Return second.
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,.
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.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
errorManipArg< error, int > exit(error &err, const int errNo=1)
void setSize(const label)
Reset size of List.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
An ordered pair of two objects of type <T> with first() and second() elements.
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)