File kernel/src/modelingTools/FirstOrderType2R.hpp#

Go to the source code of this file

non linear relations: \( y=h(x,\lambda,z), r=g(\lambda,z) \)

Typedefs

typedef void (*Type2PtrH)(unsigned int, double*, unsigned int, double*, unsigned int, double*)#
typedef void (*Type2PtrG)(unsigned int, double*, unsigned int, double*)#
class FirstOrderType2R : public FirstOrderR
#include <FirstOrderType2R.hpp>

First order non linear Relation.

Relation for First Order Dynamical Systems, with:

\[\begin{split} y &= h(x,\lambda,z)\\ r &= g(\lambda,z) \end{split}\]

Operators (and their corresponding plug-in):

  • h: saved in Interaction as y (plug-in: output[0])

  • \( \nabla_x h \): jacobianH[0] ( output[1] )

  • g: saved in DS as r ( input[0])

  • \( \nabla_\lambda g \): jacobianG[0] ( input[1] )

Remark FP: at the time, this class works only on the linear case, when:

  • \( \nabla_x h = C \), \( \nabla_\lambda h = D \) and \( \nabla_\lambda g = K \) are constants. Trying to update these jacobians with plugins functions leads to an exception. Solution: create a derived class and overide computeJachx and computeJach.

Public Functions

inline FirstOrderType2R()

Basic contructor.

FirstOrderType2R(const std::string &pluginh, const std::string &pluging)

data constructor

Parameters:
  • pluginh – name of the plugin to compute h

  • pluging – name of the plugin to compute g

FirstOrderType2R(const std::string &pluginh, const std::string &pluging, const std::string &pluginJacobianhx, const std::string &pluginJacobianglambda)

data constructor

Parameters:
  • pluginh – name of the plugin to compute h

  • pluging – name of the plugin to compute g

  • pluginJacobianhx – name of the plugin to compute the Jacobian of h according to x \( \nabla_x h \)

  • pluginJacobianglambda – name of the plugin to compute the jacobian of g according to lambda

virtual ~FirstOrderType2R() noexcept = default

destructor

virtual void initialize(Interaction &inter) override

initialize the relation (check sizes, memory allocation …)

Parameters:

inter – the interaction that owns this relation

inline virtual void checkSize(Interaction &inter) override

check sizes of the relation specific operators.

Parameters:

inter – an Interaction using this relation

virtual void computeh(double time, const BlockVector &x, const SiconosVector &lambda, SiconosVector &y)

to compute the output y = h(t,x,…) of the Relation

Parameters:
  • time – current time value

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

  • lambda – interaction \( \lambda \) vector

  • y – the resulting vector

virtual void computeg(double time, const SiconosVector &lambda, BlockVector &r)

to compute the nonsmooth input r = g(t,x,…) of the Relation

Parameters:
  • time – current time value

  • lambda – interaction \( \lambda \) vector

  • r – the resulting vector

virtual void computeJachx(double time, const BlockVector &x, const SiconosVector &lambda, SimpleMatrix &C)

to compute \( C = \nabla_x h \)

Parameters:
  • time – current time value

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

  • lambda – interaction \( \lambda \) vector

  • C[out] the resulting matrix

virtual void computeJacglambda(double time, const SiconosVector &lambda, SimpleMatrix &B)

to compute \( B = \nabla_{\lambda}g \)

Parameters:
  • time – current time value

  • lambda – interaction \( \lambda \) vector

  • B[out] the resulting matrix

virtual void computeJachlambda(double time, const BlockVector &x, const SiconosVector &lambda, SimpleMatrix &D)

to compute \( D = \nabla_{\lambda}h \)

Parameters:
  • time – current time value

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

  • lambda – interaction \( \lambda \) vector

  • D[out] the resulting matrix

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

default function to compute y, using the data from the Interaction and DS

Parameters:
  • time – current time (not used)

  • interInteraction using this Relation

  • level – not used

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

default function to compute r, using the data from the Interaction and DS

Parameters:
  • time – current time (not used)

  • interInteraction using this Relation

  • level – not used

inline virtual bool requireResidu() override

return true if the relation requires the computation of residu

Returns:

true if residu are required, false otherwise

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

compute all the H Jacobian

Parameters:
  • time – the current time

  • inter – the interaction using this relation

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

compute all the G Jacobian

Parameters:
  • time – the current time

  • inter – the interaction using this relation

  • interProp

ACCEPT_STD_VISITORS()#

Protected Functions

ACCEPT_SERIALIZATION(FirstOrderType2R)#