NEST main@caf0ae8
 
Loading...
Searching...
No Matches
nest::Event Class Referenceabstract

Encapsulate information sent between nodes. More...

#include <event.h>

Inheritance diagram for nest::Event:
[legend]
Collaboration diagram for nest::Event:
[legend]

Public Member Functions

 Event ()
 
virtual ~Event ()
 
virtual Event * clone () const =0
 
virtual void operator() ()=0
 Deliver the event to receiver.
 
void set_receiver (Node &)
 Change pointer to receiving Node.
 
Node & get_receiver () const
 Return reference to receiving Node.
 
size_t get_receiver_node_id () const
 Return node ID of receiving Node.
 
Node & get_sender () const
 Return reference to sending Node.
 
void set_sender (Node &)
 Change pointer to sending Node.
 
size_t get_sender_node_id () const
 Sender is local.
 
size_t retrieve_sender_node_id_from_source_table () const
 Sender is not local.
 
void set_sender_node_id (const size_t)
 Change node ID of sending Node.
 
void set_sender_node_id_info (const size_t tid, const synindex syn_id, const size_t lcid)
 Set tid, syn_id, lcid of spike_data_.
 
Time const & get_stamp () const
 Return time stamp of the event.
 
void set_delay_steps (long)
 Set the transmission delay of the event.
 
long get_delay_steps () const
 Return transmission delay of the event.
 
long get_rel_delivery_steps (const Time &t) const
 Relative spike delivery time in steps.
 
size_t get_port () const
 Return the sender port number of the event.
 
size_t get_rport () const
 Return the receiver port number of the event.
 
void set_port (size_t p)
 Set the port number.
 
void set_rport (size_t p)
 Set the receiver port number (r-port).
 
double get_offset () const
 Return the creation time offset of the Event.
 
void set_offset (double t)
 Set the creation time of the Event.
 
double get_weight () const
 Return the weight.
 
void set_weight (double t)
 Set weight of the event.
 
virtual void set_drift_factor (double)
 Set drift_factor of the event (see DiffusionConnectionEvent).
 
virtual void set_diffusion_factor (double)
 Set diffusion_factor of the event (see DiffusionConnectionEvent).
 
bool sender_is_valid () const
 Returns true if the pointer to the sender node is valid.
 
bool receiver_is_valid () const
 Returns true if the pointer to the receiver node is valid.
 
bool is_valid () const
 Check integrity of the event.
 
void set_stamp (Time const &)
 Set the time stamp of the event.
 
void set_flush_event_flag (bool is_flush_event)
 Sets the flush event flag.
 
bool is_flush_event ()
 Returns whether this spike is a flush event.
 

Protected Attributes

size_t sender_node_id_
 node ID of sender or 0
 
SpikeData sender_spike_data_
 spike data of sender node, in some cases required to retrieve node ID
 
Node * sender_
 Pointer to sender or nullptr.
 
Node * receiver_
 Pointer to receiver or nullptr.
 
size_t p_
 Sender port number.
 
size_t rp_
 Receiver port number (r-port).
 
long d_
 Transmission delay.
 
Time stamp_
 Time stamp.
 
long stamp_steps_
 Time stamp in steps.
 
double offset_
 Offset for precise spike times.
 
double w_
 Weight of the connection.
 

Detailed Description

Encapsulate information sent between nodes.

Event is the base class for transmitting information between nodes in NEST, with different subclasses for transmitting different types of information. Event types come in three categories

  1. SpikeEvent can be transmitted between MPI processes
  2. SecondaryEvent subclasses can also be transmitted between MPI processes, but need to be transmitted via secondary connections. They can transport data.
  3. All other Event subclasses can only be transmitted within an MPI process

Events are used for two tasks:

  1. Creating connections
  2. Sending signals between nodes during simulation

Events during connection

Node::send_test_event() creates an Event instance of the type of event emitted by that node type, and calls Node::handles_test_event() on the target node. During this call, the event will contain a pointer to a sender node, which is not necessarily the actual sender (which may reside on a different MPI rank), but usually a proxy node. The sender node id is not set. The essential task of this handshake is to ensure that the target can handle the connection and requested receptor type, and to return rport information.

Events during simulation

