File kernel/src/modelingTools/Relation.hpp#

Go to the source code of this file

General interface for relations.

class Relation
#include <Relation.hpp>

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

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

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.

All relations are specified by their type (First order or Lagrangian) accessed by getType() and their sub-type (linear, scleronomous …), returned by getSubType().

A relation provides functions to compute:

  • a function computeOutput() that updates y using dynamical systems global variables,

  • a function computeInput() that updates non-smooth dynamical systems parts (e.g. r or p) using \( \lambda \) .

Subclassed by FirstOrderR, LagrangianR, NewtonEulerR

Public Functions

virtual ~Relation() noexcept = default

destructor

inline RELATION::TYPES getType() const
Returns:

the type of the Relation (FirstOrder or Lagrangian)

inline RELATION::SUBTYPES getSubType() const
Returns:

the subType of the Relation

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

virtual void initialize(Interaction &inter) = 0

initialize the relation (check sizes, memory allocation …)

Parameters:

inter – the interaction using this relation

virtual void checkSize(Interaction &inter) = 0

check sizes of the relation specific operators.

Parameters:

inter – an Interaction using this relation

virtual void computeJach(double time, Interaction &inter) = 0

compute all the H Jacobian

Parameters:
  • time – the current time

  • inter – the interaction using this relation

virtual void computeJacg(double time, Interaction &inter) = 0

compute all the G Jacobian

Parameters:
  • time – the current time

  • inter – the interaction using this relation

  • interProp

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

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)

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

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

virtual SP::SimpleMatrix C() const = 0#
virtual SP::SimpleMatrix H() const = 0#
inline virtual bool isLinear()

return true if the relation is linear.

Returns:

bool

inline virtual bool requireResidu()

return true if the relation requires the computation of residu

Returns:

true if residu are required, false otherwise

virtual void display() const

main relation members display

inline SP::PluggedObject getPluginh() const

Get _pluginh.

Returns:

a shared pointer to the plugin

inline SP::PluggedObject getPluginJachx() const

Get _pluginJachx.

Returns:

a shared pointer to the plugin

inline SP::PluggedObject getPluginJachlambda() const

Get _pluginJachlambda.

Returns:

a shared pointer to the plugin

inline SP::PluggedObject getPluging() const

Get _pluging.

Returns:

a shared pointer to the plugin

inline SP::PluggedObject getPluginJacLg() const

Get _pluginJacglambda.

Returns:

a shared pointer to the plugin

inline SP::PluggedObject getPluginf() const

Get _pluginf.

Returns:

a shared pointer to the plugin

inline SP::PluggedObject getPlugine() const

Get _plugine.

Returns:

a shared pointer to the plugin

VIRTUAL_ACCEPT_VISITORS(Relation)#

Protected Functions

ACCEPT_SERIALIZATION(Relation)#
virtual void _zeroPlugin()#

To initialize all the plugin functions with nullptr.

Relation(RELATION::TYPES type, RELATION::SUBTYPES subtype)#

basic constructor

Parameters:
  • type – type of the relation

  • subtype – subtype of the relation

Relation() = default#

Protected Attributes

SP::PluggedObject _pluginh = {nullptr}#

Plug-in to compute h(…)

SP::PluggedObject _pluginJachx = {nullptr}#

Plug-in to compute \( \nabla_x h(..) \).

SP::PluggedObject _pluginJachz = {nullptr}#

Plug-in to compute \( \nabla_z h(..) \).

SP::PluggedObject _pluginJachlambda = {nullptr}#

Plug-in to compute \( \nabla_{\lambda} h(..) \).

SP::PluggedObject _pluging = {nullptr}#

Plug-in to compute g(…)

SP::PluggedObject _pluginJacglambda = {nullptr}#

Plug-in to compute \( \nabla_\lambda g \)

SP::PluggedObject _pluginJacgx = {nullptr}#

Plug-in to compute \( \nabla_x g \)

SP::PluggedObject _pluginf = {nullptr}#

Plug-in to compute f.

SP::PluggedObject _plugine = {nullptr}#

Plug-in to compute e.

RELATION::TYPES _relationType#

type of the Relation: FirstOrder or Lagrangian

RELATION::SUBTYPES _subType#

sub-type of the Relation (exple: LinearTIR or ScleronomousR …)

Private Functions

Relation(const Relation&) = delete#
Relation &operator=(const Relation&) = delete#
Relation &operator=(const Relation&&) = delete#