Simbody  3.7
SimTK::Measure_< T >::Extreme Class Reference

This Measure tracks extreme values attained by the elements of its source operand since the last initialize() call or explicit call to setValue(). More...

+ Inheritance diagram for SimTK::Measure_< T >::Extreme:

Classes

class  Implementation
 

Public Member Functions

 SimTK_MEASURE_HANDLE_PREAMBLE (Extreme, Measure_< T >)
 
 Extreme (Subsystem &sub, const Measure_< T > &operand, Operation op=MaxAbs)
 Default behavior for the Extreme measure is to find the operand's value that is of maximum absolute value. More...
 
ExtremesetOperation (Operation op)
 Set the operation to be performed. More...
 
Operation getOperation () const
 Return the operation currently being performed by this measure. More...
 
Real getTimeOfExtremeValue (const State &state) const
 Return the time at which the reported extreme value first occurred. More...
 
void setValue (State &s, const T &value) const
 
const Measure_< T > & getOperandMeasure () const
 
ExtremesetOperandMeasure (const Measure_< T > &s)
 
 SimTK_MEASURE_HANDLE_POSTSCRIPT (Extreme, Measure_< T >)
 
- Public Member Functions inherited from SimTK::Measure_< T >
 SimTK_MEASURE_HANDLE_PREAMBLE_ABSTRACT (Measure_, AbstractMeasure)
 This class is still abstract so we don't want it to allocate an Implementation object in its default constructor. More...
 
const T & getValue (const State &s, int derivOrder=0) const
 Retrieve the Value of this Measure or one of its time derivatives, assuming the supplied State has been realized to at least the required stage for the selected value or derivative, as reported by getDependsOnStage(). More...
 
Measure_setDefaultValue (const T &defaultValue)
 Change the default value associated with this Measure. More...
 
const T & getDefaultValue () const
 Obtain a reference to the default value associated with this Measure. More...
 
 SimTK_MEASURE_HANDLE_POSTSCRIPT (Measure_, AbstractMeasure)
 
