42 linearInterpolationWeights,
59 if (s < -SMALL || s > 1+SMALL)
62 <<
"Value " << t <<
" outside range " <<
samples_[i]
69 return Pair<scalar>(d*0.5*(1-
s), d*0.5*(1+s));
94 bool indexChanged =
false;
140 indices[1] = index_+1;
144 scalar deltaT = t1-t0;
146 weights[0] = (t1-t)/deltaT;
147 weights[1] = 1.0-weights[0];
154 bool linearInterpolationWeights::integrationWeights
165 <<
"Integration should be in positive direction." 166 <<
" t1:" << t1 <<
" t2:" << t2
181 <<
"Integrating outside table " <<
samples_[0] <<
".." 186 label nIndices = i2-i1+2;
190 bool anyChanged =
false;
192 if (nIndices != indices.
size())
203 if (indices[i] != index)
217 for (
label i = i1+1; i <= i2; 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.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void size(const label)
Override size to be inconsistent with allocated storage.
Abstract base class for interpolating in 1D.
Macros for easy insertion into run-time selection tables.
Various functions to operate on Lists.
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))
virtual bool valueWeights(const scalar t, labelList &indices, scalarField &weights) const
Calculate weights and indices to calculate t from samples.
An ordered pair of two objects of type <T> with first() and second() elements.
linearInterpolationWeights(const scalarField &samples)
Construct from components.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
const Type & second() const
Return second.
void setSize(const label)
Reset size of List.
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,.
T & last()
Return the last element of the list.
const Type & first() const
Return first.
const scalarField & samples_