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.

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[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*)”

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

ACCEPT_STD_VISITORS()
virtual void checkSize(Interaction &inter)

check sizes of the relation specific operators.

Parameters

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

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 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(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

Protected Functions

LagrangianScleronomousR()

basic constructor

virtual void _zeroPlugin()

reset all plugins

ACCEPT_SERIALIZATION(LagrangianScleronomousR)

serialization hooks

Protected Attributes

SP::SiconosVector _dotjacqhXqdot

Product of the timederivative of Jacobian with the velocity qdot.

SP::PluggedObject _plugindotjacqh

LagrangianScleronomousR plug-in to compute G0(q,z), gradient of h according to q.

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)
  • G0: : pointer to the first element of G0 (sizeY X sizeDS matrix)
  • sizeZ: size of vector z
  • z: pointer to z vector(s) from DS. Plugin object for the timederivative of Jacobian i.e. \(\frac{d}{dt} \nabla^T_{q} h(t,q,\dot q,\ldots).\) stored in _dotjachq