A list of times and values. The time values must be positive and monotonically increasing. More...
#include <OpenFOAM/interpolationTable.H>
A list of times and values. The time values must be positive and monotonically increasing.
The handling of out-of-bounds values depends on the current setting of outOfBounds.
If REPEAT is chosen for the out-of-bounds handling, the final time value is treated as being equivalent to time=0 for the following periods.
The construct from dictionary reads a filename from a dictionary and has an optional readerType. Default is to read OpenFOAM format. The only other format is csv (comma separated values):
Read csv format: readerType csv; fileName"$FOAM_CASE/constant/p0vsTime.csv"; hasHeaderLine true; // skip first line timeColumn 0; // time is in column 0 valueColumns(1);// value starts in column 1
Definition at line 78 of file interpolationTable.H.
Public Types | |
enum | boundsHandling { ERROR, WARN, CLAMP, REPEAT } |
Enumeration for handling out-of-bound values. More... | |
Public Member Functions | |
interpolationTable () | |
Construct null.
| |
interpolationTable (const List< Tuple2< scalar, Type > > &values, const boundsHandling bounds, const fileName &fName) | |
Construct from components.
| |
interpolationTable (const fileName &fName) | |
Construct given the name of the file containing the table of data.
| |
interpolationTable (const dictionary &dict) | |
Construct by reading the fileName and boundsHandling from dictionary.
| |
interpolationTable (const interpolationTable &interpTable) | |
Construct copy.
| |
word | boundsHandlingToWord (const boundsHandling &bound) const |
Return the out-of-bounds handling as a word.
| |
boundsHandling | wordToBoundsHandling (const word &bound) const |
Return the out-of-bounds handling as an enumeration.
| |
boundsHandling | outOfBounds (const boundsHandling &bound) |
Set the out-of-bounds handling from enum, return previous setting.
| |
void | check () const |
Check that list is monotonically increasing.
| |
void | write (Ostream &os) const |
Write.
| |
const Tuple2< scalar, Type > & | operator[] (const label) const |
Return an element of constant Tuple2<scalar, Type>
| |
Type | operator() (const scalar) const |
Return an interpolated value.
|
enum boundsHandling |
Enumeration for handling out-of-bound values.
ERROR |
Exit with a FatalError |
WARN |
Issue warning and clamp value (default) |
CLAMP |
Clamp value to the start/end value |
REPEAT |
Treat as a repeating list |
Definition at line 87 of file interpolationTable.H.
Construct null.
Definition at line 61 of file interpolationTable.C.
interpolationTable | ( | const List< Tuple2< scalar, Type > > & | values, |
const boundsHandling | bounds, | ||
const fileName & | fName | ||
) |
Construct from components.
Definition at line 72 of file interpolationTable.C.
interpolationTable | ( | const fileName & | fName ) |
Construct given the name of the file containing the table of data.
Definition at line 86 of file interpolationTable.C.
interpolationTable | ( | const dictionary & | dict ) |
Construct by reading the fileName and boundsHandling from dictionary.
and read the table from that file. This is a specialised constructor used by patchFields
Definition at line 98 of file interpolationTable.C.
interpolationTable | ( | const interpolationTable< Type > & | interpTable ) |
Construct copy.
Definition at line 111 of file interpolationTable.C.
Foam::word boundsHandlingToWord | ( | const boundsHandling & | bound ) | const |
Return the out-of-bounds handling as a word.
Definition at line 126 of file interpolationTable.C.
References interpolationTable< Type >::CLAMP, interpolationTable< Type >::ERROR, interpolationTable< Type >::REPEAT, and interpolationTable< Type >::WARN.
Foam::interpolationTable< Type >::boundsHandling wordToBoundsHandling | ( | const word & | bound ) | const |
Return the out-of-bounds handling as an enumeration.
Definition at line 163 of file interpolationTable.C.
References interpolationTable< Type >::CLAMP, Foam::endl(), interpolationTable< Type >::ERROR, interpolationTable< Type >::REPEAT, interpolationTable< Type >::WARN, and WarningIn.
Foam::interpolationTable< Type >::boundsHandling outOfBounds | ( | const boundsHandling & | bound ) |
Set the out-of-bounds handling from enum, return previous setting.
Definition at line 198 of file interpolationTable.C.
References Foam::bound().
void check | ( | ) | const |
Check that list is monotonically increasing.
Exit with a FatalError if there is a problem
Definition at line 209 of file interpolationTable.C.
References Foam::exit(), Foam::FatalError, FatalErrorIn, and Foam::nl.
void write | ( | Ostream & | os ) | const |
Write.
Definition at line 235 of file interpolationTable.C.
References token::END_STATEMENT, Foam::nl, and Ostream::writeKeyword().
const Foam::Tuple2< Foam::scalar, Type > & operator[] | ( | const label | i ) | const |
Return an element of constant Tuple2<scalar, Type>
Reimplemented from UList< Tuple2< scalar, Type > >.
Definition at line 252 of file interpolationTable.C.
References interpolationTable< Type >::CLAMP, Foam::endl(), interpolationTable< Type >::ERROR, Foam::exit(), Foam::FatalError, FatalErrorIn, Foam::nl, interpolationTable< Type >::REPEAT, interpolationTable< Type >::WARN, and WarningIn.
Type operator() | ( | const scalar | value ) | const |
Return an interpolated value.
Definition at line 347 of file interpolationTable.C.
References interpolationTable< Type >::CLAMP, Foam::endl(), interpolationTable< Type >::ERROR, Foam::exit(), Foam::FatalError, FatalErrorIn, Foam::nl, interpolationTable< Type >::REPEAT, interpolationTable< Type >::WARN, and WarningIn.