# File kernel/src/modelingTools/LagrangianLinearDiagonalDS.hpp¶

Go to the source code of this file

class LagrangianLinearDiagonalDS : public LagrangianDS
#include <>

Lagrangian Linear Systems with time invariant and diagonal coefficients - $$M\dot v + Cv + Kq = F_{ext}(t,z) + p$$.

where

• $$q \in R^{ndof}$$ is the set of the generalized coordinates,

• $$\dot q = v \in R^{ndof}$$ the velocity, i. e. the time derivative of the generalized coordinates.

• $$\ddot q \in R^{ndof}$$ the acceleration, i. e. the second time derivative of the generalized coordinates.

• $$p \in R^{ndof}$$ the forces due to the nonsmooth interaction. In the particular case of a nonsmooth evolution, the variable p contains the impulse and not the force.

• $$M \in R^{ndof \times ndof}$$ is the mass matrix (access : mass() method).

• $$K \in R^{ndof \times ndof}$$ is the stiffness matrix (access : stiffness() method).

• $$C \in R^{ndof \times ndof}$$ is the viscosity matrix (access : damping() method).

• $$z \in R^{zSize}$$ is a vector of arbitrary algebraic variables, some sort of discret state.

Remind that the specificity of this class is that all matrices are diagonal (and hence only diagonal coefficients are saved in memory).

Public Functions

LagrangianLinearDiagonalDS(SP::SiconosVector q0, SP::SiconosVector v0, SP::SiconosVector stiffness, SP::SiconosVector damping, SP::SiconosVector mass)

constructor from initial state and all operators.

Parameters
• q0 – initial coordinates

• v0 – initial velocity

• stiffness – diagonal of the stiffness matrix

• damping – diagonal of the damping matrix

• mass – diagonal of the mass matrix

LagrangianLinearDiagonalDS(SP::SiconosVector q0, SP::SiconosVector v0, SP::SiconosVector stiffness, SP::SiconosVector damping)

constructor for complete system with identity mass matrix

Parameters
• q0 – initial coordinates

• v0 – initial velocity

• stiffness – diagonal of the stiffness matrix

• damping – diagonal of the damping matrix

LagrangianLinearDiagonalDS(SP::SiconosVector q0, SP::SiconosVector v0, SP::SiconosVector stiffness)

constructor for undamped system and identity mass matrix

Parameters
• q0 – initial coordinates

• v0 – initial velocity

• stiffness – diagonal of the stiffness matrix

inline ~LagrangianLinearDiagonalDS()
inline const SiconosVector get_stiffness() const

get a copy of the stiffness matrix (diagonal only)

Returns
inline SP::SiconosVector stiffness() const

get stiffness matrix (diagonal only, pointer link)

Returns

pointer on a SiconosVector

inline const SiconosVector get_damping() const

get a copy of the damping matrix (diagonal only)

Returns
inline SP::SiconosVector damping() const

get damping matrix (diagonal only, pointer link)

Returns

pointer on a SiconosVector

virtual void initRhs(double t) override

allocate (if needed) and compute rhs and its jacobian.

Parameters

t – time of initialization

virtual void computeForces(double time, SP::SiconosVector q, SP::SiconosVector velocity) override

Compute $$F(v,q,t,z)$$.

Parameters
• time – the current time

• q – generalized coordinates

• velocity – time derivative of the generalized coordinates

inline virtual bool isLinear() override
Returns

true if the Dynamical system is linear.

virtual void display(bool brief = true) const override

print the data of the dynamical system on the standard output

ACCEPT_STD_VISITORS()

Protected Functions

ACCEPT_SERIALIZATION(LagrangianLinearDiagonalDS)
inline LagrangianLinearDiagonalDS()

default constructor

Protected Attributes

SP::SiconosVector _stiffness

stiffness matrix

SP::SiconosVector _damping

damping matrix

double _mu

mass density