Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

LUT< N, X > Class Template Reference
[Data classes]

N-dimensional lookup table. More...

#include <LUT.h>

Inheritance diagram for LUT< N, X >:

InterpolationType< X > Interpolation BaseType List of all members.

Public Types

typedef VEC< N, int > Dim
 An integer array type for dimensioning the table.

typedef VEC< N, X > Vec
 A floating point array for specifying table coordinates.

typedef VEC< N, std::vector<
X > > 
Breaks
 An array of breakpoint sets for specifying the input data coordinates.

enum  Modes { LINEAR, SPLINE }

Public Methods

 LUT ()
 Default constructor.

 LUT (LUT< N, X > const &copy)
 Copy constructor.

virtual ~LUT ()
 Destructor.

LUT< N, X > const & operator= (LUT< N, X > const &copy)
 Copy operator.

void interpolate (Dim const &dim, Interpolation::Modes mode)
 Interpolate the input data.

void interpolate (std::vector< int > const &dim, Interpolation::Modes mode)
 Interpolate the input data.

getValue (Vec const &v) const
 Lookup the value at a given point in the table.

getValue (std::vector< X > const &x) const
 Lookup the value at a given point in the table.

WRAP< N, X > operator[] (X x) const
 Lookup the value at a given point in the table.

void load (std::vector< X > const &values, Breaks const &breaks, int *index=0)
 Load the initial data value and breakpoints.

void load (std::vector< X > const &values, std::vector< std::vector< X > > const &breaks)
virtual void serialize (Archive &)
 Serialize to or from a data archive.

virtual std::string asString () const
 Return a string representation of LUT.

virtual std::string typeString () const
 Return a string representation of the type.

bool isInterpolated () const
 Return true if the interpolated table is ready for use.

virtual void parseXML (const char *cdata)
 Parse cdata from within the XML tags for this object.

virtual void convertXML ()
 Convert XML data to internal format prior to serialization.


Protected Methods

void find (X x, int &i, X &f) const
 Find the index and interpolation parameter for a given coordinate.

void postInterpolation (X x0, X x1, int n)
 Compute a few parameters needed for fast lookups.

void checkInterpolated () const
void checkNotInterpolated () const
void throwBreakpointOrder () const
void throwInterpolationMode () const

Protected Attributes

m_X0
m_X1
m_XS
int m_Limit
bool m_Interpolated

Friends

class LUT< N+1, X >

Detailed Description

template<int N, class X = float>
class LUT< N, X >

N-dimensional lookup table.

Converts (partially) irregularly spaced data to a regularly spaced lookup table using linear or spline interpolation. The table is then accessed by fast linear interpolation.

Author:
Mark Rose <mrose@stm.lbl.gov>


Member Typedef Documentation

template<int N, class X = float>
typedef VEC<N, std::vector<X> > LUT< N, X >::Breaks
 

An array of breakpoint sets for specifying the input data coordinates.

template<int N, class X = float>
typedef VEC<N, int> LUT< N, X >::Dim
 

An integer array type for dimensioning the table.

template<int N, class X = float>
typedef VEC<N, X> LUT< N, X >::Vec
 

A floating point array for specifying table coordinates.


Member Enumeration Documentation

enum Interpolation::Modes [inherited]
 

Enumeration values:
LINEAR 
SPLINE 


Constructor & Destructor Documentation

template<int N, class X>
LUT< N, X >::LUT  
 

Default constructor.

template<int N, class X>
LUT< N, X >::LUT LUT< N, X > const &    copy
 

Copy constructor.

template<int N, class X>
LUT< N, X >::~LUT   [virtual]
 

Destructor.


Member Function Documentation

template<int N, class X>
std::string LUT< N, X >::asString   [virtual]
 

Return a string representation of LUT.

Implements BaseType.

void Interpolation::checkInterpolated   const [inline, protected, inherited]
 

void Interpolation::checkNotInterpolated   const [inline, protected, inherited]
 

void BaseType::convertXML   [virtual, inherited]
 

Convert XML data to internal format prior to serialization.

This method is currently only called by the XML parser for Object classes. If another BaseType class requires this method, a call must be added to the appropriate XML handler in the parser.

template<typename X>
void InterpolationType< X >::find   x,
int &    i,
X &    f
const [inline, protected, inherited]
 

