Go to the documentation of this file. 1 #ifndef SimTK_SimTKCOMMON_EVENT_H_
2 #define SimTK_SimTKCOMMON_EVENT_H_
140 operator Num()
const {
return value;}
193 return Trigger(transition & mask);
218 bool shouldTriggerOnRisingSignTransition()
const;
219 bool shouldTriggerOnFallingSignTransition()
const;
220 Real getRequiredLocalizationTimeWindow()
const;
230 if (shouldTriggerOnRisingSignTransition()) {
233 if (shouldTriggerOnFallingSignTransition()) {
247 assert(!
"impossible event transition situation");
252 class EventTriggerInfoRep;
255 EventTriggerInfoRep* rep;
257 const EventTriggerInfoRep& getRep()
const {assert(rep);
return *rep;}
258 EventTriggerInfoRep& updRep() {assert(rep);
return *rep;}
294 { optionSet=0; setAccuracyDefaults();
return *
this; }
300 assert(accuracy > 0);
301 requiredAccuracy = accuracy;
308 { optionSet &= ~(unsigned)opt;
return *
this; }
312 { optionSet |= (unsigned)opt;
return *
this; }
323 { optionSet |= opts.optionSet;
return *
this; }
325 { optionSet &= opts.optionSet;
return *
this; }
327 { optionSet &= ~opts.optionSet;
return *
this; }
333 Real requiredAccuracy;
336 void setAccuracyDefaults() {
369 m_anyChangeMade =
false;
378 { assert(
isValid());
return m_anyChangeMade; }
380 { assert(
isValid());
return m_lowestModifiedStage; }
382 { assert(
isValid());
return m_message; }
385 { m_exitStatus=status;
return *
this; }
387 { m_anyChangeMade=changeMade;
return *
this; }
389 { m_lowestModifiedStage=stage;
return *
this; }
391 { m_message=message;
return *
this; }
394 bool m_anyChangeMade;
395 Stage m_lowestModifiedStage;
401 #endif // SimTK_SimTKCOMMON_EVENT_H_
Option
Definition: Event.h:271
HandleEventsOptions & operator|=(Option opt)
Definition: Event.h:329
HandleEventsOptions & operator|=(const HandleEventsOptions &opts)
Definition: Event.h:322
Stage getLowestModifiedStage() const
Definition: Event.h:379
@ NoEventTrigger
Definition: Event.h:159
@ Falling
Definition: Event.h:164
@ UseInfinityNorm
Use the stricter infinity (max absolute value) norm rather than the default RMS norm to determine whe...
Definition: Event.h:280
static Trigger classifyTransition(int before, int after)
Classify a before/after sign transition.
Definition: Event.h:177
@ Rising
Definition: Event.h:165
@ TimeAdvanced
Definition: Event.h:132
@ Invalid
This object has not been filled in yet and holds no results.
Definition: Event.h:351
These are all the possible causes for events.
Definition: Event.h:126
Options for the handleEvent() method.
Definition: Event.h:269
Status getExitStatus() const
Definition: Event.h:375
@ AnySignChange
Definition: Event.h:166
HandleEventsOptions & operator&=(const HandleEventsOptions &opts)
Definition: Event.h:324
bool isValid() const
Definition: Event.h:374
Trigger
Triggered Events respond to zero crossings of their associated trigger function.
Definition: Event.h:158
Cause & operator=(Num n)
Definition: Event.h:141
Cause()
Definition: Event.h:138
@ DontThrow
Normally failure to meet the accuracy requirements throws an exception.
Definition: Event.h:277
Results returned by the handleEvent() method.
Definition: Event.h:345
bool isOptionSet(Option opt) const
Definition: Event.h:317
This is a System that represents the dynamics of a particle moving along a smooth surface.
Definition: Assembler.h:37
static const char * getCauseName(Cause)
This is useful for debugging; it translates an Event::Cause into a readable string.
HandleEventsResults & setMessage(const String &message)
Definition: Event.h:390
@ ShouldTerminate
The handleEvent() call was successful but the event requires time stepping to terminate.
Definition: Event.h:358
static Trigger maskTransition(Trigger transition, Trigger mask)
Given an observed transition, weed out ignorable ones using the supplied mask.
Definition: Event.h:191
@ Initialization
Definition: Event.h:129
This class is used to communicate between the System and an Integrator regarding the properties of a ...
Definition: Event.h:209
HandleEventsOptions(Option opt)
Definition: Event.h:287
HandleEventsOptions(Real accuracy)
Definition: Event.h:285
Real getAccuracy() const
Return the current value for the accuracy option.
Definition: Event.h:315
bool isValid() const
Definition: Event.h:143
#define SimTK_SimTKCOMMON_EXPORT
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:224
@ Failed
The handleEvent() call was unable to successfully handle the event.
Definition: Event.h:362
bool getAnyChangeMade() const
Definition: Event.h:377
HandleEventsResults & setExitStatus(Status status)
Definition: Event.h:384
HandleEventsResults & setAnyChangeMade(bool changeMade)
Definition: Event.h:386
@ NegativeToPositive
Definition: Event.h:162
static Real getDefaultAccuracy()
Definition: Event.h:319
Event::Trigger calcTransitionMask() const
Definition: Event.h:228
Num
Definition: Event.h:128
This class is basically a glorified enumerated type, type-safe and range checked but permitting conve...
Definition: Stage.h:66
HandleEventsOptions & operator-=(const HandleEventsOptions &opts)
Definition: Event.h:326
@ None
Take all defaults.
Definition: Event.h:273
HandleEventsResults()
Definition: Event.h:347
@ Termination
Definition: Event.h:134
HandleEventsOptions & setAccuracy(Real accuracy)
The norm of the constraint errors must be driven to below this value for a project() to be considered...
Definition: Event.h:299
@ Scheduled
Definition: Event.h:131
SimTK_Real Real
This is the default compiled-in floating point type for SimTK, either float or double.
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:606
const Real Infinity
This is the IEEE positive infinity constant for this implementation of the default-precision Real typ...
An Event is "something that happens" during a Study that is advancing through time.
Definition: Event.h:76
const String & getMessage() const
Definition: Event.h:381
@ PositiveToNegative
Definition: Event.h:161
@ Infinity
Higher than any legitimate Stage.
Definition: Stage.h:79
HandleEventsResults & setLowestModifiedStage(Stage stage)
Definition: Event.h:388
HandleEventsOptions & setOption(Option opt)
Select a given option from the set.
Definition: Event.h:311
SimTK_DEFINE_UNIQUE_INDEX_TYPE(AssemblyConditionIndex)
@ Invalid
Definition: Event.h:135
SimTK::String is a plug-compatible std::string replacement (plus some additional functionality) inten...
Definition: String.h:62
HandleEventsResults & clear()
Restore this object to its default-constructed state, with the return status set to Invalid.
Definition: Event.h:367
Cause(Num n)
Definition: Event.h:139
HandleEventsOptions & clearOption(Option opt)
Remove a given option from the set.
Definition: Event.h:307
@ Signaled
Definition: Event.h:133
@ Triggered
Definition: Event.h:130
static std::string eventTriggerString(Trigger)
This is useful for debugging; it translates an Event::Trigger or a mask formed by a union of Event::T...
HandleEventsOptions & clear()
Restore this object to its default-constructed state (no options selected, default accuracy).
Definition: Event.h:293
@ Succeeded
The handleEvent() operation was successful and time stepping may continue.
Definition: Event.h:354
HandleEventsOptions()
Definition: Event.h:284
Status
Definition: Event.h:349
HandleEventsOptions & operator-=(Option opt)
Definition: Event.h:330