Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | 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 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 dimensioned< Type > dimValue (const scalar x) const
 Return dimensioned constant value. More...
 
virtual dimensioned< Type > dimIntegrate (const scalar x1, const scalar x2) const
 Integrate between two values and return dimensioned type. 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 DataEntry< Type >
 TypeName ("DataEntry") declareRunTimeSelectionTable(autoPtr
 Runtime type information. More...
 
 DataEntry (const word &entryName)
 Construct from entry name. More...
 
 DataEntry (const DataEntry< Type > &de)
 Copy constructor. More...
 
virtual tmp< DataEntry< Type > > clone () const
 Construct and return a clone. More...
 
virtual ~DataEntry ()
 Destructor. More...
 
const wordname () 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...
 
virtual tmp< Field< dimensioned< Type > > > dimValue (const scalarField &x) const
 Return dimensioned type as a function of (scalar) More...
 
virtual tmp< Field< dimensioned< Type > > > dimIntegrate (const scalarField &x1, const scalarField &x2) const
 Integrate between two scalar fields and return a field of. More...
 
- Public Member Functions inherited from refCount
 refCount ()
 Construct null with zero count. More...
 
int count () const
 Return the reference count. More...
 
bool okToDelete () const
 Return true if the reference count is zero. More...
 
void resetRefCount ()
 Reset the reference count to 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...
 
void operator= (const TableBase< Type > &)
 Disallow default bitwise assignment. 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...
 
dimensionSet dimensions_
 The dimension set. More...
 
autoPtr< scalarFieldtableSamplesPtr_
 Extracted values. More...
 
autoPtr< interpolationWeightsinterpolatorPtr_
 Interpolator method. More...
 
labelList currentIndices_
 Cached indices and weights. More...
 
scalarField currentWeights_
 
- Protected Attributes inherited from DataEntry< Type >
const word name_
 Name of entry. More...
 

Friends

Ostreamoperator (Ostream &os, const TableBase< Type > &tbl)
 Ostream Operator. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from DataEntry< Type >
static autoPtr< DataEntry< Type > > New (const word &entryName, const dictionary &dict)
 Selector. More...
 
- Public Attributes inherited from DataEntry< Type >
 DataEntry
 
 dictionary
 
const wordentryName
 
const word const dictionarydict
 
const word const dictionary entryName
 
const word const dictionary dict
 

Detailed Description

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

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

Source files

Definition at line 47 of file TableBase.H.

Member Enumeration Documentation

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 72 of file TableBase.H.

Constructor & Destructor Documentation

TableBase ( const word name,
const dictionary dict 
)

Construct from dictionary - note table is not populated.

Definition at line 58 of file TableBase.C.

TableBase ( const TableBase< Type > &  tbl)

Copy constructor. Note: steals interpolator, tableSamples.

Definition at line 79 of file TableBase.C.

~TableBase ( )
virtual

Destructor.

Definition at line 95 of file TableBase.C.

References TableBase< Type >::boundsHandlingToWord().

Here is the call graph for this function:

Member Function Documentation

const Foam::interpolationWeights & interpolator ( ) const
protected

Return (demand driven) interpolator.

Definition at line 33 of file TableBase.C.

References UList< T >::first(), forAll, Foam::compressible::New(), and scalarField().

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:

void operator= ( const TableBase< Type > &  )
protected

Disallow default bitwise assignment.

Foam::word boundsHandlingToWord ( const boundsHandling bound) const

Return the out-of-bounds handling as a word.

Definition at line 103 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 >::~TableBase().

Here is the call graph for this function:

Here is the caller graph for this function:

Foam::TableBase< Type >::boundsHandling wordToBoundsHandling ( const word bound) const

Return the out-of-bounds handling as an enumeration.

Definition at line 140 of file TableBase.C.

References TableBase< Type >::CLAMP, Foam::endl(), TableBase< Type >::ERROR, TableBase< Type >::outOfBounds(), TableBase< Type >::REPEAT, TableBase< Type >::WARN, and WarningIn.

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

Here is the call graph for this function:

Here is the caller graph for this function:

Foam::TableBase< Type >::boundsHandling outOfBounds ( const boundsHandling bound)

Set the out-of-bounds handling from enum, return previous setting.

Definition at line 174 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:

void check ( ) const

Check the table for size and consistency.

Definition at line 186 of file TableBase.C.

References TableBase< Type >::checkMinBounds(), Foam::exit(), Foam::FatalError, FatalErrorIn, UList< T >::first(), n, TableBase< Type >::name_, Foam::nl, List< T >::size(), and TableBase< Type >::table_.

Referenced by CSV< Type >::CSV(), Table< Type >::Table(), and TableFile< Type >::TableFile().

Here is the call graph for this function:

Here is the caller graph for this function:

bool checkMinBounds ( const scalar  x,
scalar &  xDash 
) const
bool checkMaxBounds ( const scalar  x,
scalar &  xDash 
) const
void convertTimeBase ( const Time t)
virtual

Convert time.

Reimplemented from DataEntry< Type >.

Definition at line 339 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:

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

Integrate between two (scalar) values.

Reimplemented from DataEntry< Type >.

Definition at line 381 of file TableBase.C.

References TableBase< Type >::currentIndices_, TableBase< Type >::currentWeights_, TableBase< Type >::dimValue(), interpolationWeights::integrationWeights(), TableBase< Type >::interpolator(), List< T >::size(), Foam::sum(), and TableBase< Type >::table_.

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

Here is the call graph for this function:

Here is the caller graph for this function:

Foam::dimensioned< Type > dimValue ( const scalar  x) const
virtual

Return dimensioned constant value.

Reimplemented from DataEntry< Type >.

Definition at line 398 of file TableBase.C.

References TableBase< Type >::dimensions_, TableBase< Type >::dimIntegrate(), and TableBase< Type >::value().

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

Here is the call graph for this function:

Here is the caller graph for this function:

Foam::dimensioned< Type > dimIntegrate ( const scalar  x1,
const scalar  x2 
) const
virtual

Integrate between two values and return dimensioned type.

Reimplemented from DataEntry< Type >.

Definition at line 406 of file TableBase.C.

References TableBase< Type >::dimensions_, and TableBase< Type >::integrate().

Referenced by DataEntry< Type >::dimIntegrate(), and TableBase< Type >::dimValue().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Return the reference values.

Definition at line 420 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:

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

Return the dependent values.

Definition at line 435 of file TableBase.C.

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

Here is the call graph for this function:

void writeData ( Ostream os) const
virtual

Write all table data in dictionary format.

Reimplemented from DataEntry< Type >.

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

Definition at line 63 of file TableBaseIO.C.

References Foam::indent(), Foam::nl, and writeData().

Here is the call graph for this function:

void writeEntries ( Ostream os) const
virtual

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

table types

Definition at line 72 of file TableBaseIO.C.

References Foam::nl, and Ostream::writeKeyword().

Here is the call graph for this function:

Friends And Related Function Documentation

Ostream& operator ( Ostream os,
const TableBase< Type > &  tbl 
)
friend

Ostream Operator.

Member Data Documentation

const word name_
protected

Table name.

Definition at line 86 of file TableBase.H.

Referenced by TableBase< Type >::check(), and DataEntry< Type >::name().

const boundsHandling boundsHandling_
protected

Enumeration for handling out-of-bound values.

Definition at line 89 of file TableBase.H.

Referenced by TableBase< Type >::checkMaxBounds(), TableBase< Type >::checkMinBounds(), and TableBase< Type >::outOfBounds().

const word interpolationScheme_
protected

Interpolation type.

Definition at line 92 of file TableBase.H.

List<Tuple2<scalar, Type> > table_
protected
dimensionSet dimensions_
protected
autoPtr<scalarField> tableSamplesPtr_
mutableprotected

Extracted values.

Definition at line 101 of file TableBase.H.

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

autoPtr<interpolationWeights> interpolatorPtr_
mutableprotected

Interpolator method.

Definition at line 104 of file TableBase.H.

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

labelList currentIndices_
mutableprotected

Cached indices and weights.

Definition at line 107 of file TableBase.H.

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

scalarField currentWeights_
mutableprotected

Definition at line 109 of file TableBase.H.

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


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