Simbody  3.6
SimTK::Measure_< T >::Integrate::Implementation Class Reference

The implementation for Integrate measures allocates a continuous state variable or variables from the State's z pool and generates zdot values to be integrated into those z variables. More...

+ Inheritance diagram for SimTK::Measure_< T >::Integrate::Implementation:

Public Member Functions

 Implementation ()
 The derivative and initialConditions Measures will be empty handles if this is default constructed. More...
 
 Implementation (const Measure_< T > &deriv, const Measure_< T > &ic, const T &defaultValue)
 Here we're shallow-copying the Measure handles so we'll be referring to the original Measures. More...
 
 Implementation (const Implementation &source)
 Copy constructor shallow-copies the referenced measures, but we don't want to share our state variables. More...
 
void setValue (State &s, const T &value) const
 Set the value of the state variables(s) that hold the integral. More...
 
const Measure_< T > & getDerivativeMeasure () const
 
const Measure_< T > & getInitialConditionMeasure () const
 
void setDerivativeMeasure (const Measure_< T > &d)
 
void setInitialConditionMeasure (const Measure_< T > &ic)
 
ImplementationcloneVirtual () const override
 
int getNumTimeDerivativesVirtual () const override
 This measure has one more time derivative than the integrand. More...
 
void calcCachedValueVirtual (const State &s, int derivOrder, T &value) const override
 Concrete measures must override this if the state cache is used for precalculated values or derivatives. More...
 
const T & getUncachedValueVirtual (const State &s, int derivOrder) const override
 This is only called when derivOrder >= the number of cache entries we have, but still <= the number of derivatives the Measure says it can deliver. More...
 
Stage getDependsOnStageVirtual (int derivOrder) const override
 
void initializeVirtual (State &s) const override
 Initialize the state to the current value of the initial condition measure, if there is one, otherwise to the default value. More...
 
void realizeMeasureTopologyVirtual (State &s) const override
 Allocate one Real continuous state variable z per element of this Measure's data type T, using the default value to determine how many are needed (if that's not part of the type T), and initialize them to the corresponding element from the default value. More...
 
void realizeMeasureAccelerationVirtual (const State &s) const override
 Set the zdots to the integrand (derivative measure) value. More...
 
- Public Member Functions inherited from SimTK::Measure_< T >::Implementation
const T & getValue (const State &s, int derivOrder) const
 
void setDefaultValue (const T &defaultValue)
 Set a new default value for this Measure. More...
 
const T & getDefaultValue () const
 Return a reference to the value that this Measure will use to initialize its value-level state resource (state variable or cache entry) during the next call to realizeTopology(). More...
 
void setIsPresumedValidAtDependsOnStage (bool presume)
 
bool getIsPresumedValidAtDependsOnStage () const
 

Additional Inherited Members

- Protected Member Functions inherited from SimTK::Measure_< T >::Implementation
 Implementation (const T &defaultValue, int numCacheEntries=1)
 
 Implementation (int numCacheEntries=1)
 Argument numCacheEntries should be one greater than the number of derivatives; that is, there is room for the value ("0th" derivative) also. More...
 
 Implementation (const Implementation &source)
 Copy constructor copies the number of cache entries from the source, but not the cache indices themselves as those must be allocated uniquely for the copy. More...
 
int size () const
 Return the number of elements in the data type of this Measure; for Vector measures this is determined by the size of the default value. More...
 
int getNumCacheEntries () const
 Return the number of cache entries allocated for the value and derivatives of this Measure. More...
 
const T & getCacheEntry (const State &s, int derivOrder) const
 Get a const reference to the value stored in one of this Measure's cache entries, indexed by the derivative order (with the value treated as the 0th derivative). More...
 
T & updCacheEntry (const State &s, int derivOrder) const
 Get a writable reference to the value stored in one of this Measure's cache entries, indexed by the derivative order (with the value treated as the 0th derivative). More...
 
