NIntp Class Template Reference

Abstract class template supports interpolation of multi-dimensional tabulated data. More...

#include <NIntp.h>

Inherits Base.

Inherited by NCube, NNurb, and NPoly.

Inheritance diagram for NIntp:

Inheritance graph
[legend]
List of all members.

Public Types

 DEPENDENT
 DERIVATIVE
 DIMENSION
 HI_INDEX
 INDEPENDENT = 0
 KNOT
 ORDER
 POLYGON
enum  VTYPE { INDEPENDENT = 0, KNOT, DEPENDENT, DERIVATIVE, POLYGON, ORDER, DIMENSION, HI_INDEX, VTYPE_CNT }
 VTYPE_CNT

Public Member Functions

virtual int * copyArrayN (enum NIntp< xType, yType >::VTYPE vType, int *array) const
virtual xType ** copyArrayX (enum NIntp< xType, yType >::VTYPE vType, xType **array) const
virtual yType * copyArrayY (enum NIntp< xType, yType >::VTYPE vType, yType *array) const
yType eval (const xType *vXn) throw (IntpErr)
virtual const int * getArrayN (enum NIntp< xType, yType >::VTYPE vType) const
virtual const xType *const * getArrayX (enum NIntp< xType, yType >::VTYPE vType) const
virtual int getCount (enum NIntp< xType, yType >::VTYPE vType) const
enum Intp< xType, yType
>::CTYPE 
getMethod (void) const
bool isBounded (const xType *vXn) const
bool isIncreasing (int iDimen) const
 operator const Intp (void) const
bool update (const xType *const *arXn, const yType *arYn)
bool update (void)

Protected Member Functions

virtual yType evaln (Intp< xType, yType > **aIi, const xType *vXn, int iDim)=0 throw (IntpErr)
 NIntp (const NIntp< xType, yType > &ni)
 NIntp (const xType *const *arXn, const yType *arYn, const int *arNn, const int *arOn, int nDimen)
void reducen (yType *aYm, Intp< xType, yType > **aIi, xType x0, int iDim) throw (IntpErr)
virtual bool specUpdate (void)
 ~NIntp (void)

Protected Attributes

int * aDa
Intp< xType, yType > ** aIn
int * aMn
int * aNn
int * aOn
xType ** aXn
bool * bInc
enum Intp< xType, yType
>::CTYPE 
cTyp
int mData
int nData
int nDim

Detailed Description

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

Abstract class template supports interpolation of multi-dimensional 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/18 01:45:34
Revision
1.2
Examples:

example_NIntp.txt.


Member Enumeration Documentation

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 (polynomial order + 1) by dimension variable
DIMENSION  index of a dimension count variable
HI_INDEX  index of a greatest array index (data count minus 1) by dimension variable
VTYPE_CNT  variable type index count


Constructor & Destructor Documentation

NIntp ( const xType *const *  arXn,
const yType *  arYn,
const int *  arNn,
const int *  arOn,
int  nDimen 
) [protected]

Constructor initializes an n-Dimension interpolation object.

Parameters:
arXn a pointer to an n-Dimension independent value interpolation array (x units)
arYn a pointer to an n-Dimension dependent value interpolation array (y units)
arNn a pointer to an array containing data counts by dimension for the specified arrays arXn and arYn
arOn a pointer to an array containing polynomial control point counts by dimension for interpolation evaluation
nDimen number of dimensions
Remarks:
If the interpolation polynomials assume a default polynomial control point count, the pointer arOn may be set to a null value.

NIntp ( const NIntp< xType, yType > &  ni  )  [protected]

Copy constructor initializes an n-Dimension interpolation object from the specified existing interpolation object.

Parameters:
ni a reference to an n-Dimension interpolation object

~NIntp ( void   )  [protected]

Destructor frees allocated memory.


Member Function Documentation

int * copyArrayN ( enum NIntp< xType, yType >::VTYPE  vType,
int *  array 
) const [virtual]

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

Parameters:
vType variable index indentifying the type of data
array a pointer to a copy of the object's 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 NIntp::getCount().
  • The pointer to the object's array identified by vType is returned by a corresponding function call NIntp::getArrayN().
  • 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.

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

Virtual function copies the object's array that contains independent data points for each dimension 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 (x units)
Returns:
the value of the pointer array
Remarks:
  • The number of pointers in the array equals the number of dimensions in the interpolation table.
  • The number of values for each array pointer is stored in the data counts by dimension array (see NIntp::getArrayN()).
  • 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 NIntp< xType, yType >::VTYPE  vType,
yType *  array 
) const [virtual]

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

Parameters:
vType variable index indentifying the type of data
array a pointer to a copy of the object's 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 NIntp::getCount().
  • 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 eval ( const xType *  vXn  )  throw (IntpErr)

Function interpolates the object's n-Dimension cubic spline data at the specified evaluation point vXn.

Parameters:
vXn a pointer to an n-Dimension independent value evaluation vector array (x units)
Returns:
calculated interpolation value defined by vector vXn (y units)
Exceptions:
IntpErr type of object thrown

