File kernel/src/modelingTools/FirstOrderLinearDS.hpp

Contents

File kernel/src/modelingTools/FirstOrderLinearDS.hpp#

Go to the source code of this file

class FirstOrderLinearDS : public FirstOrderNonLinearDS
#include <FirstOrderLinearDS.hpp>

First Order Linear Systems - \( M(t) \dot x = A(t)x(t)+ b(t) + r, \quad x(t_0)=x_0 \).

This class represents first order linear systems of the form:

\[ M(t) \dot x = A(t)x(t)+ b(t) + r, x(t_0)=x_0 \]
where

  • \( x \in R^{n} \) is the state,

  • \( r \in R^{n} \) the input due to the Non Smooth Interaction.

  • \( M \in R^{n\times n} \) is an invertible matrix

  • \( A \in R^{n\times n} \)

  • \( b \in R^{n} \)

The following operators can be plugged, in the usual way (see User Guide)

  • \( A(t) \)

  • \( b(t) \)

  • \( M(t) \)

Subclassed by FirstOrderLinearTIDS

Public Types

typedef void (*LDSPtrFunction)(double, unsigned int, double*, unsigned int, double*)

plugin signature

Public Functions

FirstOrderLinearDS(SP::SiconosVector newX0, const std::string &APlugin, const std::string &bPlugin)

constructor from initial state and plugins

Parameters:
  • newX0 – the initial state of this DynamicalSystem

  • APlugin – plugin for A

  • bPlugin – plugin for b

FirstOrderLinearDS(SP::SiconosVector newX0, SP::SiconosMatrix newA)

constructor from initial state and plugin for A

Parameters:
FirstOrderLinearDS(SP::SiconosVector newX0)

constructor from initial state

Parameters:

newX0 – the initial state of this DynamicalSystem

FirstOrderLinearDS(SP::SiconosVector newX0, SP::SiconosMatrix newA, SP::SiconosVector newB)

constructor from a initial state and constant matrices

Parameters:
  • newX0 – the initial state of this DynamicalSystem

  • newA – matrix A

  • newB – b

FirstOrderLinearDS(const FirstOrderLinearDS &FOLDS)

Copy constructor.

Parameters:

FOLDS – the original FirstOrderLinearDS we want to copy

inline virtual ~FirstOrderLinearDS()

destructor

virtual void initRhs(double time) override

Initialization function for the rhs and its jacobian.

Parameters:

time – time of initialization.

virtual void computeRhs(double time) override

update right-hand side for the current state

Parameters:

time – of interest

virtual void computeJacobianRhsx(double time) override

update \( \nabla_x rhs \) for the current state

Parameters:

time – of interest

inline SP::SiconosMatrix A() const

get the matrix \( A \)

Returns:

pointer (SP) on a matrix

inline virtual SP::SiconosMatrix jacobianfx() const override

get jacobian of f(x,t,z) with respect to x (pointer link)

Returns:

SP::SiconosMatrix

inline void setAPtr(SP::SiconosMatrix newA)

set A to pointer newPtr

Parameters:

newA – the new A matrix

void setA(const SiconosMatrix &newA)

set A to a new matrix

Parameters:

newA – the new A matrix

inline SP::SiconosVector b() const

get b vector (pointer link)

Returns:

a SP::SiconosVector

inline void setbPtr(SP::SiconosVector b)

set b vector (pointer link)

Parameters:

b – a SiconosVector

void setb(const SiconosVector &b)

set b vector (copy)

Parameters:

b – a SiconosVector

inline bool hasConstantA() const#
inline bool hasConstantB() const#
virtual void updatePlugins(double time) override

Call all plugged-function to initialize plugged-object values.

Parameters:

time – value

void setComputeAFunction(const std::string &pluginPath, const std::string &functionName)

set a specified function to compute the matrix A => same action as setComputeJacobianfxFunction

Parameters:
  • pluginPath – the complete path to the plugin

  • functionName – the function name to use in this plugin

void setComputeAFunction(LDSPtrFunction fct)

set a specified function to compute the matrix A

Parameters:

fct – a pointer on a function

void setComputebFunction(const std::string &pluginPath, const std::string &functionName)

set a specified function to compute the vector b

Parameters:
  • pluginPath – the complete path to the plugin file

  • functionName – the function name to use in this plugin

void setComputebFunction(LDSPtrFunction fct)

set a specified function to compute the vector b

Parameters:

fct – a pointer on a function

void clearComputebFunction()#
virtual void computeA(double time)

default function to compute matrix A => same action as computeJacobianfx

Parameters:

time – time instant used to compute A

virtual void computeb(double time)

default function to compute vector b

Parameters:

time – time instant used to compute b

inline SP::PluggedObject getPluginA() const

Get _pluginA.

Returns:

the plugin for A

inline SP::PluggedObject getPluginB() const

Get _pluginb.

Returns:

the plugin for b

inline void setPluginA(SP::PluggedObject newPluginA)

Set _pluginA.

Parameters:

newPluginA – the new plugin

inline void setPluginB(SP::PluggedObject newPluginB)

Set _pluginb.

Parameters:

newPluginB – the new plugin

virtual void display(bool brief = true) const override

data display on screen

inline virtual bool isLinear() override

True if the system is linear.

Returns:

a boolean

ACCEPT_STD_VISITORS()#

Protected Functions

ACCEPT_SERIALIZATION(FirstOrderLinearDS)#
inline FirstOrderLinearDS()#

default constructor

virtual void _zeroPlugin() override#

Reset all the plugins.

Protected Attributes

SP::SiconosMatrix _A#

matrix specific to the FirstOrderLinearDS \( A \in R^{n \times n} \)

SP::SiconosVector _b#

vector specific to the FirstOrderLinearDS

SP::PluggedObject _pluginA#

FirstOrderLinearDS plug-in to compute A(t,z), id = “A”.

Param time:

: current time

Param sizeOfA:

: size of square-matrix A

Param A:

[inout] : pointer to the first element of A

Param size:

of vector z

Param z:

[inout] a vector of user-defined parameters

SP::PluggedObject _pluginb#

FirstOrderLinearDS plug-in to compute b(t,z), id = “b”.

Param time:

: current time

Param sizeOfB:

: size of vector b

Param b:

[inout] : pointer to the first element of b

Param size:

of vector z

Param param:

[inout] : a vector of user-defined parameters

bool _hasConstantA#

boolean if _A is constant (set thanks to setBPtr for instance) false by default

bool _hasConstantB#

boolean if _b is constant (set thanks to setBPtr for instance) false by default