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

Go to the source code of this file

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

Lagrangian (Non Linear) Rheonomous Relation.

This class provides tools to describe non linear relation of the type:

$\begin{split}y = h(q,t,z) \\ \dot y = \nabla^\top_q(q,t,z)\dot q + \frac{\partial }{\partial t}h(q,t,z) \\\end{split}$

or more generally

$\dot y = H(q,t,z)\dot q + \frac{\partial }{\partial t}h(q,t,z)$

and by duality

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

The following operators (and their jacobians) can be plugged, in the usual way (see User Guide, ‘User-defined plugins’)

• $$h(q,t,z)$$

• $$\nabla_q h(q,t,z)$$

• $$\dot h(q,t,z)$$

The plugin functions must fit with the following signature (FPtr4):

void func(unsigned int qsize, double* q, double time, unsigned int ysize, double* buffer , unsigned int sizez, double* z)

buffer being either $$y$$, $$\dot h$$ or $$\nabla_qh$$.

Public Functions

LagrangianRheonomousR(const std::string &pluginh, const std::string &pluginJacobianhq, const std::string &pluginDoth)

constructor from a set of data

Parameters
• pluginh: name of the plugin to compute h. Its signature must be “void userPluginH(unsigned int, double*, double, unsigned int, double*, unsigned int, double*)”

• pluginJacobianhq: name of the plugin to compute jacobian h according to q. Its signature must be “void userPluginG0(unsigned int, double*, double, unsigned int, double*, unsigned int, double*)”

• pluginDoth: name of the plugin to compute hDot. Its signature must be “void userPluginHDot(unsigned int, double*, double, unsigned int, double*, unsigned int, double*)

virtual ~LagrangianRheonomousR()

destructor

ACCEPT_STD_VISITORS()
virtual void checkSize(Interaction &inter)

check sizes of the relation specific operators.

Parameters
• inter: an Interaction using this relation

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

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

Parameters
• time: current time

• q: the vector of coordinates

• z: the vector of parameters

• y: the y vector

virtual void computehDot(double time, SiconosVector &q, SiconosVector &z)

to compute hDot using plug-in mechanism

Parameters
• time: current time

• q: the vector of coordinates

• z: the vector of parameters

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

to compute p

Parameters
• time: current time

• inter: the Interaction

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

virtual void computeJacg(double time, Interaction &inter)
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(double time, SiconosVector &q, SiconosVector &z)

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

Index shows which jacobian is computed

Parameters
• time: double, current time

• q: the coordinates vector

• z: the parameters vector

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

to compute output

Parameters
• time: current time

• inter: the Interaction

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

SP::SiconosVector hDot() const

get a pointer on vector hDot

Return

a smart pointer on a SiconosVector

void initialize(Interaction &inter)

initialize G matrices or components specific to derived classes.

Parameters

void setComputehDotFunction(const std::string &pluginpath, const std::string &name)

to set a specified function to compute function hDot

Parameters
• pluginpath: the complete path to the plugin

• name: the name of the function to use in this plugin

Protected Functions

LagrangianRheonomousR()

default constructor

void _zeroPlugin()

To initialize all the plugin functions with NULL.

ACCEPT_SERIALIZATION(LagrangianRheonomousR)

serialization hooks

Protected Attributes

SP::SiconosVector _hDot

plugged vector used to compute hDot

SP::PluggedObject _pluginhDot

LagrangianRheonomousR plug-in to compute hDot(q,t,z)