Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
SurgSim::Physics::Computation Class Referenceabstract

Encapsulates a calculation over a selection of objects, needs to be subclassed to be used. More...

#include <SurgSim/Physics/Computation.h>

Inheritance diagram for SurgSim::Physics::Computation:
SurgSim::Physics::BuildMlcp SurgSim::Physics::CcdCollision SurgSim::Physics::CcdCollisionLoop SurgSim::Physics::ComputationGroup SurgSim::Physics::ContactConstraintGeneration SurgSim::Physics::ContactFiltering SurgSim::Physics::DcdCollision SurgSim::Physics::FreeMotion SurgSim::Physics::ParticleCollisionResponse SurgSim::Physics::PostUpdate SurgSim::Physics::PrepareCollisionPairs SurgSim::Physics::PreUpdate SurgSim::Physics::PushResults SurgSim::Physics::SolveMlcp SurgSim::Physics::UpdateCcdData SurgSim::Physics::UpdateCollisionData SurgSim::Physics::UpdateCollisionRepresentations SurgSim::Physics::UpdateDcdData

Public Member Functions

 Computation (bool doCopyState)
 Constructor. More...
 
virtual ~Computation ()
 Destructor. More...
 
std::shared_ptr< PhysicsManagerStateupdate (double dt, const std::shared_ptr< PhysicsManagerState > &state)
 Public Interface execute this objects computations, dt is the time from the last update call in seconds. More...
 
void setDoCopyState (bool val)
 Sets up whether the computation will copy the state of PhysicsManagerState before executing. More...
 
bool isCopyingState ()
 Query if this object is copying the PhysicsManagerState. More...
 
virtual std::string getClassName () const =0
 The class name for this class. More...
 
Framework::TimergetTimer ()
 Provides access to the update timer. More...
 

Protected Member Functions

virtual std::shared_ptr< PhysicsManagerStatedoUpdate (const double &dt, const std::shared_ptr< PhysicsManagerState > &state)=0
 Override this function to implement the computations specific behavior. More...
 

Private Member Functions

std::shared_ptr< PhysicsManagerStatepreparePhysicsState (const std::shared_ptr< PhysicsManagerState > &state)
 Copy the PhysicsManagerState object when isCopyingState() is true. More...
 

Private Attributes

bool m_copyState
 
Framework::Timer m_timer
 The update timer. More...
 

Detailed Description

Encapsulates a calculation over a selection of objects, needs to be subclassed to be used.

Constructor & Destructor Documentation

◆ Computation()

SurgSim::Physics::Computation::Computation ( bool  doCopyState)
explicit

Constructor.

Parameters
doCopyStateSpecify if the output state in Computation::Update() is a copy or not of the input state

◆ ~Computation()

SurgSim::Physics::Computation::~Computation ( )
virtual

Destructor.

Member Function Documentation

◆ doUpdate()

virtual std::shared_ptr<PhysicsManagerState> SurgSim::Physics::Computation::doUpdate ( const double &  dt,
const std::shared_ptr< PhysicsManagerState > &  state 
)
protectedpure virtual

◆ getClassName()

virtual std::string SurgSim::Physics::Computation::getClassName ( ) const
pure virtual

The class name for this class.

Note
Use the SURGSIM_CLASSNAME macro in derived classes.
Returns
The fully namespace qualified name of this class.

◆ getTimer()

Framework::Timer & SurgSim::Physics::Computation::getTimer ( )

Provides access to the update timer.

Returns
The timer.

◆ isCopyingState()

bool SurgSim::Physics::Computation::isCopyingState ( )

Query if this object is copying the PhysicsManagerState.

Returns
true if copying the state, false if not.

◆ preparePhysicsState()

std::shared_ptr< PhysicsManagerState > SurgSim::Physics::Computation::preparePhysicsState ( const std::shared_ptr< PhysicsManagerState > &  state)
private

Copy the PhysicsManagerState object when isCopyingState() is true.

◆ setDoCopyState()

void SurgSim::Physics::Computation::setDoCopyState ( bool  val)

Sets up whether the computation will copy the state of PhysicsManagerState before executing.

Parameters
valWhether to create a copy of the PhysicsState before running the update fuction.

◆ update()

std::shared_ptr< PhysicsManagerState > SurgSim::Physics::Computation::update ( double  dt,
const std::shared_ptr< PhysicsManagerState > &  state 
)

Public Interface execute this objects computations, dt is the time from the last update call in seconds.

Parameters
dtThe time passed from the last update in seconds.
stateThe physics state.
Returns
The changed state of the, depending on the setting of doCopyState this is either the same instance or a copied instance of the physics state.

Member Data Documentation

◆ m_copyState

bool SurgSim::Physics::Computation::m_copyState
private

◆ m_timer

Framework::Timer SurgSim::Physics::Computation::m_timer
private

The update timer.


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