Find the index and interpolation parameter for a given coordinate.

template<int N, class X = float>
X LUT< N, X >::getValue std::vector< X > const &    x const [inline]
 

Lookup the value at a given point in the table.

The value is calculated by linear interpolation of the evenly- spaced table values, which in turn were generated from the source data by the interpolate() method.

Parameters:
x  The coordinates to sample.

template<int N, class X>
X LUT< N, X >::getValue Vec const &    v const
 

Lookup the value at a given point in the table.

The value is calculated by linear interpolation of the evenly- spaced table values, which in turn were generated from the source data by the interpolate() method.

Parameters:
v  The coordinates to sample.

template<int N, class X>
void LUT< N, X >::interpolate std::vector< int > const &    dim,
Interpolation::Modes    mode
 

Interpolate the input data.

The resulting table will have uniformly spaced data points, with the specified number of points in each dimension.

Parameters:
dim  The number of (evenly-spaced) points in each table dimension after interpolation.
mode  The interpolation mode (e.g. linear)

template<int N, class X>
void LUT< N, X >::interpolate Dim const &    dim,
Interpolation::Modes    mode
 

Interpolate the input data.

The resulting table will have uniformly spaced data points, with the specified number of points in each dimension.

Parameters:
dim  The number of (evenly-spaced) points in each table dimension after interpolation.
mode  The interpolation mode (e.g. linear)

bool Interpolation::isInterpolated   const [inline, inherited]
 

Return true if the interpolated table is ready for use.

template<int N, class X>
void LUT< N, X >::load std::vector< X > const &    values,
std::vector< std::vector< X > > const &    breaks
 

template<int N, class X>
void LUT< N, X >::load std::vector< X > const &    values,
Breaks const &    breaks,
int *    index = 0
 

Load the initial data value and breakpoints.

The order of table values is last index first. So for a 3x3 table, the order would be [0][0], [0][1], [0][2], [1][0], [1][1], etc.

Parameters:
values  the table values.
breaks  the breakpoints for each dimension.
index  for internal use only.

template<int N, class X>
LUT< N, X > const & LUT< N, X >::operator= LUT< N, X > const &    copy
 

Copy operator.

template<int N, class X = float>
WRAP<N,X> LUT< N, X >::operator[]   x const [inline]
 

Lookup the value at a given point in the table.

This method returns a WRAP instance which allows further coordinates to be specified by indexing. The result is equivalent to the getValue() methods, but the syntax is different: <tt>table[c0][c1][c2] == table.getValue(Vec(c0)(c1)(c2))

Parameters:
x  The first coordinate to sample.

void BaseType::parseXML const char *    cdata [virtual, inherited]
 

Parse cdata from within the XML tags for this object.

Reimplemented in SimDate, EnumLink, GeoPos, LLA, UTM, Matrix3, Quat, Real, and Vector3.

template<typename X>
void InterpolationType< X >::postInterpolation   x0,
  x1,
int    n
[protected, inherited]
 

Compute a few parameters needed for fast lookups.

Called after a LUT has been interpolated.

template<int N, class X>
void LUT< N, X >::serialize Archive   archive [virtual]
 

Serialize to or from a data archive.

Reimplemented from BaseType.

void Interpolation::throwBreakpointOrder   const [inline, protected, inherited]
 

void Interpolation::throwInterpolationMode   const [inline, protected, inherited]
 

template<int N, class X>
std::string LUT< N, X >::typeString   [virtual]
 

Return a string representation of the type.

Implements BaseType.


Friends And Related Function Documentation

template<int N, class X = float>
friend class LUT< N+1, X > [friend]
 


Member Data Documentation

bool Interpolation::m_Interpolated [protected, inherited]
 

template<typename X>
int InterpolationType< X >::m_Limit [protected, inherited]
 

template<typename X>
X InterpolationType< X >::m_X0 [protected, inherited]
 

template<typename X>
X InterpolationType< X >::m_X1 [protected, inherited]
 

template<typename X>
X InterpolationType< X >::m_XS [protected, inherited]
 


The documentation for this class was generated from the following files:
SimData version pre-0.4.0. For more information on SimData, visit the SimData Homepage.

Generated on Tue Oct 14 12:06:41 2003, using Doxygen 1.2.18.

[SF.net]