# Class LagrangianScleronomousR¶

class LagrangianScleronomousR : public LagrangianR

Scleronomic Lagrangian (Non Linear) Relations.

Scleronomic Relation (constraint) :

$\begin{split}y = h(q,z) \\\end{split}$

$\dot y = \nabla^\top_q h(q,z) \dot q$

or more generally

$\dot y = H(q,z) \dot q$

and by duality

$p = \nabla_q h(q,z)\lambda$

or more generally

$p = H^\top(q,z)\lambda$

with

$H^\top(q,z) = \nabla_q h(q,z)$

is the pure Lagrangian setting.

y (or its discrete approximation) is stored in y $$\dot y$$ (or its discrete approximation) is stored in y higher level y[i] can be used for storing higher levels of derivatives.

Jacobians and h are connected to plug-in functions.

The plugin function to compute h(q,z) needs the following parameters:

> sizeQ: size of q = sum of the sizes of all the DynamicalSystems involved in the interaction> q : pointer to the first element of q > sizeY : size of vector y (ie of the interaction) > [in,out] y : pointer to the first element of y > sizeZ : size of vector z > [in,out] z: pointer to z vector(s) from DS.

Its signature must be “void plugin(unsigned int, double*, unsigned int, double*, unsigned int, double*)”

The plugin function to compute G0(q,z), gradient of h according to q, needs the following parameters:

> sizeQ: size of q = sum of the sizes of all the DynamicalSystems involved in the interaction > q : pointer to the first element of q > sizeY : size of vector y (ie of the intercation) > [in,out] H : pointer to the first element of H (sizeY X sizeDS matrix)> sizeZ : size of vector z >[in,out] z: pointer to z vector(s) from DS.

Its signature must be “void plugin(unsigned int, double*, unsigned int, double*, unsigned int, double*)”

Subclassed by Lagrangian2d1DR, Lagrangian2d2DR

Public Functions

LagrangianScleronomousR(const std::string &pluginh, const std::string &pluginJacobianhq)

constructor from a set of data

Parameters
• pluginh: the name of the plugin to compute h(q,z). The signature of the plugged function must be: “void pluginH(unsigned int, double*, unsigned int, double*, unsigned int, double*)”

• pluginJacobianhq: the name of the plugin to compute jacobian h according to q.

The signature of the plugged function must be: “void pluginG0(unsigned int, double*, unsigned int, double*, unsigned int, double*)”

LagrangianScleronomousR(const std::string &pluginh, const std::string &pluginJacobianhq, const std::string &pluginDotJacobianhq)

constructor from a set of data used for EventDriven Scheme

Parameters
• pluginh: the name of the plugin to compute h(q,z). The signature of the plugged function must be: “void pluginH(unsigned int, double*, unsigned int, double*, unsigned int, double*)”

• pluginJacobianhq: the name of the plugin to compute jacobian h according to q.

The signature of the plugged function must be: “void pluginG0(unsigned int, double*, unsigned int, double*, unsigned int, double*)”

• pluginDotJacobianhq: the name of the plugin to compute the derivative of H Jacobian with respect to time The signature of the plugged function must be: “void pluginS0(unsigned int, double*,unsigned int, double*, unsigned int, double*, unsigned int, double*)”

virtual ~LagrangianScleronomousR()

destructor

virtual void checkSize(Interaction &inter)

check sizes of the relation specific operators.

Parameters
• inter: an Interaction using this relation

virtual void computeDotJachq(SiconosVector &q, SiconosVector &z, SiconosVector &qDot)

to compute the time derivative of the Jacobian with respect to time using plug-in mechanism

Parameters

void computedotjacqhXqdot(double time, Interaction &inter, VectorOfBlockVectors &DSlink)

to compute the product of the timederivative of Jacobian with the velocity qdot

Parameters
• time: double, current time

• inter: interaction that owns the relation

• DSlink:

virtual void computeh(SiconosVector &q, SiconosVector &z, SiconosVector &y)

to compute y = h(q,z) using plug-in mechanism

Parameters
• q: the BlockVector of coordinates

• z: the BlockVector of parameters

• y: the output

virtual void computeInput(double time, Interaction &inter, unsigned int level = 0)

to compute p

Parameters
• time: the current time

• inter: interaction that owns the relation

• level: “derivative” order of lambda used to compute input

void computeJach(double time, Interaction &inter)

compute all the H Jacobian

Parameters
• time: the current time

• inter: the interaction using this relation

virtual void computeJachq(SiconosVector &q, SiconosVector &z)

to compute the jacobian of h using plug-in mechanism.

Index shows which jacobian is computed

Parameters

virtual void computeOutput(double time, Interaction &inter, unsigned int derivativeNumber = 0)

to compute output

Parameters
• time: the current time

• inter: interaction that owns the relation

• derivativeNumber: number of the derivative to compute, optional, default = 0.

SP::SiconosVector dotjacqhXqdot()

Return

the product of the timederivative of Jacobian with the velocity qdot

virtual void initialize(Interaction &inter)

initialize components specific to derived classes.

Parameters
• inter: the interaction using this relation