Force Class Reference

This is the base class from which all Force element handle classes derive. More...

#include <Force.h>

Inheritance diagram for Force:
PIMPLHandle< Force, ForceImpl, true > ElasticFoundationForce ConstantForce ConstantTorque Custom GlobalDamper Gravity LinearBushing MobilityConstantForce MobilityLinearDamper MobilityLinearSpring Thermostat TwoPointConstantForce TwoPointLinearDamper TwoPointLinearSpring UniformGravity HuntCrossleyForce

List of all members.

Classes

class  ConstantForce
 A constant force applied to a body station. More...
class  ConstantTorque
 A constant torque to a body. More...
class  Custom
 This class can be used to define new forces. More...
class  GlobalDamper
 A general energy "drain" on the system. More...
class  Gravity
 This force element represents a uniform gravitational field applied to a set of bodies. More...
class  LinearBushing
 This force element represents a bushing acting to connect a frame F fixed on one body (B1) to a frame M fixed on a second body (B2), by a massless, compliant element with linear stiffness and damping properties. More...
class  MobilityConstantForce
 A constant (scalar) "force" f applied to a mobility. More...
class  MobilityLinearDamper
 A linear damper on a mobility coordinate. More...
class  MobilityLinearSpring
 A linear spring along or around a mobility coordinate. More...
class  Thermostat
 This is a feedback-controlled force that uses Nose'-Hoover chains to maintain a particular temperature Tb, as though the system were immersed in an infinite heat bath at that temperature. More...
class  TwoPointConstantForce
 A constant force f (a signed scalar) which acts along the line between two points, specified as a station on each of two bodies. More...
class  TwoPointLinearDamper
 A force which resists changes in the distance between two points, acting along the line between those points. More...
class  TwoPointLinearSpring
 A linear spring between two points, specified as a station on each of two bodies. More...
class  UniformGravity
 A uniform gravitational force applied to every body in the system. More...

Public Member Functions

Enabling and disabling

These methods determine whether this force element is active in a given State.

When disabled, the Force element is completely ignored and will not be updated during realization. Normally force elements are enabled when defined unless explicitly disabled; you can reverse that using the setDisabledByDefault() method below.



void disable (State &) const
 Disable this force element, effectively removing it from the System for computational purposes (it is still using its ForceIndex, however).
void enable (State &) const
 Enable this force element if it was previously disabled.
bool isDisabled (const State &) const
 Test whether this force element is currently disabled in the supplied State.
void setDisabledByDefault (bool shouldBeDisabled)
 Normally force elements are enabled when defined and can be disabled later.
bool isDisabledByDefault () const
 Test whether this force element is disabled by default in which case it must be explicitly enabled before it will take effect.
Advanced methods

Don't use these unless you're sure you know what you're doing.

They aren't normally necessary but can be handy sometimes, especially when debugging newly-developed force elements.



void calcForceContribution (const State &state, Vector_< SpatialVec > &bodyForces, Vector_< Vec3 > &particleForces, Vector &mobilityForces) const
 Calculate the force that would be applied by this force element if the given state were realized to Dynamics stage.
Real calcPotentialEnergyContribution (const State &state) const
 Calculate the potential energy contribution that is made by this force element at the given state.
Bookkeeping

These methods are not normally needed.

They provide bookkeeping information such as access to the parent force subsystem and the force index assigned to this force element.



 Force ()
 Default constructor for Force handle base class does nothing.
 operator ForceIndex () const
 Implicit conversion to ForceIndex when needed.
const GeneralForceSubsystemgetForceSubsystem () const
 Get the GeneralForceSubsystem of which this Force is an element.
ForceIndex getForceIndex () const
 Get the index of this force element within its parent force subsystem.

Protected Member Functions

 Force (ForceImpl *r)
 Use this in a derived Force handle class constructor to supply the concrete implementation object to be stored in the handle base.

Detailed Description

This is the base class from which all Force element handle classes derive.

A Force object applies forces to some or all of the bodies, particles, and mobilities in a System. There are subclasses for various standard types of forces, or you can create your own forces by deriving from Force::Custom.


Constructor & Destructor Documentation

Force (  )  [inline]

Default constructor for Force handle base class does nothing.

Force ( ForceImpl *  r  )  [inline, explicit, protected]

