opensurgsim
|
Base class for all springs It handles the node ids to which it is connected and requires all derived classes to compute the force and its derivatives (the stiffness and damping matrices) A extra method also exist to compute all of them at once for performance purposes. More...
#include <Spring.h>
Public Member Functions | |
virtual | ~Spring () |
Virtual destructor. | |
virtual void | initialize (const SurgSim::Math::OdeState &state) |
Initialize the Spring once everything has been set. More... | |
size_t | getNumNodes () const |
Gets the number of nodes the spring is connecting. More... | |
size_t | getNodeId (size_t springNodeId) const |
Gets the springNodeId-th node id. More... | |
const std::vector< size_t > & | getNodeIds () const |
Gets the node ids for this spring. More... | |
virtual void | addForce (const SurgSim::Math::OdeState &state, SurgSim::Math::Vector *F, double scale=1.0)=0 |
Adds the spring force (computed for a given state) to a complete system force vector F (assembly) More... | |
virtual void | addDamping (const SurgSim::Math::OdeState &state, SurgSim::Math::SparseMatrix *D, double scale=1.0)=0 |
Adds the spring damping matrix D (= -df/dv) (computed for a given state) to a complete system damping matrix D (assembly) More... | |
virtual void | addStiffness (const SurgSim::Math::OdeState &state, SurgSim::Math::SparseMatrix *K, double scale=1.0)=0 |
Adds the spring stiffness matrix K (= -df/dx) (computed for a given state) to a complete system stiffness matrix K (assembly) More... | |
virtual void | addFDK (const SurgSim::Math::OdeState &state, SurgSim::Math::Vector *F, SurgSim::Math::SparseMatrix *D, SurgSim::Math::SparseMatrix *K)=0 |
Adds the spring force vector, mass, stiffness and damping matrices (computed for a given state) into a complete system data structure F, D, K (assembly) More... | |
virtual void | addMatVec (const SurgSim::Math::OdeState &state, double alphaD, double alphaK, const SurgSim::Math::Vector &x, SurgSim::Math::Vector *F)=0 |
Adds the spring matrix-vector contribution F += (alphaD.D + alphaK.K).x (computed for a given state) into a complete system data structure F (assembly) More... | |
Protected Attributes | |
std::vector< size_t > | m_nodeIds |
Node ids connected by this spring. | |
Base class for all springs It handles the node ids to which it is connected and requires all derived classes to compute the force and its derivatives (the stiffness and damping matrices) A extra method also exist to compute all of them at once for performance purposes.
It holds on to the actual computed values (m_f, m_K, m_D) as its size is not predefined from outside and would requires intensive (de)allocation or a temporary variable anyway
|
pure virtual |
Adds the spring damping matrix D (= -df/dv) (computed for a given state) to a complete system damping matrix D (assembly)
state | The state to compute the damping matrix with | |
[in,out] | D | The complete system damping matrix to add the spring damping matrix into |
scale | A factor to scale the added damping matrix with |
Implemented in SurgSim::Physics::LinearSpring.
|
pure virtual |
Adds the spring force vector, mass, stiffness and damping matrices (computed for a given state) into a complete system data structure F, D, K (assembly)
state | The state to compute everything with | |
[in,out] | F | The complete system force vector to add the spring force into |
[in,out] | D | The complete system damping matrix to add the spring damping matrix into |
[in,out] | K | The complete system stiffness matrix to add the spring stiffness matrix into |
Implemented in SurgSim::Physics::LinearSpring.
|
pure virtual |
Adds the spring force (computed for a given state) to a complete system force vector F (assembly)
state | The state to compute the force with | |
[in,out] | F | The complete system force vector to add the spring force into |
scale | A factor to scale the added force with |
Implemented in SurgSim::Physics::LinearSpring.
|
pure virtual |
Adds the spring matrix-vector contribution F += (alphaD.D + alphaK.K).x (computed for a given state) into a complete system data structure F (assembly)
state | The state to compute everything with | |
alphaD | The scaling factor for the damping contribution | |
alphaK | The scaling factor for the stiffness contribution | |
x | A complete system vector to use as the vector in the matrix-vector multiplication | |
[in,out] | F | The complete system force vector to add the element matrix-vector contribution into |
Implemented in SurgSim::Physics::LinearSpring.
|
pure virtual |
Adds the spring stiffness matrix K (= -df/dx) (computed for a given state) to a complete system stiffness matrix K (assembly)
state | The state to compute the stiffness matrix with | |
[in,out] | K | The complete system stiffness matrix to add the spring stiffness matrix into |
scale | A factor to scale the added stiffness matrix with |
Implemented in SurgSim::Physics::MockSpring, and SurgSim::Physics::LinearSpring.
size_t SurgSim::Physics::Spring::getNodeId | ( | size_t | springNodeId | ) | const |
Gets the springNodeId-th node id.
const std::vector< size_t > & SurgSim::Physics::Spring::getNodeIds | ( | ) | const |
Gets the node ids for this spring.
size_t SurgSim::Physics::Spring::getNumNodes | ( | ) | const |
Gets the number of nodes the spring is connecting.
|
virtual |
Initialize the Spring once everything has been set.
state | The state to initialize the Spring with |
Reimplemented in SurgSim::Physics::LinearSpring.