Public Types | Public Member Functions | Private Member Functions | Private Attributes
interpolation2DTable< Type > Class Template Reference

2D table interpolation. The data must be in ascending order in both dimensions x and y. More...

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

Public Types

enum  boundsHandling { ERROR, WARN, CLAMP }
 Enumeration for handling out-of-bound values. More...
 
typedef List< Tuple2< scalar, List< Tuple2< scalar, Type > > > > table
 Cconvenience typedef. More...
 
- Public Types inherited from List< Tuple2< scalar, List< Tuple2< scalar, Type > > > >
typedef SubList< TsubList
 Declare type of subList. More...
 

Public Member Functions

 interpolation2DTable ()
 Construct null. More...
 
 interpolation2DTable (const List< Tuple2< scalar, List< Tuple2< scalar, Type > > > > &values, const boundsHandling bounds, const fileName &fName)
 Construct from components. More...
 
 interpolation2DTable (const fileName &fName)
 Construct given the name of the file containing the table of data. More...
 
 interpolation2DTable (const dictionary &dict)
 Construct by reading the fileName and boundsHandling from dictionary. More...
 
 interpolation2DTable (const interpolation2DTable &interpTable)
 Construct copy. 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 checkOrder () const
 Check that list is monotonically increasing. More...
 
void write (Ostream &os) const
 Write. More...
 
const List< Tuple2< scalar, Type > > & operator[] (const label) const
 Return an element of constant Tuple2<scalar, Type> More...
 
Type operator() (const scalar, const scalar) const
 Return an interpolated value. More...
 
template<class BinaryOp >
Foam::label Xi (const BinaryOp &bop, const scalar valueX, const bool reverse) const
 
- Public Member Functions inherited from List< Tuple2< scalar, List< Tuple2< scalar, Type > > > >
label size () const
 Return the number of elements in the UList. More...
 
 List ()
 Null constructor. More...
 
 List (const label)
 Construct with given size. More...
 
 List (const label, const T &)
 Construct with given size and value for all elements. More...
 
 List (const List< T > &)
 Copy constructor. More...
 
 List (const Xfer< List< T > > &)
 Construct by transferring the parameter contents. More...
 
 List (List< T > &, bool reUse)
 Construct as copy or re-use as specified. More...
 
 List (const UList< T > &, const labelUList &mapAddressing)
 Construct as subset. More...
 
 List (InputIterator first, InputIterator last)
 Construct given start and end iterators. More...
 
 List (const FixedList< T, Size > &)
 Construct as copy of FixedList<T, Size> More...
 
 List (const PtrList< T > &)
 Construct as copy of PtrList<T> More...
 
 List (const SLList< T > &)
 Construct as copy of SLList<T> More...
 
 List (const UIndirectList< T > &)
 Construct as copy of UIndirectList<T> More...
 
 List (const BiIndirectList< T > &)
 Construct as copy of BiIndirectList<T> More...
 
 List (Istream &)
 Construct from Istream. More...
 
 List (const label s)
 
 List (const label s, const T &a)
 
 List (const List< T > &a)
 
 List (const Xfer< List< T > > &lst)
 
 List (List< T > &a, bool reUse)
 
 List (const UList< T > &a, const labelUList &map)
 
 List (const PtrList< T > &lst)
 
 List (const SLList< T > &lst)
 
 List (const UIndirectList< T > &lst)
 
 List (const BiIndirectList< T > &lst)
 
 List ()
 
 List (Istream &is)
 
autoPtr< List< T > > clone () const
 Clone. More...
 
 ~List ()
 Destructor. More...
 
void resize (const label)
 Alias for setSize(const label) More...
 
void resize (const label, const T &)
 Alias for setSize(const label, const T&) More...
 
void setSize (const label)
 Reset size of List. More...
 
void setSize (const label, const T &)
 Reset size of List and value for new elements. More...
 
void clear ()
 Clear the list, i.e. set size to zero. More...
 
void append (const T &)
 Append an element at the end of the list. More...
 
void append (const UList< T > &)
 Append a List at the end of this list. More...
 
void append (const UIndirectList< T > &)
 Append a UIndirectList at the end of this list. More...
 
void transfer (List< T > &)
 Transfer the contents of the argument List into this list. More...
 
void transfer (DynamicList< T, SizeInc, SizeMult, SizeDiv > &)
 Transfer the contents of the argument List into this list. More...
 
void transfer (SortableList< T > &)
 Transfer the contents of the argument List into this list. More...
 
void transfer (List< T > &a)
 
void transfer (SortableList< T > &a)
 
Xfer< List< T > > xfer ()
 Transfer contents to the Xfer container. More...
 
TnewElmt (const label)
 Return subscript-checked element of UList. More...
 
void operator= (const UList< T > &)
 Assignment from UList operator. Takes linear time. More...
 
void operator= (const List< T > &)
 Assignment operator. Takes linear time. More...
 
void operator= (const SLList< T > &)
 Assignment from SLList operator. Takes linear time. More...
 
void operator= (const UIndirectList< T > &)
 Assignment from UIndirectList operator. Takes linear time. More...
 
void operator= (const BiIndirectList< T > &)
 Assignment from BiIndirectList operator. Takes linear time. More...
 
void operator= (const T &)
 Assignment of all entries to the given value. More...
 

Private Member Functions

void readTable ()
 Read the table of data from file. More...
 
