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

Go to the source code of this file

class LagrangianR : public Relation
#include <>

Lagrangian Non Linear Relation (generic interface)

This class is an interface for specific Lagrangian Relations used for Lagrangian dynamical systems.

• $$y = h(t,q,\dot q,\ldots)$$ describes the constraint (the relation)

• The Jacobian of the constraints with respect to the coodinates $$q$$ i.e. $$\nabla^T_q h(t,q,\dot q,\ldots)$$ , is accessed with jachq().

This Jacobian is mainly used for Newton linearization and to compute the time-derivative of the constraint,

$$y = h(q,\ldots)$$ that is $$\dot y (t) = \nabla^T_q h(t,q,\dot q,\ldots) (q) \dot q +\ldots$$

This object can also store more general linearized part of the gap function. If $$y=h(q)$$ models a gap function, then the time derivative can be generically written as

$$\dot y (t) = H(q,\ldots) \dot q +\ldots.$$ The matrix $$H(q,\ldots)$$ can also be accessed using jachq().

• The Jacobian of the constraints with respect to the generalized velocities $$\dot q$$

i.e. $$\nabla^\top_{\dot q} h(t,q,\dot q,\ldots)$$ is accessed using jachqDot().

• The time-derivative of Jacobian of the constraints with respect to the generalized coordinates $$q$$

i.e. $$\frac{d}{dt} \nabla^\top_{q} h(t,q,\dot q,\ldots).$$ , is accessed using dotJachq().

This value is useful to compute the second-order time&#8212;derivative of the constraints with respect to time.

All these operators can be defined with user-defined plugins.

Public Types

enum LagrangianRDS

Values:

enumerator z
enumerator q0
enumerator q1
enumerator q2
enumerator p0
enumerator p1
enumerator p2

Public Functions

virtual ~LagrangianR() noexcept = default

destructor

inline virtual void initialize(Interaction &inter) override

initialize the relation (check sizes, memory allocation …)

Parameters

inter – the interaction using this relation

inline SP::SimpleMatrix jachq() const

get a pointer on matrix Jach[index]

Returns

a pointer on a SimpleMatrix

inline SP::SimpleMatrix jachqDot() const
inline SP::SimpleMatrix dotJachq() const
inline SP::SimpleMatrix jachlambda() const
inline void setJachqPtr(SP::SimpleMatrix newPtr)

set Jach[index] to pointer newPtr (pointer link)

Parameters

newPtr – the new matrix

inline virtual SP::SimpleMatrix C() const override
inline virtual SP::SimpleMatrix H() const override
virtual void display() const override

main relation members display

Protected Functions

ACCEPT_SERIALIZATION(LagrangianR)
inline LagrangianR(RELATION::SUBTYPES lagType)

basic constructor

Parameters

lagType – the sub-type of the relation

virtual void _zeroPlugin() override

To initialize all the plugin functions with nullptr.

Protected Attributes

SP::SimpleMatrix _jachlambda = {nullptr}

Jacobian matrices of $$y = h(t,q,\dot q,\ldots)$$

SP::SimpleMatrix _jachq = {nullptr}

The Jacobian of the constraints with respect to the generalized coodinates $$q$$ i.e.

$$\nabla^\top_q h(t,q,\dot q,\ldots)$$

SP::SimpleMatrix _jachqDot = {nullptr}

The Jacobian of the constraints with respect to the generalized velocities $$\dot q$$ i.e.

$$\nabla^\top_{\dot q} h(t,q,\dot q,\ldots)$$

SP::SimpleMatrix _dotjachq = {nullptr}

The time-derivative of Jacobian of the constraints with respect to the generalized coordinates $$q$$ i.e.

$$\frac{d}{dt} \nabla^\top_{ q} h(t,q,\dot q,\ldots).$$ This value is useful to compute the second-order time&#8212;derivative of the constraints with respect to time.

SP::PluggedObject _pluginJachq = {nullptr}