Simbody  3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SimTK::MultibodySystem Class Reference

The job of the MultibodySystem class is to coordinate the activities of various subsystems which can be part of a multibody system. More...

+ Inheritance diagram for SimTK::MultibodySystem:

Public Member Functions

 MultibodySystem ()
 
 MultibodySystem (SimbodyMatterSubsystem &m)
 
int addForceSubsystem (ForceSubsystem &)
 
int setMatterSubsystem (SimbodyMatterSubsystem &)
 
const SimbodyMatterSubsystemgetMatterSubsystem () const
 
SimbodyMatterSubsystemupdMatterSubsystem ()
 
bool hasMatterSubsystem () const
 
int setDecorationSubsystem (DecorationSubsystem &)
 
const DecorationSubsystemgetDecorationSubsystem () const
 
DecorationSubsystemupdDecorationSubsystem ()
 
bool hasDecorationSubsystem () const
 
int setContactSubsystem (GeneralContactSubsystem &)
 
const GeneralContactSubsystemgetContactSubsystem () const
 
GeneralContactSubsystemupdContactSubsystem ()
 
bool hasContactSubsystem () const
 
const Real calcPotentialEnergy (const State &) const
 Calculate the total potential energy of the system. More...
 
const Real calcKineticEnergy (const State &) const
 Calculate the total kinetic energy of the system. More...
 
Real calcEnergy (const State &s) const
 Calculate the total energy of the system. More...
 
const Vector_< SpatialVec > & getRigidBodyForces (const State &, Stage) const
 
const Vector_< Vec3 > & getParticleForces (const State &, Stage) const
 
const VectorgetMobilityForces (const State &, Stage) const
 
Vector_< SpatialVec > & updRigidBodyForces (const State &, Stage) const
 
Vector_< Vec3 > & updParticleForces (const State &, Stage) const
 
VectorupdMobilityForces (const State &, Stage) const
 
 SimTK_PIMPL_DOWNCAST (MultibodySystem, System)
 
class MultibodySystemRep & updRep ()
 
const MultibodySystemRep & getRep () const
 
- Public Member Functions inherited from SimTK::System
SystemsetUpDirection (const CoordinateDirection &up)
 This is a hint to other software as to which way this System's designer considers to be "up". More...
 
SystemsetUseUniformBackground (bool useUniformBackground)
 This is a hint to visualization software that this System is best viewed against a uniform background (e.g. all white) rather than against a ground plane. More...
 
SystemsetDefaultTimeScale (Real tc)
 (Advanced) This is a hint used for some default behaviors, such as determining an initial step size for an integrator, or the default unit error for a constraint error derivative from the original constraint. More...
 
SystemsetDefaultLengthScale (Real lc)
 (Advanced) This is a hint that can be used to get a sense of what a "unit length" looks like for this System in the units it uses. More...
 
void setHasTimeAdvancedEvents (bool)
 This determines whether this System wants to be notified whenever time advances irreversibly. More...
 
CoordinateDirection getUpDirection () const
 Get the current setting of the "up" direction hint. More...
 
bool getUseUniformBackground () const
 Get the current setting of the "use uniform background" visualization hint. More...
 
Real getDefaultTimeScale () const
 Get the currently-set value for the default time scale, 0.1 time units if it has never been set. More...
 
Real getDefaultLengthScale () const
 Get the currently-set value for the default length scale, 1 length unit if it has never been set. More...
 
bool hasTimeAdvancedEvents () const
 Return the current value of the flag indicating whether this System wants an event generated whenever time advances irreversibly. More...
 
void addEventHandler (ScheduledEventHandler *handler)
 Add a ScheduledEventHandler to this System, which takes over ownership of the event handler object. More...
 
void addEventHandler (TriggeredEventHandler *handler)
 Add a TriggeredEventHandler to this System, which takes over ownership of the event handler object. More...
 
void addEventReporter (ScheduledEventReporter *handler) const
 Add a ScheduledEventReporter to this System, which takes over ownership of the event reporter object. More...
 
void addEventReporter (TriggeredEventReporter *handler) const
 Add a TriggeredEventReporter to this System, which takes over ownership of the event reporter object. More...
 
const StaterealizeTopology () const
 The following call must be made after any topological change has been made to this System, before the System can be used to perform any computations. More...
 