Type interpolateValue (const List< Tuple2< scalar, Type > > &data, const scalar) const
 Return interpolated value in List. More...
 
template<class BinaryOp >
label Xi (const BinaryOp &bop, const scalar valueX, const bool reverse) const
 Return an X index from the matrix. More...
 

Private Attributes

boundsHandling boundsHandling_
 Enumeration for handling out-of-bound values. More...
 
fileName fileName_
 File name. More...
 
autoPtr< tableReader< Type > > reader_
 The actual reader. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from List< Tuple2< scalar, List< Tuple2< scalar, Type > > > >
static const List< T > & null ()
 Return a null List. More...
 
- Protected Member Functions inherited from List< Tuple2< scalar, List< Tuple2< scalar, Type > > > >
void size (const label)
 Override size to be inconsistent with allocated storage. More...
 

Detailed Description

template<class Type>
class Foam::interpolation2DTable< Type >

2D table interpolation. The data must be in ascending order in both dimensions x and y.

Source files

Definition at line 52 of file interpolation2DTable.H.

Member Typedef Documentation

◆ table

typedef List<Tuple2<scalar, List<Tuple2<scalar, Type> > > > table

Cconvenience typedef.

Definition at line 69 of file interpolation2DTable.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

Definition at line 61 of file interpolation2DTable.H.

Constructor & Destructor Documentation

◆ interpolation2DTable() [1/5]

Construct null.

Definition at line 55 of file interpolation2DTable.C.

◆ interpolation2DTable() [2/5]

interpolation2DTable ( const List< Tuple2< scalar, List< Tuple2< scalar, Type > > > > &  values,
const boundsHandling  bounds,
const fileName fName 
)

Construct from components.

Definition at line 66 of file interpolation2DTable.C.

◆ interpolation2DTable() [3/5]

interpolation2DTable ( const fileName fName)

Construct given the name of the file containing the table of data.

Definition at line 80 of file interpolation2DTable.C.

References interpolation2DTable< Type >::readTable().

Here is the call graph for this function:

◆ interpolation2DTable() [4/5]

interpolation2DTable ( const dictionary dict)

Construct by reading the fileName and boundsHandling from dictionary.

Definition at line 92 of file interpolation2DTable.C.

References interpolation2DTable< Type >::readTable().

Here is the call graph for this function:

◆ interpolation2DTable() [5/5]

interpolation2DTable ( const interpolation2DTable< Type > &  interpTable)

Construct copy.

Definition at line 105 of file interpolation2DTable.C.

Member Function Documentation

◆ readTable()

void readTable
private

Read the table of data from file.

Definition at line 32 of file interpolation2DTable.C.

References Foam::exit(), string::expand(), Foam::FatalError, FatalErrorInFunction, and Foam::nl.

Referenced by interpolation2DTable< Type >::interpolation2DTable().

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

◆ interpolateValue()

Type interpolateValue ( const List< Tuple2< scalar, Type > > &  data,
const scalar  lookupValue 
) const
private

◆ Xi() [1/2]

label Xi ( const BinaryOp &  bop,
const scalar  valueX,
const bool  reverse 
) const
private

Return an X index from the matrix.

◆ boundsHandlingToWord()

Foam::word boundsHandlingToWord ( const boundsHandling bound) const

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

Definition at line 349 of file interpolation2DTable.C.

References Foam::bound(), interpolation2DTable< Type >::CLAMP, interpolation2DTable< Type >::ERROR, and interpolation2DTable< Type >::WARN.

Here is the call graph for this function:

◆ wordToBoundsHandling()

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

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

Definition at line 381 of file interpolation2DTable.C.

References Foam::bound(), interpolation2DTable< Type >::CLAMP, Foam::endl(), interpolation2DTable< Type >::ERROR, interpolation2DTable< Type >::WARN, and WarningInFunction.

Here is the call graph for this function:

◆ outOfBounds()

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

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

Definition at line 410 of file interpolation2DTable.C.

References Foam::bound().

Here is the call graph for this function:

◆ checkOrder()

void checkOrder

Check that list is monotonically increasing.

Exit with a FatalError if there is a problem

Definition at line 421 of file interpolation2DTable.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, n, and Foam::nl.

Here is the call graph for this function:

◆ write()

void write ( Ostream os) const

Write.

Definition at line 446 of file interpolation2DTable.C.

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

Here is the call graph for this function:

◆ operator[]()

const List<Tuple2<scalar, Type> >& operator[] ( const  label) const

Return an element of constant Tuple2<scalar, Type>

◆ operator()()

Type operator() ( const scalar  valueX,
const scalar  valueY 
) const

Return an interpolated value.

Definition at line 296 of file interpolation2DTable.C.

References Foam::endl(), WarningInFunction, Foam::y0(), and Foam::y1().

Here is the call graph for this function:

◆ Xi() [2/2]

Foam::label Xi ( const BinaryOp &  bop,
const scalar  valueX,
const bool  reverse 
) const

Field Documentation

◆ boundsHandling_

boundsHandling boundsHandling_
private

Enumeration for handling out-of-bound values.

Definition at line 77 of file interpolation2DTable.H.

◆ fileName_

fileName fileName_
private

File name.

Definition at line 80 of file interpolation2DTable.H.

◆ reader_

autoPtr<tableReader<Type> > reader_
private

The actual reader.

Definition at line 83 of file interpolation2DTable.H.


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