Simbody
3.5
|
A Subsystem is expected to be part of a larger System and to have interdependencies with other subsystems of that same System. More...
Classes | |
class | Guts |
The abstract parent of all Subsystem implementation classes. More... | |
Public Member Functions | |
Subsystem () | |
Default constructor creates and empty handle with a null Subsystem::Guts pointer. | |
Subsystem (const Subsystem &) | |
Copy constructor clones the Subsystem::Guts object if there is one and makes this the owner handle of the new clone. | |
Subsystem & | operator= (const Subsystem &) |
Copy assignment deletes the Subsystem::Guts object if there is one and then behaves like the copy constructor. | |
~Subsystem () | |
Destructor deletes the referenced Subsystem::Guts object if this is the owner handle of that object, otherwise does nothing. | |
State access methods | |
These convenience methods are inline pass-throughs to the State methods of the same name but insert this Subsystem's SubsystemIndex as the first argument. That is the value returned by the getMySubsystemIndex() method. An exception will be thrown if this Subsystem is not contained in a System. See the SimTK::State documentation for the meaning of these methods; the behavior is identical here. | |
QIndex | allocateQ (State &s, const Vector &qInit) const |
UIndex | allocateU (State &s, const Vector &uInit) const |
ZIndex | allocateZ (State &s, const Vector &zInit) const |
DiscreteVariableIndex | allocateDiscreteVariable (State &s, Stage g, AbstractValue *v) const |
DiscreteVariableIndex | allocateAutoUpdateDiscreteVariable (State &s, Stage invalidates, AbstractValue *v, Stage updateDependsOn) const |
CacheEntryIndex | allocateCacheEntry (const State &s, Stage dependsOn, Stage computedBy, AbstractValue *v) const |
CacheEntryIndex | allocateCacheEntry (const State &state, Stage g, AbstractValue *v) const |
CacheEntryIndex | allocateLazyCacheEntry (const State &state, Stage earliest, AbstractValue *v) const |
QErrIndex | allocateQErr (const State &s, int nqerr) const |
UErrIndex | allocateUErr (const State &s, int nuerr) const |
UDotErrIndex | allocateUDotErr (const State &s, int nudoterr) const |
EventTriggerByStageIndex | allocateEventTriggersByStage (const State &s, Stage g, int ntriggers) const |
const Vector & | getQ (const State &s) const |
const Vector & | getU (const State &s) const |
const Vector & | getZ (const State &s) const |
const Vector & | getUWeights (const State &s) const |
const Vector & | getZWeights (const State &s) const |
Vector & | updQ (State &s) const |
Vector & | updU (State &s) const |
Vector & | updZ (State &s) const |
const Vector & | getQDot (const State &s) const |
const Vector & | getUDot (const State &s) const |
const Vector & | getZDot (const State &s) const |
const Vector & | getQDotDot (const State &s) const |
Vector & | updQDot (const State &s) const |
Vector & | updUDot (const State &s) const |
Vector & | updZDot (const State &s) const |
Vector & | updQDotDot (const State &s) const |
const Vector & | getQErr (const State &s) const |
const Vector & | getUErr (const State &s) const |
const Vector & | getQErrWeights (const State &s) const |
const Vector & | getUErrWeights (const State &s) const |
const Vector & | getUDotErr (const State &s) const |
const Vector & | getMultipliers (const State &s) const |
const Vector & | getEventTriggersByStage (const State &s, Stage g) const |
Vector & | updQErr (const State &s) const |
Vector & | updUErr (const State &s) const |
Vector & | updUDotErr (const State &s) const |
Vector & | updMultipliers (const State &s) const |
Vector & | updEventTriggersByStage (const State &s, Stage g) const |
SystemQIndex | getQStart (const State &s) const |
int | getNQ (const State &s) const |
SystemUIndex | getUStart (const State &s) const |
int | getNU (const State &s) const |
SystemZIndex | getZStart (const State &s) const |
int | getNZ (const State &s) const |
SystemQErrIndex | getQErrStart (const State &s) const |
int | getNQErr (const State &s) const |
SystemUErrIndex | getUErrStart (const State &s) const |
int | getNUErr (const State &s) const |
SystemUDotErrIndex | getUDotErrStart (const State &s) const |
int | getNUDotErr (const State &s) const |
SystemMultiplierIndex | getMultipliersStart (const State &s) const |
int | getNMultipliers (const State &s) const |
SystemEventTriggerByStageIndex | getEventTriggerStartByStage (const State &s, Stage g) const |
int | getNEventTriggersByStage (const State &s, Stage g) const |
void | setQ (State &s, const Vector &q) const |
void | setU (State &s, const Vector &u) const |
void | setZ (State &s, const Vector &z) const |
Stage | getStage (const State &s) const |
void | advanceToStage (const State &s, Stage g) const |
const AbstractValue & | getDiscreteVariable (const State &s, DiscreteVariableIndex index) const |
AbstractValue & | updDiscreteVariable (State &s, DiscreteVariableIndex index) const |
const AbstractValue & | getCacheEntry (const State &s, CacheEntryIndex index) const |
AbstractValue & | updCacheEntry (const State &s, CacheEntryIndex index) const |
Real | getDiscreteVarLastUpdateTime (const State &s, DiscreteVariableIndex dx) const |
CacheEntryIndex | getDiscreteVarUpdateIndex (const State &s, DiscreteVariableIndex dx) const |
const AbstractValue & | getDiscreteVarUpdateValue (const State &s, DiscreteVariableIndex dx) const |
AbstractValue & | updDiscreteVarUpdateValue (const State &s, DiscreteVariableIndex dx) const |
bool | isDiscreteVarUpdateValueRealized (const State &s, DiscreteVariableIndex dx) const |
void | markDiscreteVarUpdateValueRealized (const State &s, DiscreteVariableIndex dx) const |
bool | isCacheValueRealized (const State &s, CacheEntryIndex cx) const |
void | markCacheValueRealized (const State &s, CacheEntryIndex cx) const |
void | markCacheValueNotRealized (const State &s, CacheEntryIndex cx) const |
Miscellaneous bookkeeping | |
These methods are not commonly used by end users. They are concerned with the mechanics of creating and managing a Subsystem, typically a concern of Subsystem developers. These are mostly inline pass-throughs to the Subsystem::Guts object pointed to by this handle. | |
const String & | getName () const |
Obtain the Subsystem name if one was given on construction of the concrete Subsystem. | |
const String & | getVersion () const |
Obtain the Subsystem version string if one was given on construction. | |
bool | isInSystem () const |
Return true if this Subsystem is contained in a System. | |
bool | isInSameSystem (const Subsystem &otherSubsystem) const |
Return true if this Subsystem is contained in the same System as contains the given otherSubsystem. | |
const System & | getSystem () const |
Return a const reference to the System that contains this Subsystem. | |
System & | updSystem () |
Return a writable reference to the System that contains this Subsystem. | |
void | setSystem (System &system, SubsystemIndex subx) |
Inform this Subsystem of the System that contains it, as well as the SubsystemIndex which the System has assigned to it. | |
SubsystemIndex | getMySubsystemIndex () const |
Return the SubsystemIndex within the containing System. | |
bool | isEmptyHandle () const |
Return true if this handle has a null Subsystem::Guts pointer. | |
bool | isSameSubsystem (const Subsystem &otherSubsystem) const |
Determine if this Subsystem handle refers to the same Subsystem::Guts object as handle otherSubsystem. | |
bool | isOwnerHandle () const |
Is this Subsystem handle the owner of the Subsystem::Guts object it points to? This is true if the handle is empty or if its Guts object points back to this handle. | |
bool | subsystemTopologyHasBeenRealized () const |
Returns true if this Subsystem's realizeTopology() method has been called since the last topological change or call to invalidateSubsystemTopologyCache(). | |
void | invalidateSubsystemTopologyCache () const |
Always call this method when a topological change is made to this Subsystem to indicate that any Stage::Topology cache values may need recomputation. | |
MeasureIndex | adoptMeasure (AbstractMeasure &) |
Obtain the Subsystem name if one was given on construction of the concrete Subsystem. | |
AbstractMeasure | getMeasure (MeasureIndex) const |
Obtain the Subsystem name if one was given on construction of the concrete Subsystem. | |
template<class T > | |
Measure_< T > | getMeasure_ (MeasureIndex mx) const |
Obtain the Subsystem name if one was given on construction of the concrete Subsystem. | |
const Subsystem::Guts & | getSubsystemGuts () const |
Obtain the Subsystem name if one was given on construction of the concrete Subsystem. | |
Subsystem::Guts & | updSubsystemGuts () |
Obtain the Subsystem name if one was given on construction of the concrete Subsystem. | |
void | adoptSubsystemGuts (Subsystem::Guts *g) |
Obtain the Subsystem name if one was given on construction of the concrete Subsystem. | |
Subsystem (Subsystem::Guts *g) | |
Obtain the Subsystem name if one was given on construction of the concrete Subsystem. | |
bool | hasGuts () const |
Obtain the Subsystem name if one was given on construction of the concrete Subsystem. | |
Friends | |
class | Guts |
A Subsystem is expected to be part of a larger System and to have interdependencies with other subsystems of that same System.
It must NOT have dependencies on objects which are outside the System. Consequently construction of any concrete Subsystem requires specification of a System at that time. Subsystems go through an extended construction phase in which their contents and interdependencies are created. Thus all of a System's Subsystems generally need to be available simultaneously during construction, so that they can reference each other.
There are three distinct users of this class:
Only end user methods are public here. Methods intended for use by the concrete Subsystem class implementation can be found in the Subsystem::Guts class which is defined in a separate header file. End users need not look over there.
SimTK::Subsystem::Subsystem | ( | ) | [inline] |
Default constructor creates and empty handle with a null Subsystem::Guts pointer.
SimTK::Subsystem::Subsystem | ( | const Subsystem & | ) |
Copy constructor clones the Subsystem::Guts object if there is one and makes this the owner handle of the new clone.
This is typically not very useful.
Destructor deletes the referenced Subsystem::Guts object if this is the owner handle of that object, otherwise does nothing.
Note that Subsystem::Guts objects are not reference counted so any other handles pointing to the same object will be invalid after the owner handle is destructed.
SimTK::Subsystem::Subsystem | ( | Subsystem::Guts * | g | ) | [inline, explicit] |
Copy assignment deletes the Subsystem::Guts object if there is one and then behaves like the copy constructor.
Probably not useful in most cases.
QIndex SimTK::Subsystem::allocateQ | ( | State & | s, |
const Vector & | qInit | ||
) | const [inline] |
UIndex SimTK::Subsystem::allocateU | ( | State & | s, |
const Vector & | uInit | ||
) | const [inline] |
ZIndex SimTK::Subsystem::allocateZ | ( | State & | s, |
const Vector & | zInit | ||
) | const [inline] |
DiscreteVariableIndex SimTK::Subsystem::allocateDiscreteVariable | ( | State & | s, |
Stage | g, | ||
AbstractValue * | v | ||
) | const [inline] |
DiscreteVariableIndex SimTK::Subsystem::allocateAutoUpdateDiscreteVariable | ( | State & | s, |
Stage | invalidates, | ||
AbstractValue * | v, | ||
Stage | updateDependsOn | ||
) | const [inline] |
CacheEntryIndex SimTK::Subsystem::allocateCacheEntry | ( | const State & | s, |
Stage | dependsOn, | ||
Stage | computedBy, | ||
AbstractValue * | v | ||
) | const [inline] |
CacheEntryIndex SimTK::Subsystem::allocateCacheEntry | ( | const State & | state, |
Stage | g, | ||
AbstractValue * | v | ||
) | const [inline] |
CacheEntryIndex SimTK::Subsystem::allocateLazyCacheEntry | ( | const State & | state, |
Stage | earliest, | ||
AbstractValue * | v | ||
) | const [inline] |
QErrIndex SimTK::Subsystem::allocateQErr | ( | const State & | s, |
int | nqerr | ||
) | const [inline] |
UErrIndex SimTK::Subsystem::allocateUErr | ( | const State & | s, |
int | nuerr | ||
) | const [inline] |
UDotErrIndex SimTK::Subsystem::allocateUDotErr | ( | const State & | s, |
int | nudoterr | ||
) | const [inline] |
EventTriggerByStageIndex SimTK::Subsystem::allocateEventTriggersByStage | ( | const State & | s, |
Stage | g, | ||
int | ntriggers | ||
) | const [inline] |
const Vector& SimTK::Subsystem::getQ | ( | const State & | s | ) | const [inline] |
const Vector& SimTK::Subsystem::getU | ( | const State & | s | ) | const [inline] |
const Vector& SimTK::Subsystem::getZ | ( | const State & | s | ) | const [inline] |
const Vector& SimTK::Subsystem::getUWeights | ( | const State & | s | ) | const [inline] |
const Vector& SimTK::Subsystem::getZWeights | ( | const State & | s | ) | const [inline] |
Vector& SimTK::Subsystem::updQ | ( | State & | s | ) | const [inline] |
Vector& SimTK::Subsystem::updU | ( | State & | s | ) | const [inline] |
Vector& SimTK::Subsystem::updZ | ( | State & | s | ) | const [inline] |
const Vector& SimTK::Subsystem::getQDot | ( | const State & | s | ) | const [inline] |
const Vector& SimTK::Subsystem::getUDot | ( | const State & | s | ) | const [inline] |
const Vector& SimTK::Subsystem::getZDot | ( | const State & | s | ) | const [inline] |
const Vector& SimTK::Subsystem::getQDotDot | ( | const State & | s | ) | const [inline] |
Vector& SimTK::Subsystem::updQDot | ( | const State & | s | ) | const [inline] |
Vector& SimTK::Subsystem::updUDot | ( | const State & | s | ) | const [inline] |
Vector& SimTK::Subsystem::updZDot | ( | const State & | s | ) | const [inline] |
Vector& SimTK::Subsystem::updQDotDot | ( | const State & | s | ) | const [inline] |
const Vector& SimTK::Subsystem::getQErr | ( | const State & | s | ) | const [inline] |
const Vector& SimTK::Subsystem::getUErr | ( | const State & | s | ) | const [inline] |
const Vector& SimTK::Subsystem::getQErrWeights | ( | const State & | s | ) | const [inline] |
const Vector& SimTK::Subsystem::getUErrWeights | ( | const State & | s | ) | const [inline] |
const Vector& SimTK::Subsystem::getUDotErr | ( | const State & | s | ) | const [inline] |
const Vector& SimTK::Subsystem::getMultipliers | ( | const State & | s | ) | const [inline] |
const Vector& SimTK::Subsystem::getEventTriggersByStage | ( | const State & | s, |
Stage | g | ||
) | const [inline] |
Vector& SimTK::Subsystem::updQErr | ( | const State & | s | ) | const [inline] |
Vector& SimTK::Subsystem::updUErr | ( | const State & | s | ) | const [inline] |
Vector& SimTK::Subsystem::updUDotErr | ( | const State & | s | ) | const [inline] |
Vector& SimTK::Subsystem::updMultipliers | ( | const State & | s | ) | const [inline] |
Vector& SimTK::Subsystem::updEventTriggersByStage | ( | const State & | s, |
Stage | g | ||
) | const [inline] |
SystemQIndex SimTK::Subsystem::getQStart | ( | const State & | s | ) | const [inline] |
int SimTK::Subsystem::getNQ | ( | const State & | s | ) | const [inline] |
SystemUIndex SimTK::Subsystem::getUStart | ( | const State & | s | ) | const [inline] |
int SimTK::Subsystem::getNU | ( | const State & | s | ) | const [inline] |
SystemZIndex SimTK::Subsystem::getZStart | ( | const State & | s | ) | const [inline] |
int SimTK::Subsystem::getNZ | ( | const State & | s | ) | const [inline] |
SystemQErrIndex SimTK::Subsystem::getQErrStart | ( | const State & | s | ) | const [inline] |
int SimTK::Subsystem::getNQErr | ( | const State & | s | ) | const [inline] |
SystemUErrIndex SimTK::Subsystem::getUErrStart | ( | const State & | s | ) | const [inline] |
int SimTK::Subsystem::getNUErr | ( | const State & | s | ) | const [inline] |
SystemUDotErrIndex SimTK::Subsystem::getUDotErrStart | ( | const State & | s | ) | const [inline] |
int SimTK::Subsystem::getNUDotErr | ( | const State & | s | ) | const [inline] |
SystemMultiplierIndex SimTK::Subsystem::getMultipliersStart | ( | const State & | s | ) | const [inline] |
int SimTK::Subsystem::getNMultipliers | ( | const State & | s | ) | const [inline] |
SystemEventTriggerByStageIndex SimTK::Subsystem::getEventTriggerStartByStage | ( | const State & | s, |
Stage | g | ||
) | const [inline] |
int SimTK::Subsystem::getNEventTriggersByStage | ( | const State & | s, |
Stage | g | ||
) | const [inline] |
void SimTK::Subsystem::setQ | ( | State & | s, |
const Vector & | q | ||
) | const [inline] |
void SimTK::Subsystem::setU | ( | State & | s, |
const Vector & | u | ||
) | const [inline] |
void SimTK::Subsystem::setZ | ( | State & | s, |
const Vector & | z | ||
) | const [inline] |
Stage SimTK::Subsystem::getStage | ( | const State & | s | ) | const [inline] |
void SimTK::Subsystem::advanceToStage | ( | const State & | s, |
Stage | g | ||
) | const [inline] |
const AbstractValue& SimTK::Subsystem::getDiscreteVariable | ( | const State & | s, |
DiscreteVariableIndex | index | ||
) | const [inline] |
AbstractValue& SimTK::Subsystem::updDiscreteVariable | ( | State & | s, |
DiscreteVariableIndex | index | ||
) | const [inline] |
const AbstractValue& SimTK::Subsystem::getCacheEntry | ( | const State & | s, |
CacheEntryIndex | index | ||
) | const [inline] |
AbstractValue& SimTK::Subsystem::updCacheEntry | ( | const State & | s, |
CacheEntryIndex | index | ||
) | const [inline] |
Real SimTK::Subsystem::getDiscreteVarLastUpdateTime | ( | const State & | s, |
DiscreteVariableIndex | dx | ||
) | const [inline] |
CacheEntryIndex SimTK::Subsystem::getDiscreteVarUpdateIndex | ( | const State & | s, |
DiscreteVariableIndex | dx | ||
) | const [inline] |
const AbstractValue& SimTK::Subsystem::getDiscreteVarUpdateValue | ( | const State & | s, |
DiscreteVariableIndex | dx | ||
) | const [inline] |
AbstractValue& SimTK::Subsystem::updDiscreteVarUpdateValue | ( | const State & | s, |
DiscreteVariableIndex | dx | ||
) | const [inline] |
bool SimTK::Subsystem::isDiscreteVarUpdateValueRealized | ( | const State & | s, |
DiscreteVariableIndex | dx | ||
) | const [inline] |
void SimTK::Subsystem::markDiscreteVarUpdateValueRealized | ( | const State & | s, |
DiscreteVariableIndex | dx | ||
) | const [inline] |
bool SimTK::Subsystem::isCacheValueRealized | ( | const State & | s, |
CacheEntryIndex | cx | ||
) | const [inline] |
void SimTK::Subsystem::markCacheValueRealized | ( | const State & | s, |
CacheEntryIndex | cx | ||
) | const [inline] |
void SimTK::Subsystem::markCacheValueNotRealized | ( | const State & | s, |
CacheEntryIndex | cx | ||
) | const [inline] |
const String & SimTK::Subsystem::getName | ( | ) | const [inline] |
const String & SimTK::Subsystem::getVersion | ( | ) | const [inline] |
Obtain the Subsystem version string if one was given on construction.
Simbody does not interpret this in any way.
bool SimTK::Subsystem::isInSystem | ( | ) | const [inline] |
Return true
if this Subsystem is contained in a System.
bool SimTK::Subsystem::isInSameSystem | ( | const Subsystem & | otherSubsystem | ) | const [inline] |
Return true
if this Subsystem is contained in the same System as contains the given otherSubsystem.
Returns false
if either Subsystem is not contained in a System, or if the Systems don't match.
const System & SimTK::Subsystem::getSystem | ( | ) | const [inline] |
Return a const reference to the System that contains this Subsystem.
Throws an exception if this is not contained in a System; call isInSystem() first if you aren't sure.
System & SimTK::Subsystem::updSystem | ( | ) | [inline] |
Return a writable reference to the System that contains this Subsystem.
Throws an exception if this is not contained in a System; call isInSystem() first if you aren't sure.
void SimTK::Subsystem::setSystem | ( | System & | system, |
SubsystemIndex | subx | ||
) | [inline] |
Inform this Subsystem of the System that contains it, as well as the SubsystemIndex which the System has assigned to it.
SubsystemIndex SimTK::Subsystem::getMySubsystemIndex | ( | ) | const [inline] |
Return the SubsystemIndex within the containing System.
An exception will be thrown (in Debug mode at least) if this Subsystem is not in a System.
bool SimTK::Subsystem::isEmptyHandle | ( | ) | const [inline] |
Return true if this handle has a null Subsystem::Guts pointer.
bool SimTK::Subsystem::isSameSubsystem | ( | const Subsystem & | otherSubsystem | ) | const [inline] |
Determine if this
Subsystem handle refers to the same Subsystem::Guts object as handle otherSubsystem.
There can be multiple handles on the same underlying Subsystem::Guts object but at most one can be the owner.
bool SimTK::Subsystem::isOwnerHandle | ( | ) | const [inline] |
Is this Subsystem handle the owner of the Subsystem::Guts object it points to? This is true
if the handle is empty or if its Guts object points back to this handle.
bool SimTK::Subsystem::subsystemTopologyHasBeenRealized | ( | ) | const [inline] |
Returns true
if this Subsystem's realizeTopology() method has been called since the last topological change or call to invalidateSubsystemTopologyCache().
void SimTK::Subsystem::invalidateSubsystemTopologyCache | ( | ) | const [inline] |
Always call this method when a topological change is made to this Subsystem to indicate that any Stage::Topology cache values may need recomputation.
If the Subsystem belongs to a System, the System's overall topology will also be invalidated, since its Stage::Topology cannot be valid if any of its Subsystem topology stages are not valid. However, the stages of other Subsystems in the same System are not affected. A subsequent call to realizeTopology() is required before any computed values may be obtained.
MeasureIndex SimTK::Subsystem::adoptMeasure | ( | AbstractMeasure & | m | ) | [inline] |
AbstractMeasure SimTK::Subsystem::getMeasure | ( | MeasureIndex | mx | ) | const [inline] |
Measure_<T> SimTK::Subsystem::getMeasure_ | ( | MeasureIndex | mx | ) | const [inline] |
const Subsystem::Guts& SimTK::Subsystem::getSubsystemGuts | ( | ) | const [inline] |
Subsystem::Guts& SimTK::Subsystem::updSubsystemGuts | ( | ) | [inline] |
void SimTK::Subsystem::adoptSubsystemGuts | ( | Subsystem::Guts * | g | ) |
bool SimTK::Subsystem::hasGuts | ( | ) | const [inline] |
friend class Guts [friend] |