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 (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.

Subclassed by FirstOrderR, LagrangianR, NewtonEulerR

Public Functions

virtual ~Relation()

destructor

virtual SP::SimpleMatrix C() const = 0
virtual void checkSize(Interaction &inter) = 0

check sizes of the relation specific operators.

Parameters

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 void computeJacg(double time, Interaction &inter) = 0
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 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 display() const

main relation members display

SP::PluggedObject getPlugine() const

Get _plugine.

Return
a shared pointer to the plugin

SP::PluggedObject getPluginf() const

Get _pluginf.

Return
a shared pointer to the plugin

SP::PluggedObject getPluging() const

Get _pluging.

Return
a shared pointer to the plugin

SP::PluggedObject getPluginh() const

Get _pluginh.

Return
a shared pointer to the plugin

SP::PluggedObject getPluginJachlambda() const

Get _pluginJachlambda.

Return
a shared pointer to the plugin

SP::PluggedObject getPluginJachx() const

Get _pluginJachx.

Return
a shared pointer to the plugin

SP::PluggedObject getPluginJacLg() const

Get _pluginJacglambda.

Return
a shared pointer to the plugin

RELATION::SUBTYPES getSubType() const

To get the subType of the Relation.

Return
the sub-type of the Relation

RELATION::TYPES getType() const

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

Return
the type of the Relation

virtual void initialize(Interaction &inter) = 0

initialize the relation (check sizes, memory allocation …)

Parameters
  • inter: the interaction using this relation

virtual bool isLinear()

return true if the relation is linear.

Return
bool

virtual bool requireResidu()

return true if the relation requires the computation of residu

Return
true if residu are required, false otherwise

virtual 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

virtual 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

virtual 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

virtual 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

virtual 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 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

virtual 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

virtual 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

virtual 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

VIRTUAL_ACCEPT_VISITORS(Relation)

Protected Functions

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

basic constructor

Parameters
  • type: type of the relation
  • subtype: subtype of the relation

virtual void _zeroPlugin()

To initialize all the plugin functions with NULL.

ACCEPT_SERIALIZATION(Relation)

serialization hooks

Protected Attributes

SP::PluggedObject _plugine

Plug-in to compute e.

SP::PluggedObject _pluginf

Plug-in to compute f.

SP::PluggedObject _pluging

Plug-in to compute g(…)

SP::PluggedObject _pluginh

Plug-in to compute h(…)

SP::PluggedObject _pluginJacglambda

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

SP::PluggedObject _pluginJacgx

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

SP::PluggedObject _pluginJachlambda

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

SP::PluggedObject _pluginJachx

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

SP::PluggedObject _pluginJachz

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

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()

default constructor => private, no copy nor pass-by-value

Relation(const Relation&)

copy constructor => private, no copy nor pass-by-value.

Relation &operator=(const Relation&)