Go to the documentation of this file.
36 fileName fName(fileName_);
40 reader_()(fName, *
this);
45 <<
"table read from " << fName <<
" is empty" <<
nl
61 fileName_(
"fileNameIsUndefined"),
121 bounding_(tbl.bounding_),
122 fileName_(tbl.fileName_),
123 reader_(tbl.reader_.clone())
146 template<
class BinaryOp>
159 limitI = t.size() - 1;
162 if (bop(valueX, t[limitI].first()))
166 case bounds::normalBounding::ERROR:
169 <<
"value (" << valueX <<
") out of bounds" <<
nl
173 case bounds::normalBounding::WARN:
176 <<
"value (" << valueX <<
") out of bounds" <<
nl;
182 case bounds::normalBounding::CLAMP:
190 <<
"Unhandled bounding type " << int(bounding_)
199 const label nX = t.size();
201 while ((i < nX) && (valueX > t[i].first()))
209 while ((i > 0) && (valueX < t[i].first()))
233 bounding_ = rhs.bounding_;
234 fileName_ = rhs.fileName_;
235 reader_.reset(rhs.reader_.clone());
249 const label nX = t.size();
254 <<
"Cannot interpolate zero-sized table - returning zero" <<
nl;
261 return interpolateValue(t.first().second(), valueY);
271 return interpolateValue(t[lo].second(), valueY);
277 const Type
y0(interpolateValue(t[lo].second(), valueY));
278 const Type
y1(interpolateValue(t[hi].second(), valueY));
280 const scalar& x0 = t[lo].first();
281 const scalar& x1 = t[hi].first();
283 return (
y0 + (
y1 -
y0)*(valueX - x0)/(x1 - x0));
295 for (
const auto& item : list)
297 const scalar& currValue = item.first();
300 if (i && currValue <= prevValue)
303 <<
"out-of-order value: "
304 << currValue <<
" at index " << i <<
nl
307 prevValue = currValue;
void reverse(UList< T > &list, const label n)
Reads an interpolation table from a file - OpenFOAM-format.
A class for handling file names.
dimensionedScalar y1(const dimensionedScalar &ds)
static constexpr const zero Zero
Global zero (0)
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
interpolation2DTable()
Default construct.
Base class to read table data for the interpolationTable.
normalBounding
Enumeration for handling out-of-bound values.
repeatableBounding
Enumeration for handling out-of-bound values that are repeatable.
2D table interpolation. The data must be in ascending order in both dimensions x and y.
dimensionedScalar y0(const dimensionedScalar &ds)
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
void check() const
Check that list is monotonically increasing.
errorManip< error > abort(error &err)
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.
const Foam::Enum< normalBounding > normalBoundingNames
Strings corresponding to the normalBounding.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
string & expand(const bool allowEmpty=false)
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
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,...
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
#define WarningInFunction
Report a warning using Foam::Warning.
void write(Ostream &os) const
Write.