bool isCacheValueRealized (const State &s, int derivOrder) const
 Determine whether a particular one of this Measure's cache entries has already been realized since the given state was modified. More...
 
void markCacheValueRealized (const State &s, int derivOrder) const
 Mark one of this Measure's cache entries up to date; call this after you have calculated a value or derivative and stored it in the corresponding cache entry. More...
 
void markCacheValueNotRealized (const State &s, int derivOrder) const
 Invalidate one of this Measure's cache entries. More...
 
const T & getValueZero () const
 Return a reference to a zero of the same type and size as this Measure's value. More...
 
- Protected Member Functions inherited from SimTK::AbstractMeasure::Implementation
 Implementation ()
 This default constructor is for use by concrete measure implementation classes. More...
 
 Implementation (const Implementation &src)
 Base class copy constructor removes the Subsystem and sets the reference count to zero. More...
 
Implementationoperator= (const Implementation &src)
 Base class copy assignment operator removes the Subsystem, and sets the reference count to zero. More...
 
int incrRefCount () const
 
int decrRefCount () const
 
int getRefCount () const
 
int getCopyNumber () const
 
Implementationclone () const
 This is a deep copy of the concrete Implementation object, except the Subsystem will have been removed. More...
 
void realizeModel (State &s) const
 
void realizeInstance (const State &s) const
 
void realizeTime (const State &s) const
 
void realizePosition (const State &s) const
 
void realizeVelocity (const State &s) const
 
void realizeDynamics (const State &s) const
 
void realizeAcceleration (const State &s) const
 
void realizeReport (const State &s) const
 
void initialize (State &s) const
 This should be called at the start of a time stepping study to cause this Measure to set its state variables (if any) in the supplied state to their initial conditions. More...
 
int getNumTimeDerivatives () const
 
Stage getDependsOnStage (int derivOrder) const
 
void setSubsystem (Subsystem &sub, MeasureIndex mx)
 
bool isInSubsystem () const
 
const SubsystemgetSubsystem () const
 
SubsystemupdSubsystem ()
 
MeasureIndex getSubsystemMeasureIndex () const
 
SubsystemIndex getSubsystemIndex () const
 
void invalidateTopologyCache () const
 
Stage getStage (const State &s) const
 
virtual ~Implementation ()
 
virtual void realizeMeasureModelVirtual (State &) const
 
virtual void realizeMeasureInstanceVirtual (const State &) const
 
virtual void realizeMeasureTimeVirtual (const State &) const
 
virtual void realizeMeasurePositionVirtual (const State &) const
 
virtual void realizeMeasureVelocityVirtual (const State &) const
 
virtual void realizeMeasureDynamicsVirtual (const State &) const
 
virtual void realizeMeasureReportVirtual (const State &) const
 

Detailed Description

template<class T>
class SimTK::Measure_< T >::Integrate::Implementation

The implementation for Integrate measures allocates a continuous state variable or variables from the State's z pool and generates zdot values to be integrated into those z variables.

The z's are then copied into a type T, Time-stage cache entry so that we can return the value as a type T reference. Derivative requests are passed through to the integrand so only one cache entry is required here.

Constructor & Destructor Documentation

◆ Implementation() [1/3]

template<class T>
SimTK::Measure_< T >::Integrate::Implementation::Implementation ( )
inline

The derivative and initialConditions Measures will be empty handles if this is default constructed.

◆ Implementation() [2/3]

template<class T>
SimTK::Measure_< T >::Integrate::Implementation::Implementation ( const Measure_< T > &  deriv,
const Measure_< T > &  ic,
const T &  defaultValue 
)
inline

Here we're shallow-copying the Measure handles so we'll be referring to the original Measures.

◆ Implementation() [3/3]

template<class T>
SimTK::Measure_< T >::Integrate::Implementation::Implementation ( const Implementation source)
inline

