NEST main@caf0ae8
 
Loading...
Searching...
No Matches
nest::RingBuffer Class Reference

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ RingBuffer()

nest::RingBuffer::RingBuffer ( )

Member Function Documentation

◆ add_value()

void nest::RingBuffer::add_value ( const long  offs,
const double  v 
)
inline

Add a value to the ring buffer.

Parameters
offsArrival time relative to beginning of slice.
doubleValue 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().

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

◆ clear()

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().

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

◆ get_index_()

size_t nest::RingBuffer::get_index_ ( const long  d) const
inlineprivate

Obtain buffer index.

Parameters
delaydelivery delay for event
Returns
index to buffer element into which event should be recorded.

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().

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

◆ get_value()

double nest::RingBuffer::get_value ( const long  offs)
inline

Read one value from ring buffer.

Parameters
offsOffset of element to read within slice.
Returns
value

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().

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

◆ get_value_wfr_update()

double nest::RingBuffer::get_value_wfr_update ( const long  offs)
inline

Read one value from ring buffer without deleting it afterwards.

Parameters
offsOffset of element to read within slice.
Returns
value

References buffer_, get_index_(), and nest::kernel().

Here is the call graph for this function:

◆ resize()

void nest::RingBuffer::resize ( )

Resize the buffer according to max_thread and max_delay.

New elements are filled with noughts.

Note
resize() has no effect if the buffer has the correct size.

References buffer_, nest::KernelManager::connection_manager, nest::ConnectionManager::get_max_delay(), nest::ConnectionManager::get_min_delay(), nest::kernel(), and size().

Referenced by clear().

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

◆ set_value()

void nest::RingBuffer::set_value ( const long  offs,
const double  v 
)
inline

Set a ring buffer entry to a given value.

Parameters
offsArrival time relative to beginning of slice.
doubleValue to set.

References buffer_, and get_index_().

Here is the call graph for this function:

◆ size()

size_t nest::RingBuffer::size ( ) const
inline

Returns buffer size, for memory measurement.

References buffer_.

Referenced by nest::cm_default::add_receptor_(), and resize().

Here is the caller graph for this function:

Member Data Documentation

◆ buffer_

std::vector< double > nest::RingBuffer::buffer_
private

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