Simbody
Public Member Functions

SimTK::EventHandler Class Reference

An EventHandler is an object that defines an event that can occur within a system. More...

#include <EventHandler.h>

Inheritance diagram for SimTK::EventHandler:

List of all members.

Public Member Functions

virtual ~EventHandler ()
virtual void handleEvent (State &state, Real accuracy, const Vector &yWeights, const Vector &ooConstraintTols, Stage &lowestModified, bool &shouldTerminate) const =0
 This method is invoked to handle the event.

Detailed Description

An EventHandler is an object that defines an event that can occur within a system.

It is an abstract class. Subclasses define how to determine when the event occurs, and what happens when it does. You will not generally subclass EventHandler directly. Instead, subclass ScheduledEventHandler (for events that occur at a particular time that is know in advance) or TriggeredEventHandler (for events that occur when some condition is satisfied within the system). ScheduledEventHandler also has another subclass, PeriodicEventHandler, for the common situation of events that occur at regular intervals.

An EventHandler should be thought of as an integral part of the system it belongs to, and may alter the physical properties or behavior of the system. If you merely want to observe the system but not to alter it, you should generally use a EventReporter instead.

Once you have created an EventHandler, you can add it to a System by calling addEventHandler() on the System.


Constructor & Destructor Documentation

virtual SimTK::EventHandler::~EventHandler ( ) [virtual]

Member Function Documentation

virtual void SimTK::EventHandler::handleEvent ( State state,
Real  accuracy,
const Vector yWeights,
const Vector ooConstraintTols,
Stage lowestModified,
bool &  shouldTerminate 
) const [pure virtual]

This method is invoked to handle the event.

It is given a State which describes the system at the time when the event occurs, and it is permitted to modify any aspect of the state except the time. In doing so, it should respect the specified accuracy requirements for the continuous variables and constraints.

Parameters:
statethe state of the system when the event occurred. This method should modify it to reflect the changes caused by the event.
accuracythe overall accuracy for the simulation. This acts as a multiplier for the weights and constraint tolerances.
yWeightsa vector of weights for the continuous state variables. If this method modifies a variable, its new value should be accurate to within accuracy*yWeight.
ooConstraintTolsa vector of constraint tolerances. If this method modifies the state, each constraint should be satisfied to within accuracy*ooConstraintTol.
lowestModifiedif this method modifies the state, it should set this to the lowest stage which it modified, so that the realization cache can be updated.
shouldTerminateif the event handler sets this to true, it will cause the simulation to terminate immediately.

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