# 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() noexcept = default

destructor

virtual void initialize(Interaction &inter) override

initialize G matrices or components specific to derived classes.

Parameters:

inter – the Interaction

inline virtual void checkSize(Interaction &inter) override

check sizes of the relation specific operators.

Parameters:

inter – an Interaction using this relation

inline SP::SiconosVector hDot() const

get a pointer on vector hDot

Returns:

a smart pointer on a SiconosVector

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

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

to compute the output y = h(t,q,z) of the Relation

Parameters:
• time – current time value

• q – coordinates of the dynamical systems involved in the relation

• z – user defined parameters (optional)

• y – the resulting vector

virtual void computehDot(double time, const BlockVector &q, BlockVector &z)

to compute the time-derivative of the output y = h(t,q,z), saved in attribute _hDot (access: hDot())

Parameters:
• time – current time value

• q – coordinates of the dynamical systems involved in the relation

• z – user defined parameters (optional)

virtual void computeJachq(double time, const BlockVector &q, BlockVector &z)

to compute the jacobian of h(…).

Set attribute _jachq (access: jacqhq())

Parameters:
• time – current time value

• q – coordinates of the dynamical systems involved in the relation

• z – user defined parameters (optional)

virtual void computeJach(double time, Interaction &inter) override

compute all the H Jacobian

inline virtual void computeJacg(double time, Interaction &inter) override

compute all the G Jacobian

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

to compute output

Parameters:
• time – current time

• inter – the Interaction

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

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

to compute p

Parameters:
• time – current time

• inter – the Interaction

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

ACCEPT_STD_VISITORS()#

Protected Functions

ACCEPT_SERIALIZATION(LagrangianRheonomousR)#
virtual void _zeroPlugin() override#

reset all plugins

inline LagrangianRheonomousR()#

default constructor

Protected Attributes

SP::SiconosVector _hDot = {nullptr}#

plugged vector used to compute hDot

SP::PluggedObject _pluginhDot = {nullptr}#

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