Go to the documentation of this file.
16 #ifndef SURGSIM_PHYSICS_LINEARSPRING_H
17 #define SURGSIM_PHYSICS_LINEARSPRING_H
83 double scale = 1.0)
override;
143 #endif // SURGSIM_PHYSICS_LINEARSPRING_H
void addStiffness(const SurgSim::Math::OdeState &state, SurgSim::Math::SparseMatrix *K, double scale=1.0) override
Adds the spring stiffness matrix K (= -df/dx) (computed for a given state) to a complete system stiff...
Definition: LinearSpring.cpp:141
The state of an ode of 2nd order of the form with boundary conditions.
Definition: OdeState.h:39
bool operator==(const Spring &spring) const
Comparison operator (equality)
Definition: LinearSpring.cpp:297
Base class for all springs It handles the node ids to which it is connected and requires all derived ...
Definition: Spring.h:43
void setStiffness(double stiffness)
Sets the spring stiffness parameter.
Definition: LinearSpring.cpp:50
bool computeDampingAndStiffness(const SurgSim::Math::OdeState &state, SurgSim::Math::Matrix33d *De, SurgSim::Math::Matrix33d *Ke)
Compute the stiffness matrix Ke = -dF1/dx1 and damping matrix De = -dF1/dv1 of this spring for a give...
Definition: LinearSpring.cpp:259
void addMatVec(const SurgSim::Math::OdeState &state, double alphaD, double alphaK, const SurgSim::Math::Vector &vector, SurgSim::Math::Vector *F) override
Adds the spring matrix-vector contribution F += (alphaD.D + alphaK.K).x (computed for a given state) ...
Definition: LinearSpring.cpp:226
double getStiffness() const
Gets the spring stiffness parameter.
Definition: LinearSpring.cpp:56
Definition: CompoundShapeToGraphics.cpp:30
Eigen::Matrix< double, 3, 3, Eigen::RowMajor > Matrix33d
A 3x3 matrix of doubles.
Definition: Matrix.h:51
void addFDK(const SurgSim::Math::OdeState &state, SurgSim::Math::Vector *F, SurgSim::Math::SparseMatrix *D, SurgSim::Math::SparseMatrix *K) override
Adds the spring force vector, mass, stiffness and damping matrices (computed for a given state) into ...
Definition: LinearSpring.cpp:174
double getDamping() const
Gets the spring damping parameter.
Definition: LinearSpring.cpp:67
void setDamping(double damping)
Sets the spring damping parameter.
Definition: LinearSpring.cpp:61
Eigen::SparseMatrix< double > SparseMatrix
A sparse matrix.
Definition: SparseMatrix.h:32
double getRestLength() const
Gets the rest length of the spring.
Definition: LinearSpring.cpp:78
void setRestLength(double restLength)
Sets the rest length of the spring.
Definition: LinearSpring.cpp:72
void addDamping(const SurgSim::Math::OdeState &state, SurgSim::Math::SparseMatrix *D, double scale=1.0) override
Adds the spring damping matrix D (= -df/dv) (computed for a given state) to a complete system damping...
Definition: LinearSpring.cpp:108
void addForce(const SurgSim::Math::OdeState &state, SurgSim::Math::Vector *F, double scale=1.0) override
Adds the spring force (computed for a given state) to a complete system force vector F (assembly)
Definition: LinearSpring.cpp:83
bool operator!=(const Spring &spring) const
Comparison operator (inequality)
Definition: LinearSpring.cpp:308
double m_damping
Damping parameters (in N.s.m-1)
Definition: LinearSpring.h:136
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
A dynamic size column vector.
Definition: Vector.h:68
LinearSpring(size_t nodeId0, size_t nodeId1)
Constructor.
Definition: LinearSpring.cpp:35
double m_restLength
Rest length (in m)
Definition: LinearSpring.h:130
double m_stiffness
Stiffness parameters (in N.m-1)
Definition: LinearSpring.h:133
Linear spring connecting 2 nodes with a viscous term.
Definition: LinearSpring.h:29
void initialize(const SurgSim::Math::OdeState &state) override
Initialize the Spring once everything has been set.
Definition: LinearSpring.cpp:42