Copy constructor shallow-copies the referenced measures, but we don't want to share our state variables.

Member Function Documentation

◆ setValue()

template<class T>
void SimTK::Measure_< T >::Integrate::Implementation::setValue ( State s,
const T &  value 
) const
inline

Set the value of the state variables(s) that hold the integral.

This cannot be used to change the size if the type T is a Vector; the supplied value must be the same length as the default value of this Measure.

◆ getDerivativeMeasure()

template<class T>
const Measure_<T>& SimTK::Measure_< T >::Integrate::Implementation::getDerivativeMeasure ( ) const
inline

◆ getInitialConditionMeasure()

template<class T>
const Measure_<T>& SimTK::Measure_< T >::Integrate::Implementation::getInitialConditionMeasure ( ) const
inline

◆ setDerivativeMeasure()

template<class T>
void SimTK::Measure_< T >::Integrate::Implementation::setDerivativeMeasure ( const Measure_< T > &  d)
inline

◆ setInitialConditionMeasure()

template<class T>
void SimTK::Measure_< T >::Integrate::Implementation::setInitialConditionMeasure ( const Measure_< T > &  ic)
inline

◆ cloneVirtual()

template<class T>
Implementation* SimTK::Measure_< T >::Integrate::Implementation::cloneVirtual ( ) const
inlineoverridevirtual

◆ getNumTimeDerivativesVirtual()

template<class T>
int SimTK::Measure_< T >::Integrate::Implementation::getNumTimeDerivativesVirtual ( ) const
inlineoverridevirtual

This measure has one more time derivative than the integrand.

Reimplemented from SimTK::AbstractMeasure::Implementation.

◆ calcCachedValueVirtual()

template<class T>
void SimTK::Measure_< T >::Integrate::Implementation::calcCachedValueVirtual ( const State ,
int  derivOrder,
T &  value 
) const
inlineoverridevirtual

Concrete measures must override this if the state cache is used for precalculated values or derivatives.

Reimplemented from SimTK::Measure_< T >::Implementation.

◆ getUncachedValueVirtual()

template<class T>
const T& SimTK::Measure_< T >::Integrate::Implementation::getUncachedValueVirtual ( const State ,
int  derivOrder 
) const
inlineoverridevirtual

This is only called when derivOrder >= the number of cache entries we have, but still <= the number of derivatives the Measure says it can deliver.

You don't need to override this if that condition can't occur. This is commonly used for functions whose derivatives above a certain order are zero.

Reimplemented from SimTK::Measure_< T >::Implementation.

◆ getDependsOnStageVirtual()

template<class T>
Stage SimTK::Measure_< T >::Integrate::Implementation::getDependsOnStageVirtual ( int  derivOrder) const
inlineoverridevirtual

◆ initializeVirtual()

template<class T>
void SimTK::Measure_< T >::Integrate::Implementation::initializeVirtual ( State s) const
inlineoverridevirtual

Initialize the state to the current value of the initial condition measure, if there is one, otherwise to the default value.

Reimplemented from SimTK::AbstractMeasure::Implementation.

◆ realizeMeasureTopologyVirtual()

template<class T>
void SimTK::Measure_< T >::Integrate::Implementation::realizeMeasureTopologyVirtual ( State s) const
inlineoverridevirtual

Allocate one Real continuous state variable z per element of this Measure's data type T, using the default value to determine how many are needed (if that's not part of the type T), and initialize them to the corresponding element from the default value.

Reimplemented from SimTK::Measure_< T >::Implementation.

◆ realizeMeasureAccelerationVirtual()

template<class T>
void SimTK::Measure_< T >::Integrate::Implementation::realizeMeasureAccelerationVirtual ( const State s) const
inlineoverridevirtual

Set the zdots to the integrand (derivative measure) value.

If no integrand was provided it is treated as though it were zero.

Reimplemented from SimTK::AbstractMeasure::Implementation.


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