Buffer Layout. More...
#include <ring_buffer.h>
Public Member Functions | |
| RingBuffer () | |
| void | add_value (const long offs, const double) |
| Add a value to the ring buffer. | |
| void | set_value (const long offs, const double) |
| Set a ring buffer entry to a given value. | |
| double | get_value (const long offs) |
| Read one value from ring buffer. | |
| double | get_value_wfr_update (const long offs) |
| Read one value from ring buffer without deleting it afterwards. | |
| void | clear () |
| Initialize the buffer with noughts. | |
| void | resize () |
| Resize the buffer according to max_thread and max_delay. | |
| size_t | size () const |
| Returns buffer size, for memory measurement. | |
Private Member Functions | |
| size_t | get_index_ (const long d) const |
| Obtain buffer index. | |
Private Attributes | |
| std::vector< double > | buffer_ |
| Buffered data. | |
Buffer Layout.
MODIFICATION 2005-06-19: The explanation below no longer holds if we allow direct delivery of events from devices such as the Poisson generator. The reasoning below applies only to events in the central queue, which are held in that queue until the beginning of the next slice, when system time has been advance from T to T + min_delay. Direct delivery events, in contrast are delivered when system time is still T. Their earliest delivery time is
min T_d = T + min_del
and the latest
max T_d = T + (min_del-1) + max_del = T + min_del + max_del - 1
Since we still need to keep the entries 0..min_del-1 for readout during the time slice beginning at T, we need a buffer with min_del+max_del elements.
SUPERSEEDED: Let S be the time at the beginning of the present time slice (from). All spikes arriving during this time slice, must have been emitted during the previous time slice, which started at S - min_del. Then, the earliest spike delivery time (compare Time Memo) is
min T_d = S-min_del + min_del = S
and the latest
max T_d = S-1 + max_del = S + (max_del - 1)
Thus,
0 <= S - T_d <= max_del - 1
so that the ring buffer needs max_del elements.
Each field represents an entry in the vector.
| nest::RingBuffer::RingBuffer | ( | ) |
|
inline |
Add a value to the ring buffer.
| offs | Arrival time relative to beginning of slice. |
| double | Value to add. |
References buffer_, and get_index_().
Referenced by nest::amat2_psc_exp::handle(), nest::cm_default::handle(), nest::eprop_iaf::handle(), nest::eprop_iaf_adapt::handle(), nest::eprop_iaf_adapt_bsshslm_2020::handle(), nest::eprop_iaf_bsshslm_2020::handle(), nest::eprop_iaf_psc_delta::handle(), nest::eprop_iaf_psc_delta_adapt::handle(), nest::eprop_readout::handle(), nest::eprop_readout_bsshslm_2020::handle(), nest::gif_psc_exp::handle(), nest::gif_psc_exp_multisynapse::handle(), nest::glif_psc::handle(), nest::glif_psc_double_alpha::handle(), nest::iaf_psc_alpha_multisynapse::handle(), nest::iaf_psc_alpha_ps::handle(), nest::iaf_psc_delta::handle(), nest::iaf_psc_delta_ps::handle(), nest::iaf_psc_exp_htum::handle(), nest::iaf_psc_exp_multisynapse::handle(), nest::iaf_psc_exp_ps::handle(), nest::iaf_psc_exp_ps_lossless::handle(), nest::izhikevich::handle(), nest::mat2_psc_exp::handle(), nest::pp_psc_delta::handle(), nest::amat2_psc_exp::handle(), nest::eprop_iaf::handle(), nest::eprop_iaf_adapt::handle(), nest::eprop_iaf_adapt_bsshslm_2020::handle(), nest::eprop_iaf_bsshslm_2020::handle(), nest::eprop_iaf_psc_delta::handle(), nest::eprop_iaf_psc_delta_adapt::handle(), nest::eprop_readout::handle(), nest::eprop_readout_bsshslm_2020::handle(), nest::gif_psc_exp::handle(), nest::iaf_chs_2007::handle(), nest::iaf_psc_delta::handle(), nest::iaf_psc_exp_htum::handle(), nest::izhikevich::handle(), nest::mat2_psc_exp::handle(), nest::parrot_neuron::handle(), nest::pp_psc_delta::handle(), nest::spike_dilutor::handle(), and nest::volume_transmitter::handle().
| void nest::RingBuffer::clear | ( | ) |
Initialize the buffer with noughts.
Also resizes the buffer if necessary.
References buffer_, and resize().
Referenced by nest::amat2_psc_exp::init_buffers_(), nest::eprop_iaf::init_buffers_(), nest::eprop_iaf_adapt::init_buffers_(), nest::eprop_iaf_adapt_bsshslm_2020::init_buffers_(), nest::eprop_iaf_bsshslm_2020::init_buffers_(), nest::eprop_iaf_psc_delta::init_buffers_(), nest::eprop_iaf_psc_delta_adapt::init_buffers_(), nest::eprop_readout::init_buffers_(), nest::eprop_readout_bsshslm_2020::init_buffers_(), nest::gif_psc_exp::init_buffers_(), nest::gif_psc_exp_multisynapse::init_buffers_(), nest::glif_psc::init_buffers_(), nest::glif_psc_double_alpha::init_buffers_(), nest::iaf_chs_2007::init_buffers_(), nest::iaf_psc_alpha_multisynapse::init_buffers_(), nest::iaf_psc_alpha_ps::init_buffers_(), nest::iaf_psc_delta::init_buffers_(), nest::iaf_psc_delta_ps::init_buffers_(), nest::iaf_psc_exp_htum::init_buffers_(), nest::iaf_psc_exp_multisynapse::init_buffers_(), nest::iaf_psc_exp_ps::init_buffers_(), nest::iaf_psc_exp_ps_lossless::init_buffers_(), nest::izhikevich::init_buffers_(), nest::mat2_psc_exp::init_buffers_(), nest::parrot_neuron::init_buffers_(), nest::pp_psc_delta::init_buffers_(), nest::spike_dilutor::init_buffers_(), nest::volume_transmitter::init_buffers_(), nest::AMPA::pre_run_hook(), nest::GABA::pre_run_hook(), nest::NMDA::pre_run_hook(), nest::AMPA_NMDA::pre_run_hook(), and nest::Compartment::pre_run_hook().
|
inlineprivate |
Obtain buffer index.
| delay | delivery delay for event |
References buffer_, nest::KernelManager::event_delivery_manager, nest::EventDeliveryManager::get_modulo(), and nest::kernel().
Referenced by add_value(), get_value(), get_value_wfr_update(), and set_value().
|
inline |
Read one value from ring buffer.
| offs | Offset of element to read within slice. |
References buffer_, get_index_(), and nest::kernel().
Referenced by nest::Compartment::construct_matrix_element(), nest::AMPA::f_numstep(), nest::GABA::f_numstep(), nest::NMDA::f_numstep(), nest::AMPA_NMDA::f_numstep(), nest::iaf_chs_2007::update(), nest::volume_transmitter::update(), nest::amat2_psc_exp::update(), 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(), nest::eprop_readout::update(), nest::eprop_readout_bsshslm_2020::update(), nest::gif_psc_exp::update(), nest::gif_psc_exp_multisynapse::update(), nest::glif_psc::update(), nest::glif_psc_double_alpha::update(), nest::iaf_psc_alpha_multisynapse::update(), nest::iaf_psc_delta::update(), nest::iaf_psc_delta_ps::update(), nest::iaf_psc_exp_htum::update(), nest::iaf_psc_exp_multisynapse::update(), nest::izhikevich::update(), nest::mat2_psc_exp::update(), nest::parrot_neuron::update(), nest::pp_psc_delta::update(), nest::spike_dilutor::update(), nest::iaf_psc_alpha_ps::update(), nest::iaf_psc_exp_ps::update(), and nest::iaf_psc_exp_ps_lossless::update().
|
inline |
Read one value from ring buffer without deleting it afterwards.
| offs | Offset of element to read within slice. |
References buffer_, get_index_(), and nest::kernel().
| void nest::RingBuffer::resize | ( | ) |
Resize the buffer according to max_thread and max_delay.
New elements are filled with noughts.
References buffer_, nest::KernelManager::connection_manager, nest::ConnectionManager::get_max_delay(), nest::ConnectionManager::get_min_delay(), nest::kernel(), and size().
Referenced by clear().
|
inline |
Set a ring buffer entry to a given value.
| offs | Arrival time relative to beginning of slice. |
| double | Value to set. |
References buffer_, and get_index_().
|
inline |
Returns buffer size, for memory measurement.
References buffer_.
Referenced by nest::cm_default::add_receptor_(), and resize().
|
private |
Buffered data.
Referenced by add_value(), clear(), get_index_(), get_value(), get_value_wfr_update(), resize(), set_value(), and size().