36 if (interpolatorPtr_.empty())
39 tableSamplesPtr_.reset(
new scalarField(table_.size()));
43 tableSamples[i] = table_[i].
first();
52 return interpolatorPtr_();
87 boundsHandling_(tbl.boundsHandling_),
88 interpolationScheme_(tbl.interpolationScheme_),
90 tableSamplesPtr_(tbl.tableSamplesPtr_),
91 interpolatorPtr_(tbl.interpolatorPtr_)
110 word enumName(
"warn");
147 if (bound ==
"error")
151 else if (bound ==
"warn")
155 else if (bound ==
"clamp")
159 else if (bound ==
"repeat")
166 <<
"bad outOfBounds specifier " << bound <<
" using 'warn'" 194 <<
"Table for entry " << this->
name_ <<
" is invalid (empty)" 201 for (
label i = 1; i <
n; ++i)
206 if (currValue <= prevValue)
209 <<
"out-of-order value: " << currValue <<
" at index " << i
212 prevValue = currValue;
224 if (x <
table_[0].first())
231 <<
"value (" << x <<
") underflow" 238 <<
"value (" << x <<
") underflow" <<
nl 281 <<
"value (" << x <<
") overflow" 288 <<
"value (" << x <<
") overflow" <<
nl 338 return table_[0].second();
402 fld[i] =
table_[i].second();
Issue warning and clamp value (default)
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.
bool checkMinBounds(const scalar x, scalar &xDash) const
Check minimum table bounds.
boundsHandling wordToBoundsHandling(const word &bound) const
Return the out-of-bounds handling as an enumeration.
#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.
boundsHandling outOfBounds(const boundsHandling &bound)
Set the out-of-bounds handling from enum, return previous setting.
Ostream & indent(Ostream &os)
Indent stream.
TableBase(const word &name, const dictionary &dict)
Construct from dictionary - note table is not populated.
virtual void writeEntries(Ostream &os) const
Write keywords only in dictionary format. Used for non-inline.
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< Tuple2< scalar, Type > > table_
Table data.
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual scalar userTimeToTime(const scalar theta) const
Convert the user-time (e.g. CA deg) to real-time (s).
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
autoPtr< interpolationWeights > interpolatorPtr_
Interpolator method.
virtual void writeData(Ostream &os) const
Write in dictionary format.
T & first()
Return the first element of the list.
Abstract base class for interpolating in 1D.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
word boundsHandlingToWord(const boundsHandling &bound) const
Return the out-of-bounds handling as a word.
virtual ~TableBase()
Destructor.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Treat as a repeating list.
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){const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Base class for table with bounds handling, interpolation and integration.
bool checkMaxBounds(const scalar x, scalar &xDash) const
Check maximum table bounds.
const word name_
Table name.
A class for handling words, derived from string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const interpolationWeights & interpolator() const
Return (demand driven) interpolator.
virtual tmp< scalarField > x() const
Return the reference values.
scalarField currentWeights_
virtual bool integrationWeights(const scalar t1, const scalar t2, labelList &indices, scalarField &weights) const =0
Calculate weights and indices to calculate integrand of t1..t2.
virtual Type integrate(const scalar x1, const scalar x2) const
Integrate between two (scalar) values.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
volScalarField scalarField(fieldObject, mesh)
void check() const
Check the table for size and consistency.
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
virtual tmp< Field< Type > > y() const
Return the dependent values.
word name(const complex &)
Return a string representation of a complex.
const word interpolationScheme_
Interpolation type.
virtual void convertTimeBase(const Time &t)
Convert time.
autoPtr< scalarField > tableSamplesPtr_
Extracted values.
const boundsHandling boundsHandling_
Enumeration for handling out-of-bound values.
labelList currentIndices_
Cached indices and weights.
volScalarField & bound(volScalarField &, const dimensionedScalar &lowerBound)
Bound the given scalar field if it has gone unbounded.
#define WarningInFunction
Report a warning using Foam::Warning.
virtual void writeData(Ostream &os) const
Write all table data in dictionary format.
A class for managing temporary objects.
T & last()
Return the last element of the list.
T & ref() const
Return non-const reference or generate a fatal error.
virtual bool valueWeights(const scalar t, labelList &indices, scalarField &weights) const =0
Calculate weights and indices to calculate t from samples.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
Clamp value to the start/end value.
boundsHandling
Enumeration for handling out-of-bound values.