Go to the documentation of this file.
42 linearInterpolationWeights,
60 if (s < -SMALL || s > 1+SMALL)
63 <<
"Value " << t <<
" outside range " <<
samples_[i]
70 return Pair<scalar>(d*0.5*(1-
s), d*0.5*(1+
s));
95 bool indexChanged =
false;
101 && index_ < samples_.size()
103 samples_[index_] <= t
104 && (index_ == samples_.size()-1 || t <= samples_[index_+1])
126 else if (index_ == samples_.size()-1)
131 indices[0] = samples_.size()-1;
141 indices[1] = index_+1;
143 scalar t0 = samples_[indices[0]];
144 scalar t1 = samples_[indices[1]];
145 scalar deltaT = t1-t0;
147 weights[0] = (t1-t)/deltaT;
148 weights[1] = 1.0-weights[0];
155 bool Foam::linearInterpolationWeights::integrationWeights
166 <<
"Integration should be in positive direction."
167 <<
" t1:" << t1 <<
" t2:" << t2
180 if (i1 == -1 || i2 == samples_.size()-1)
183 <<
"Integrating outside table " << samples_[0] <<
".."
184 << samples_.last() <<
" not implemented."
188 const label nIndices = i2-i1+2;
192 bool anyChanged =
false;
194 if (nIndices != indices.size())
205 if (indices[i] != index)
215 weights.setSize(nIndices);
219 for (
label i = i1+1; i <= i2; i++)
221 const scalar d = samples_[i+1]-samples_[i];
223 weights[i-i1] += 0.5*d;
224 indices[i+1-i1] = i+1;
225 weights[i+1-i1] += 0.5*d;
233 weights[0] += i1Tot1.first();
234 weights[1] += i1Tot1.
second();
241 indices[i2-i1+1] = i2+1;
242 weights[i2-i1] += -wghts.first();
243 weights[i2-i1+1] += -wghts.
second();
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
const T & second() const noexcept
Return second element, which is also the last element.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.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))
#define forAll(list, i)
Loop across all elements in list.
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.
label findLower(const ListType &input, const T &val, const label start, const ComparePredicate &comp)
scalarField samples(nIntervals, Zero)
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.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
An ordered pair of two objects of type <T> with first() and second() elements.
const scalarField & samples_
Various functions to operate on Lists.
void setSize(const label newSize)
Alias for resize(const label)
defineTypeNameAndDebug(combustionModel, 0)