# siconos.kernel.LagrangianScleronomousR (Python class)¶

class siconos.kernel.LagrangianScleronomousR(*args)[source]

Bases: siconos.kernel.LagrangianR

Scleronomic Lagrangian (Non Linear) Relations.

Scleronomic Relation (constraint) :



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

Generated class (swig), based on C++ header Program listing for file kernel/src/modelingTools/LagrangianScleronomousR.hpp.

Constructors

LagrangianScleronomousR(str pluginh, str 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(str pluginh, str pluginJacobianhq, str 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*)”
checkSize(Interaction inter) → None[source]

check sizes of the relation specific operators.

Parameters: inter – an Interaction using this relation
computeDotJachq(array_like (np.float64, 1D) q, array_like (np.float64, 1D) z, array_like (np.float64, 1D) qDot) → None[source]

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

Parameters: q – the BlockVector of coordinates z – the BlockVector of parameters qDot – q the BlockVector of derivative of coordinates
computeInput(double time, Interaction inter, int level=0) → None[source]

to compute p

Parameters: time – the current time inter – interaction that owns the relation level – “derivative” order of lambda used to compute input
computeJacg(double time, Interaction inter) → None[source]
computeJach(double time, Interaction inter) → None[source]

compute all the H Jacobian

Parameters: time – the current time inter – the interaction using this relation
computeJachq(array_like (np.float64, 1D) q, array_like (np.float64, 1D) z) → None[source]

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

Index shows which jacobian is computed

Parameters: q – the BlockVector of coordinates z – the BlockVector of parameters
computeOutput(double time, Interaction inter, int derivativeNumber=0) → None[source]

to compute output

Parameters: time – the current time inter – interaction that owns the relation derivativeNumber – number of the derivative to compute, optional, default = 0.
computedotjacqhXqdot(double time, Interaction inter, VectorOfBlockVectors DSlink) → None[source]

to compute the product of the time–derivative of Jacobian with the velocity qdot

Parameters: time – double, current time inter – interaction that owns the relation DSlink –
computeh(array_like (np.float64, 1D) q, array_like (np.float64, 1D) z, array_like (np.float64, 1D) y) → None[source]

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

Parameters: q – the BlockVector of coordinates z – the BlockVector of parameters y – the output
dotjacqhXqdot() -> array_like (np.float64, 1D)[source]
Returns: the product of the time–derivative of Jacobian with the velocity qdot
initialize(Interaction inter) → None[source]

initialize components specific to derived classes.

Parameters: inter – the interaction using this relation