NEST
2.6.0,not_revisioned_source_dir@0
|
Buffer Layout. More...
#include <ring_buffer.h>
Public Member Functions | |
RingBuffer () | |
void | add_value (const long_t offs, const double_t) |
Add a value to the ring buffer. More... | |
void | set_value (const long_t offs, const double_t) |
Set a ring buffer entry to a given value. More... | |
double | get_value (const long_t offs) |
Read one value from ring buffer. More... | |
void | clear () |
Initialize the buffer with noughts. More... | |
void | resize () |
Resize the buffer according to max_thread and max_delay. More... | |
size_t | size () const |
Returns buffer size, for memory measurement. More... | |
Private Member Functions | |
size_t | get_index_ (const delay d) const |
Obtain buffer index. More... | |
Private Attributes | |
std::valarray< double_t > | buffer_ |
Buffered data. More... | |
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 valarray.
nest::RingBuffer::RingBuffer | ( | ) |
Add a value to the ring buffer.
offs | Arrival time relative to beginning of slice. |
double_t | Value to add. |
References buffer_, and get_index_().
Referenced by nest::iaf_psc_exp_multisynapse::handle(), nest::iaf_psc_alpha_multisynapse::handle(), nest::parrot_neuron::handle(), nest::aeif_cond_alpha_multisynapse::handle(), nest::iaf_psc_alpha::handle(), and nest::iaf_psc_delta_canon::handle().
void nest::RingBuffer::clear | ( | ) |
Initialize the buffer with noughts.
Also resizes the buffer if necessary.
References resize().
Referenced by nest::iaf_psc_exp_multisynapse::init_buffers_(), nest::iaf_psc_alpha_multisynapse::init_buffers_(), nest::parrot_neuron::init_buffers_(), nest::aeif_cond_alpha_multisynapse::init_buffers_(), and nest::iaf_psc_alpha::init_buffers_().
|
inlineprivate |
Obtain buffer index.
delay | delivery delay for event |
References assert(), buffer_, and nest::Scheduler::get_modulo().
Referenced by add_value(), get_value(), and set_value().
|
inline |
Read one value from ring buffer.
offs | Offset of element to read within slice. |
References assert(), buffer_, get_index_(), and nest::Scheduler::get_min_delay().
Referenced by nest::iaf_psc_exp_multisynapse::update(), nest::iaf_psc_alpha_multisynapse::update(), nest::parrot_neuron::update(), nest::aeif_cond_alpha_multisynapse::update(), nest::iaf_psc_alpha::update(), nest::ht_neuron::update(), and nest::iaf_psc_delta_canon::update().
void nest::RingBuffer::resize | ( | ) |
Resize the buffer according to max_thread and max_delay.
New elements are filled with noughts.
References nest::Scheduler::get_max_delay(), and nest::Scheduler::get_min_delay().
Set a ring buffer entry to a given value.
offs | Arrival time relative to beginning of slice. |
double_t | Value to set. |
References buffer_, and get_index_().
|
inline |
Returns buffer size, for memory measurement.
References buffer_.
|
private |
Buffered data.
Referenced by add_value(), get_index_(), get_value(), set_value(), and size().