Base class for table with bounds handling, interpolation and integration. More...
Public Types | |
enum | boundsHandling { ERROR, WARN, CLAMP, REPEAT } |
Enumeration for handling out-of-bound values. More... | |
Public Member Functions | |
TableBase (const word &name, const dictionary &dict) | |
Construct from dictionary - note table is not populated. More... | |
TableBase (const TableBase< Type > &tbl) | |
Copy constructor. Note: steals interpolator, tableSamples. More... | |
virtual | ~TableBase () |
Destructor. More... | |
word | boundsHandlingToWord (const boundsHandling &bound) const |
Return the out-of-bounds handling as a word. More... | |
boundsHandling | wordToBoundsHandling (const word &bound) const |
Return the out-of-bounds handling as an enumeration. More... | |
boundsHandling | outOfBounds (const boundsHandling &bound) |
Set the out-of-bounds handling from enum, return previous setting. More... | |
void | check () const |
Check the table for size and consistency. More... | |
bool | checkMinBounds (const scalar x, scalar &xDash) const |
Check minimum table bounds. More... | |
bool | checkMaxBounds (const scalar x, scalar &xDash) const |
Check maximum table bounds. More... | |
virtual void | convertTimeBase (const Time &t) |
Convert time. More... | |
virtual Type | value (const scalar x) const |
Return Table value. More... | |
virtual Type | integrate (const scalar x1, const scalar x2) const |
Integrate between two (scalar) values. More... | |
virtual tmp< scalarField > | x () const |
Return the reference values. More... | |
virtual tmp< Field< Type > > | y () const |
Return the dependent values. More... | |
virtual void | writeData (Ostream &os) const |
Write all table data in dictionary format. More... | |
virtual void | writeEntries (Ostream &os) const |
Write keywords only in dictionary format. Used for non-inline. More... | |
Public Member Functions inherited from Function1< Type > | |
TypeName ("Function1") declareRunTimeSelectionTable(autoPtr | |
Runtime type information. More... | |
Function1 (const word &entryName) | |
Construct from entry name. More... | |
Function1 (const Function1< Type > &de) | |
Copy constructor. More... | |
virtual tmp< Function1< Type > > | clone () const |
Construct and return a clone. More... | |
virtual | ~Function1 () |
Destructor. More... | |
const word & | name () const |
Return the name of the entry. More... | |
virtual tmp< Field< Type > > | value (const scalarField &x) const |
Return value as a function of (scalar) independent variable. More... | |
virtual tmp< Field< Type > > | integrate (const scalarField &x1, const scalarField &x2) const |
Integrate between two (scalar) values. More... | |
Public Member Functions inherited from refCount | |
int | count () const |
Return the current reference count. More... | |
bool | unique () const |
Return true if the reference count is zero. More... | |
void | operator++ () |
Increment the reference count. More... | |
void | operator++ (int) |
Increment the reference count. More... | |
void | operator-- () |
Decrement the reference count. More... | |
void | operator-- (int) |
Decrement the reference count. More... | |
Protected Member Functions | |
const interpolationWeights & | interpolator () const |
Return (demand driven) interpolator. More... | |
void | operator= (const TableBase< Type > &) |
Disallow default bitwise assignment. More... | |
Protected Member Functions inherited from refCount | |
refCount () | |
Construct null initializing count to 0. More... | |
Protected Attributes | |
const word | name_ |
Table name. More... | |
const boundsHandling | boundsHandling_ |
Enumeration for handling out-of-bound values. More... | |
const word | interpolationScheme_ |
Interpolation type. More... | |
List< Tuple2< scalar, Type > > | table_ |
Table data. More... | |
autoPtr< scalarField > | tableSamplesPtr_ |
Extracted values. More... | |
autoPtr< interpolationWeights > | interpolatorPtr_ |
Interpolator method. More... | |
labelList | currentIndices_ |
Cached indices and weights. More... | |
scalarField | currentWeights_ |
Protected Attributes inherited from Function1< Type > | |
const word | name_ |
Name of entry. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from Function1< Type > | |
static autoPtr< Function1< Type > > | New (const word &entryName, const dictionary &dict) |
Selector. More... | |
Public Attributes inherited from Function1< Type > | |
Function1 | |
dictionary | |
const word & | entryName |
const word const dictionary & | dict |
const word const dictionary | entryName |
const word const dictionary | dict |
Base class for table with bounds handling, interpolation and integration.
Definition at line 55 of file TableBase.H.
enum boundsHandling |
Enumeration for handling out-of-bound values.
Enumerator | |
---|---|
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 64 of file TableBase.H.
TableBase | ( | const word & | name, |
const dictionary & | dict | ||
) |
Construct from dictionary - note table is not populated.
Definition at line 60 of file TableBase.C.
Referenced by TableBase< Type >::interpolator().
Copy constructor. Note: steals interpolator, tableSamples.
Definition at line 83 of file TableBase.C.
|
virtual |
Destructor.
Definition at line 98 of file TableBase.C.
References TableBase< Type >::boundsHandlingToWord().
|
protected |
Return (demand driven) interpolator.
Definition at line 34 of file TableBase.C.
References UList< T >::first(), forAll, Foam::New(), scalarField(), and TableBase< Type >::TableBase().
Referenced by TableBase< Type >::integrate(), and TableBase< Type >::value().
Foam::word boundsHandlingToWord | ( | const boundsHandling & | bound | ) | const |
Return the out-of-bounds handling as a word.
Definition at line 106 of file TableBase.C.
References TableBase< Type >::CLAMP, TableBase< Type >::ERROR, TableBase< Type >::REPEAT, TableBase< Type >::WARN, and TableBase< Type >::wordToBoundsHandling().
Referenced by TableBase< Type >::writeEntries(), and TableBase< Type >::~TableBase().
Foam::Function1Types::TableBase< Type >::boundsHandling wordToBoundsHandling | ( | const word & | bound | ) | const |
Return the out-of-bounds handling as an enumeration.
Definition at line 143 of file TableBase.C.
References TableBase< Type >::CLAMP, Foam::endl(), TableBase< Type >::ERROR, TableBase< Type >::outOfBounds(), TableBase< Type >::REPEAT, TableBase< Type >::WARN, and WarningInFunction.
Referenced by TableBase< Type >::boundsHandlingToWord().
Foam::Function1Types::TableBase< Type >::boundsHandling outOfBounds | ( | const boundsHandling & | bound | ) |
Set the out-of-bounds handling from enum, return previous setting.
Definition at line 177 of file TableBase.C.
References Foam::bound(), and TableBase< Type >::boundsHandling_.
Referenced by TableBase< Type >::wordToBoundsHandling().
void check | ( | ) | const |
Check the table for size and consistency.
Definition at line 189 of file TableBase.C.
References TableBase< Type >::checkMinBounds(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, UList< T >::first(), n, TableBase< Type >::name_, Foam::nl, List< T >::size(), and TableBase< Type >::table_.
bool checkMinBounds | ( | const scalar | x, |
scalar & | xDash | ||
) | const |
Check minimum table bounds.
Definition at line 219 of file TableBase.C.
References TableBase< Type >::boundsHandling_, TableBase< Type >::checkMaxBounds(), TableBase< Type >::CLAMP, Foam::endl(), TableBase< Type >::ERROR, Foam::exit(), Foam::FatalError, FatalErrorInFunction, UList< T >::first(), UList< T >::last(), Foam::nl, TableBase< Type >::REPEAT, TableBase< Type >::table_, TableBase< Type >::WARN, WarningInFunction, and TableBase< Type >::x().
Referenced by TableBase< Type >::check(), and TableBase< Type >::value().
bool checkMaxBounds | ( | const scalar | x, |
scalar & | xDash | ||
) | const |
Check maximum table bounds.
Definition at line 269 of file TableBase.C.
References TableBase< Type >::boundsHandling_, TableBase< Type >::CLAMP, Foam::endl(), TableBase< Type >::ERROR, Foam::exit(), Foam::FatalError, FatalErrorInFunction, UList< T >::first(), UList< T >::last(), Foam::nl, TableBase< Type >::REPEAT, TableBase< Type >::table_, TableBase< Type >::WARN, WarningInFunction, and TableBase< Type >::x().
Referenced by TableBase< Type >::checkMinBounds(), and TableBase< Type >::value().
|
virtual |
Convert time.
Reimplemented from Function1< Type >.
Definition at line 318 of file TableBase.C.
References UList< T >::first(), forAll, TableBase< Type >::interpolatorPtr_, TableBase< Type >::table_, TableBase< Type >::tableSamplesPtr_, TimeState::userTimeToTime(), and TableBase< Type >::value().
|
virtual |
Return Table value.
Reimplemented from Function1< Type >.
Definition at line 332 of file TableBase.C.
References TableBase< Type >::checkMaxBounds(), TableBase< Type >::checkMinBounds(), TableBase< Type >::currentIndices_, TableBase< Type >::currentWeights_, TableBase< Type >::integrate(), TableBase< Type >::interpolator(), UList< T >::last(), List< T >::size(), TableBase< Type >::table_, interpolationWeights::valueWeights(), and TableBase< Type >::x().
Referenced by TableBase< Type >::convertTimeBase(), and Function1< Type >::value().
|
virtual |
Integrate between two (scalar) values.
Reimplemented from Function1< Type >.
Definition at line 361 of file TableBase.C.
References TableBase< Type >::currentIndices_, TableBase< Type >::currentWeights_, interpolationWeights::integrationWeights(), TableBase< Type >::interpolator(), List< T >::size(), Foam::sum(), and TableBase< Type >::table_.
Referenced by Function1< Type >::integrate(), and TableBase< Type >::value().
|
virtual |
Return the reference values.
Definition at line 380 of file TableBase.C.
References UList< T >::first(), fld(), forAll, List< T >::size(), and TableBase< Type >::table_.
Referenced by TableBase< Type >::checkMaxBounds(), TableBase< Type >::checkMinBounds(), and TableBase< Type >::value().
|
virtual |
Return the dependent values.
Definition at line 395 of file TableBase.C.
References fld(), forAll, tmp< T >::ref(), List< T >::size(), TableBase< Type >::table_, and Foam::Zero.
|
virtual |
Write all table data in dictionary format.
Reimplemented from Function1< Type >.
Reimplemented in CSV< Type >, and TableFile< Type >.
Definition at line 426 of file TableBase.C.
References token::END_STATEMENT, Foam::indent(), Foam::nl, TableBase< Type >::table_, Function1< Type >::writeData(), and TableBase< Type >::writeEntries().
|
virtual |
Write keywords only in dictionary format. Used for non-inline.
table types
Definition at line 410 of file TableBase.C.
References TableBase< Type >::boundsHandling_, TableBase< Type >::boundsHandlingToWord(), TableBase< Type >::CLAMP, token::END_STATEMENT, TableBase< Type >::interpolationScheme_, Foam::nl, and Ostream::writeKeyword().
Referenced by TableFile< Type >::writeData(), CSV< Type >::writeData(), and TableBase< Type >::writeData().
|
protected |
Table name.
Definition at line 78 of file TableBase.H.
Referenced by TableBase< Type >::check(), Function1< Type >::name(), and Function1< Type >::writeData().
|
protected |
Enumeration for handling out-of-bound values.
Definition at line 81 of file TableBase.H.
Referenced by TableBase< Type >::checkMaxBounds(), TableBase< Type >::checkMinBounds(), TableBase< Type >::outOfBounds(), and TableBase< Type >::writeEntries().
|
protected |
Interpolation type.
Definition at line 84 of file TableBase.H.
Referenced by TableBase< Type >::writeEntries().
Table data.
Definition at line 87 of file TableBase.H.
Referenced by TableBase< Type >::check(), TableBase< Type >::checkMaxBounds(), TableBase< Type >::checkMinBounds(), TableBase< Type >::convertTimeBase(), TableBase< Type >::integrate(), TableBase< Type >::value(), TableBase< Type >::writeData(), TableBase< Type >::x(), and TableBase< Type >::y().
|
mutableprotected |
Extracted values.
Definition at line 90 of file TableBase.H.
Referenced by TableBase< Type >::convertTimeBase().
|
mutableprotected |
Interpolator method.
Definition at line 93 of file TableBase.H.
Referenced by TableBase< Type >::convertTimeBase().
|
mutableprotected |
Cached indices and weights.
Definition at line 96 of file TableBase.H.
Referenced by TableBase< Type >::integrate(), and TableBase< Type >::value().
|
mutableprotected |
Definition at line 98 of file TableBase.H.
Referenced by TableBase< Type >::integrate(), and TableBase< Type >::value().