File kernel/src/modelingTools/LagrangianScleronomousR.hpp#

Go to the source code of this file

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

Scleronomic Lagrangian (Non Linear) Relations.

\[ y = h(q,z) \]

\[ \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[0] \( \dot y \) (or its discrete approximation) is stored in y[1] 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, Lagrangian2d3DR

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

destructor

virtual void initialize(Interaction &inter) override

initialize the relation (check sizes, memory allocation …)

Parameters:

inter – the interaction using this relation

virtual void checkSize(Interaction &inter) override

check sizes of the relation specific operators.

Parameters:

inter – an Interaction using this relation

inline SP::SiconosVector dotjacqhXqdot()
Returns:

the product of the time&#8212;derivative of Jacobian with the velocity qdot

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

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

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

  • z – user defined parameters (optional)

  • y – the resulting vector

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

to compute the jacobian of h(…).

Set attribute _jachq (access: jacqhq())

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

  • z – user defined parameters (optional)

virtual void computeDotJachq(const BlockVector &q, BlockVector &z, const BlockVector &qDot)

to compute the time derivative of the Jacobian.

Result in _dotjachq (access: dotjachq())

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

  • z – user defined parameters (optional)

  • time – derivatives of q

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

to compute the product of the time&#8212;derivative of Jacobian with the velocity qdot

Parameters:
  • time – double, current time

  • inter – interaction

  • DSlink

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

compute all the H Jacobian

Parameters:
  • time – double, current time

  • inter – interaction that owns the relation

  • interProp

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

compute all the G Jacobian

Parameters:
  • time – double, current time

  • inter – interaction that owns the relation

  • interProp

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

to compute output

Parameters:
  • time – the current time

  • inter – interaction that owns the relation

  • 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 – the current time

  • inter – interaction that owns the relation

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

ACCEPT_STD_VISITORS()#

Protected Functions

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

reset all plugins

inline LagrangianScleronomousR()#

basic constructor

Protected Attributes

SP::PluggedObject _plugindotjacqh = {nullptr}#

Plugin object for the time&#8212;derivative of Jacobian i.e.

\( \frac{d}{dt} \nabla^T_{q} h(t,q,\dot q,\ldots). \) stored in _dotjachq

SP::SiconosVector _dotjacqhXqdot = {nullptr}#

Product of the time&#8212;derivative of Jacobian with the velocity qdot.