Class Topology#

Defined in Program listing for file kernel/src/simulationTools/Topology.hpp

class Topology : public std::enable_shared_from_this<Topology>#

This class describes the topology of the non-smooth dynamical system.

It holds all the “potential” Interactions”.

Topology is built in NSDS constructors but initialized in Simulation->initialize(), ie when all Interactions have been clearly defined.

Note that indexSet0 holds all the possible relations (declared by user) not only those which are “actives”.

Construction consists in:

  • link with the NSDS that owns the topology.

Initialization consists in:

  • scan of all the interactions of the NSDS

  • initialization of each interaction

  • insertion of the relations of all the Interaction into indexSet0

Insertion of an Interaction into the set indexSet0: addInteractionInIndexSet0(SP::Interaction inter) for each relation of the interaction, it creates a new Interaction and inserts it into indexSet0 It also counts the total number of “constraints” in the system.

Public Functions

Topology()#

default constructor

~Topology()#

destructor

bool hasDynamicalSystem(SP::DynamicalSystem ds) const#

check if an dynamical system is already a vertex of the DSs graph.

Parameters:

ds – the DS to test

Returns:

true if ds is in the graph

bool hasInteraction(SP::Interaction inter) const#

check if an interaction is already a vertex of the Interactions graph.

Parameters:

inter – the Interaction to test

Returns:

true if inter is in the graph

void removeInteraction(SP::Interaction inter)#

remove an Interaction from the topology.

The interaction is removed from Dynamical Systems graph and Interactions Graph. The interaction is not removed from actives subgraphs : see updateIndexSet

Parameters:

inter – the interaction to remove

void insertDynamicalSystem(SP::DynamicalSystem ds)#

add a dynamical system

Parameters:

ds – the DynamicalSystem to add

void removeDynamicalSystem(SP::DynamicalSystem ds)#

remove a Dynamical System from the topology.

The dynamical system is removed from Dynamical Systems graph and Interactions Graph. The dynamical system is not removed from actives subgraphs : see updateIndexSet

Parameters:

ds – the dynamical system to remove

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

set the name for this Dynamical System

Parameters:
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.

void setName(SP::Interaction inter, const std::string &name)#

set the name for an Interaction

Parameters:
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.

void setOSI(SP::DynamicalSystem ds, SP::OneStepIntegrator OSI)#

set the OSI for this DynamicalSystem

Parameters:
std::pair<DynamicalSystemsGraph::EDescriptor, InteractionsGraph::VDescriptor> link(SP::Interaction inter, SP::DynamicalSystem ds, SP::DynamicalSystem ds2 = SP::DynamicalSystem())#

link two dynamical systems to a relation

Parameters:
  • inter – a SP::Interaction

  • ds – a SP::DynamicalSystem

  • ds2 – a SP::DynamicalSystem (optional)

Returns:

a vertex descriptor of the new vertex in IndexSet0

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

specify if the given Interaction is for controlling the DS

Parameters:
inline SP::InteractionsGraph indexSet0() const#

get a pointer to the graph of all Interactions.

Returns:

a SP::InteractionsGraph

SP::InteractionsGraph indexSet(unsigned int num) const#

get a pointer to the graph at level num of Interactions

Parameters:

num – the number of indexSet

Returns:

a SP::InteractionsGraph

inline size_t numberOfIndexSet() const#

get a pointer to the graph at level num of Interactions

Returns:

a SP::InteractionsGraph

inline void resetIndexSetPtr(unsigned int num)#

reset graph at level num of Interactions

Parameters:

num – the indexSet to reset

inline SP::DynamicalSystemsGraph dSG(unsigned int num) const#

get a pointer to the graph at level num of Dynamical System

Parameters:

num – the level

Returns:

a SP::DynamicalSystemsGraph

inline size_t indexSetsSize() const#

get the number of Interactions Graphs

Returns:

the number of Interactions Graphs

inline size_t indexSetSize(unsigned int level) const#

get the size of the InteractionGraphs at a given level

Parameters:

level

Returns:

size of the InteractionGraphs at a given level

inline void indexSetsResize(unsigned int newSize)#

resize Interactions Graphs

Parameters:

newSize – the new size

inline void setHasChanged(const bool val)#

set _hasChanged to val

Parameters:

val – a bool

inline bool hasChanged() const#

check

Returns:

a bool

inline unsigned int numberOfConstraints() const#

get the total number of scalar constraints

Returns:

an unsigned int

inline void setSymmetric(bool val)#

set symmetry in the blocks computation

Parameters:

val – a bool

void setProperties()#

initialize graphs properties

SP::DynamicalSystem getDynamicalSystem(unsigned int requiredNumber) const#

Get a dynamical system using its number.

Warning

O(n) complexity

Parameters:

requiredNumber – the required number

Returns:

a DynamicalSystem

void displayDynamicalSystems() const#

list and display all dynamical systems

SP::DynamicalSystem getDynamicalSystem(std::string name) const#

Get a dynamical system using its name.

Warning

O(n) complexity

Parameters:

name – the name of the dynamical system

Returns:

a DynamicalSystem

SP::Interaction getInteraction(unsigned int requiredNumber) const#

Get a interaction using its number.

Warning

O(n) complexity

Parameters:

requiredNumber – the required number

Returns:

an Interaction

SP::Interaction getInteraction(std::string name) const#

Get a interaction using its name.

Warning

O(n) complexity

Parameters:

name – the name of the Interaction

Returns:

an Interaction pointer

std::vector<SP::Interaction> interactionsForDS(SP::DynamicalSystem) const#

get Interactions for a given DS

Returns:

a vector of pointers to Interaction

std::vector<SP::Interaction> interactionsForPairOfDS(SP::DynamicalSystem ds1, SP::DynamicalSystem ds2 = SP::DynamicalSystem()) const#

get Interactions for a given pair of DSs

Returns:

a vector of pointers to Interaction

std::vector<SP::DynamicalSystem> dynamicalSystemsForInteraction(SP::Interaction) const#

get DynamicalSystems for a given Interaction

Returns:

a vector of pointers to DynamicalSystem

inline DynamicalSystemsGraph::VDescriptor getDSG0Descriptor(SP::DynamicalSystem ds)#

Helper to get the descriptor in DSG0 from a DynamicalSystem.

Parameters:

dsDynamicalSystem of which we want the descriptor

Returns:

the descriptor in DSG0 from a DynamicalSystem

unsigned int numberOfInvolvedDS(unsigned int inumber)#

get the number of DynamicalSystem currently involved in an indexSet

Parameters:

inumber – the indexSet number

Returns:

the number of DynamicalSystem involved