Events transmit information during simulation. SpikeEvent and SecondaryEvent types are first stored in buffers on the sending VP, then serialized for transmission to destination VPs and finally deserialized for delivery. In this process, for the sake of efficiency, NEST creates one Event object and updates its properties for each single event to be delivered. In this case, no pointer to the source node is stored in the Event (as it may be on a different MPI rank), but the correct sender node id is provided.

Other Event types are delivered directly on the VP on which they are generated and can, for example, be used for call backs or request-reply sequences.

See also
Node
SpikeEvent
DSSpikeEvent
RateEvent
CurrentEvent
DSCurrentEvent
ConductanceEvent
WeightRecorderEvent
DataLoggingRequest
DataLoggingReply
DataEvent
DoubleDataEvent
SecondaryEvent
DelayedRateConnectionEvent
DiffusionConnectionEvent
GapJunctionEvent
InstantaneousRateConnectionEvent
LearningSignalConnectionEvent

Constructor & Destructor Documentation

◆ Event()

nest::Event::Event ( )

◆ ~Event()

virtual nest::Event::~Event ( )
inlinevirtual

Member Function Documentation

◆ clone()

◆ get_delay_steps()

long nest::Event::get_delay_steps ( ) const
inline

Return transmission delay of the event.

The delay refers to the time until the event is expected to arrive at the receiver.

References d_.

◆ get_offset()

double nest::Event::get_offset ( ) const
inline

Return the creation time offset of the Event.

Each Event carries the exact time of creation. This time need not coincide with an integral multiple of the temporal resolution. Rather, Events may be created at any point in time.

References offset_.

Referenced by nest::RecordingBackendMemory::DeviceData::push_back().

Here is the caller graph for this function:

◆ get_port()

size_t nest::Event::get_port ( ) const
inline

Return the sender port number of the event.

This function returns the number of the port over which the Event was sent.

Return values
Anegative return value indicates that no port number was available.

References p_.

◆ get_receiver()

Node & nest::Event::get_receiver ( ) const
inline

Return reference to receiving Node.

References receiver_.

◆ get_receiver_node_id()

size_t nest::Event::get_receiver_node_id ( ) const

Return node ID of receiving Node.

References nest::Node::get_node_id(), and receiver_.

Here is the call graph for this function:

◆ get_rel_delivery_steps()

long nest::Event::get_rel_delivery_steps ( const Time &  t) const
inline

Relative spike delivery time in steps.

Returns the delivery time of the spike relative to a given time in steps. Causality commands that the result should not be negative.

Returns
stamp + delay - 1 - t in steps
Parameters
Timereference time
See also
NEST Time Memo, Rule 3

References d_, nest::Time::get_steps(), stamp_, and stamp_steps_.

Here is the call graph for this function:

◆ get_rport()

size_t nest::Event::get_rport ( ) const
inline

Return the receiver port number of the event.

This function returns the number of the r-port over which the Event was sent.

Note
A return value of 0 indicates that the r-port is not used.

References rp_.

◆ get_sender()

Node & nest::Event::get_sender ( ) const
inline

Return reference to sending Node.

Note
This will cause a segmentation fault if sender has not been set via set_sender().

References sender_.

◆ get_sender_node_id()

size_t nest::Event::get_sender_node_id ( ) const
inline

Sender is local.

Return node ID of sending Node.

Note
This will trigger an assertion if sender node id has not been set.

References sender_node_id_.

Referenced by nest::RecordingBackendMemory::DeviceData::push_back().

Here is the caller graph for this function:

◆ get_stamp()

Time const & nest::Event::get_stamp ( ) const
inline

Return time stamp of the event.

The stamp denotes the time when the event was created. The resolution of Stamp is limited by the time base of the simulation kernel (

See also
class nest::Time). If this resolution is not fine enough, the creation time can be corrected by using the time attribute.

References stamp_.

Referenced by nest::RecordingBackendMemory::DeviceData::push_back().

Here is the caller graph for this function:

◆ get_weight()

double nest::Event::get_weight ( ) const
inline

Return the weight.

References w_.

Referenced by nest::spin_detector::handle(), and nest::spin_detector::update().

Here is the caller graph for this function:

◆ is_flush_event()

bool nest::Event::is_flush_event ( )
inline

Returns whether this spike is a flush event.

References nest::SpikeData::is_flush_event(), and sender_spike_data_.

Referenced by set_flush_event_flag().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_valid()