const StategetDefaultState () const
 This is available after realizeTopology(), and will throw an exception if realizeTopology() has not been called since the most recent topological change to this System. More...
 
StateupdDefaultState ()
 Don't use this; make a copy of the default state instead and modify your copy. More...
 
void realizeModel (State &state) const
 Realize the model to be used for subsequent computations with the given state. More...
 
void realize (const State &state, Stage stage=Stage::HighestRuntime) const
 Realize the given state to the indicated stage. More...
 
void project (State &state, Real accuracy=-1) const
 Apply prescribed motion and attempt to satisfy all position and velocity constraints by projecting the generalized coordinates q and generalized speeds u onto the position and velocity constraint manifolds. More...
 
void projectQ (State &state, Real accuracy=-1) const
 Set prescribed positions q=q(t) and attempt to satisfy position constraints by modifying the remaining free q's. More...
 
void projectU (State &state, Real accuracy=-1) const
 Set prescribed velocities u=u(t,q) and attempt to satisfy velocity constraints by modifying the remaining free u's. More...
 
void projectQ (State &state, Vector &qErrEst, const ProjectOptions &options, ProjectResults &results) const
 (Advanced) Project free q's so that position constraints are satisfied and remove the corresponding error from the supplied error estimate. More...
 
void projectU (State &state, Vector &uErrEst, const ProjectOptions &options, ProjectResults &results) const
 (Advanced) Project free u's so that velocity constraints are satisfied and remove the corresponding error from the supplied error estimate. More...
 
void prescribe (State &state) const
 Set values for prescribed positions q and velocities u. More...
 
bool prescribeQ (State &state) const
 This solver sets prescribed q's to their known values q=q(t) as a function of time (and possibly earlier-stage discrete state variables). More...
 
bool prescribeU (State &state) const
 This solver sets prescribed u's to their known values u=u(t,q) as a function of time and position variables q (and possibly earlier-stage discrete state variables). More...
 
void getFreeQIndex (const State &state, Array_< SystemQIndex > &freeQs) const
 Return the indices of the q's in the given state that are free; that is, they are not affected by prescribeQ(). More...
 
void getFreeUIndex (const State &state, Array_< SystemUIndex > &freeUs) const
 Return the indices of the u's in the given state that are free; that is, they are not affected by prescribeU(). More...
 
void handleEvents (State &state, Event::Cause cause, const Array_< EventId > &eventIds, const HandleEventsOptions &options, HandleEventsResults &results) const
 This solver handles a set of events which a TimeStepper has denoted as having occurred at the given time and state. More...
 
void reportEvents (const State &state, Event::Cause cause, const Array_< EventId > &eventIds) const
 This method is similar to handleEvents(), but does not allow the State to be modified. More...
 
void calcEventTriggerInfo (const State &state, Array_< EventTriggerInfo > &triggerInfo) const
 This routine provides the Integrator with information it needs about the individual event trigger functions, such as which sign transitions are relevant and how tightly we need to localize. More...
 
void calcTimeOfNextScheduledEvent (const State &state, Real &tNextEvent, Array_< EventId > &eventIds, bool includeCurrentTime) const
 This routine should be called to determine if and when there is an event scheduled to occur at a particular time. More...
 
void calcTimeOfNextScheduledReport (const State &state, Real &tNextEvent, Array_< EventId > &eventIds, bool includeCurrentTime) const
 This routine is similar to calcTimeOfNextScheduledEvent(), but is used for "reporting events" which do not modify the state. More...
 
void relax (State &state, Stage stage, Real accuracy=-1) const
 This optional method should modify fast variables at the given stage until they satisfy some relaxation criteria. More...
 
void multiplyByN (const State &state, const Vector &u, Vector &dq) const
 Calculate dq=N*u in O(n) time (very fast). More...
 
void multiplyByNTranspose (const State &state, const Vector &fq, Vector &fu) const
 Calculate fu=~N*fq in O(n) time (very fast). More...
 
void multiplyByNPInv (const State &state, const Vector &dq, Vector &u) const
 Calculate u=pinv(N)*dq in O(n) time (very fast). More...
 
