Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TableBase< Type > Class Template Reference

Base class for table with bounds handling, interpolation and integration. More...

Inheritance diagram for TableBase< Type >:
Inheritance graph
[legend]
Collaboration diagram for TableBase< Type >:
Collaboration graph
[legend]

Public Types

enum  boundsHandling { ERROR, WARN, CLAMP, REPEAT }
 Enumeration for handling out-of-bound values. More...
 
- Public Types inherited from Function1< Type >
typedef Type returnType
 

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< scalarFieldx () 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 > &f1)
 Copy constructor. More...
 
virtual tmp< Function1< Type > > clone () const =0
 Construct and return a clone. More...
 
virtual ~Function1 ()
 Destructor. More...
 
const wordname () const
 Return the name of the entry. More...
 
virtual tmp< Field< Type > > value (const scalarField &x) const =0
 Return value as a function of (scalar) independent variable. More...
 
virtual tmp< Field< Type > > integrate (const scalarField &x1, const scalarField &x2) const =0
 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 interpolationWeightsinterpolator () const
 Return (demand driven) interpolator. 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< scalarFieldtableSamplesPtr_
 Extracted values. More...
 
autoPtr< interpolationWeightsinterpolatorPtr_
 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 wordentryName
 
const word const dictionarydict
 
const word const dictionary entryName
 
const word const dictionary dict
 

Detailed Description

template<class Type>
class Foam::Function1Types::TableBase< Type >

Base class for table with bounds handling, interpolation and integration.

Source files

Definition at line 55 of file TableBase.H.

Member Enumeration Documentation

◆ 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.

Constructor & Destructor Documentation

◆ TableBase() [1/2]

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().

Here is the caller graph for this function:

◆ TableBase() [2/2]

TableBase ( const TableBase< Type > &  tbl)

Copy constructor. Note: steals interpolator, tableSamples.

Definition at line 83 of file TableBase.C.

◆ ~TableBase()

~TableBase ( )
virtual

Destructor.

Definition at line 98 of file TableBase.C.

References TableBase< Type >::boundsHandlingToWord().

Here is the call graph for this function:

Member Function Documentation

◆ interpolator()

const Foam::interpolationWeights & interpolator ( ) const
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ boundsHandlingToWord()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wordToBoundsHandling()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ outOfBounds()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check()

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_.

Here is the call graph for this function:

◆ checkMinBounds()

bool checkMinBounds ( const scalar  x,
scalar &  xDash 
) const

◆ checkMaxBounds()

bool checkMaxBounds ( const scalar  x,
scalar &  xDash 
) const

◆ convertTimeBase()

void convertTimeBase ( const Time t)
virtual

Convert time.

Reimplemented from Function1< Type >.

Definition at line 320 of file TableBase.C.

References UList< T >::first(), forAll, TableBase< Type >::interpolatorPtr_, TableBase< Type >::table_, TableBase< Type >::tableSamplesPtr_, TimeState::userTimeToTime(), and TableBase< Type >::value().

Here is the call graph for this function:

◆ value()

Type value ( const scalar  x) const
virtual

◆ integrate()

Type integrate ( const scalar  x1,
const scalar  x2 
) const
virtual

Integrate between two (scalar) values.

Reimplemented from Function1< Type >.

Definition at line 363 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 TableBase< Type >::value().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ x()

Foam::tmp< Foam::scalarField > x ( ) const
virtual

Return the reference values.

Definition at line 382 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ y()

Foam::tmp< Foam::Field< Type > > y ( ) const
virtual

Return the dependent values.

Definition at line 397 of file TableBase.C.

References fld(), forAll, tmp< T >::ref(), List< T >::size(), TableBase< Type >::table_, and Foam::Zero.

Here is the call graph for this function:

◆ writeData()

void writeData ( Ostream os) const
virtual

Write all table data in dictionary format.

Reimplemented from Function1< Type >.

Reimplemented in CSV< Type >, and TableFile< Type >.

Definition at line 428 of file TableBase.C.

References token::END_STATEMENT, Foam::indent(), Foam::nl, TableBase< Type >::table_, Function1< Type >::writeData(), and TableBase< Type >::writeEntries().

Here is the call graph for this function:

◆ writeEntries()

void writeEntries ( Ostream os) const
virtual

Write keywords only in dictionary format. Used for non-inline.

table types

Definition at line 412 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().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ name_

const word name_
protected

◆ boundsHandling_

const boundsHandling boundsHandling_
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().

◆ interpolationScheme_

const word interpolationScheme_
protected

Interpolation type.

Definition at line 84 of file TableBase.H.

Referenced by TableBase< Type >::writeEntries().

◆ table_

List<Tuple2<scalar, Type> > table_
protected

◆ tableSamplesPtr_

autoPtr<scalarField> tableSamplesPtr_
mutableprotected

Extracted values.

Definition at line 90 of file TableBase.H.

Referenced by TableBase< Type >::convertTimeBase().

◆ interpolatorPtr_

autoPtr<interpolationWeights> interpolatorPtr_
mutableprotected

Interpolator method.

Definition at line 93 of file TableBase.H.

Referenced by TableBase< Type >::convertTimeBase().

◆ currentIndices_

labelList currentIndices_
mutableprotected

Cached indices and weights.

Definition at line 96 of file TableBase.H.

Referenced by TableBase< Type >::integrate(), and TableBase< Type >::value().

◆ currentWeights_

scalarField currentWeights_
mutableprotected

Definition at line 98 of file TableBase.H.

Referenced by TableBase< Type >::integrate(), and TableBase< Type >::value().


The documentation for this class was generated from the following files: