File kernel/src/modelingTools/NonSmoothDynamicalSystem.hpp

Contents

File kernel/src/modelingTools/NonSmoothDynamicalSystem.hpp#

Go to the source code of this file

container for DynamicalSystem and Interaction

container for DynamicalSystem and Interaction

class NonSmoothDynamicalSystem
#include <NonSmoothDynamicalSystem.hpp>

the NonSmoothDynamicalSystem consists in Dynamical Systems and Interactions structured into a graph defined in a Topology.

In the DynamicalSystem graph, DynamicalSystem objects are nodes and Interaction objects are edges.

To add a DynamicalSystem, use insertDynamicalSystem method. To add a new Interaction, use link method.

A dual graph is also contructed, where Interactions are vertices and DynamicalSystems are edges.

Subclassed by LinearComplementaritySystemsNSDS

Public Types

enum ChangeType#

Values:

enumerator addDynamicalSystem#
enumerator rmDynamicalSystem#
enumerator addInteraction#
enumerator rmInteraction#
enumerator clearTopology#
typedef std::list<Change> ChangeLog#

Public Functions

NonSmoothDynamicalSystem(double t0, double T)

NSDS constructor.

Parameters:
  • t0 – initial time

  • T – final time

~NonSmoothDynamicalSystem()

destructor

inline double currentTime() const
Returns:

the current time value

inline void setCurrentTime(double newValue)

set the current time

Parameters:

newValue – the new time

inline double t0() const
Returns:

initial time

inline void sett0(double newT0)

set initial time of the time discretisation

Parameters:

newT0

inline double finalT() const
Returns:

final time

inline void setT(double newValue)

set final time

Parameters:

newValue – the new final time for the Simulatiom

inline const std::string title() const

get the title of the simulation

Returns:

std::string : the title

inline void setTitle(const std::string &s)

set the title of the simulation

Parameters:

s – : the title

inline const std::string author() const

get the author of the simulation

Returns:

std::string : the author

inline void setAuthor(const std::string &s)

set the author of the simulation

Parameters:

s – std::string : the author

inline const std::string description() const

allows to get the description of the simulation

Returns:

std::string : the description

inline void setDescription(const std::string &s)

set the author of the simulation

Parameters:

s – std::string : the author

inline const std::string date() const

allows to get the date of the simulation

Returns:

std::string : the date

inline void setDate(const std::string &s)

set the date of the simulation

Parameters:

s – std::string : the date

inline bool isBVP() const

get problem type (true if BVP)

Returns:

a bool

inline bool isIVP() const

get problem type (true if IVP)

Returns:

a bool

inline void setBVP(const bool &newBvp)

set the NonSmoothDynamicalSystem to BVP, else it is IVP

Parameters:

newBvp – true if BVP, false otherwise

inline const ChangeLog &changeLog()

get a reference to the changelog for an NSDS.

Returns:

a reference to the changelog.

inline ChangeLogIter changeLogPosition()

get an iterator to the last item in the changelog.

Returns:

an iterator pointing at the last item in the changelog.

inline ChangeLogIter changeLogBegin()

get an iterator to the beginning of the changelog.

Returns:

an iterator pointing at the beginning of the changelog.

void clearChangeLogTo(const ChangeLogIter &it)

clear the changelog up to a given position.

Parameters:

it – This iterator must point to somewhere in the changelog for this NSDS.

inline size_t getNumberOfDS() const
Returns:

the number of Dynamical Systems present in the NSDS

inline const SP::DynamicalSystemsGraph dynamicalSystems() const

get all the dynamical systems declared in the NonSmoothDynamicalSystem.

Returns:

a SP::DynamicalSystemsGraph

std::vector<SP::DynamicalSystem> dynamicalSystemsVector() const

get all the dynamical systems declared in the NonSmoothDynamicalSystem.

into a std::vector<SP::DynamicalSystem> Useful for iterates on DynamicalSystems in Python for instance

Returns:

std::vector<SP::DynamicalSystem>

void insertDynamicalSystem(SP::DynamicalSystem ds)

add a dynamical system into the DS graph (as a vertex)

Parameters:

ds – a pointer to the system to add

inline SP::DynamicalSystem dynamicalSystem(unsigned int nb) const

get Dynamical system number I

Parameters:

nb – the identifier of the DynamicalSystem to get

Returns:

a pointer on DynamicalSystem

inline void displayDynamicalSystems() const#
void removeDynamicalSystem(SP::DynamicalSystem ds)

remove a dynamical system

Parameters:

ds – a pointer to the dynamical system to remove

inline size_t getNumberOfInteractions() const

get the number of Interactions present in the NSDS.

Returns:

an unsigned int

inline const SP::InteractionsGraph interactions() const

return the graph of Interactions present in the NSDS.

Returns:

SP::InteractionGraph

void removeInteraction(SP::Interaction inter)

remove an interaction to the system

Parameters:

inter – a pointer to the interaction to remove

inline SP::Interaction interaction(unsigned int nb) const

