37 fileName fName(fileName_);
42 reader_()(fName, *
this);
47 <<
"table read from " << fName <<
" is empty" <<
nl 63 fileName_(
"fileNameIsUndefined"),
77 boundsHandling_(bounds),
100 fileName_(dict.
lookup(
"fileName")),
114 boundsHandling_(interpTable.boundsHandling_),
115 fileName_(interpTable.fileName_),
116 reader_(interpTable.reader_)
129 word enumName(
"warn");
166 if (bound ==
"error")
170 else if (bound ==
"warn")
174 else if (bound ==
"clamp")
178 else if (bound ==
"repeat")
185 <<
"bad outOfBounds specifier " << bound <<
" using 'warn'" <<
endl;
200 boundsHandling_ =
bound;
213 const scalar currValue =
217 if (currValue <= prevValue)
220 <<
"out-of-order value: " 221 << currValue <<
" at index " << i <<
nl 224 prevValue = currValue;
256 scalar lookupValue = value;
258 if (lookupValue < minLimit)
260 switch (boundsHandling_)
265 <<
"value (" << lookupValue <<
") underflow" <<
nl 272 <<
"value (" << lookupValue <<
") underflow" <<
nl 273 <<
" Zero rate of change." 285 scalar span = maxLimit-minLimit;
286 lookupValue = fmod(lookupValue-minLimit, span) + minLimit;
291 else if (lookupValue >= maxLimit)
293 switch (boundsHandling_)
298 <<
"value (" << lookupValue <<
") overflow" <<
nl 305 <<
"value (" << lookupValue <<
") overflow" <<
nl 306 <<
" Zero rate of change." 318 scalar span = maxLimit-minLimit;
319 lookupValue = fmod(lookupValue-minLimit, span) + minLimit;
329 for (
label i = 0; i <
n; ++i)
402 switch (boundsHandling_)
407 <<
"index (" << ii <<
") underflow" <<
nl 414 <<
"index (" << ii <<
") underflow" <<
nl 415 <<
" Continuing with the first entry" 436 switch (boundsHandling_)
441 <<
"index (" << ii <<
") overflow" <<
nl 448 <<
"index (" << ii <<
") overflow" <<
nl 449 <<
" Continuing with the last entry" 485 scalar lookupValue = value;
487 if (lookupValue < minLimit)
489 switch (boundsHandling_)
494 <<
"value (" << lookupValue <<
") underflow" <<
nl 501 <<
"value (" << lookupValue <<
") underflow" <<
nl 502 <<
" Continuing with the first entry" 514 scalar span = maxLimit-minLimit;
515 lookupValue = fmod(lookupValue-minLimit, span) + minLimit;
520 else if (lookupValue >= maxLimit)
522 switch (boundsHandling_)
527 <<
"value (" << lookupValue <<
") overflow" <<
nl 534 <<
"value (" << lookupValue <<
") overflow" <<
nl 535 <<
" Continuing with the last entry" 547 scalar span = maxLimit-minLimit;
548 lookupValue = fmod(lookupValue-minLimit, span) + minLimit;
558 for (
label i = 0; i <
n; ++i)
592 *(lookupValue / minLimit)
Type rateOfChange(const scalar) const
Return the rate of change at the interpolation location.
word boundsHandlingToWord(const boundsHandling &bound) const
Return the out-of-bounds handling as a word.
void check() const
Check that list is monotonically increasing.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
friend Ostream & operator(Ostream &, const UList< T > &)
interpolationTable()
Construct null.
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.
A 2-tuple for storing two objects of different types.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Tuple2< scalar, Type > & operator[](const label) const
Return an element of constant Tuple2<scalar, Type>
Reads an interpolation table from a file - OpenFOAM-format.
T & first()
Return the first element of the list.
Base class to read table data for the interpolationTable.
Type operator()(const scalar) const
Return an interpolated value.
boundsHandling outOfBounds(const boundsHandling &bound)
Set the out-of-bounds handling from enum, return previous setting.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
stressControl lookup("compactNormalStress") >> compactNormalStress
A class for handling words, derived from string.
Clamp value to the start/end value.
An interpolation/look-up table of scalar vs <Type> values. The reference scalar values must be monoto...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
label size() const
Return the number of elements in the UList.
Issue warning and clamp value (default)
boundsHandling
Enumeration for handling out-of-bound values.
volScalarField & bound(volScalarField &, const dimensionedScalar &lowerBound)
Bound the given scalar field if it has gone unbounded.
#define WarningInFunction
Report a warning using Foam::Warning.
string & expand(const bool allowEmpty=false)
Expand initial tildes and all occurences of environment variables.
Treat as a repeating list.
boundsHandling wordToBoundsHandling(const word &bound) const
Return the out-of-bounds handling as an enumeration.
void write(Ostream &os) const
Write.