Simbody  3.6
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...

+ Inheritance diagram for SimTK::BicubicFunction:

Public Member Functions

 BicubicFunction (const BicubicSurface &surface)
 Create a BicubicFunction referencing the given BicubicSurface, which is shared not copied. More...
 
const BicubicSurfacegetBicubicSurface () const
 Return a reference to the BicubicSurface object being used by this BicubicFunction. More...
 
Real calcValue (const Vector &XY) const override
 Calculate the value of the function at a particular XY coordinate. More...
 
Real calcDerivative (const Array_< int > &derivComponents, const Vector &XY) const override
 Calculate a partial derivative of this function at a particular point. More...
 
int getArgumentSize () const override
 This implements the Function base class pure virtual; here it always returns 2 (X and Y). More...
 
int getMaxDerivativeOrder () const override
 This implements the Function base class pure virtual specifying how many derivatives can be taken of this function; here it is unlimited. More...
 
BicubicFunctionclone () const override
 Create a new heap-allocated copy of this concrete Function. More...
 
Real calcDerivative (const std::vector< int > &derivComponents, const Vector &x) const
 This provides compatibility with std::vector without requiring any copying. More...
 
- Public Member Functions inherited from SimTK::Function_< Real >
virtual ~Function_ ()
 
Real calcDerivative (const std::vector< int > &derivComponents, const Vector &x) const
 This provides compatibility with std::vector without requiring any copying. More...
 

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

◆ BicubicFunction()

SimTK::BicubicFunction::BicubicFunction ( const BicubicSurface surface)
inline

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

Member Function Documentation

◆ getBicubicSurface()

const BicubicSurface& SimTK::BicubicFunction::getBicubicSurface ( ) const
inline

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

◆ calcValue()

Real SimTK::BicubicFunction::calcValue ( const Vector XY) const
inlineoverridevirtual

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 >.

◆ calcDerivative() [1/2]

Real SimTK::BicubicFunction::calcDerivative ( const Array_< int > &  derivComponents,
const Vector XY 
) const
inlineoverridevirtual

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 >.

◆ getArgumentSize()

int SimTK::BicubicFunction::getArgumentSize ( ) const
inlineoverridevirtual

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

Implements SimTK::Function_< Real >.

◆ getMaxDerivativeOrder()

int SimTK::BicubicFunction::getMaxDerivativeOrder ( ) const
inlineoverridevirtual

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 >.

◆ clone()

BicubicFunction* SimTK::BicubicFunction::clone ( ) const
inlineoverridevirtual

Create a new heap-allocated copy of this concrete Function.

For backwards compatibility this is not pure virtual; it has a default implementation that throws an exception if called. However, it should always be implemented.

Reimplemented from SimTK::Function_< Real >.

◆ calcDerivative() [2/2]

Real SimTK::BicubicFunction::calcDerivative ( const std::vector< int > &  derivComponents,
const Vector x 
) const
inline

This provides compatibility with std::vector without requiring any copying.


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