Simbody  3.4 (development)
SimTK::BicubicFunction Class Reference

This is a two-argument Function built using a shared BicubicSurface and managing current state to optimize for localized access. More...

#include <BicubicSurface.h>

+ Inheritance diagram for SimTK::BicubicFunction:

List of all members.

Public Member Functions

 BicubicFunction (const BicubicSurface &surface)
 Create a BicubicFunction referencing the given BicubicSurface, which is shared not copied.
const BicubicSurfacegetBicubicSurface () const
 Return a reference to the BicubicSurface object being used by this BicubicFunction.
virtual Real calcValue (const Vector &XY) const
 Calculate the value of the function at a particular XY coordinate.
virtual Real calcDerivative (const Array_< int > &derivComponents, const Vector &XY) const
 Calculate a partial derivative of this function at a particular point.
virtual int getArgumentSize () const
 This implements the Function base class pure virtual; here it always returns 2 (X and Y).
virtual int getMaxDerivativeOrder () const
 This implements the Function base class pure virtual specifying how many derivatives can be taken of this function; here it is unlimited.

Detailed Description

This is a two-argument Function built using a shared BicubicSurface and managing current state to optimize for localized access.

Each distinct use of the BicubicSurface should create its own BicubicFunction, which is a lightweight wrapper around the BicubicSurface. This allows for localized access pattern optimization to be effective for each use of the surface.

Thread safety

BicubicFunction is not thread-safe, but the underlying BicubicSurface is. Each thread should thus have a private BicubicFunction that it uses to access the shared surface.

Author:
Matthew Millard, Michael Sherman

Constructor & Destructor Documentation

Create a BicubicFunction referencing the given BicubicSurface, which is shared not copied.


Member Function Documentation

Return a reference to the BicubicSurface object being used by this BicubicFunction.

virtual Real SimTK::BicubicFunction::calcValue ( const Vector XY) const [inline, virtual]

Calculate the value of the function at a particular XY coordinate.

Note that XY must be a vector with only 2 elements in it (because this is a 2-argument function), anything else will throw an exception. This is the required implementation of the Function base class pure virtual.

Parameters:
[in]XYthe 2-Vector of input arguments X and Y.
Returns:
The interpolated value of the function at point (X,Y).

Implements SimTK::Function_< Real >.

virtual Real SimTK::BicubicFunction::calcDerivative ( const Array_< int > &  derivComponents,
const Vector XY 
) const [inline, virtual]

Calculate a partial derivative of this function at a particular point.

Which derivative to take is specified by listing the input components (0==x, 1==y) with which to take it. For example, if derivComponents=={0}, that indicates a first derivative with respective to argument x. If derivComponents=={0, 0, 0}, that indicates a third derivative with respective to argument x. If derivComponents=={0, 1}, that indicates a partial second derivative with respect to x and y, that is Df(x,y)/DxDy. (We use capital D to indicate partial derivative.)

Parameters:
[in]derivComponentsThe input components with respect to which the derivative should be taken. Each entry must be 0 or 1, and if there are 4 or more entries the result will be zero since the surface has only 3 non-zero derivatives.
[in]XYThe vector of two input arguments that define the XY location on the surface.
Returns:
The interpolated value of the selected function partial derivative for arguments (X,Y).

Implements SimTK::Function_< Real >.

virtual int SimTK::BicubicFunction::getArgumentSize ( ) const [inline, virtual]

This implements the Function base class pure virtual; here it always returns 2 (X and Y).

Implements SimTK::Function_< Real >.

virtual int SimTK::BicubicFunction::getMaxDerivativeOrder ( ) const [inline, virtual]

This implements the Function base class pure virtual specifying how many derivatives can be taken of this function; here it is unlimited.

However, note that a bicubic surface is continuous up to the second derivative, discontinuous at the third, and zero for any derivatives equal to or higher than the fourth.

Implements SimTK::Function_< Real >.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines