siconos.kernel.Topology (Python class)

class siconos.kernel.Topology[source]

Bases: object

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.

Generated class (swig), based on C++ header Program listing for file kernel/src/simulationTools/Topology.hpp.

Constructors

Topology()

default constructor

clear() → None[source]
dSG(int num) → DynamicalSystemsGraph[source]

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

Parameters:num – the level
Returns:a SP::DynamicalSystemsGraph
dynamicalSystemsForInteraction(Interaction) → vector< DynamicalSystem >[source]

get DynamicalSystems for a given Interaction

Returns:a vector of pointers to DynamicalSystem
getDSG0Descriptor(DynamicalSystem ds) → DynamicalSystemsGraph::VDescriptor[source]

Helper to get the descriptor in DSG0 from a DynamicalSystem.

Parameters:ds – DynamicalSystem of which we want the descriptor
Returns:the descriptor in DSG0 from a DynamicalSystem
getDynamicalSystem(*args)[source]

Warning - Overloaded function : multiple signatures available, check prototypes below.

getDynamicalSystem(int requiredNumber) → DynamicalSystem[source]

Get a dynamical system using its number.

Warning: O(n) complexity

Parameters:requiredNumber – the required number
Returns:a DynamicalSystem
getDynamicalSystem(str name) → DynamicalSystem[source]

Get a dynamical system using its name.

Warning: O(n) complexity

Parameters:name – the name of the dynamical system
Returns:a DynamicalSystem
getInteraction(*args)[source]

Warning - Overloaded function : multiple signatures available, check prototypes below.

getInteraction(int requiredNumber) → Interaction[source]

Get a interaction using its number.

Warning: O(n) complexity

Parameters:requiredNumber – the required number
Returns:an Interaction
getInteraction(str name) → Interaction[source]

Get a interaction using its name.

Warning: O(n) complexity

Parameters:name – the name of the Interaction
Returns:an Interaction pointer
hasChanged() → bool[source]

check

Returns:a bool
hasDynamicalSystem(DynamicalSystem ds) → bool[source]

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
hasInteraction(Interaction inter) → bool[source]

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
indexSet(int num) → InteractionsGraph[source]

get a pointer to the graph at level num of Interactions

Parameters:num – the number of indexSet
Returns:a SP::InteractionsGraph
indexSet0() → InteractionsGraph[source]

get a pointer to the graph of all Interactions.

Returns:a SP::InteractionsGraph
indexSetSize(int level) → int[source]

get the size of the InteractionGraphs at a given level

Parameters:level
Returns:size of the InteractionGraphs at a given level
indexSetsResize(int newSize) → None[source]

resize Interactions Graphs

Parameters:newSize – the new size
indexSetsSize() → int[source]

get the number of Interactions Graphs

Returns:the number of Interactions Graphs
insertDynamicalSystem(DynamicalSystem ds) → None[source]

add a dynamical system

Parameters:ds – the DynamicalSystem to add
interaction_properties(int index, Interaction inter) → InteractionProperties[source]
interactionsForDS(DynamicalSystem) → vector< Interaction >[source]

get Interactions for a given DS

Returns:a vector of pointers to Interaction
interactionsForPairOfDS(DynamicalSystem ds1, DynamicalSystem ds2=DynamicalSystem()) → vector< Interaction >[source]

get Interactions for a given pair of DSs

Returns:a vector of pointers to Interaction

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

name(*args)[source]

Warning - Overloaded function : multiple signatures available, check prototypes below.

name(DynamicalSystem ds) → str[source]

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.
name(Interaction inter) → str[source]

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.
numberOfConstraints() → int[source]

get the total number of scalar constraints

Returns:an unsigned int
numberOfIndexSet() → int[source]

get a pointer to the graph at level num of Interactions

Returns:a SP::InteractionsGraph
numberOfInvolvedDS(int inumber) → int[source]

get the number of DynamicalSystem currently involved in an indexSet

Parameters:inumber – the indexSet number
Returns:the number of DynamicalSystem involved
removeDynamicalSystem(DynamicalSystem ds) → None[source]

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
removeInteraction(Interaction inter) → None[source]

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
resetIndexSetPtr(int num) → None[source]

reset graph at level num of Interactions

Parameters:num – the indexSet to reset
setControlProperty(Interaction inter, bool isControlInteraction) → None[source]

specify if the given Interaction is for controlling the DS

Parameters:
  • inter – Interaction
  • isControlInteraction – true if the Interaction is used for control purposes
setHasChanged(bool val) → None[source]

set _hasChanged to val

Parameters:val – a bool
setName(*args)[source]

Warning - Overloaded function : multiple signatures available, check prototypes below.

setName(DynamicalSystem ds, str name) → None[source]

set the name for this Dynamical System

Parameters:
  • ds – a pointer to the system
  • name – the name of the DynamicalSystem
setName(Interaction inter, str name) → None[source]

set the name for an Interaction

Parameters:
  • inter – a pointer to the Interaction
  • name – the name of the Interaction
setOSI(DynamicalSystem ds, OneStepIntegrator OSI) → None[source]

set the OSI for this DynamicalSystem

Parameters:
  • ds – the DynamicalSystem
  • OSI – the integrator to use for this DS
setProperties() → None[source]

initialize graphs properties

setSymmetric(bool val) → None[source]

set symmetry in the blocks computation

Parameters:val – a bool