Simbody
|
This Measure operator returns the time derivative of its operand measure, or a numerical approximation of the time derivative if an analytic one is not available. More...
#include <Measure.h>
Classes | |
class | Implementation |
Public Member Functions | |
SimTK_MEASURE_HANDLE_PREAMBLE (Differentiate, Measure_< T >) | |
Differentiate (Subsystem &subsystem, const Measure_< T > &operand) | |
Create a measure whose value is the time derivative of the given operand measure. | |
bool | isUsingApproximation () const |
Test whether the derivative returned as the value of this measure is being estimated numerically, either because the operand measure is unable to supply its derivative or because setForceUseApproximation(true) has been called. | |
const Measure_< T > & | getOperandMeasure () const |
Get a reference to the measure that is being differentiated by this measure. | |
Differentiate & | setOperandMeasure (const Measure_< T > &operand) |
Set the measure that is to be differentiated by this measure. | |
void | setForceUseApproximation (bool mustApproximate) |
Force use of numerical approximation for the derivative, even if the operand measure can supply its own derivative. | |
bool | getForceUseApproximation () const |
Check the current value of the flag which forces this measure to use numerical approximation regardless of whether the operand can supply its own derivative. | |
SimTK_MEASURE_HANDLE_POSTSCRIPT (Differentiate, Measure_< T >) |
This Measure operator returns the time derivative of its operand measure, or a numerical approximation of the time derivative if an analytic one is not available.
If the operand measure provides its own derivative measure, then the value of the Differentiate operator is just the value of the operand's derivative measure, and this measure will have one fewer available derivatives than does the operand. If the operand does not have a derivative, then we will estimate it by the following method:
Special cases:
At initialization of a timestepping study beginning at t=t0, we sample the operand and record its initial value f0 at t0, and set fdot0=NaN. This ensures that we'll return zero as the initial derivative (for lack of anything better) and then use the first order method for the first step's derivative.
SimTK::Measure_< T >::Differentiate::Differentiate | ( | Subsystem & | subsystem, |
const Measure_< T > & | operand | ||
) | [inline] |
Create a measure whose value is the time derivative of the given operand measure.
subsystem | The Subsystem into which this measure will be placed. |
operand | The Measure to be differentiated. |
SimTK::Measure_< T >::Differentiate::SimTK_MEASURE_HANDLE_PREAMBLE | ( | Differentiate | , |
Measure_< T > | |||
) |
bool SimTK::Measure_< T >::Differentiate::isUsingApproximation | ( | ) | const [inline] |
Test whether the derivative returned as the value of this measure is being estimated numerically, either because the operand measure is unable to supply its derivative or because setForceUseApproximation(true) has been called.
const Measure_<T>& SimTK::Measure_< T >::Differentiate::getOperandMeasure | ( | ) | const [inline] |
Get a reference to the measure that is being differentiated by this measure.
Differentiate& SimTK::Measure_< T >::Differentiate::setOperandMeasure | ( | const Measure_< T > & | operand | ) | [inline] |
Set the measure that is to be differentiated by this measure.
This is a topology-stage change so you'll have to call realizeTopology() again on the enclosing System before using it.
void SimTK::Measure_< T >::Differentiate::setForceUseApproximation | ( | bool | mustApproximate | ) | [inline] |
Force use of numerical approximation for the derivative, even if the operand measure can supply its own derivative.
This is not recommended! This is a Topology-stage change.
bool SimTK::Measure_< T >::Differentiate::getForceUseApproximation | ( | ) | const [inline] |
Check the current value of the flag which forces this measure to use numerical approximation regardless of whether the operand can supply its own derivative.
Note that even if the flag is currently false (the default) we may still have to use approximation; see isUsingApproximation().
SimTK::Measure_< T >::Differentiate::SimTK_MEASURE_HANDLE_POSTSCRIPT | ( | Differentiate | , |
Measure_< T > | |||
) |