Go to the documentation of this file.
16 #ifndef SURGSIM_PHYSICS_SPRING_H
17 #define SURGSIM_PHYSICS_SPRING_H
58 size_t getNodeId(
size_t springNodeId)
const;
69 double scale = 1.0) = 0;
77 double scale = 1.0) = 0;
85 double scale = 1.0) = 0;
115 #endif // SURGSIM_PHYSICS_SPRING_H
virtual ~Spring()
Virtual destructor.
Definition: Spring.cpp:23
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 stiff...
The state of an ode of 2nd order of the form with boundary conditions.
Definition: OdeState.h:38
Base class for all springs It handles the node ids to which it is connected and requires all derived ...
Definition: Spring.h:42
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 ...
Definition: CompoundShapeToGraphics.cpp:29
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)
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...
const std::vector< size_t > & getNodeIds() const
Gets the node ids for this spring.
Definition: Spring.cpp:40
Eigen::SparseMatrix< double > SparseMatrix
A sparse matrix.
Definition: SparseMatrix.h:32
virtual void initialize(const SurgSim::Math::OdeState &state)
Initialize the Spring once everything has been set.
Definition: Spring.cpp:26
size_t getNumNodes() const
Gets the number of nodes the spring is connecting.
Definition: Spring.cpp:30
std::vector< size_t > m_nodeIds
Node ids connected by this spring.
Definition: Spring.h:108
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
A dynamic size column vector.
Definition: Vector.h:68
size_t getNodeId(size_t springNodeId) const
Gets the springNodeId-th node id.
Definition: Spring.cpp:35
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) ...