1 #ifndef SimTK_SimTKCOMMON_SUBSYSTEM_GUTS_H_
2 #define SimTK_SimTKCOMMON_SUBSYSTEM_GUTS_H_
36 class DecorativeGeometry;
50 const String& version=
"0.0.0");
53 const String& getName()
const;
54 const String& getVersion()
const;
76 {
return allocateCacheEntry(state, g, g, v); }
126 assert(q.
size() == getNQ(s));
130 assert(u.
size() == getNU(s));
134 assert(z.
size() == getNZ(s));
186 int getNQ (
const State&)
const;
188 int getNU (
const State&)
const;
190 int getNZ (
const State&)
const;
192 int getNQErr (
const State&)
const;
194 int getNUErr (
const State&)
const;
196 int getNUDotErr (
const State&)
const;
198 int getNMultipliers(
const State&)
const;
200 getEventTriggerStartByStage(
const State&,
Stage)
const;
201 int getNEventTriggersByStage(
const State&,
Stage)
const;
208 bool isInSystem()
const;
209 bool isInSameSystem(
const Subsystem& otherSubsystem)
const;
211 const System& getSystem()
const;
217 const Subsystem& getOwnerSubsystemHandle()
const;
219 void setOwnerSubsystemHandle(
Subsystem&);
220 bool hasOwnerSubsystemHandle()
const;
225 explicit Guts(GutsRep* r) : rep(r) { }
227 const GutsRep&
getRep()
const {assert(rep);
return *rep;}
228 GutsRep&
updRep()
const {assert(rep);
return *rep;}
229 void setRep(GutsRep& r) {assert(!rep); rep = &r;}
231 bool subsystemTopologyHasBeenRealized()
const;
232 void invalidateSubsystemTopologyCache()
const;
247 void realizeSubsystemTopology (
State&)
const;
248 void realizeSubsystemModel (
State&)
const;
249 void realizeSubsystemInstance (
const State&)
const;
250 void realizeSubsystemTime (
const State&)
const;
251 void realizeSubsystemPosition (
const State&)
const;
252 void realizeSubsystemVelocity (
const State&)
const;
253 void realizeSubsystemDynamics (
const State&)
const;
254 void realizeSubsystemAcceleration(
const State&)
const;
255 void realizeSubsystemReport (
const State&)
const;
262 void calcDecorativeGeometryAndAppend
265 void createScheduledEvent(
const State& state,
EventId& eventId)
const;
266 void createTriggeredEvent(
const State& state,
EventId& eventId,
274 void calcEventTriggerInfo
276 void calcTimeOfNextScheduledEvent
278 bool includeCurrentTime)
const;
279 void calcTimeOfNextScheduledReport
281 bool includeCurrentTime)
const;
318 virtual int calcDecorativeGeometryAndAppendImpl
321 virtual void calcEventTriggerInfoImpl
323 virtual void calcTimeOfNextScheduledEventImpl
325 bool includeCurrentTime)
const {}
326 virtual void calcTimeOfNextScheduledReportImpl
328 bool includeCurrentTime)
const {}
329 virtual void handleEventsImpl
333 virtual void reportEventsImpl
337 void advanceToStage(
const State& s,
Stage g)
const;
343 friend class GutsRep;
348 #endif // SimTK_SimTKCOMMON_SUBSYSTEM_GUTS_H_
AbstractValue & updDiscreteVarUpdateValue(SubsystemIndex, DiscreteVariableIndex) const
For an auto-updating discrete variable, return a writable reference to the value of its associated up...
The abstract parent of all Subsystems.
Definition: Subsystem.h:61
#define SimTK_SimTKCOMMON_EXPORT
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:202
Unique integer type for Subsystem-local uDotErr indexing.
bool isDiscreteVarUpdateValueRealized(SubsystemIndex, DiscreteVariableIndex) const
Check whether the update value for this auto-update discrete variable has already been computed since...
bool hasRep() const
Definition: SubsystemGuts.h:226
Unique integer type for Subsystem-local u indexing.
virtual int realizeSubsystemModelImpl(State &s) const
Definition: SubsystemGuts.h:309
Measure_< T > getMeasure_(MeasureIndex mx) const
Definition: SubsystemGuts.h:205
Unique integer type for Subsystem-local uErr indexing.
Real getDiscreteVarLastUpdateTime(SubsystemIndex, DiscreteVariableIndex) const
Return the time of last update for this discrete variable.
Unique integer type for Subsystem-local qErr indexing.
This class is basically a glorified enumerated type, type-safe and range checked but permitting conve...
Definition: Stage.h:50
void setRep(GutsRep &r)
Definition: SubsystemGuts.h:229
int size() const
Definition: BigMatrix.h:1411
Guts(GutsRep *r)
Definition: SubsystemGuts.h:225
CacheEntryIndex getDiscreteVarUpdateIndex(SubsystemIndex, DiscreteVariableIndex) const
For an auto-updating discrete variable, return the CacheEntryIndex for its associated update cache en...
virtual int realizeSubsystemPositionImpl(const State &s) const
Definition: SubsystemGuts.h:312
This is the base class for all Measure handle classes.
Definition: Measure.h:151
This unique integer type is for indexing global "multiplier-like" arrays, that is, arrays that inherently have the same dimension as the total number of Lagrange multipliers in the full System-level view of the State.
This is the handle class for the hidden State implementation.
Definition: State.h:264
void setU(State &s, const Vector &u) const
Definition: SubsystemGuts.h:129
const GutsRep & getRep() const
Definition: SubsystemGuts.h:227
These are all the possible causes for events.
Definition: Event.h:123
const AbstractValue & getDiscreteVarUpdateValue(const State &s, DiscreteVariableIndex dx) const
Definition: SubsystemGuts.h:162
virtual int realizeSubsystemDynamicsImpl(const State &s) const
Definition: SubsystemGuts.h:314
The SimTK::Array_<T> container class is a plug-compatible replacement for the C++ standard template l...
Definition: Array.h:50
This unique integer type is for indexing global "q-like" arrays, that is, arrays that inherently have...
This unique integer type is for indexing global "qErr-like" arrays, that is, arrays that inherently h...
Unique integer type for Subsystem-local z indexing.
This unique integer type is for indexing global "uErr-like" arrays, that is, arrays that inherently h...
AbstractValue & updDiscreteVarUpdateValue(const State &s, DiscreteVariableIndex dx) const
Definition: SubsystemGuts.h:164
void setZ(State &s, const Vector &z) const
Definition: SubsystemGuts.h:133
Unique integer type for Subsystem-local q indexing.
The abstract parent of all Subsystem "Guts" implementation classes.
Definition: SubsystemGuts.h:42
virtual int realizeSubsystemTimeImpl(const State &s) const
Definition: SubsystemGuts.h:311
Higher than any legitimate Stage.
Definition: Stage.h:63
virtual int realizeSubsystemReportImpl(const State &s) const
Definition: SubsystemGuts.h:316
void markDiscreteVarUpdateValueRealized(const State &s, DiscreteVariableIndex dx) const
Definition: SubsystemGuts.h:168
This unique integer type is for identifying a triggered event within a particular Stage of the full S...
virtual int realizeSubsystemTopologyImpl(State &s) const
Definition: SubsystemGuts.h:308
GutsRep & updRep() const
Definition: SubsystemGuts.h:228
bool isDiscreteVarUpdateValueRealized(const State &s, DiscreteVariableIndex dx) const
Definition: SubsystemGuts.h:166
virtual int realizeSubsystemVelocityImpl(const State &s) const
Definition: SubsystemGuts.h:313
SimTK::String is a plug-compatible std::string replacement (plus some additional functionality) inten...
Definition: String.h:62
virtual int realizeSubsystemInstanceImpl(const State &s) const
Definition: SubsystemGuts.h:310
void setQ(State &s, const Vector &q) const
Definition: SubsystemGuts.h:125
Abstract base class representing an arbitrary value of self-describing type.
Definition: Value.h:41
This unique integer type is for indexing global "uDotErr-like" arrays, that is, arrays that inherentl...
This unique integer type is for selecting discrete variables.
This unique integer type is for indexing global "z-like" arrays, that is, arrays that inherently have...
const AbstractValue & getDiscreteVarUpdateValue(SubsystemIndex, DiscreteVariableIndex) const
For an auto-updating discrete variable, return the current value of its associated update cache entry...
This is the base class that serves as the parent of all SimTK System objects; most commonly Simbody's...
Definition: System.h:96
CacheEntryIndex getDiscreteVarUpdateIndex(const State &s, DiscreteVariableIndex dx) const
Definition: SubsystemGuts.h:160
Provide a unique integer type for identifying Subsystems.
This unique integer type is for selecting non-shared cache entries.
Real getDiscreteVarLastUpdateTime(const State &s, DiscreteVariableIndex dx) const
Definition: SubsystemGuts.h:158
Results returned by the handleEvent() method.
Definition: Event.h:341
This is the header which should be included in user programs that would like to make use of all the S...
virtual int realizeSubsystemAccelerationImpl(const State &s) const
Definition: SubsystemGuts.h:315
Unique integer type for Subsystem-local, per-stage event indexing.
This unique integer type is for indexing global "u-like" arrays, that is, arrays that inherently have...
void markDiscreteVarUpdateValueRealized(SubsystemIndex, DiscreteVariableIndex) const
Mark the update value for this auto-update discrete variable as up-to-date with respect to the state ...
Includes internal headers providing declarations for the basic SimTK Core classes.
Options for the handleEvent() method.
Definition: Event.h:265
This is the base handle class for all Measures whose value type is known, including all the Simbody b...
Definition: Measure.h:261
This is a class to represent unique IDs for events in a type-safe way.