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

Go to the source code of this file

class LagrangianR : public Relation
#include <LagrangianR.hpp>

Lagrangian (Non Linear) Relation (generic interface)

Relations for Lagrangian Dynamical Systems. This class is only an interface for specific (Linear, scleronomic, rheomomic …) Lagrangian Relations (see derived classes).

Class name = type+subType.

If $$y = h(t,q,\dot q,\ldots)$$ describes the constraint (the relation) , all the gradients of h are handled by the following SimpleMatrix and SiconosVector objects.

• The Jacobian of the constraints with respect to the coodinates $$q$$

i.e. $$\nabla^T_q h(t,q,\dot q,\ldots)$$ is stored in SP::SimpleMatrix _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 timederivative can be generically written as $$\dot y (t) = H(q,\ldots) \dot q +\ldots.$$ The matrix $$H(q,\ldots)$$ is also stored in SP::SimpleMatrix _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 stored in SP::SimpleMatrix _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).$$. This value is useful to compute the second-order timederivative of the constraints with respect to time.

In corresponding derived classes, h and Jacobians are connected to plug-in functions (user-defined).

Public Types

enum LagrangianRDS

Values:

z
q0
q1
q2
p0
p1
p2
DSlinkSize

Public Functions

virtual ~LagrangianR()

destructor

SP::SimpleMatrix C() const
virtual void checkSize(Interaction &inter) = 0

check sizes of the relation specific operators.

Parameters
• inter: an Interaction using this relation

virtual void computeJacg(double time, Interaction &inter) = 0
virtual void computeJach(double time, Interaction &inter) = 0

compute all the H Jacobian

Parameters
• time: the current time

• inter: the interaction using this relation

void display() const

main relation members display

SP::SimpleMatrix dotJachq() const
virtual void initialize(Interaction &inter)

initialize components specific to derived classes.

Parameters
• inter: the interaction using this relation

SP::SimpleMatrix jachlambda() const
SP::SimpleMatrix jachq() const

get a pointer on matrix Jach[index]

Return

a pointer on a SimpleMatrix

SP::SimpleMatrix jachqDot() const
void setJachqPtr(SP::SimpleMatrix newPtr)

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

Parameters
• newPtr: the new matrix

Protected Functions

LagrangianR(RELATION::SUBTYPES lagType)

basic constructor

Parameters
• lagType: the sub-type of the relation

virtual void _zeroPlugin()

To initialize all the plugin functions with NULL.

ACCEPT_SERIALIZATION(LagrangianR)

serialization hooks

Protected Attributes

SP::SimpleMatrix _dotjachq

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 timederivative of the constraints with respect to time.

SP::SimpleMatrix _jachlambda

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

SP::SimpleMatrix _jachq

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

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::PluggedObject _pluginJachq