Simbody
3.6
|
This is a concrete subsystem which can apply arbitrary forces to a MultibodySystem. More...
Public Member Functions | |
GeneralForceSubsystem () | |
GeneralForceSubsystem (MultibodySystem &) | |
ForceIndex | adoptForce (Force &force) |
Attach a new force to this subsystem. More... | |
int | getNumForces () const |
Get the number of force elements which have been added to this Subsystem. More... | |
const Force & | getForce (ForceIndex index) const |
Get a const reference to a force element by index. More... | |
Force & | updForce (ForceIndex index) |
Get a writable reference to a force element by index. More... | |
bool | isForceDisabled (const State &state, ForceIndex index) const |
Find out whether a particular force element contained in this subsystem is currently disabled in the given state. More... | |
void | setForceIsDisabled (State &state, ForceIndex index, bool shouldBeDisabled) const |
Disable or enable a particular force element contained in this subsystem. More... | |
void | setNumberOfThreads (unsigned numThreads) |
Set the number of threads that the GeneralForceSubsystem can use to calculate computationally expensive forces (that have the shouldBeParallelIfPossible() method overridden). More... | |
int | getNumberOfThreads () const |
Returns the number of threads that the GeneralForceSubsystem can use to calculate computationally expensive forces (that have the shouldBeParallelIfPossible() method overridden). More... | |
const MultibodySystem & | getMultibodySystem () const |
Every Subsystem is owned by a System; a GeneralForceSubsystem expects to be owned by a MultibodySystem. More... | |
Public Member Functions inherited from SimTK::ForceSubsystem | |
ForceSubsystem () | |
SimTK_PIMPL_DOWNCAST (ForceSubsystem, Subsystem) | |
Guts & | updRep () |
const Guts & | getRep () const |
Public Member Functions inherited from SimTK::Subsystem | |
Subsystem () | |
Default constructor creates and empty handle with a null Subsystem::Guts pointer. More... | |
Subsystem (const Subsystem &) | |
Copy constructor clones the Subsystem::Guts object if there is one and makes this the owner handle of the new clone. More... | |
Subsystem & | operator= (const Subsystem &) |
Copy assignment deletes the Subsystem::Guts object if there is one and then behaves like the copy constructor. More... | |
~Subsystem () | |
Destructor deletes the referenced Subsystem::Guts object if this is the owner handle of that object, otherwise does nothing. More... | |
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 |
const String & | getName () const |
Obtain the Subsystem name if one was given on construction of the concrete Subsystem. More... | |
const String & | getVersion () const |
Obtain the Subsystem version string if one was given on construction. More... | |
bool | isInSystem () const |
Return true if this Subsystem is contained in a System. More... | |
bool | isInSameSystem (const Subsystem &otherSubsystem) const |
Return true if this Subsystem is contained in the same System as contains the given otherSubsystem. More... | |
const System & | getSystem () const |
Return a const reference to the System that contains this Subsystem. More... | |
System & | updSystem () |
Return a writable reference to the System that contains this Subsystem. More... | |
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. More... | |
SubsystemIndex | getMySubsystemIndex () const |
Return the SubsystemIndex within the containing System. More... | |
bool | isEmptyHandle () const |
Return true if this handle has a null Subsystem::Guts pointer. More... | |
bool | isSameSubsystem (const Subsystem &otherSubsystem) const |
Determine if this Subsystem handle refers to the same Subsystem::Guts object as handle otherSubsystem. More... | |
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. More... | |
bool | subsystemTopologyHasBeenRealized () const |
Returns true if this Subsystem's realizeTopology() method has been called since the last topological change or call to invalidateSubsystemTopologyCache(). More... | |
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. More... | |
MeasureIndex | adoptMeasure (AbstractMeasure &) |
Obtain the Subsystem name if one was given on construction of the concrete Subsystem. More... | |
AbstractMeasure | getMeasure (MeasureIndex) const |
Obtain the Subsystem name if one was given on construction of the concrete Subsystem. More... | |
template<class T > | |
Measure_< T > | getMeasure_ (MeasureIndex mx) const |
Obtain the Subsystem name if one was given on construction of the concrete Subsystem. More... | |
const Subsystem::Guts & | getSubsystemGuts () const |
Obtain the Subsystem name if one was given on construction of the concrete Subsystem. More... | |
Subsystem::Guts & | updSubsystemGuts () |
Obtain the Subsystem name if one was given on construction of the concrete Subsystem. More... | |
void | adoptSubsystemGuts (Subsystem::Guts *g) |
Obtain the Subsystem name if one was given on construction of the concrete Subsystem. More... | |
Subsystem (Subsystem::Guts *g) | |
Obtain the Subsystem name if one was given on construction of the concrete Subsystem. More... | |
bool | hasGuts () const |
Obtain the Subsystem name if one was given on construction of the concrete Subsystem. More... | |
This is a concrete subsystem which can apply arbitrary forces to a MultibodySystem.
Each force element is represented by a Force object. For example, to add a spring between two bodies, you would write
SimTK::GeneralForceSubsystem::GeneralForceSubsystem | ( | ) |
|
explicit |
ForceIndex SimTK::GeneralForceSubsystem::adoptForce | ( | Force & | force | ) |
Attach a new force to this subsystem.
The subsystem takes over ownership of the force, leaving the passed in handle as a reference to it. This is normally called by the Force handle constructor.
force | A writable reference to a Force handle whose referenced force element is not yet owned by any subsystem. We will take over ownership of the ForceImpl implementation objected referenced by the handle, bumping the reference count and leaving the reference in place so that the original handle can continue to be used to reference and modify the force element. |
int SimTK::GeneralForceSubsystem::getNumForces | ( | ) | const |
Get the number of force elements which have been added to this Subsystem.
Legal ForceIndex values range from 0 to getNumForces()-1.
const Force& SimTK::GeneralForceSubsystem::getForce | ( | ForceIndex | index | ) | const |
Get a const reference to a force element by index.
Force& SimTK::GeneralForceSubsystem::updForce | ( | ForceIndex | index | ) |
Get a writable reference to a force element by index.
bool SimTK::GeneralForceSubsystem::isForceDisabled | ( | const State & | state, |
ForceIndex | index | ||
) | const |
Find out whether a particular force element contained in this subsystem is currently disabled in the given state.
void SimTK::GeneralForceSubsystem::setForceIsDisabled | ( | State & | state, |
ForceIndex | index, | ||
bool | shouldBeDisabled | ||
) | const |
Disable or enable a particular force element contained in this subsystem.
This can usually be done more conveniently through the Force handle's disable() and enable() methods. Note that although force elements are normally enabled when created, it is possible that the force element will have been constructed to be disabled by default in which case it must be explicitly enabled.
void SimTK::GeneralForceSubsystem::setNumberOfThreads | ( | unsigned | numThreads | ) |
Set the number of threads that the GeneralForceSubsystem can use to calculate computationally expensive forces (that have the shouldBeParallelIfPossible() method overridden).
By default, the number of threads is the number of total processors (including hyperthreads) on the machine.
int SimTK::GeneralForceSubsystem::getNumberOfThreads | ( | ) | const |
Returns the number of threads that the GeneralForceSubsystem can use to calculate computationally expensive forces (that have the shouldBeParallelIfPossible() method overridden).
const MultibodySystem& SimTK::GeneralForceSubsystem::getMultibodySystem | ( | ) | const |
Every Subsystem is owned by a System; a GeneralForceSubsystem expects to be owned by a MultibodySystem.
This method returns a const reference to the containing MultibodySystem and will throw an exception if there is no containing System or it is not a MultibodySystem.