Use this in a derived Force handle class constructor to supply the concrete implementation object to be stored in the handle base.


Member Function Documentation

void calcForceContribution ( const State state,
Vector_< SpatialVec > &  bodyForces,
Vector_< Vec3 > &  particleForces,
Vector mobilityForces 
) const

Calculate the force that would be applied by this force element if the given state were realized to Dynamics stage.

This sizes the given arrays if necessary, zeroes them, and then calls the force element's calcForce() method which adds its force contributions if any to the appropriate array elements for bodies, particles, and mobilities. Note that in general we have no idea what elements of the system are affected by a force element, and in fact that can change based on state and time (consider contact forces, for example). A disabled force element will return all zeroes without invoking calcForce(), since that method may depend on earlier computations which may not have been performed in that case.

Parameters:
[in] state The State containing information to be used by the force element to calculate the current force. This must have already been realized to a high enough stage for the force element to get what it needs; if you don't know then realize it to Stage::Velocity.
[out] bodyForces This is a Vector of spatial forces, one per mobilized body in the matter subsystem associated with this force element. This Vector is indexed by MobilizedBodyIndex so it has a 0th entry corresponding to Ground. A spatial force contains two Vec3's; index with [0] to get the moment vector, with [1] to get the force vector. This argument is resized if necessary to match the number of mobilized bodies and any unused entry will be set to zero on return.
[out] particleForces This is a Vector of force vectors, one per particle in the matter subsystem associated with this force element. This vector is indexed by ParticleIndex; the 0th entry is the 1st particle, not Ground. This argument is resized if necessary to match the number of particles and any unused entry will be set to zero on return. (As of March 2010 Simbody treats particles as mobilized bodies so this is unused.)
[out] mobilityForces This is a Vector of scalar generalized forces, one per mobility in the matter subsystem associated with this force element. This is the same as the number of generalized speeds u that collectively represent all the mobilities of the mobilizers. To determine the per-mobilizer correspondence, you must call methods of MobilizedBody; there is no hint here.
Note:
This method must zero out the passed in arrays, and in most cases almost all returned entries will be zero, so this is not the most efficent way to calculate forces; use it sparingly.
Real calcPotentialEnergyContribution ( const State state  )  const

Calculate the potential energy contribution that is made by this force element at the given state.

This calls the force element's calcPotentialEnergy() method. A disabled force element will return zero without invoking calcPotentialEnergy().

Parameters:
[in] state The State containing information to be used by the force element to calculate the current potential energy. This must have already been realized to a high enough stage for the force element to get what it needs; if you don't know then realize it to Stage::Position.
Returns:
The potential energy contribution of this force element at this state value.
void disable ( State  )  const

Disable this force element, effectively removing it from the System for computational purposes (it is still using its ForceIndex, however).

This is an Instance-stage change.

void enable ( State  )  const

Enable this force element if it was previously disabled.

This is an Instance-stage change. Nothing happens if the force element was already enabled.

ForceIndex getForceIndex (  )  const

Get the index of this force element within its parent force subsystem.

The returned index will be invalid if the force element has not yet been adopted by any subsystem (test with the index.isValid() method).

const GeneralForceSubsystem& getForceSubsystem (  )  const

Get the GeneralForceSubsystem of which this Force is an element.

This will throw an exception if the force element has not yet been adopted by a force subsystem.

bool isDisabled ( const State  )  const

Test whether this force element is currently disabled in the supplied State.

If it is disabled you cannot depend on any computations it normally performs being available.

bool isDisabledByDefault (  )  const

Test whether this force element is disabled by default in which case it must be explicitly enabled before it will take effect.

See also:
enable()
operator ForceIndex (  )  const [inline]

Implicit conversion to ForceIndex when needed.

This will throw an exception if the force element has not yet been adopted by a force subsystem.

void setDisabledByDefault ( bool  shouldBeDisabled  ) 

Normally force elements are enabled when defined and can be disabled later.

If you want to define this force element but have it be off by default, use this method. Note that this is a Topology-stage (construction) change; you will have to call realizeTopology() before using the containing System after a change to this setting has been made.


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

Generated on Thu Aug 12 16:37:59 2010 for SimTKcore by  doxygen 1.6.1