Go to the documentation of this file.
39 if (!interpolatorPtr_)
42 tableSamplesPtr_.reset(
new scalarField(table_.size()));
43 auto&
samples = *tableSamplesPtr_;
55 return *interpolatorPtr_;
76 bounds::repeatableBounding::CLAMP,
84 "interpolationScheme",
90 tableSamplesPtr_(
nullptr),
91 interpolatorPtr_(
nullptr)
99 bounding_(tbl.bounding_),
100 interpolationScheme_(tbl.interpolationScheme_),
102 tableSamplesPtr_(nullptr),
103 interpolatorPtr_(nullptr)
115 <<
"Table for entry " << this->
name() <<
" is invalid (empty)"
122 for (
const auto& item : table_)
124 const scalar& currValue = item.first();
127 if (i && currValue <= prevValue)
130 <<
"out-of-order value: "
131 << currValue <<
" at index " << i <<
nl
134 prevValue = currValue;
147 const scalar minLimit = table_.first().first();
148 const scalar maxLimit = table_.last().first();
157 <<
"value (" <<
x <<
") less than lower "
158 <<
"bound (" << minLimit <<
")" <<
nl
165 <<
"value (" <<
x <<
") less than lower "
166 <<
"bound (" << minLimit <<
")" <<
nl
167 <<
" Continuing with the first entry" <<
endl;
183 const scalar span = maxLimit - minLimit;
184 xDash = fmod(
x - minLimit, span) + minLimit;
205 const scalar minLimit = table_.first().first();
206 const scalar maxLimit = table_.last().first();
215 <<
"value (" <<
x <<
") greater than upper "
216 <<
"bound (" << maxLimit <<
")" <<
nl
223 <<
"value (" <<
x <<
") greater than upper "
224 <<
"bound (" << maxLimit <<
")" <<
nl
225 <<
" Continuing with the last entry" <<
endl;
241 const scalar span = maxLimit - minLimit;
242 xDash = fmod(
x - minLimit, span) + minLimit;
259 for (
auto& item : table_)
264 tableSamplesPtr_.clear();
265 interpolatorPtr_.clear();
274 if (checkMinBounds(
x, xDash))
276 return table_.first().second();
279 if (checkMaxBounds(xDash, xDash))
281 return table_.last().second();
285 interpolator().valueWeights(xDash, currentIndices_, currentWeights_);
287 Type t(currentWeights_[0]*table_[currentIndices_[0]].second());
288 for (label i = 1; i < currentIndices_.size(); i++)
290 t += currentWeights_[i]*table_[currentIndices_[i]].second();
305 interpolator().integrationWeights(x1, x2, currentIndices_, currentWeights_);
307 Type
sum(currentWeights_[0]*table_[currentIndices_[0]].second());
308 for (label i = 1; i < currentIndices_.size(); i++)
310 sum += currentWeights_[i]*table_[currentIndices_[i]].second();
321 auto&
fld = tfld.ref();
325 fld[i] = table_[i].first();
336 auto&
fld = tfld.ref();
340 fld[i] = table_[i].second();
359 os.writeEntryIfDifferent<
word>
361 "interpolationScheme",
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
bool checkMaxBounds(const scalar x, scalar &xDash) const
Check maximum table bounds.
A class for handling words, derived from Foam::string.
const interpolationWeights & interpolator() const
Return (demand driven) interpolator.
A class for managing temporary objects.
static constexpr const zero Zero
Global zero (0)
virtual scalar userTimeToTime(const scalar theta) const
Convert the user-time (e.g. CA deg) to real-time (s).
Ostream & endl(Ostream &os)
Add newline and flush stream.
Treat as a repeating list.
virtual Type integrate(const scalar x1, const scalar x2) const
Integrate between two (scalar) values.
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
virtual Type value(const scalar x) const
Return Table value.
#define forAll(list, i)
Loop across all elements in list.
Registry of regIOobjects.
virtual tmp< scalarField > x() const
Return the reference values.
virtual void writeData(Ostream &os) const
Write in dictionary format.
scalarField samples(nIntervals, Zero)
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;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Clamp value to the start/end value.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Abstract base class for interpolating in 1D.
OBJstream os(runTime.globalPath()/outputName)
void initialise()
Check the table for size and consistency.
Ostream & indent(Ostream &os)
Indent stream.
Issue warning and clamp value (this is a good default)
errorManipArg< error, int > exit(error &err, const int errNo=1)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual void writeData(Ostream &os) const
Write all table data in dictionary format.
TableBase(const word &name, const dictionary &dict, const objectRegistry *obrPtr=nullptr)
Construct from dictionary - note table is not populated.
static tmp< T > New(Args &&... args)
Construct tmp of T with forwarding arguments.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
virtual void writeEntries(Ostream &os) const
Write keywords only in dictionary format.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
const Foam::Enum< repeatableBounding > repeatableBoundingNames
Strings corresponding to the repeatableBounding.
Base class for table with bounds handling, interpolation and integration.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual tmp< Field< Type > > y() const
Return the dependent values.
bool checkMinBounds(const scalar x, scalar &xDash) const
Check minimum table bounds.
virtual void userTimeToTime(const Time &t)
Convert time.
#define WarningInFunction
Report a warning using Foam::Warning.