Simbody
3.4 (development)
|
This is a two-argument Function built using a shared BicubicSurface and managing current state to optimize for localized access. More...
#include <BicubicSurface.h>
Public Member Functions | |
BicubicFunction (const BicubicSurface &surface) | |
Create a BicubicFunction referencing the given BicubicSurface, which is shared not copied. | |
const BicubicSurface & | getBicubicSurface () 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. |
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.
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.
SimTK::BicubicFunction::BicubicFunction | ( | const BicubicSurface & | surface | ) | [inline] |
Create a BicubicFunction referencing the given BicubicSurface, which is shared not copied.
const BicubicSurface& SimTK::BicubicFunction::getBicubicSurface | ( | ) | const [inline] |
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.
[in] | XY | the 2-Vector of input arguments X and 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.)
[in] | derivComponents | The 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] | XY | The vector of two input arguments that define the XY location on the surface. |
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 >.