Encapsulate information sent between nodes. More...
#include <event.h>
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. | |
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
Events are used for two tasks:
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 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.
| nest::Event::Event | ( | ) |
|
inlinevirtual |
|
pure virtual |
Implemented in nest::SICEvent, nest::SpikeEvent, nest::WeightRecorderEvent, nest::RateEvent, nest::CurrentEvent, nest::DataLoggingRequest, nest::DataLoggingReply, nest::ConductanceEvent, nest::DoubleDataEvent, nest::GapJunctionEvent, nest::InstantaneousRateConnectionEvent, nest::DelayedRateConnectionEvent, nest::DiffusionConnectionEvent, nest::LearningSignalConnectionEvent, and nest::SecondaryEvent.
|
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_.
|
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().
|
inline |
|
inline |
| size_t nest::Event::get_receiver_node_id | ( | ) | const |
Return node ID of receiving Node.
References nest::Node::get_node_id(), and receiver_.
|
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.
| Time | reference time |
References d_, nest::Time::get_steps(), stamp_, and stamp_steps_.
|
inline |
|
inline |
Return reference to sending Node.
References sender_.
|
inline |
Sender is local.
Return node ID of sending Node.
References sender_node_id_.
Referenced by nest::RecordingBackendMemory::DeviceData::push_back().
|
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 (
References stamp_.
Referenced by nest::RecordingBackendMemory::DeviceData::push_back().
|
inline |
Return the weight.
References w_.
Referenced by nest::spin_detector::handle(), and nest::spin_detector::update().
|
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().
|
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().
|
pure virtual |
Deliver the event to receiver.
This operator calls the handler for the specific event type at the receiver.
Implemented in nest::SICEvent, nest::SpikeEvent, nest::WeightRecorderEvent, nest::DSSpikeEvent, nest::RateEvent, nest::CurrentEvent, nest::DSCurrentEvent, nest::DataLoggingRequest, nest::DataLoggingReply, nest::ConductanceEvent, nest::DoubleDataEvent, nest::GapJunctionEvent, nest::InstantaneousRateConnectionEvent, nest::DelayedRateConnectionEvent, nest::DiffusionConnectionEvent, and nest::LearningSignalConnectionEvent.
|
inline |
Returns true if the pointer to the receiver node is valid.
References receiver_.
Referenced by is_valid().
| 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_.
|
inline |
Returns true if the pointer to the sender node is valid.
References sender_.
Referenced by is_valid().
|
inline |
Set the transmission delay of the event.
The delay refers to the time until the event is expected to arrive at the receiver.
| t | delay. |
References d_.
Referenced by nest::Connector< ConnectionT >::send_weight_event().
|
inlinevirtual |
Set diffusion_factor of the event (see DiffusionConnectionEvent).
Reimplemented in nest::DiffusionConnectionEvent.
|
inlinevirtual |
Set drift_factor of the event (see DiffusionConnectionEvent).
Reimplemented in nest::DiffusionConnectionEvent.
|
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().
|
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.
| t | Creation 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().
|
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.
| p | Port number of the connection, or -1 if unknown. |
References p_.
Referenced by nest::Connector< ConnectionT >::send_weight_event().
|
inline |
Change pointer to receiving Node.
References receiver_.
Referenced by nest::Connector< ConnectionT >::send_weight_event().
|
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.
| p | Receiver port number of the connection, or 0 if unused. |
References rp_.
Referenced by nest::Connector< ConnectionT >::send_weight_event().
|
inline |
Change pointer to sending Node.
References sender_.
Referenced by nest::diffusion_connection< targetidentifierT >::check_connection(), nest::eprop_learning_signal_connection< targetidentifierT >::check_connection(), nest::eprop_learning_signal_connection_bsshslm_2020< targetidentifierT >::check_connection(), nest::gap_junction< targetidentifierT >::check_connection(), nest::rate_connection_delayed< targetidentifierT >::check_connection(), nest::rate_connection_instantaneous< targetidentifierT >::check_connection(), and nest::sic_connection< targetidentifierT >::check_connection().
|
inline |
Change node ID of sending Node.
References sender_node_id_.
Referenced by nest::Connector< ConnectionT >::send_weight_event().
|
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_().
|
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().
|
inline |
Set weight of the event.
References w_.
Referenced by nest::spin_detector::handle(), and nest::Connector< ConnectionT >::send_weight_event().
|
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().
|
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().
|
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.
Referenced by get_port(), and set_port().
|
protected |
Pointer to receiver or nullptr.
Referenced by get_receiver(), get_receiver_node_id(), nest::SICEvent::operator()(), nest::SpikeEvent::operator()(), nest::WeightRecorderEvent::operator()(), nest::RateEvent::operator()(), nest::CurrentEvent::operator()(), nest::DataLoggingRequest::operator()(), nest::DataLoggingReply::operator()(), nest::ConductanceEvent::operator()(), nest::DoubleDataEvent::operator()(), nest::GapJunctionEvent::operator()(), nest::InstantaneousRateConnectionEvent::operator()(), nest::DelayedRateConnectionEvent::operator()(), nest::DiffusionConnectionEvent::operator()(), nest::LearningSignalConnectionEvent::operator()(), receiver_is_valid(), and set_receiver().
|
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.
Referenced by get_rport(), and set_rport().
|
protected |
Pointer to sender or nullptr.
Referenced by get_sender(), nest::DSSpikeEvent::operator()(), nest::DSCurrentEvent::operator()(), sender_is_valid(), and set_sender().
|
protected |
node ID of sender or 0
Referenced by get_sender_node_id(), retrieve_sender_node_id_from_source_table(), and set_sender_node_id().
|
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().
|
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().
|
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().
|
protected |
Weight of the connection.
Referenced by get_weight(), and set_weight().