NEST  2.6.0,not_revisioned_source_dir@0
cont_delay_connection.h
Go to the documentation of this file.
1 /*
2  * cont_delay_connection.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 CONT_DELAY_CONNECTION_H
24 #define CONT_DELAY_CONNECTION_H
25 
26 /* BeginDocumentation
27  Name: cont_delay_synapse - Synapse type for continuous delays
28 
29  Description:
30  cont_delay_synapse relaxes the condition that NEST only implements delays
31  which are an integer multiple of the time step h. A continuous delay is
32  decomposed into an integer part (delay_) and a double (delay_offset_) so
33  that the actual delay is given by delay_*h - delay_offset_. This can be
34  combined with off-grid spike times.
35 
36  Transmits: SpikeEvent, RateEvent, CurrentEvent, ConductanceEvent, DoubleDataEvent
37 
38  References: none
39  FirstVersion: June 2007
40  Author: Abigail Morrison
41  SeeAlso: synapsedict, static_synapse, iaf_psc_alpha_canon
42 */
43 
44 
45 #include "connection.h"
46 #include <cmath>
47 
48 namespace nest
49 {
50 
51  template<typename targetidentifierT>
52  class ContDelayConnection : public Connection<targetidentifierT> {
53 
54  public:
55 
58 
64 
70 
75 
76  // Explicitly declare all methods inherited from the dependent base ConnectionBase.
77  // This avoids explicit name prefixes in all places these functions are used.
78  // Since ConnectionBase depends on the template parameter, they are not automatically
79  // found in the base class.
84 
86  void set_weight(double_t w) { weight_ = w; }
87 
91  void get_status(DictionaryDatum & d) const;
92 
96  void set_status(const DictionaryDatum & d, ConnectorModel &cm);
97 
104  void send(Event& e, thread t, double_t t_lastspike, const CommonSynapseProperties &cp);
105 
107  {
108  public:
109  // Ensure proper overriding of overloaded virtual functions.
110  // Return values from functions are ignored.
117  };
118 
120  {
121  ConnTestDummyNode dummy_target;
122  ConnectionBase::check_connection_(dummy_target, s, t, receptor_type);
123  }
124 
125  private:
128  };
129 
136 template<typename targetidentifierT>
137 inline
139 {
140  e.set_receiver(*get_target(t));
141  e.set_weight(weight_);
142  e.set_rport(get_rport());
143  double orig_event_offset = e.get_offset();
144  double total_offset = orig_event_offset + delay_offset_;
145  // As far as i have seen, offsets are outside of tics regime provided
146  // by the Time-class to allow more precise spike-times, hence comparing
147  // on the tics level here is not reasonable. Still, the double comparison
148  // seems save.
149  if (total_offset < Time::get_resolution().get_ms())
150  {
151  e.set_delay(get_delay_steps());
152  e.set_offset(total_offset);
153  }
154  else
155  {
156  e.set_delay(get_delay_steps() - 1);
157  e.set_offset(total_offset - Time::get_resolution().get_ms());
158  }
159  e();
160  //reset offset to original value
161  e.set_offset(orig_event_offset);
162 }
163 
164 } // of namespace nest
165 
166 #endif // of #ifndef CONT_DELAY_CONNECTION_H
void set_rport(rport p)
Set the receiver port number (r-port).
Definition: event.h:817
void check_connection(Node &s, Node &t, rport receptor_type, double_t, const CommonPropertiesType &)
Definition: cont_delay_connection.h:119
void set_receiver(Node &)
Change pointer to receiving Node.
Definition: event.h:708
const Name receptor_type("receptor_type")
Connection parameters.
Definition: nest_names.h:240
Definition: lockptrdatum.h:40
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
port handles_test_event(SpikeEvent &, rport)
Check if the node can handle a particular event and receptor type.
Definition: cont_delay_connection.h:112
long_t get_delay_steps() const
Return the delay of the connection in steps.
Definition: connection.h:126
void check_connection_(Node &dummy_target, Node &source, Node &target, rport receptor_type)
This function calls check_connection() on the sender to check if the receiver accepts the event type ...
Definition: connection.h:183
const rport invalid_port_
Value for invalid connection port number.
Definition: nest.h:160
Encapsulates information which is sent between Nodes.
Definition: event.h:73
void set_status(const DictionaryDatum &d, ConnectorModel &cm)
Set properties of this connection from the values given in dictionary.
Definition: cont_delay_connection_impl.h:58
port handles_test_event(CurrentEvent &, rport)
Definition: cont_delay_connection.h:114
void set_weight(double_t w)
Used by ConnectorModel::add_connection() for fast initialization.
Definition: cont_delay_connection.h:86
void set_weight(weight t)
Set weight of the event.
Definition: event.h:751
port handles_test_event(ConductanceEvent &, rport)
Definition: cont_delay_connection.h:115
Definition: cont_delay_connection.h:106
Event for electrical currents.
Definition: event.h:420
long_t rport
Connection port number to distinguish incoming connections, also called receiver port.
Definition: nest.h:147
double_t delay_offset_
fractional delay < h, total delay = delay_ - delay_offset_
Definition: cont_delay_connection.h:127
Node * get_target(thread t) const
Definition: connection.h:155
CommonSynapseProperties CommonPropertiesType
Definition: cont_delay_connection.h:56
double_t get_offset() const
Return the creation time offset of the Event.
Definition: event.h:787
void set_offset(double_t t)
Set the creation time of the Event.
Definition: event.h:793
void set_delay_steps(const long_t delay)
Set the delay of the connection in steps.
Definition: connection.h:136
const Name w("w")
Specific to Brette & Gerstner 2005 (aeif_cond-*)
Definition: nest_names.h:343
ContDelayConnection()
Default Constructor.
Definition: cont_delay_connection_impl.h:35
void set_delay(delay)
Set the transmission delay of the event.
Definition: event.h:781
Connection< targetidentifierT > ConnectionBase
Definition: cont_delay_connection.h:57
port handles_test_event(RateEvent &, rport)
Definition: cont_delay_connection.h:113
Base class for dummy nodes used in connection testing.
Definition: connection.h:64
Event for firing rate information.
Definition: event.h:387
long_t port
Connection port number to distinguis outgoing connections.
Definition: nest.h:155
port handles_test_event(DoubleDataEvent &, rport)
Definition: cont_delay_connection.h:116
double double_t
Double precision floating point numbers.
Definition: nest.h:93
~ContDelayConnection()
Default Destructor.
Definition: cont_delay_connection.h:74
rport get_rport() const
Definition: connection.h:156
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
static Time get_resolution()
Definition: nest_time.h:303
Class containing the common properties for all connections of a certain type.
Definition: common_synapse_properties.h:44
Definition: event.h:685
double_t weight_
synaptic weight
Definition: cont_delay_connection.h:126
Base class for representing connections.
Definition: connection.h:85
Event for spike information.
Definition: event.h:320
Base class for all NEST network objects.
Definition: node.h:96
Definition: connector_model.h:38
void send(Event &e, thread t, double_t t_lastspike, const CommonSynapseProperties &cp)
Send an event to the receiver of this connection.
Definition: cont_delay_connection.h:138
int_t thread
Thread index type.
Definition: nest.h:133
const double e
Definition: numerics.cpp:62
void get_status(DictionaryDatum &d) const
Get all properties of this connection and put them into a dictionary.
Definition: cont_delay_connection_impl.h:49
Event for electrical conductances.
Definition: event.h:616
Definition: cont_delay_connection.h:52