FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

interpolationTable< Type > Class Template Reference

A list of times and values. The time values must be positive and monotonically increasing. More...

#include <OpenFOAM/interpolationTable.H>


Detailed Description

template<class Type>
class Foam::interpolationTable< Type >

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

Note:
  • Accessing an empty list results in an error.
  • Accessing a list with a single element always returns the same value.
Source files

Definition at line 78 of file interpolationTable.H.

Inheritance diagram for interpolationTable< Type >:
Collaboration diagram for interpolationTable< Type >:

List of all members.

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.

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 87 of file interpolationTable.H.


Constructor & Destructor Documentation

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.


Member Function Documentation

Foam::word boundsHandlingToWord ( const boundsHandling &   bound  ) const
Foam::interpolationTable< Type >::boundsHandling wordToBoundsHandling ( const word &   bound  ) const
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().


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