bool nest::Event::is_valid ( ) const
inline

Check integrity of the event.

This function returns true, if all data, in particular sender and receiver pointers are correctly set.

References d_, receiver_is_valid(), and sender_is_valid().

Here is the call graph for this function:

◆ operator()()

◆ receiver_is_valid()

bool nest::Event::receiver_is_valid ( ) const
inline

Returns true if the pointer to the receiver node is valid.

References receiver_.

Referenced by is_valid().

Here is the caller graph for this function:

◆ retrieve_sender_node_id_from_source_table()

size_t nest::Event::retrieve_sender_node_id_from_source_table ( ) const

Sender is not local.

Retrieve node ID of sending Node from SourceTable and return it.

References nest::KernelManager::connection_manager, nest::SpikeData::get_lcid(), nest::ConnectionManager::get_source_node_id(), nest::SpikeData::get_syn_id(), nest::SpikeData::get_tid(), nest::kernel(), sender_node_id_, and sender_spike_data_.

Here is the call graph for this function:

◆ sender_is_valid()

bool nest::Event::sender_is_valid ( ) const
inline

Returns true if the pointer to the sender node is valid.

References sender_.

Referenced by is_valid().

Here is the caller graph for this function:

◆ set_delay_steps()

void nest::Event::set_delay_steps ( long  d)
inline

Set the transmission delay of the event.

The delay refers to the time until the event is expected to arrive at the receiver.

Parameters
tdelay.

References d_.

Referenced by nest::Connector< ConnectionT >::send_weight_event().

Here is the caller graph for this function:

◆ set_diffusion_factor()

virtual void nest::Event::set_diffusion_factor ( double  )
inlinevirtual

Set diffusion_factor of the event (see DiffusionConnectionEvent).

Reimplemented in nest::DiffusionConnectionEvent.

◆ set_drift_factor()

virtual void nest::Event::set_drift_factor ( double  )
inlinevirtual

Set drift_factor of the event (see DiffusionConnectionEvent).

Reimplemented in nest::DiffusionConnectionEvent.

◆ set_flush_event_flag()

void nest::Event::set_flush_event_flag ( bool  is_flush_event)
inline

Sets the flush event flag.

References is_flush_event(), sender_spike_data_, and nest::SpikeData::set_flush_event_flag().

Referenced by nest::EventDeliveryManager::deliver_events_(), nest::eprop_iaf::update(), nest::eprop_iaf_adapt::update(), nest::eprop_iaf_adapt_bsshslm_2020::update(), nest::eprop_iaf_bsshslm_2020::update(), nest::eprop_iaf_psc_delta::update(), nest::eprop_iaf_psc_delta_adapt::update(), and nest::parrot_neuron::update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_offset()

void nest::Event::set_offset ( double  t)
inline

Set the creation time of the Event.

Each Event carries the exact time of creation in realtime. This time need not coincide with an integral multiple of the temporal resolution. Rather, Events may be created at any point in time.

Parameters
tCreation time in realtime. t has to be in [0, h).

References offset_.

Referenced by nest::EventDeliveryManager::deliver_events_(), nest::iaf_psc_exp_ps::emit_instant_spike_(), nest::iaf_psc_exp_ps_lossless::emit_instant_spike_(), nest::iaf_psc_alpha_ps::emit_instant_spike_(), nest::iaf_psc_delta_ps::emit_instant_spike_(), nest::iaf_psc_exp_ps::emit_spike_(), nest::iaf_psc_exp_ps_lossless::emit_spike_(), nest::iaf_psc_delta_ps::emit_spike_(), nest::iaf_psc_alpha_ps::emit_spike_(), nest::iaf_tum_2000::update(), nest::parrot_neuron_ps::update(), nest::spike_generator::update(), and nest::spike_train_injector::update().

Here is the caller graph for this function:

◆ set_port()

void nest::Event::set_port ( size_t  p)
inline

Set the port number.

Each event carries the number of the port over which the event is sent. When a connection is established, it receives a unique ID from the sender. This number has to be stored in each Event object.

Parameters
pPort number of the connection, or -1 if unknown.

References p_.

Referenced by nest::Connector< ConnectionT >::send_weight_event().

Here is the caller graph for this function:

◆ set_receiver()

void nest::Event::set_receiver ( Node &  r)
inline

Change pointer to receiving Node.

