#include <PiecewiseConstantFunction.h>
Public Member Functions | |
PiecewiseConstantFunction () | |
Default constructor. | |
PiecewiseConstantFunction (int aN, const double *aTimes, const double *aValues, const std::string &aName="") | |
PiecewiseConstantFunction (const PiecewiseConstantFunction &aFunction) | |
Copy constructor. | |
virtual | ~PiecewiseConstantFunction () |
Destructor. | |
virtual Object * | copy () const |
Copy this object. | |
virtual void | init (Function *aFunction) |
Initialize the function with X and Y values. | |
PiecewiseConstantFunction & | operator= (const PiecewiseConstantFunction &aFunction) |
Assignment operator. | |
int | getSize () const |
Get size or number of independent data points (or number of coefficients) used to construct the function. | |
const Array< double > & | getX () const |
Get the array of independent variables used to construct the function. | |
const Array< double > & | getY () const |
Get the array of Y values for the function. | |
virtual const double * | getXValues () const |
Get the array of independent variables used to construct the function. | |
virtual const double * | getYValues () const |
Get the array of dependent variables used to construct the function. | |
virtual int | getNumberOfPoints () const |
virtual double | getX (int aIndex) const |
virtual double | getY (int aIndex) const |
virtual double | getZ (int aIndex) const |
virtual void | setX (int aIndex, double aValue) |
virtual void | setY (int aIndex, double aValue) |
virtual bool | deletePoint (int aIndex) |
virtual bool | deletePoints (const Array< int > &indices) |
virtual int | addPoint (double aX, double aY) |
virtual double | evaluateTotalFirstDerivative (double aX, double aDxdt) const |
Evaluates total first derivative. | |
virtual double | evaluateTotalSecondDerivative (double aX, double aDxdt, double aD2xdt2) const |
Evaluates total second derivative. | |
double | calcValue (const SimTK::Vector &x) const |
Calculate the value of this function at a particular point. | |
double | calcDerivative (const std::vector< int > &derivComponents, const SimTK::Vector &x) const |
Calculate a partial derivative of this function at a particular point. | |
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. | |
SimTK::Function * | createSimTKFunction () const |
virtual void | updateFromXMLNode () |
Update this object based on its XML node. | |
Protected Attributes | |
PropertyDblArray | _propX |
Array of values for the independent variables (i.e., the knot sequence). | |
Array< double > & | _x |
PropertyDblArray | _propY |
Y values. | |
Array< double > & | _y |
PiecewiseConstantFunction::PiecewiseConstantFunction | ( | ) |
Default constructor.
OpenSim::PiecewiseConstantFunction::PiecewiseConstantFunction | ( | int | aN, | |
const double * | aTimes, | |||
const double * | aValues, | |||
const std::string & | aName = "" | |||
) |
PiecewiseConstantFunction::PiecewiseConstantFunction | ( | const PiecewiseConstantFunction & | aFunction | ) |
Copy constructor.
All data members of the specified function are copied.
aFunction | PiecewiseConstantFunction object to be copied. |
PiecewiseConstantFunction::~PiecewiseConstantFunction | ( | ) | [virtual] |
Destructor.
int PiecewiseConstantFunction::addPoint | ( | double | aX, | |
double | aY | |||
) | [virtual] |
double OpenSim::PiecewiseConstantFunction::calcDerivative | ( | const std::vector< int > & | derivComponents, | |
const SimTK::Vector & | x | |||
) | const [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.
derivComponents | the 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(). | |
x | the Vector of input arguments. Its size must equal the value returned by getArgumentSize(). |
Reimplemented from OpenSim::Function.
double OpenSim::PiecewiseConstantFunction::calcValue | ( | const SimTK::Vector & | x | ) | const [virtual] |
Calculate the value of this function at a particular point.
x | the Vector of input arguments. Its size must equal the value returned by getArgumentSize(). |
Reimplemented from OpenSim::Function.
Object * PiecewiseConstantFunction::copy | ( | ) | const [virtual] |
SimTK::Function * PiecewiseConstantFunction::createSimTKFunction | ( | ) | const [virtual] |
Implements OpenSim::Function.
bool PiecewiseConstantFunction::deletePoint | ( | int | aIndex | ) | [virtual] |
bool PiecewiseConstantFunction::deletePoints | ( | const Array< int > & | indices | ) | [virtual] |
double PiecewiseConstantFunction::evaluateTotalFirstDerivative | ( | double | aX, | |
double | aDxdt | |||
) | const [virtual] |
Evaluates total first derivative.
double PiecewiseConstantFunction::evaluateTotalSecondDerivative | ( | double | aX, | |
double | aDxdt, | |||
double | aD2xdt2 | |||
) | const [virtual] |
Evaluates total second derivative.
int PiecewiseConstantFunction::getArgumentSize | ( | ) | const [virtual] |
Get the number of components expected in the input vector.
Reimplemented from OpenSim::Function.
int PiecewiseConstantFunction::getMaxDerivativeOrder | ( | ) | const [virtual] |
Get the maximum derivative order this Function object can calculate.
Reimplemented from OpenSim::Function.
virtual int OpenSim::PiecewiseConstantFunction::getNumberOfPoints | ( | ) | const [inline, virtual] |
int PiecewiseConstantFunction::getSize | ( | ) | const |
Get size or number of independent data points (or number of coefficients) used to construct the function.
double PiecewiseConstantFunction::getX | ( | int | aIndex | ) | const [virtual] |
const Array< double > & PiecewiseConstantFunction::getX | ( | ) | const |
Get the array of independent variables used to construct the function.
For the number of independent variable data points use getN().
const double * PiecewiseConstantFunction::getXValues | ( | ) | const [virtual] |
Get the array of independent variables used to construct the function.
For the number of independent variable data points use getN().
double PiecewiseConstantFunction::getY | ( | int | aIndex | ) | const [virtual] |
const Array< double > & PiecewiseConstantFunction::getY | ( | ) | const |
Get the array of Y values for the function.
For the number of Y values use getNX().
const double * PiecewiseConstantFunction::getYValues | ( | ) | const [virtual] |
Get the array of dependent variables used to construct the function.
virtual double OpenSim::PiecewiseConstantFunction::getZ | ( | int | aIndex | ) | const [inline, virtual] |
void PiecewiseConstantFunction::init | ( | Function * | aFunction | ) | [virtual] |
Initialize the function with X and Y values.
aN | the number of X and Y values | |
aXValues | the X values | |
aYValues | the Y values |
PiecewiseConstantFunction & PiecewiseConstantFunction::operator= | ( | const PiecewiseConstantFunction & | aFunction | ) |
Assignment operator.
Note that data members of the base class are also assigned.
Reimplemented from OpenSim::Function.
void PiecewiseConstantFunction::setX | ( | int | aIndex, | |
double | aValue | |||
) | [virtual] |
void PiecewiseConstantFunction::setY | ( | int | aIndex, | |
double | aValue | |||
) | [virtual] |
void PiecewiseConstantFunction::updateFromXMLNode | ( | ) | [virtual] |
Update this object based on its XML node.
Reimplemented from OpenSim::Object.
Array of values for the independent variables (i.e., the knot sequence).
This array must be monotonically increasing.
Y values.
Array<double>& OpenSim::PiecewiseConstantFunction::_x [protected] |
Array<double>& OpenSim::PiecewiseConstantFunction::_y [protected] |