Simbody  3.7
SimTK::Force::Custom::Implementation Class Referenceabstract

Every custom force requires implementation of a class that is derived from this abstract class. See Force::Custom for details. More...

Public Member Functions

virtual ~Implementation ()
 
virtual void calcForce (const State &state, Vector_< SpatialVec > &bodyForces, Vector_< Vec3 > &particleForces, Vector &mobilityForces) const =0
 Calculate the force for a given state. More...
 
virtual Real calcPotentialEnergy (const State &state) const =0
 Calculate this force's contribution to the potential energy of the System. More...
 
virtual bool dependsOnlyOnPositions () const
 Get whether this force depends only on the position variables (q), not on the velocies (u) or auxiliary variables (z). More...
 
virtual bool shouldBeParallelIfPossible () const
 Returns a boolean flag telling Simbody whether this Force type should be calculated in parallel if possible. More...
 
virtual void calcDecorativeGeometryAndAppend (const State &state, Stage stage, Array_< DecorativeGeometry > &geometry) const
 Override this if you want to generate some geometry for the visualizer to display. More...
 
virtual void realizeTopology (State &state) const
 The following methods may optionally be overridden to do specialized realization for a Force. More...
 
virtual void realizeModel (State &state) const
 The following methods may optionally be overridden to do specialized realization for a Force. More...
 
virtual void realizeInstance (const State &state) const
 The following methods may optionally be overridden to do specialized realization for a Force. More...
 
virtual void realizeTime (const State &state) const
 The following methods may optionally be overridden to do specialized realization for a Force. More...
 
virtual void realizePosition (const State &state) const
 The following methods may optionally be overridden to do specialized realization for a Force. More...
 
virtual void realizeVelocity (const State &state) const
 The following methods may optionally be overridden to do specialized realization for a Force. More...
 
virtual void realizeDynamics (const State &state) const
 The following methods may optionally be overridden to do specialized realization for a Force. More...
 
virtual void realizeAcceleration (const State &state) const
 The following methods may optionally be overridden to do specialized realization for a Force. More...
 
virtual void realizeReport (const State &state) const
 The following methods may optionally be overridden to do specialized realization for a Force. More...
 

Detailed Description

Every custom force requires implementation of a class that is derived from this abstract class. See Force::Custom for details.

Constructor & Destructor Documentation

◆ ~Implementation()

virtual SimTK::Force::Custom::Implementation::~Implementation ( )
inlinevirtual

Member Function Documentation

◆ calcForce()

virtual void SimTK::Force::Custom::Implementation::calcForce ( const State state,
Vector_< SpatialVec > &  bodyForces,
Vector_< Vec3 > &  particleForces,
Vector mobilityForces 
) const
pure virtual

Calculate the force for a given state.

Parameters
statethe State for which to calculate the force
bodyForcesspatial forces on MobilizedBodies are accumulated in this. To apply a force to a body, add it to the appropriate element of this vector.
particleForcesforces on particles are accumulated in this. Since particles are not yet implemented, this is ignored.
mobilityForcesforces on individual mobilities (elements of the state's u vector) are accumulated in this. To apply a force to a mobility, add it to the appropriate element of this vector.

◆ calcPotentialEnergy()

virtual Real SimTK::Force::Custom::Implementation::calcPotentialEnergy ( const State state) const
pure virtual

Calculate this force's contribution to the potential energy of the System.

Parameters
statethe State for which to calculate the potential energy

◆ dependsOnlyOnPositions()

virtual bool SimTK::Force::Custom::Implementation::dependsOnlyOnPositions ( ) const
inlinevirtual

Get whether this force depends only on the position variables (q), not on the velocies (u) or auxiliary variables (z).

The default implementation returns false. If the force depends only on positions, you should override this to return true. This allows force calculations to be optimized in some cases.

◆ shouldBeParallelIfPossible()

virtual bool SimTK::Force::Custom::Implementation::shouldBeParallelIfPossible ( ) const
inlinevirtual

Returns a boolean flag telling Simbody whether this Force type should be calculated in parallel if possible.

By default, this method returns false.

Note
: By overriding this method, you are telling Simbody that (1) the Force class is computationally expensive to calculate and (2) the Force class is thread safe such that multiple instances of the Force class will not rely on any shared cache variables in the state. See getStateLock() in SimTK::State.

◆ realizeTopology()

virtual void SimTK::Force::Custom::Implementation::realizeTopology ( State state) const
inlinevirtual

The following methods may optionally be overridden to do specialized realization for a Force.

◆ realizeModel()

virtual void SimTK::Force::Custom::Implementation::realizeModel ( State state) const
inlinevirtual

The following methods may optionally be overridden to do specialized realization for a Force.

◆ realizeInstance()

virtual void SimTK::Force::Custom::Implementation::realizeInstance ( const State state) const
inlinevirtual

The following methods may optionally be overridden to do specialized realization for a Force.

◆ realizeTime()

virtual void SimTK::Force::Custom::Implementation::realizeTime ( const State state) const
inlinevirtual

The following methods may optionally be overridden to do specialized realization for a Force.

◆ realizePosition()

virtual void SimTK::Force::Custom::Implementation::realizePosition ( const State state) const
inlinevirtual

The following methods may optionally be overridden to do specialized realization for a Force.

◆ realizeVelocity()

virtual void SimTK::Force::Custom::Implementation::realizeVelocity ( const State state) const
inlinevirtual

The following methods may optionally be overridden to do specialized realization for a Force.

◆ realizeDynamics()

virtual void SimTK::Force::Custom::Implementation::realizeDynamics ( const State state) const
inlinevirtual

The following methods may optionally be overridden to do specialized realization for a Force.

◆ realizeAcceleration()

virtual void SimTK::Force::Custom::Implementation::realizeAcceleration ( const State state) const
inlinevirtual

The following methods may optionally be overridden to do specialized realization for a Force.

◆ realizeReport()

virtual void SimTK::Force::Custom::Implementation::realizeReport ( const State state) const
inlinevirtual

The following methods may optionally be overridden to do specialized realization for a Force.

◆ calcDecorativeGeometryAndAppend()

virtual void SimTK::Force::Custom::Implementation::calcDecorativeGeometryAndAppend ( const State state,
Stage  stage,
Array_< DecorativeGeometry > &  geometry 
) const
inlinevirtual

Override this if you want to generate some geometry for the visualizer to display.

Be sure to append the geometry to the list.


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