- Public Member Functions inherited from SimTK::AbstractMeasure
 AbstractMeasure (Implementation *g=0)
 Provide an Implementation for this AbstractMeasure and bump its reference count. More...
 
 AbstractMeasure (Subsystem &, Implementation *g, const SetHandle &)
 Construct this handle with a given Implementation object (whose reference count will be bumped) and then let the given Subsystem adopt this Measure (which will again bump the Implementation's reference count, leaving us with two new handles). More...
 
 AbstractMeasure (const AbstractMeasure &)
 Shallow copy constructor copies the pointer from the source Implementation object and bumps its reference count. More...
 
AbstractMeasureoperator= (const AbstractMeasure &source)
 Shallow assignment operator results in this handle referencing the same Implementation object as does the source. More...
 
 ~AbstractMeasure ()
 Destructor decrements the Implementation's reference count and deletes the object if the count goes to zero. More...
 
AbstractMeasureshallowAssign (const AbstractMeasure &)
 Shallow assignment operator destructs the current Implementation object (meaning its reference count is decremented and the object actually deleted only if the count goes to zero), then copies the Implementation pointer from the source and bumps its reference count. More...
 
AbstractMeasuredeepAssign (const AbstractMeasure &source)
 Deep assignment clones the Implementation object pointed to by the source handle, so that this handle ends up pointing to a new Measure object similar to the original but not yet contained in any Subsystem. More...
 
int getNumTimeDerivatives () const
 Every Measure can produce a value, and some can provide one or more total derivatives with respect to time of that value. More...
 
Stage getDependsOnStage (int derivOrder=0) const
 At what Stage can we expect the value of this AbstractMeasure or one of its time derivatives to be available? Users of Measures will typically impose restrictions on the levels they will accept. More...
 
bool isSameMeasure (const AbstractMeasure &other) const
 There can be multiple handles on the same Measure. More...
 
bool isEmptyHandle () const
 
bool isInSubsystem () const
 Test whether this Measure object has been adopted by a Subsystem. More...
 
const SubsystemgetSubsystem () const
 Return a reference to the Subsystem that owns this Measure. More...
 
bool isSameSubsystem (const Subsystem &) const
 Is getSubsystem() the same as the passed-in Subsystem? More...
 
MeasureIndex getSubsystemMeasureIndex () const
 Return the MeasureIndex by which this Measure is known to the Subsystem that owns it. More...
 
const ImplementationgetImpl () const
 
ImplementationupdImpl ()
 
bool hasImpl () const
 
int getRefCount () const
 

Detailed Description

template<class T>
class SimTK::Measure_< T >::Extreme

This Measure tracks extreme values attained by the elements of its source operand since the last initialize() call or explicit call to setValue().

The extreme is either minimum or maximum and may be determined by the actual or absolute value of the operand. In any case the value of the Extreme measure is the actual extreme value of the operand, not its absolute value.

The template type T must be the same as the template type of the operand measure. If T is a Vec or Vector type, each element is treated separately.

Normally Extreme is not used directly; it is the common implementation underlying the Minimum, Maximum, MinAbs, and MaxAbs measures.

Information available from this Measure:

  • the current extreme value (at the source's stage)
  • the value at the start of the current step (Time stage)
  • time of last change
  • the DiscreteVariableIndex holding the previous value
  • the CacheEntryIndex designated for the current/next value
  • a reference to the source Measure

The time derivative fdot of f(t)=min_t0_t(s(t')) where s is the source measure and t0 <= t' <= t is

     fdot(t) = s(t) < f(ti) && sdot(t) < 0 ? sdot(t) : 0

where ti is the time at the start of the current step.

At the start of a continuous interval, the updated value (if any) replaces the stored value.

Extreme isolation (not implemented yet)

If the time derivative of the source operand is available, the measure will arrange to ensure precise isolation of the minimum values by defining a triggered event that watches for negative-to-positive sign changes of the derivative. Then if you output reporting data upon the occurrence of triggered events (as well as your regularly scheduled output) your data will include the precise minimum (to within a specifiable isolation time window).

Additional information available in this case:

  • the EventId of the extreme-trapping event if there is one
  • the time derivative of the Extreme measure

Constructor & Destructor Documentation

◆ Extreme()

template<class T>
SimTK::Measure_< T >::Extreme::Extreme ( Subsystem sub,
const Measure_< T > &  operand,
Operation  op = MaxAbs 
)
inline

Default behavior for the Extreme measure is to find the operand's value that is of maximum absolute value.

You can change that to minimum and/or actual value.

Member Function Documentation

◆ SimTK_MEASURE_HANDLE_PREAMBLE()

template<class T>
SimTK::Measure_< T >::Extreme::SimTK_MEASURE_HANDLE_PREAMBLE ( Extreme  ,
Measure_< T >   
)

◆ setOperation()

template<class T>
Extreme& SimTK::Measure_< T >::Extreme::setOperation ( Operation  op)
inline

Set the operation to be performed.

The default operation is MaxAbs.

◆ getOperation()

template<class T>
Operation SimTK::Measure_< T >::Extreme::getOperation ( ) const
inline

Return the operation currently being performed by this measure.

◆ getTimeOfExtremeValue()

template<class T>
Real SimTK::Measure_< T >::Extreme::getTimeOfExtremeValue ( const State state) const
inline

Return the time at which the reported extreme value first occurred.

This is the current time if the operand is at its extreme value now, otherwise it is the time that the extreme value first occurred during a time stepping study. The state must be realized to the level required to evaluate the operand measure.

◆ setValue()

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

◆ getOperandMeasure()

template<class T>
const Measure_<T>& SimTK::Measure_< T >::Extreme::getOperandMeasure ( ) const
inline

◆ setOperandMeasure()

template<class T>
Extreme& SimTK::Measure_< T >::Extreme::setOperandMeasure ( const Measure_< T > &  s)
inline

◆ SimTK_MEASURE_HANDLE_POSTSCRIPT()

template<class T>
SimTK::Measure_< T >::Extreme::SimTK_MEASURE_HANDLE_POSTSCRIPT ( Extreme  ,
Measure_< T >   
)

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