References receiver_.

Referenced by nest::Connector< ConnectionT >::send_weight_event().

Here is the caller graph for this function:

◆ set_rport()

void nest::Event::set_rport ( size_t  p)
inline

Set the receiver port number (r-port).

When a connection is established, the receiving Node may issue a port number (r-port) to distinguish the incomin connection. By the default, the r-port is not used and its port number defaults to zero.

Parameters
pReceiver port number of the connection, or 0 if unused.

References rp_.

Referenced by nest::Connector< ConnectionT >::send_weight_event().

Here is the caller graph for this function:

◆ set_sender()

◆ set_sender_node_id()

void nest::Event::set_sender_node_id ( const size_t  node_id)
inline

Change node ID of sending Node.

References sender_node_id_.

Referenced by nest::Connector< ConnectionT >::send_weight_event().

Here is the caller graph for this function:

◆ set_sender_node_id_info()

void nest::Event::set_sender_node_id_info ( const size_t  tid,
const synindex  syn_id,
const size_t  lcid 
)
inline

Set tid, syn_id, lcid of spike_data_.

These are required to retrieve the Node ID of a non-local sender from the SourceTable.

References sender_spike_data_, and nest::SpikeData::set().

Referenced by nest::EventDeliveryManager::deliver_events_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_stamp()

void nest::Event::set_stamp ( Time const &  s)
inline

Set the time stamp of the event.

The time stamp refers to the time when the event was created.

References stamp_, and stamp_steps_.

Referenced by nest::EventDeliveryManager::deliver_events_(), nest::multimeter::handle(), and nest::Connector< ConnectionT >::send_weight_event().

Here is the caller graph for this function:

◆ set_weight()

void nest::Event::set_weight ( double  t)
inline

Set weight of the event.

References w_.

Referenced by nest::spin_detector::handle(), and nest::Connector< ConnectionT >::send_weight_event().

Here is the caller graph for this function:

Member Data Documentation

◆ d_

long nest::Event::d_
protected

Transmission delay.

Number of simulations steps that pass before the event is delivered at the receiver. The delay must be at least 1.

Referenced by get_delay_steps(), get_rel_delivery_steps(), is_valid(), and set_delay_steps().

◆ offset_

double nest::Event::offset_
protected

Offset for precise spike times.

offset_ specifies a correction to the creation time. If the resolution of stamp is not sufficiently precise, this attribute can be used to correct the creation time. offset_ has to be in [0, h).

Referenced by get_offset(), and set_offset().

◆ p_

size_t nest::Event::p_
protected

Sender port number.

The sender port is used as a unique identifier for the connection. The receiver of an event can use the port number to obtain data from the sender. The sender uses this number to locate target-specific information.

Note
A negative port number indicates an unknown port.

Referenced by get_port(), and set_port().

◆ receiver_

◆ rp_

size_t nest::Event::rp_
protected

Receiver port number (r-port).

The receiver port (r-port) can be used by the receiving Node to distinguish incoming connections. E.g. the r-port number can be used by Events to access specific parts of a Node. In most cases, however, this port will no be used.

Note
The use of this port number is optional.
An r-port number of 0 indicates that the port is not used.

Referenced by get_rport(), and set_rport().

◆ sender_

Node* nest::Event::sender_
protected

◆ sender_node_id_

size_t nest::Event::sender_node_id_
protected

◆ sender_spike_data_

SpikeData nest::Event::sender_spike_data_
protected

spike data of sender node, in some cases required to retrieve node ID

Referenced by is_flush_event(), retrieve_sender_node_id_from_source_table(), set_flush_event_flag(), and set_sender_node_id_info().

◆ stamp_

Time nest::Event::stamp_
protected

Time stamp.

The time stamp specifies the absolute time when the event shall arrive at the target.

Referenced by get_rel_delivery_steps(), get_stamp(), and set_stamp().

◆ stamp_steps_

long nest::Event::stamp_steps_
mutableprotected

Time stamp in steps.

Caches the value of stamp in steps for efficiency. Needs to be declared mutable since it is modified by a const function (get_rel_delivery_steps).

Referenced by get_rel_delivery_steps(), and set_stamp().

◆ w_

double nest::Event::w_
protected

Weight of the connection.

Referenced by get_weight(), and set_weight().


The documentation for this class was generated from the following files: