siconos.kernel.Event (Python class)

class siconos.kernel.Event(*args)[source]

Bases: object

Abstract class that represents generic time events.

This base class simply records the time at which the event will take place. A pure virtual function named process will be invoked to execute the event. The time is represented with a mpz_t, from gmp library. See http://gmplib.org.

Derived classes:

  • TimeDiscretisationEvent: events that corresponds to user-defined time- discretisation points
  • NonSmoothEvent: specific events, detected during simulation, when constraints are violated (thanks to roots-finding algorithm)
  • SensorEvent: event dedicated to data capture through user-defined sensors.

Existing types of events: 0 -> undef 1 -> TimeDiscretisation 2 -> NonSmooth 3 -> Sensor 4 -> Observer 5 -> Actuator

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

Constructors

Event(double time, int newType=0, bool reschedule=False)

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

assignment operator private => no assign allowedconstructor with time value and type as input

Parameters:
  • time – the starting type (a double)
  • newType – the Event type (an int)
  • reschedule – set this to true if the event has to be rescheduled
display() → None[source]

display Event data

getDoubleTimeOfEvent() → double[source]

get the time of the present event (double format)

Returns:a double
getTick() → double[source]

get tick value

Returns:a double
getTimeDiscretisation() → TimeDiscretisation[source]

Get the TimeDiscretisation.

Returns:the TimeDiscretisation used in this Event
getTimeOfEvent() → mpz_t *[source]

get the time of the present event (mpz_t format)

Returns:a mpz_t
getType() → int[source]

get a type of the present event

Returns:an std::string
incrementTime(int step=1) → None[source]
process(sim: Simulation) → void[source]

process(Simulation sim)=0 -> None

virtual function which actions depends on event type

Parameters:sim – the simulation that owns this Event (through the EventsManager)
reschedule() → bool[source]
setK(int newK) → None[source]

Set the current step k.

Parameters:newK – the new value of _k
static setTick(double newTick) → None[source]

set tick value

Parameters:newTick – the new tick value
setTime(double time) → None[source]

set the time of the present event (double format)

Parameters:time – the new time
setTimeDiscretisation(TimeDiscretisation td) → None[source]

Set the TimeDiscretisation.

Parameters:td – a TimeDiscretisation for this Event
setType(int newType) → None[source]

set a new type for the present Event

Parameters:newType – the new Event type
update(int k=0) → None[source]

virtual function which actions depends on event type.

The generic implementation present in this object is to increment the TimeDiscretisation and to chamge the time of the current Event

Parameters:k – meaning depends on the type of event. See derived class.