virtual yType evaln ( Intp< xType, yType > **  aIi,
const xType *  vXn,
int  iDim 
) throw (IntpErr) [protected, pure virtual]

Virtual function requires a function in derived classes to recursively uses interpolation to evaluate the specified i-Dimension Intp array aIi at independent value vXn[i].

Parameters:
aIi a pointer to a first dimension spline interpolation object array for the recursive i-Dimension iDim
vXn a pointer to an n-Dimension independent value evaluation vector array (x units)
iDim recursive number of dimensions
Returns:
the calculated interpolation value defined by vector vXn (y units)
Exceptions:
IntpErr type of object thrown

const int * getArrayN ( enum NIntp< xType, yType >::VTYPE  vType  )  const [virtual]

Virtual function returns the pointer of the identified object discrete value array.

Parameters:
vType variable index indentifying the 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 NIntp::getCount().
  • The data contained in the object's array identified by vType can be copied to user-identified memory by a corresponding function call NIntp::copyArrayN().
  • 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 xType *const * getArrayX ( enum NIntp< xType, yType >::VTYPE  vType  )  const [virtual]

Virtual function returns the pointer of the identified object array.

Parameters:
vType variable index indentifying the array type
Returns:
a pointer to the object's identified array (varying units)
Remarks:
  • The number of pointers in the array equals the number of dimensions in the interpolation table.
  • The number of values for each array pointer is stored in the data counts by dimension array.
  • The data contained in the object's array identified by vType can be copied to user-identified memory by a corresponding function call NIntp::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.

int getCount ( enum NIntp< 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 NIntp::getArrayX() or NIntp::getArrayN().
  • 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 multi-dimensional 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 ( const xType *  vXn  )  const

Function determines if the specified evaluation vector vXn is within the interpolation table's interpolation limits.

Parameters:
vXn a pointer to an n-Dimension independent value evaluation vector array (x units)
Returns:
status flag
  • false (point is outside the interpolation interval)
  • true (point is within the interpolation interval)

bool isIncreasing ( int  iDimen  )  const

Function returns the ascending status of the independent data for a given dimension index iDimen.

Parameters:
iDimen dimension index
Returns:
the increasing status of the dimensional independent data
  • false (data is not monotonically increasing in value)
  • true (data is monotonically increasing in value)
Remarks:
If the dimension index iDimen is outside the dimensional range of the independent data, false is returned.

operator const Intp ( void   )  const

Conversion function returns a pointer to the calc::Intp pointer array of objects of the multi-dimensional interpolation object.

Returns:
a pointer to the interpolation data data
Remarks:
  • The number of values in the array equals the total data count divided by the data count of the base dimension. (see NIntp::getCount()).
  • If an object initialization error has occurred, a null pointer is returned.
Note:
For conversion reference of a n-dimensional interpolation object ni, the object is cast as: const Intp<xType,yType> *const *ni;

void reducen ( yType *  aYm,
Intp< xType, yType > **  aIi,
xType  x0,
int  iDim 
) throw (IntpErr) [protected]

Function recursively reduces the interpolation table by one dimension. The first dimension is evaluated at the specified value x0.

Parameters:
aIi a pointer to a first dimension interpolation object array for the recursive i-Dimension iDim
x0 interpolation value for first dimension reduction (x units)
iDim recursive number of dimensions
aYm a pointer to the calculated reduced dimension interpolation array evaluated at x0 (y units)
Exceptions:
IntpErr type of object thrown

virtual bool specUpdate ( void   )  [protected, virtual]

Virtual function implements class specific tasks to prepare the interpolation object for interpolation evaluations.

Returns:
status flag
  • false (successful execution)
  • true (execution error)

bool update ( const xType *const *  arXn,
const yType *  arYn 
)

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

Parameters:
arXn a pointer to an n-Dimension independent value interpolation array (x units)
arYn a pointer to an n-Dimension dependent value interpolation array (y units)
Returns:
status flag
  • false (successful execution)
  • true (execution error)
    • object initialization error
    • memory allocation error
    • some independent data points are equal or decreasing
Remarks:
  • The data count values of the object's arrays can not be changed, and are returned by function calls NIntp::getCount() and NIntp::getArrayN().
  • Either/Both array pointers can be set to null to indicate that the object's existing data has not changed.
  • The class specific function NIntp::update(void) is called after the array data has been updated.

bool update ( void   ) 

Overloaded 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


Member Data Documentation

int* aDa [protected]

pointer to an n-Dimension array locator array

Intp<xType,yType>** aIn [protected]

pointer to a first dimension polynomial interpolation object array

int* aMn [protected]

pointer to an n-Dimension data count minus one (highest array index per dimension) array

int* aNn [protected]

pointer to an n-Dimension data count by dimension array

int* aOn [protected]

pointer to an n-Dimension polynomial control point count (order + one) array

xType** aXn [protected]

pointer to an n-Dimension independent interpolation array (x units)

bool* bInc [protected]

pointer to an n-Dimension independent data increasing flags array

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

class type index

int mData [protected]

first dimension interpolation object count

int nData [protected]

total data point count

int nDim [protected]

dimension count


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