NEST  2.6.0,not_revisioned_source_dir@0
parrot_neuron_ps.h
Go to the documentation of this file.
1 /*
2  * parrot_neuron_ps.h
3  *
4  * This file is part of NEST.
5  *
6  * Copyright (C) 2004 The NEST Initiative
7  *
8  * NEST is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * NEST is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with NEST. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #ifndef PARROT_NEURON_PS_H
24 #define PARROT_NEURON_PS_H
25 
26 #include "nest.h"
27 #include "event.h"
28 #include "node.h"
29 #include "slice_ring_buffer.h"
30 #include "connection.h"
31 
32 /* BeginDocumentation
33 Name: parrot_neuron_ps - Neuron that repeats incoming spikes handling
34 precise spike times.
35 
36 Description:
37  The parrot neuron simply emits one spike for every incoming spike.
38  One possible application for this is to create different channels
39  for the output of generator devices such as the poisson_generator
40  or the mip_generator.
41 
42 Remarks:
43  Network-wise the parrot neuron behaves like other neuron models
44  regarding connections and communication. While the number of
45  outgoing spikes equals that of incoming ones, the weigth of the
46  outgoing spikes solely depends on the weigth of outgoing connections.
47 
48  A Poisson generator that would send multiple spikes during a single
49  time step due to a high rate will send single spikes with
50  multiple synaptic strength instead, for effiacy reasons.
51  This can be realized because of the way devices are implemented
52  in the threaded environment. A parrot neuron on the other
53  hand always emits single spikes. Hence, in a situation where for
54  example a poisson generator with a high firing rate is connected
55  to a parrot neuron, the communication cost associated with outgoing
56  spikes is much bigger for the latter.
57 
58  Please note that this node is capable of sending precise spike times
59  to target nodes (on-grid spike time plus offset). If this node is
60  connected to a spike_detector, the property "precise_times" of the
61  spike_detector has to be set to true in order to record the offsets
62  in addition to the on-grid spike times.
63 
64 Parameters:
65  No parameters to be set in the status dictionary.
66 
67 References:
68  No references
69 
70 Sends: SpikeEvent
71 
72 Receives: SpikeEvent
73 
74 Author: adapted from parrot_neuron by Kunkel
75 */
76 
77 namespace nest
78 {
80  public Node
81  {
82  class Network;
83 
84  public:
85 
87 
92  using Node::handle;
94 
95  void handle(SpikeEvent &);
98 
99  void get_status(DictionaryDatum &) const {}
100  void set_status(const DictionaryDatum &) {}
101 
102  // uses off_grid events
103  bool is_off_grid() const
104  {
105  return true;
106  }
107 
108  private:
109 
110  void init_state_(Node const &){} // no state
111  void init_buffers_();
112  void calibrate(){} // no variables
113 
114  void update(Time const &, const long_t, const long_t);
115 
117  struct Buffers_
118  {
120  };
121 
123  };
124 
125  inline
127  {
128  SpikeEvent e;
129  e.set_sender(*this);
130 
131  return target.handles_test_event(e, receptor_type);
132  }
133 
134  inline
136  {
137  if (receptor_type != 0)
138  throw UnknownReceptorType(receptor_type, get_name());
139  return 0;
140  }
141 
142 } // namespace
143 
144 #endif //PARROT_NEURON_PS_H
const Name receptor_type("receptor_type")
Connection parameters.
Definition: nest_names.h:240
Declarations for base class Node.
void init_buffers_()
Private function to initialize the buffers of a node.
Definition: parrot_neuron_ps.cpp:41
void set_sender(Node &)
Change pointer to sending Node.
Definition: event.h:714
void set_status(const DictionaryDatum &)
Definition: parrot_neuron_ps.h:100
long_t rport
Connection port number to distinguish incoming connections, also called receiver port.
Definition: nest.h:147
bool is_off_grid() const
Returns true if the node if it sends/receives -grid events This is used to discriminate between diffe...
Definition: parrot_neuron_ps.h:103
Queue for all spikes arriving into a neuron.
Definition: slice_ring_buffer.h:56
parrot_neuron_ps()
Definition: parrot_neuron_ps.cpp:37
Definition: nest_time.h:130
std::string get_name() const
Return class name.
Definition: node.cpp:83
void init_state_(Node const &)
Private function to initialize the state of a node to model defaults.
Definition: parrot_neuron_ps.h:110
Exception to be thrown if the specified receptor type does not exist in the node. ...
Definition: exceptions.h:254
void calibrate()
Re-calculate dependent parameters of the node.
Definition: parrot_neuron_ps.h:112
const Name target("target")
Connection parameters.
Definition: nest_names.h:282
Queue for incoming events.
Definition: parrot_neuron_ps.h:117
Main administrative interface to the network.
Definition: network.h:135
SliceRingBuffer events_
Definition: parrot_neuron_ps.h:119
long_t port
Connection port number to distinguis outgoing connections.
Definition: nest.h:155
virtual void handle(SpikeEvent &e)
Handle incoming spike events.
Definition: node.cpp:198
virtual port handles_test_event(SpikeEvent &, rport receptor_type)
Check if the node can handle a particular event and receptor type.
Definition: node.cpp:203
void update(Time const &, const long_t, const long_t)
Bring the node from state $t$ to $t+n*dt$.
Definition: parrot_neuron_ps.cpp:47
unsigned char synindex
Unsigned char type for enumerations of synapse types.
Definition: nest.h:115
Buffers_ B_
Definition: parrot_neuron_ps.h:122
Default types used by the NEST kernel.
port handles_test_event(SpikeEvent &, rport)
Check if the node can handle a particular event and receptor type.
Definition: parrot_neuron_ps.h:135
Event for spike information.
Definition: event.h:320
Base class for all NEST network objects.
Definition: node.h:96
void get_status(DictionaryDatum &) const
Definition: parrot_neuron_ps.h:99
void handle(SpikeEvent &)
Handle incoming spike events.
Definition: parrot_neuron_ps.cpp:78
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
const double e
Definition: numerics.cpp:62
Definition: parrot_neuron_ps.h:79
port send_test_event(Node &, rport, synindex, bool)
Send an event to the receiving_node passed as an argument.
Definition: parrot_neuron_ps.h:126