siconos.kernel.Relation (Python class)

class siconos.kernel.Relation(type: RELATION::TYPES, subtype: RELATION::SUBTYPES)[source]

Bases: object

General Non Linear Relation (Virtual Base class for Relations).

A relation is a link between global variables of the Dynamical Systems and some local ones, named y and lambda; belonging to one and only one Interaction.

The present class is an interface to all relations and provides tools to define and describe them.

Each relation must have the two following functions:

  • computeOutput(…) to compute y using DS global variables.
  • computeInput(…) to compute non-smooth DS part (r or p) using lambda.

Depending on the DS class and the link type, various relations (ie derived classes) are available:

  • FirstOrder, for FirstOrderDS and derived classes.
  • Lagrangian, for LagrangianDS and derived classes.
The specific type (Linear, Scleronomous …) is then given by the “subType”.
The relation holds also:
  • a VectorMap to handle links to DS variables (no copy!!!). Filled in during initialize.

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

C() =0 -> array_like (np.float64, 2D)[source]
checkSize(inter: Interaction) → void[source]

checkSize(Interaction inter)=0 -> None

check sizes of the relation specific operators.

Parameters:inter – an Interaction using this relation
computeInput(time: double, inter: Interaction, level: unsigned int = 0) → void[source]

computeInput(double time, Interaction inter, int level=0)=0 -> None

default function to compute r

Parameters:
  • time – the current time
  • inter – the interaction using this relation
  • level – the input “derivative” order of lambda used to compute input
computeJacg(time: double, inter: Interaction) → void[source]

computeJacg(double time, Interaction inter)=0 -> None

computeJach(time: double, inter: Interaction) → void[source]

computeJach(double time, Interaction inter)=0 -> None

compute all the H Jacobian

Parameters:
  • time – the current time
  • inter – the interaction using this relation
computeOutput(time: double, inter: Interaction, derivativeNumber: unsigned int = 0) → void[source]

computeOutput(double time, Interaction inter, int derivativeNumber=0)=0 -> None

default function to compute y

Parameters:
  • time – the current time
  • inter – the interaction using this relation
  • derivativeNumber – number of the derivative to compute (optional, default = 0)
display() → None[source]

main relation members display

getPluginJacLg() → PluggedObject[source]

Get _pluginJacglambda.

Returns:a shared pointer to the plugin
getPluginJachlambda() → PluggedObject[source]

Get _pluginJachlambda.

Returns:a shared pointer to the plugin
getPluginJachx() → PluggedObject[source]

Get _pluginJachx.

Returns:a shared pointer to the plugin
getPlugine() → PluggedObject[source]

Get _plugine.

Returns:a shared pointer to the plugin
getPluginf() → PluggedObject[source]

Get _pluginf.

Returns:a shared pointer to the plugin
getPluging() → PluggedObject[source]

Get _pluging.

Returns:a shared pointer to the plugin
getPluginh() → PluggedObject[source]

Get _pluginh.

Returns:a shared pointer to the plugin
getSubType() → RELATION::SUBTYPES[source]

To get the subType of the Relation.

Returns:the sub-type of the Relation
getType() → RELATION::TYPES[source]

To get the type of the Relation (FirstOrder or Lagrangian)

Returns:the type of the Relation
initialize(inter: Interaction) → void[source]

initialize(Interaction inter)=0 -> None

initialize the relation (check sizes, memory allocation …)

Parameters:inter – the interaction using this relation
isLinear() → bool[source]

return true if the relation is linear.

Returns:bool
requireResidu() → bool[source]

return true if the relation requires the computation of residu

Returns:true if residu are required, false otherwise
setComputeEFunction(str pluginPath, str functionName) → None[source]

To set a plug-in function to compute input function E.

Parameters:
  • pluginPath – the complete path to the plugin
  • functionName – the function name to use in this plugin
setComputeFFunction(str pluginPath, str functionName) → None[source]

To set a plug-in function to compute input function F.

Parameters:
  • pluginPath – the complete path to the plugin
  • functionName – the function name to use in this plugin
setComputeJacglambdaFunction(str pluginPath, str functionName) → None[source]

To set a plug-in function to compute the jacobian of \(g\) w.r.t.

\(\lambda\).

Parameters:
  • pluginPath – the complete path to the plugin
  • functionName – the function name to use in this plugin
setComputeJacgxFunction(str pluginPath, str functionName) → None[source]

To set a plug-in function to compute the jacobian of \(g\) w.r.t.

x

Parameters:
  • pluginPath – the complete path to the plugin
  • functionName – the function name to use in this plugin
setComputeJachlambdaFunction(str pluginPath, str functionName) → None[source]

To set a plug-in function to compute \(\nabla_{\lambda} h(..)\).

Parameters:
  • pluginPath – the complete path to the plugin
  • functionName – the function name to use in this plugin
setComputeJachxFunction(str pluginPath, str functionName) → None[source]

To set a plug-in function to compute \(\nabla_x h(..)\).

Parameters:
  • pluginPath – the complete path to the plugin
  • functionName – the function name to use in this plugin
setComputeJachzFunction(str pluginPath, str functionName) → None[source]

To set a plug-in function to compute \(\nabla_z h(..)\).

Parameters:
  • pluginPath – the complete path to the plugin
  • functionName – the function name to use in this plugin
setComputegFunction(str pluginPath, str functionName) → None[source]

To set a plug-in function to compute input function g.

Parameters:
  • pluginPath – the complete path to the plugin
  • functionName – the function name to use in this plugin
setComputehFunction(str pluginPath, str functionName) → None[source]

To set a plug-in function to compute output function h.

Parameters:
  • pluginPath – the complete path to the plugin
  • functionName – the function name to use in this plugin