get Interaction number I

Parameters:

nb – the identifier of the Interaction to get

Returns:

a pointer to an Interaction

inline SP::Interaction interaction(std::string name) const

get Interaction named name

Parameters:

name – of the Interaction to get

Returns:

a pointer to an Interaction

std::vector<SP::Interaction> InteractionsVector() const

get all the interactions declared in the NonSmoothDynamicalSystem.

into a std::vector<SP::Interaction> Useful for iterates on Interaction in Python for instance

Returns:

std::vector<SP::Interaction>

void link(SP::Interaction inter, SP::DynamicalSystem ds1, SP::DynamicalSystem ds2 = SP::DynamicalSystem())

link an interaction to two dynamical systems

Parameters:
inline void setName(SP::DynamicalSystem ds, const std::string &name)

set the name for this Dynamical System

Parameters:
inline std::string name(SP::DynamicalSystem ds)

get the name for this Dynamical System

Parameters:

ds – a pointer to the system

Returns:

name the name of the DynamicalSystem, or empty string if not found.

inline void setName(SP::Interaction interaction, const std::string &name)

set the name for this Interaction

Parameters:
inline std::string name(SP::Interaction inter)

get the name for this Interaction

Parameters:

inter – a pointer to the Interaction

Returns:

name the name of the Interaction, or empty string if not found.

inline void setControlProperty(SP::Interaction inter, const bool isControlInteraction)

specify id the given Interaction is for controlling the DS

Parameters:
inline SP::Topology topology() const

get the topology of the system

Returns:

a pointer on Topology

void display() const

display the data of the Non Smooth Dynamical System

inline bool isLinear() const

return false is one of the interations is not linear.

else return true.

Returns:

a bool

void clear()#
void setSymmetric(bool val)

set symmetry in the blocks computation

Parameters:

val – a bool

void resetNonSmoothPart(unsigned int level)

Set all DS non-smooth part to zero for a given level.

Parameters:

level – the level to will be zeroed

void swapInMemory()

save DynamicalSystems and Interactions states in Memories

void pushInteractionsInMemory()

save interaction states in memories.

Applied to all interactions of the connected topology

void updateDSPlugins(double time)

update the plugins of the DS

Parameters:

time – to be used for plugins

void updateInput(double time, unsigned int level)

compute r thanks to lambda[level] for all Interactions

Parameters:
  • time

  • level – lambda level

void updateOutput(double time, unsigned int level = 0)

compute output for all the interactions for a given level

Parameters:
  • time

  • level – y order to be computed

void updateOutput(double time, unsigned int level_min, unsigned int level_max)

compute output for all the interactions and for a level range

Parameters:
  • time

  • level_min – y min order to be computed

  • level_max – y max order to be computed

void computeInteractionJacobians(double time)

compute Jacobians for all the interactions (in indexSet0)

Parameters:

time

void computeInteractionJacobians(double time, InteractionsGraph &indexSet)

compute Jacobians for all the interactions of a given index set

Parameters:
void visitDynamicalSystems(SP::SiconosVisitor visitor)

visit all dynamical systems in this system

Parameters:

visitor – an SP::SiconosVisitor that can visit classes derived from DS

Protected Functions

inline NonSmoothDynamicalSystem()#

Private Functions

ACCEPT_SERIALIZATION(NonSmoothDynamicalSystem)#
NonSmoothDynamicalSystem(const NonSmoothDynamicalSystem &nsds) = delete#
OneStepNSProblem &operator=(const OneStepNSProblem &osnsp) = delete#

Private Members

double _t0 = 0.#

initial time of the simulation

double _t = _t0#

current time of the simulation Warning FP : it corresponds to the time at the end of the integration step.

It means that _t corresponds to tkp1 of the simulation or nextTime().

double _T = 0.#

final time of the simulation

std::string _title = "none"#

information concerning the Model

std::string _author = "none"#
std::string _description = "none"#
std::string _date = "unknown"#
bool _BVP = false#

TRUE if the NonSmoothDynamicalSystem is a boundary value problem.

std::list<Change> _changeLog#

log list of the modifications of the nsds

SP::Topology _topology#

the topology of the system

bool _mIsLinear = true#

False is one of the interaction is non-linear.

class Change

Public Functions

inline Change(ChangeType t, SP::DynamicalSystem dsnew)#
inline Change(ChangeType t, SP::Interaction inew)#
inline Change(ChangeType t)#
void display() const#

Public Members

ChangeType typeOfChange#
SP::DynamicalSystem ds#
SP::Interaction i#

Private Functions

ACCEPT_SERIALIZATION(NonSmoothDynamicalSystem::Change)#
Change() = default#
class ChangeLogIter

Public Functions

inline ChangeLogIter()#
inline ChangeLogIter(const ChangeLog &log, const ChangeLog::const_iterator &i)#

Public Members

const ChangeLog *_log#
ChangeLog::const_iterator it#

Private Functions

ACCEPT_SERIALIZATION(NonSmoothDynamicalSystem::Change)#