Simbody
Public Member Functions

SimTK::Function_< T >::Constant Class Reference

This is a Function_ subclass which simply returns a fixed value, independent of its arguments. More...

#include <Function.h>

Inheritance diagram for SimTK::Function_< T >::Constant:

List of all members.

Public Member Functions

 Constant (T value, int argumentSize=1)
 Create a Function_::Constant object.
calcValue (const Vector &x) const
 Calculate the value of this function at a particular point.
calcDerivative (const Array_< int > &derivComponents, const Vector &x) const
 Calculate a partial derivative of this function at a particular point.
virtual int getArgumentSize () const
 Get the number of components expected in the input vector.
int getMaxDerivativeOrder () const
 Get the maximum derivative order this Function_ object can calculate.
calcDerivative (const std::vector< int > &derivComponents, const Vector &x) const
 This provides compatibility with std::vector without requiring any copying.

Detailed Description

template<class T>
class SimTK::Function_< T >::Constant

This is a Function_ subclass which simply returns a fixed value, independent of its arguments.


Constructor & Destructor Documentation

template<class T >
SimTK::Function_< T >::Constant::Constant ( value,
int  argumentSize = 1 
) [inline, explicit]

Create a Function_::Constant object.

Parameters:
valuethe value which should be returned by calcValue();
argumentSizethe value which should be returned by getArgumentSize(), with a default of 1.

Member Function Documentation

template<class T >
T SimTK::Function_< T >::Constant::calcValue ( const Vector x) const [inline, virtual]

Calculate the value of this function at a particular point.

Parameters:
xthe Vector of input arguments. Its size must equal the value returned by getArgumentSize().

Implements SimTK::Function_< T >.

template<class T >
T SimTK::Function_< T >::Constant::calcDerivative ( const Array_< int > &  derivComponents,
const Vector x 
) 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 with which to take it. For example, if derivComponents=={0}, that indicates a first derivative with respective to component 0. If derivComponents=={0, 0, 0}, that indicates a third derivative with respective to component 0. If derivComponents=={4, 7}, that indicates a partial second derivative with respect to components 4 and 7.

Parameters:
derivComponentsThe input components with respect to which the derivative should be taken. Its size must be less than or equal to the value returned by getMaxDerivativeOrder().
xThe Vector of input arguments. Its size must equal the value returned by getArgumentSize().
Returns:
The value of the selected derivative, which is of type T.

Implements SimTK::Function_< T >.

template<class T >
virtual int SimTK::Function_< T >::Constant::getArgumentSize ( ) const [inline, virtual]

Get the number of components expected in the input vector.

Implements SimTK::Function_< T >.

template<class T >
int SimTK::Function_< T >::Constant::getMaxDerivativeOrder ( ) const [inline, virtual]

Get the maximum derivative order this Function_ object can calculate.

Implements SimTK::Function_< T >.

template<class T >
T SimTK::Function_< T >::Constant::calcDerivative ( const std::vector< int > &  derivComponents,
const Vector x 
) const [inline]

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

Reimplemented from SimTK::Function_< T >.


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