void multiplyByNPInvTranspose (const State &state, const Vector &fu, Vector &fq) const
 Calculate fq=~pinv(N)*fu in O(n) time (very fast). More...
 
void resetAllCountersToZero ()
 Zero out the statistics for this System. More...
 
int getNumRealizationsOfThisStage (Stage) const
 Whenever the system was realized from Stage-1 to the indicated Stage, this counter is bumped. More...
 
int getNumRealizeCalls () const
 Return the total number of calls to realizeTopology(), realizeModel(), or realize(), regardless of whether these routines actually did anything when called. More...
 
int getNumPrescribeQCalls () const
 Return the total number of calls to the System's prescribeQ() method. More...
 
int getNumPrescribeUCalls () const
 Return the total number of calls to the System's prescribeU() method. More...
 
int getNumProjectQCalls () const
 Return the total number of calls to projectQ(), regardless of whether the call did anything. More...
 
int getNumFailedProjectQCalls () const
 Return the total number of calls to projectQ() that failed. More...
 
int getNumQProjections () const
 How many of the successful projectQ() calls actually did a constraint projection, rather than returning quickly? More...
 
int getNumQErrorEstimateProjections () const
 How many of the projectQ() calls that did a constraint projection also projected an error estimate? More...
 
int getNumProjectUCalls () const
 Return the total number of calls to projectU(), regardless of whether the call did anything. More...
 
int getNumFailedProjectUCalls () const
 Return the total number of calls to projectU() that failed. More...
 
int getNumUProjections () const
 How many of the successful projectU() calls actually did a constraint projection, rather than returning quickly? More...
 
int getNumUErrorEstimateProjections () const
 How many of the projectU() calls that did a constraint projection also projected an error estimate? More...
 
int getNumHandlerCallsThatChangedStage (Stage) const
 handleEvents() reports the lowest Stage it modified and we bump the counter for that Stage. More...
 
int getNumHandleEventCalls () const
 This is the total number of calls to handleEvents() regardless of the outcome. More...
 
int getNumReportEventCalls () const
 This is the total number of calls to reportEvents() regardless of the outcome. More...
 
 System ()
 Default constructor creates an empty handle. More...
 
 System (const System &)
 Copy constructor (untested). More...
 
Systemoperator= (const System &)
 Copy assignment (untested). More...
 
 ~System ()
 Destructor here will invoke the virtual destructor in the System::Guts class and thus clean up all unneeded detritus owned by this System. More...
 
const StringgetName () const
 Return the name assigned to this System (arbitrary). More...
 
const StringgetVersion () const
 Return the version string assigned to this System (arbitrary). More...
 
SubsystemIndex adoptSubsystem (Subsystem &child)
 Take over ownership of the supplied subsystem and install it into the next free subsystem slot. More...
 
int getNumSubsystems () const
 How may Subsystems are in here? More...
 
const SubsystemgetSubsystem (SubsystemIndex) const
 Obtain read-only access to a particular subsystem by its index. More...
 
SubsystemupdSubsystem (SubsystemIndex)
 Obtain writable access to a particular subsystem by its index. More...
 
const DefaultSystemSubsystemgetDefaultSubsystem () const
 Get read-only access to the default subsystem which is present in every system. More...
 
DefaultSystemSubsystemupdDefaultSubsystem ()
 Get writable access to the default subsystem which is present in every system. More...
 
 operator const Subsystem & () const
 Implicitly convert this System into a const Subsystem reference; this actually returns a reference to the DefaultSystemSubsystem contained in this System. More...
 
 operator Subsystem & ()
 Implicitly convert this System into a writable Subsystem reference; this actually returns a reference to the DefaultSystemSubsystem contained in this System. More...
 
bool systemTopologyHasBeenRealized () const
 (Advanced) You can check whether realizeTopology() has been called since the last topological change to this Syatem. More...
 
StageVersion getSystemTopologyCacheVersion () const
 (Advanced) Return the current version number of this system's Topology cache information. More...
 
void setSystemTopologyCacheVersion (StageVersion topoVersion) const
 (Really advanced) Set the current version number of this system's Topology cache information. More...
 
void invalidateSystemTopologyCache () const
 (Advanced) Mark the Topology stage of this system and all its subsystems "not realized." This is normally handled automatically by whenever you make a Topology-stage change to any subsystem. More...
 
