Simbody  3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SimTK::GeneralForceSubsystem Class Reference

This is a concrete subsystem which can apply arbitrary forces to a MultibodySystem. More...

#include <GeneralForceSubsystem.h>

+ Inheritance diagram for SimTK::GeneralForceSubsystem:

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 ForcegetForce (ForceIndex index) const
 Get a const reference to a force element by index. More...
 
ForceupdForce (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...
 
const MultibodySystemgetMultibodySystem () 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)
 
GutsupdRep ()
 
const GutsgetRep () const
 
- Public Member Functions inherited from SimTK::Subsystem
 Subsystem ()
 
 Subsystem (const Subsystem &)
 
Subsystemoperator= (const Subsystem &)
 
 ~Subsystem ()
 
const StringgetName () const
 
const StringgetVersion () const
 
QIndex allocateQ (State &, const Vector &qInit) const
 
UIndex allocateU (State &, const Vector &uInit) const
 
ZIndex allocateZ (State &, const Vector &zInit) const
 
DiscreteVariableIndex allocateDiscreteVariable (State &, Stage invalidates, AbstractValue *v) const
 
DiscreteVariableIndex allocateAutoUpdateDiscreteVariable (State &, Stage invalidates, AbstractValue *v, Stage updateDependsOn) const
 
CacheEntryIndex allocateCacheEntry (const State &, 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 &, int nqerr) const
 
UErrIndex allocateUErr (const State &, int nuerr) const
 
UDotErrIndex allocateUDotErr (const State &, int nudoterr) const
 
EventTriggerByStageIndex allocateEventTriggersByStage (const State &, Stage, int ntriggers) const
 
const VectorgetQ (const State &) const
 
const VectorgetU (const State &) const
 
const VectorgetZ (const State &) const
 
const VectorgetQDot (const State &) const
 
const VectorgetUDot (const State &) const
 
const VectorgetZDot (const State &) const
 
const VectorgetQDotDot (const State &) const
 
const VectorgetQErr (const State &) const
 
const VectorgetUErr (const State &) const
 
const VectorgetUDotErr (const State &) const
 
const VectorgetMultipliers (const State &) const
 
const VectorgetEventTriggersByStage (const State &, Stage) const
 
VectorupdQ (State &) const
 
VectorupdU (State &) const
 
VectorupdZ (State &) 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
 
VectorupdQDot (const State &) const
 
VectorupdUDot (const State &) const
 
VectorupdZDot (const State &) const
 
VectorupdQDotDot (const State &) const
 
VectorupdQErr (const State &) const
 
VectorupdUErr (const State &) const
 
VectorupdUDotErr (const State &) const
 
VectorupdMultipliers (const State &) const
 
VectorupdEventTriggersByStage (const State &, Stage) const
 
Stage getStage (const State &) const
 
const AbstractValuegetDiscreteVariable (const State &s, DiscreteVariableIndex dx) const
 
Real getDiscreteVarLastUpdateTime (const State &s, DiscreteVariableIndex dx) const
 
CacheEntryIndex getDiscreteVarUpdateIndex (const State &s, DiscreteVariableIndex dx) const
 
const AbstractValuegetDiscreteVarUpdateValue (const State &s, DiscreteVariableIndex dx) const
 
AbstractValueupdDiscreteVarUpdateValue (const State &s, DiscreteVariableIndex dx) const
 
bool isDiscreteVarUpdateValueRealized (const State &s, DiscreteVariableIndex dx) const
 
void markDiscreteVarUpdateValueRealized (const State &s, DiscreteVariableIndex dx) const
 
AbstractValueupdDiscreteVariable (State &, DiscreteVariableIndex) const
 
const AbstractValuegetCacheEntry (const State &, CacheEntryIndex) const
 
AbstractValueupdCacheEntry (const State &, CacheEntryIndex) const
 
bool isCacheValueRealized (const State &, CacheEntryIndex) const
 
void markCacheValueRealized (const State &, CacheEntryIndex) const
 
void markCacheValueNotRealized (const State &, CacheEntryIndex) const
 
SystemQIndex getQStart (const State &) const
 
int getNQ (const State &) const
 
SystemUIndex getUStart (const State &) const
 
int getNU (const State &) const
 
SystemZIndex getZStart (const State &) const
 
int getNZ (const State &) const
 
SystemQErrIndex getQErrStart (const State &) const
 
int getNQErr (const State &) const
 
SystemUErrIndex getUErrStart (const State &) const
 
int getNUErr (const State &) const
 
SystemUDotErrIndex getUDotErrStart (const State &) const
 
int getNUDotErr (const State &) const
 
SystemMultiplierIndex getMultipliersStart (const State &) const
 
int getNMultipliers (const State &) const
 
SystemEventTriggerByStageIndex getEventTriggerStartByStage (const State &, Stage) const
 
int getNEventTriggersByStage (const State &, Stage) const
 
bool isInSystem () const
 
bool isInSameSystem (const Subsystem &otherSubsystem) const
 
const SystemgetSystem () const
 
SystemupdSystem ()
 
SubsystemIndex getMySubsystemIndex () const
 
bool isOwnerHandle () const
 
bool isEmptyHandle () const
 
bool isSameSubsystem (const Subsystem &otherSubsystem) const
 
bool subsystemTopologyHasBeenRealized () const
 
void invalidateSubsystemTopologyCache () const
 
MeasureIndex adoptMeasure (AbstractMeasure &)
 
AbstractMeasure getMeasure (MeasureIndex) const
 
template<class T >
Measure_< T > getMeasure_ (MeasureIndex mx) const
 
const Subsystem::GutsgetSubsystemGuts () const
 
Subsystem::GutsupdSubsystemGuts ()
 
void adoptSubsystemGuts (Subsystem::Guts *g)
 
void setSystem (System &, SubsystemIndex)
 
 Subsystem (Subsystem::Guts *g)
 
bool hasGuts () const
 

Detailed Description

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

GeneralForceSubsystem forces(system);
// ...
Force::TwoPointLinearSpring(forces, body1, station1, body2, station2, k, x0);

Constructor & Destructor Documentation

SimTK::GeneralForceSubsystem::GeneralForceSubsystem ( )
SimTK::GeneralForceSubsystem::GeneralForceSubsystem ( MultibodySystem )
explicit

Member Function Documentation

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.

Parameters
forceA 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.
Returns
A unique integer index for the adopted force element that can be used to retrieve this force element from the subsystem later if needed.
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.

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.


The documentation for this class was generated from the following file: