Intp Class Template Reference

Abstract class template supports interpolation of tabulated data. More...

#include <Intp.h>

Inherits Base.

Inherited by Cube, Nurb, and Poly.

Inheritance diagram for Intp:

Inheritance graph
[legend]
List of all members.

Public Types

enum  CTYPE { CUBIC = 0, NURBS, POLYNOMIAL, CTYPE_CNT }
 CTYPE_CNT
 CUBIC = 0
 DEPENDENT
 DERIVATIVE
 INDEPENDENT = 0
 KNOT
 NURBS
 ORDER
 POLYGON
 POLYNOMIAL
enum  VTYPE { INDEPENDENT = 0, KNOT, DEPENDENT, DERIVATIVE, POLYGON, ORDER, VTYPE_CNT }
 VTYPE_CNT

Public Member Functions

virtual xType * copyArrayX (enum Intp< xType, yType >::VTYPE vType, xType *array) const
virtual yType * copyArrayY (enum Intp< xType, yType >::VTYPE vType, yType *array) const
virtual yType eval (xType x)=0 throw (IntpErr)
virtual const xType * getArrayX (enum Intp< xType, yType >::VTYPE vType) const
virtual const yType * getArrayY (enum Intp< xType, yType >::VTYPE vType) const
virtual int getCount (enum Intp< xType, yType >::VTYPE vType) const
enum Intp< xType, yType
>::CTYPE 
getMethod (void) const
bool isBounded (xType x) const
bool isIncreasing (void) const
virtual bool update (void)
bool update (const xType *arX, const yType *arY)

Static Public Attributes

static const int DEF_POINTS = 4

Protected Member Functions

 Intp (const Intp< xType, yType > &in)
 Intp (const xType *arX, const yType *arY, int nCount, int nPoints)
 ~Intp (void)

Protected Attributes

xType * aX
yType * aY
bool bInc
enum Intp< xType, yType
>::CTYPE 
cTyp
int mData
int nData
int nPts

Detailed Description

template<typename xType, typename yType>
class calc::Intp< xType, yType >

Abstract class template supports interpolation of tabulated data.

Object instantiation of this class should be made only through classes which inherit this class.

The declaration typename <xType> specifies the form of independent variables used in interpolation calculations. The declaration typename <yType> specifies the form of solution variables used in interpolation calculations. In general, the <yType> variables should be the equal or superset of the <xType> variables.

See the cited References to obtain more information on the mathematical theory applied here.

Author
efgeorge
Date
2006/07/19 13:21:43
Revision
1.3
Examples:

example_Intp.txt.


Member Enumeration Documentation

enum CTYPE

Enumeration indicates the class index of the interpolation method used.

Enumerator:
CUBIC  index of a calc::Cube object implementing cubic splines
NURBS  index of a calc::Nurb object implementing non-uniform rational Bezier splines
POLYNOMIAL  index of a calc::Poly object implementing polynomial curve-fits
CTYPE_CNT  class type index count

enum VTYPE

Enumeration indicates the variable index and unit type consistent with the interpolation method used.

Enumerator:
INDEPENDENT  index of an independent variable (x units) <xType>
KNOT  index of a knot vector variable implemented in a calc::Nurb object (scaled x units) <xType>
DEPENDENT  index of a dependent variable (y units) <yType>
DERIVATIVE  index of a second derivative variable implemented in a calc::Cube object (y/x2 units) <yType>
POLYGON  index of a control polygon variable implemented in a calc::Nurb object (y units) <yType>
ORDER  index of a polynomial control point count (order + 1) variable
VTYPE_CNT  variable type index count


Constructor & Destructor Documentation

Intp ( const xType *  arX,
const yType *  arY,
int  nCount,
int  nPoints 
) [protected]

Function initializes an interpolation object.

Parameters:
arX a pointer to an independent value interpolation array (x units)
arY a pointer to a dependent value interpolation array (y units)
nCount data count for the specified arrays arX and arY
nPoints data point count of polynomials used in interpolation evaluations
Remarks:
  • The data count value nCount must be greater than zero.
  • The polynomial point count value nPoints must be greater than zero.
  • The value nPoints should, be at most, equal to the data count value nCount.
  • The degree of polynomials used in interpolation evaluations is one less than the polynomial point count.

Intp ( const Intp< xType, yType > &  in  )  [protected]

Copy constructor initializes an interpolation object from the specified existing interpolation object.

Parameters:
in a reference to an interpolation object

~Intp ( void   )  [protected]

Destructor frees allocated memory.


Member Function Documentation

xType * copyArrayX ( enum Intp< xType, yType >::VTYPE  vType,
xType *  array 
) const [virtual]

Virtual function copies values contained in an identified object independent array to the specified pointer.

Parameters:
vType variable index indentifying the type of data
array a pointer to a copy of the object's independent data array (varying units)
Returns:
the value of the pointer array
Remarks:
  • The data count of the object's array identified by vType is returned by a corresponding function call Intp::getCount().
  • The pointer to the object's array identified by vType is returned by a corresponding function call Intp::getArrayX().
  • The user-supplied pointer array should have sufficient allocated memory.
  • If the object is not initialized, a null pointer is returned.
  • If the object does not have the variable identified by vType, a null pointer is returned.
  • The units expressed in the values of array vary depending on the the variable index vType.

yType * copyArrayY ( enum Intp< xType, yType >::VTYPE  vType,
yType *  array 
) const [virtual]