void calcDecorativeGeometryAndAppend (const State &, Stage, Array_< DecorativeGeometry > &) const
 (Advanced) Generate all decorative geometry computable at a specific stage; this is useful for visualizers. More...
 
bool isSameSystem (const System &otherSystem) const
 There can be multiple handles referring to the same System::Guts object; they are considered to be the same System. More...
 
const GutsgetSystemGuts () const
 Obtain a const reference to the System::Guts object to which this handle refers. More...
 
GutsupdSystemGuts ()
 Obtain a writable reference to the System::Guts object to which this handle refers. More...
 
void adoptSystemGuts (System::Guts *g)
 Put new unowned Guts into this *empty* handle and take over ownership. More...
 
 System (System::Guts *g)
 Constructor for internal use only. More...
 
bool hasGuts () const
 Return true if this System handle is not empty. More...
 
bool isOwnerHandle () const
 Internal use only. More...
 
bool isEmptyHandle () const
 Internal use only. More...
 

Protected Member Functions

 MultibodySystem (MultibodySystemRep *)
 

Detailed Description

The job of the MultibodySystem class is to coordinate the activities of various subsystems which can be part of a multibody system.

We insist on having exactly one SimbodyMatterSubsystem, and we would like also to have:

Constructor & Destructor Documentation

SimTK::MultibodySystem::MultibodySystem ( )
SimTK::MultibodySystem::MultibodySystem ( SimbodyMatterSubsystem m)
explicit
SimTK::MultibodySystem::MultibodySystem ( MultibodySystemRep *  )
explicitprotected

Member Function Documentation

int SimTK::MultibodySystem::addForceSubsystem ( ForceSubsystem )
int SimTK::MultibodySystem::setMatterSubsystem ( SimbodyMatterSubsystem )
const SimbodyMatterSubsystem& SimTK::MultibodySystem::getMatterSubsystem ( ) const
SimbodyMatterSubsystem& SimTK::MultibodySystem::updMatterSubsystem ( )
bool SimTK::MultibodySystem::hasMatterSubsystem ( ) const
int SimTK::MultibodySystem::setDecorationSubsystem ( DecorationSubsystem )
const DecorationSubsystem& SimTK::MultibodySystem::getDecorationSubsystem ( ) const
DecorationSubsystem& SimTK::MultibodySystem::updDecorationSubsystem ( )
bool SimTK::MultibodySystem::hasDecorationSubsystem ( ) const
int SimTK::MultibodySystem::setContactSubsystem ( GeneralContactSubsystem )
const GeneralContactSubsystem& SimTK::MultibodySystem::getContactSubsystem ( ) const
GeneralContactSubsystem& SimTK::MultibodySystem::updContactSubsystem ( )
bool SimTK::MultibodySystem::hasContactSubsystem ( ) const
const Real SimTK::MultibodySystem::calcPotentialEnergy ( const State ) const

Calculate the total potential energy of the system.

The state must be at Dynamics stage or later.

const Real SimTK::MultibodySystem::calcKineticEnergy ( const State ) const

Calculate the total kinetic energy of the system.

The state must be at Velocity stage or later.

Real SimTK::MultibodySystem::calcEnergy ( const State s) const
inline

Calculate the total energy of the system.

The state must be at Dynamics stage or later.

const Vector_<SpatialVec>& SimTK::MultibodySystem::getRigidBodyForces ( const State ,
Stage   
) const
const Vector_<Vec3>& SimTK::MultibodySystem::getParticleForces ( const State ,
Stage   
) const
const Vector& SimTK::MultibodySystem::getMobilityForces ( const State ,
Stage   
) const
Vector_<SpatialVec>& SimTK::MultibodySystem::updRigidBodyForces ( const State ,
Stage   
) const
Vector_<Vec3>& SimTK::MultibodySystem::updParticleForces ( const State ,
Stage   
) const
Vector& SimTK::MultibodySystem::updMobilityForces ( const State ,
Stage   
) const
SimTK::MultibodySystem::SimTK_PIMPL_DOWNCAST ( MultibodySystem  ,
System   
)
class MultibodySystemRep& SimTK::MultibodySystem::updRep ( )
const MultibodySystemRep& SimTK::MultibodySystem::getRep ( ) const

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