1 #ifndef SimTK_SimTKCOMMON_EVENT_H_
2 #define SimTK_SimTKCOMMON_EVENT_H_
137 operator Num()
const {
return value;}
190 return Trigger(transition & mask);
215 bool shouldTriggerOnRisingSignTransition()
const;
216 bool shouldTriggerOnFallingSignTransition()
const;
217 Real getRequiredLocalizationTimeWindow()
const;
227 if (shouldTriggerOnRisingSignTransition()) {
230 if (shouldTriggerOnFallingSignTransition()) {
244 assert(!
"impossible event transition situation");
249 class EventTriggerInfoRep;
252 EventTriggerInfoRep* rep;
254 const EventTriggerInfoRep& getRep()
const {assert(rep);
return *rep;}
255 EventTriggerInfoRep& updRep() {assert(rep);
return *rep;}
277 UseInfinityNorm = 0x0002
283 { clear(); setAccuracy(accuracy); }
285 { clear(); setOption(opt); }
291 { optionSet=0; setAccuracyDefaults();
return *
this; }
297 assert(accuracy > 0);
298 requiredAccuracy = accuracy;
305 { optionSet &= ~(unsigned)opt;
return *
this; }
309 { optionSet |= (unsigned)opt;
return *
this; }
320 { optionSet |= opts.optionSet;
return *
this; }
322 { optionSet &= opts.optionSet;
return *
this; }
324 { optionSet &= ~opts.optionSet;
return *
this; }
330 Real requiredAccuracy;
333 void setAccuracyDefaults() {
334 requiredAccuracy = getDefaultAccuracy();
365 m_exitStatus = Invalid;
366 m_anyChangeMade =
false;
371 bool isValid()
const {
return m_exitStatus != Invalid;}
375 { assert(isValid());
return m_anyChangeMade; }
377 { assert(isValid());
return m_lowestModifiedStage; }
379 { assert(isValid());
return m_message; }
382 { m_exitStatus=status;
return *
this; }
384 { m_anyChangeMade=changeMade;
return *
this; }
386 { m_lowestModifiedStage=stage;
return *
this; }
388 { m_message=message;
return *
this; }
391 bool m_anyChangeMade;
392 Stage m_lowestModifiedStage;
398 #endif // SimTK_SimTKCOMMON_EVENT_H_
#define SimTK_SimTKCOMMON_EXPORT
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:202
Trigger
Triggered Events respond to zero crossings of their associated trigger function.
Definition: Event.h:155
SimTK_DEFINE_UNIQUE_INDEX_TYPE(AssemblyConditionIndex)
HandleEventsOptions & operator-=(const HandleEventsOptions &opts)
Definition: Event.h:323
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
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...
static Trigger classifyTransition(int before, int after)
Classify a before/after sign transition.
Definition: Event.h:174
This class is basically a glorified enumerated type, type-safe and range checked but permitting conve...
Definition: Stage.h:50
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:296
Status getExitStatus() const
Definition: Event.h:372
bool isValid() const
Definition: Event.h:140
HandleEventsResults & setExitStatus(Status status)
Definition: Event.h:381
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:577
HandleEventsOptions & clearOption(Option opt)
Remove a given option from the set.
Definition: Event.h:304
bool isOptionSet(Option opt) const
Definition: Event.h:314
HandleEventsResults & setMessage(const String &message)
Definition: Event.h:387
HandleEventsOptions & setOption(Option opt)
Select a given option from the set.
Definition: Event.h:308
An Event is "something that happens" during a Study that is advancing through time.
Definition: Event.h:76
Num
Definition: Event.h:125
HandleEventsResults & setAnyChangeMade(bool changeMade)
Definition: Event.h:383
These are all the possible causes for events.
Definition: Event.h:123
HandleEventsOptions & operator-=(Option opt)
Definition: Event.h:327
Option
Definition: Event.h:268
HandleEventsOptions & clear()
Restore this object to its default-constructed state (no options selected, default accuracy)...
Definition: Event.h:290
HandleEventsOptions & operator|=(Option opt)
Definition: Event.h:326
HandleEventsOptions & operator|=(const HandleEventsOptions &opts)
Definition: Event.h:319
Cause()
Definition: Event.h:135
HandleEventsOptions()
Definition: Event.h:281
Stage getLowestModifiedStage() const
Definition: Event.h:376
static const char * getCauseName(Cause)
This is useful for debugging; it translates an Event::Cause into a readable string.
Higher than any legitimate Stage.
Definition: Stage.h:63
Real getAccuracy() const
Return the current value for the accuracy option.
Definition: Event.h:312
HandleEventsOptions & operator&=(const HandleEventsOptions &opts)
Definition: Event.h:321
const Real Infinity
This is the IEEE positive infinity constant for this implementation of the default-precision Real typ...
HandleEventsResults & clear()
Restore this object to its default-constructed state, with the return status set to Invalid...
Definition: Event.h:364
HandleEventsResults()
Definition: Event.h:344
SimTK::String is a plug-compatible std::string replacement (plus some additional functionality) inten...
Definition: String.h:62
Event::Trigger calcTransitionMask() const
Definition: Event.h:225
static Trigger maskTransition(Trigger transition, Trigger mask)
Given an observed transition, weed out ignorable ones using the supplied mask.
Definition: Event.h:188
Cause(Num n)
Definition: Event.h:136
Status
Definition: Event.h:346
This class is used to communicate between the System and an Integrator regarding the properties of a ...
Definition: Event.h:206
bool getAnyChangeMade() const
Definition: Event.h:374
Results returned by the handleEvent() method.
Definition: Event.h:342
HandleEventsOptions(Option opt)
Definition: Event.h:284
bool isValid() const
Definition: Event.h:371
Includes internal headers providing declarations for the basic SimTK Core classes.
HandleEventsOptions(Real accuracy)
Definition: Event.h:282
Cause & operator=(Num n)
Definition: Event.h:138
HandleEventsResults & setLowestModifiedStage(Stage stage)
Definition: Event.h:385
const String & getMessage() const
Definition: Event.h:378
static Real getDefaultAccuracy()
Definition: Event.h:316
Options for the handleEvent() method.
Definition: Event.h:266
This is a class to represent unique IDs for events in a type-safe way.