Virtual function copies values contained in an identified object dependent array to the specified pointer.

Parameters:
vType variable index indentifying the type of data
array a pointer to a copy of the object's dependent data array (varying units)
Returns:
the value of the pointer array
Remarks:
  • The data count of the object's array identified by vType is returned by a corresponding function call Intp::getCount().
  • The pointer to the object's array identified by vType is returned by a corresponding function call Intp::getArrayY().
  • The user-supplied pointer array should have sufficient allocated memory.
  • If the object is not initialized, a null pointer is returned.
  • If the object does not have the variable identified by vType, a null pointer is returned.
  • The units expressed in the values of array vary depending on the the variable index vType.

virtual yType eval ( xType  x  )  throw (IntpErr) [pure virtual]

Virtual function interpolates the dependent data at the specified independent data value.

Parameters:
x an independent value interpolation point (x units)
Returns:
calculated interpolation value evaluated at value x (y units)
Exceptions:
IntpErr type of object thrown

Implemented in Cube, Nurb, and Poly.

const xType * getArrayX ( enum Intp< xType, yType >::VTYPE  vType  )  const [virtual]

Virtual function returns the pointer of the identified object independent array.

Parameters:
vType variable index indentifying the independent array type
Returns:
a pointer to the object's identified array (varying units)
Remarks:
  • The data count of the object's array identified by vType is returned by a corresponding function call Intp::getCount().
  • The data contained in the object's array identified by vType can be copied to user-identified memory by a corresponding function call Intp::copyArrayX().
  • If the object is not initialized, a null pointer is returned.
  • If the object does not have the variable identified by vType, a null pointer is returned.
  • The units expressed in the values of the returned array vary depending on the the variable index vType.

const yType * getArrayY ( enum Intp< xType, yType >::VTYPE  vType  )  const [virtual]

Virtual function returns the pointer of the identified object dependent array.

Parameters:
vType variable index indentifying the dependent array type
Returns:
a pointer to the object's identified array (varying units)
Remarks:
  • The data count of the object's array identified by vType is returned by a corresponding function call Intp::getCount().
  • The data contained in the object's array identified by vType can be copied to user-identified memory by a corresponding function call Intp::copyArrayY().
  • If the object is not initialized, a null pointer is returned.
  • If the object does not have the variable identified by vType, a null pointer is returned.
  • The units expressed in the values of the returned array vary depending on the the variable index vType.

int getCount ( enum Intp< xType, yType >::VTYPE  vType  )  const [virtual]

Virtual function determines the number of values contained in the object's identified array.

Parameters:
vType variable index indentifying the type of data
Returns:
the data count of the object's array
Remarks:
  • The pointer of the object's array identified by vType is returned by a corresponding function call Intp::getArrayX() or Intp::getArrayY().
  • If the object is not initialized, -1 is returned.
  • If the object does not have the variable identified by vType, -1 is returned.

enum Intp< xType, yType >::CTYPE getMethod ( void   )  const

Function returns an enumeration index indicating the calculation method used in the interpolation evaluation.

Returns:
an index of the enumeration Intp::CTYPE identifying the interpolation method of the interpolation object
Remarks:
The interpolation method index (Intp::CTYPE) can be one of the following values:
  • CUBIC (cubic splines)
  • NURBS (non-uniform rational Bezier splines)
  • POLYNOMIAL (multi-point curve-fit)

bool isBounded ( xType  x  )  const

Function determines if the specified independent value x is within the interpolation table's interpolation limits.

Parameters:
x an independent value to interpolate (x units)
Returns:
status flag
  • false (value x is outside the interpolation interval)
  • true (value x is within the interpolation interval)

bool isIncreasing ( void   )  const

Function returns the ascending status of the independent data.

Returns:
the increasing status of the independent data
  • false (data is not monotonically increasing in value)
  • true (data is monotonically increasing in value)

virtual bool update ( void   )  [virtual]

Virtual function prepares the interpolation object for interpolation evaluations.

Returns:
status flag
  • false (successful execution)
  • true (execution error)
    • object initialization error
    • memory allocation error
    • some independent data points are equal or decreasing

Reimplemented in Cube, and Nurb.

bool update ( const xType *  arX,
const yType *  arY 
)

Overloaded function updates values of the interpolation object's independent and dependent data arrays.

Parameters:
arX a pointer to an independent value interpolation array (x units)
arY a pointer to a dependent value interpolation array (y units)
Returns:
status flag
  • false (point is outside the interpolation interval)
  • true (point is within the interpolation interval)
Remarks:
  • The data count value of the object's arrays can not be changed, and is returned by function call Intp::getCount().
  • Either/Both array pointers can be set to null to indicate that the object's existing data has not changed.
  • The class specific function Intp::update(void) is called after the array data has been updated.


Member Data Documentation

xType* aX [protected]

pointer to an independent interpolation array (x units)

yType* aY [protected]

pointer to a dependent interpolation array (y units)

bool bInc [protected]

independent data increasing parameter

enum Intp< xType, yType >::CTYPE cTyp [protected]

class type index

const int DEF_POINTS = 4 [static]

default interpolation polynomial data point count

Reimplemented in Cube, Nurb, and Poly.

int mData [protected]

data table count minus one

int nData [protected]

data table count

int nPts [protected]

data point count used in the interpolation polynomials


The documentation for this class was generated from the following files:
Generated on Wed Jul 19 09:24:12 2006 for CalcLib by  doxygen 1.4.7