NEST main@caf0ae8
 
Loading...
Searching...
No Matches
rate_connection_instantaneous.h
Go to the documentation of this file.
1/*
2 * rate_connection_instantaneous.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
24#ifndef RATE_CONNECTION_INSTANTANEOUS_H
25#define RATE_CONNECTION_INSTANTANEOUS_H
26
27#include "connection.h"
28
29namespace nest
30{
31
32/* BeginUserDocs: synapse, abstract, rate
33
34Short description
35+++++++++++++++++
36
37Synapse type for instantaneous rate connections
38
39Description
40+++++++++++
41
42``rate_connection_instantaneous`` is a connector to create
43instantaneous connections between rate model neurons.
44
45The value of the parameter delay is ignored for connections of
46this type. To create rate connections with delay please use
47the synapse type ``rate_connection_delayed``.
48
49See also :footcite:p:`Hahne2017`.
50
51Transmits
52+++++++++
53
54InstantaneousRateConnectionEvent
55
56References
57++++++++++
58
59.. footbibliography::
60
61See also
62++++++++
63
64rate_connection_delayed, rate_neuron_ipn, rate_neuron_opn
65
66Examples using this model
67+++++++++++++++++++++++++
68
69.. listexamples:: rate_connection_instantaneous
70
71EndUserDocs */
72
77void register_rate_connection_instantaneous( const std::string& name );
78
79template < typename targetidentifierT >
80class rate_connection_instantaneous : public Connection< targetidentifierT >
81{
82
83public:
84 // this line determines which common properties to use
87
89
99
100 std::unique_ptr< SecondaryEvent > get_secondary_event();
101
102 // Explicitly declare all methods inherited from the dependent base
103 // ConnectionBase.
104 // This avoids explicit name prefixes in all places these functions are used.
105 // Since ConnectionBase depends on the template parameter, they are not
106 // automatically
107 // found in the base class.
111
112 void
113 check_connection( Node& s, Node& t, size_t receptor_type, const CommonPropertiesType& )
114 {
116
117 s.sends_secondary_event( ge );
118 ge.set_sender( s );
119 Connection< targetidentifierT >::target_.set_rport( t.handles_test_event( ge, receptor_type ) );
121 }
122
128 bool
129 send( Event& e, size_t t, const CommonSynapseProperties& )
130 {
131 e.set_weight( weight_ );
132 e.set_receiver( *get_target( t ) );
133 e.set_rport( get_rport() );
134 e();
135 return true;
136 }
137
138 void get_status( Dictionary& d ) const;
139
140 void set_status( const Dictionary& d, ConnectorModel& cm );
141
142 void
143 set_weight( double w )
144 {
145 weight_ = w;
146 }
147
148 void
149 set_delay( double )
150 {
151 throw BadProperty( "rate_connection_instantaneous has no delay. Please use rate_connection_delayed." );
152 }
153
154private:
155 double weight_;
156};
157
158template < typename targetidentifierT >
160
161template < typename targetidentifierT >
162void
164{
165 ConnectionBase::get_status( d );
166 d[ names::weight ] = weight_;
167 d[ names::size_of ] = static_cast< long >( sizeof( *this ) );
168}
169
170template < typename targetidentifierT >
171void
173{
174 // If the delay is set, we throw a BadProperty
175 if ( d.known( names::delay ) )
176 {
177 throw BadProperty( "rate_connection_instantaneous has no delay. Please use rate_connection_delayed." );
178 }
179
180 ConnectionBase::set_status( d, cm );
181 d.update_value( names::weight, weight_ );
182}
183
184template < typename targetidentifierT >
185std::unique_ptr< SecondaryEvent >
187{
188 return std::make_unique< InstantaneousRateConnectionEvent >();
189}
190
191} // namespace
192
193#endif /* #ifndef RATE_CONNECTION_INSTANTANEOUS_H */
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
Exception to be thrown if a status parameter is incomplete or inconsistent.
Definition exceptions.h:680
Class containing the common properties for all connections of a certain type.
Definition common_synapse_properties.h:50
Base class for representing connections.
Definition connection.h:110
long get_delay_steps() const
Return the delay of the connection in steps.
Definition connection.h:181
Node * get_target(const size_t tid) const
Definition connection.h:239
size_t get_rport() const
Definition connection.h:244
Definition connector_model.h:69
Encapsulate information sent between nodes.
Definition event.h:103
void set_sender(Node &)
Change pointer to sending Node.
Definition event.h:920
Event for rate model connections without delay.
Definition secondary_event.h:315
Base class for all NEST network objects.
Definition node.h:99
Definition rate_connection_instantaneous.h:81
std::unique_ptr< SecondaryEvent > get_secondary_event()
Definition rate_connection_instantaneous.h:186
void set_delay(double)
Definition rate_connection_instantaneous.h:149
double weight_
connection weight
Definition rate_connection_instantaneous.h:155
static constexpr ConnectionModelProperties properties
Definition rate_connection_instantaneous.h:88
Node * get_target(const size_t tid) const
Definition connection.h:239
size_t get_rport() const
Definition connection.h:244
void set_status(const Dictionary &d, ConnectorModel &cm)
Definition rate_connection_instantaneous.h:172
void set_weight(double w)
Definition rate_connection_instantaneous.h:143
void check_connection(Node &s, Node &t, size_t receptor_type, const CommonPropertiesType &)
Definition rate_connection_instantaneous.h:113
bool send(Event &e, size_t t, const CommonSynapseProperties &)
Send an event to the receiver of this connection.
Definition rate_connection_instantaneous.h:129
rate_connection_instantaneous()
Default Constructor.
Definition rate_connection_instantaneous.h:94
void get_status(Dictionary &d) const
Definition rate_connection_instantaneous.h:163
Connection< targetidentifierT > ConnectionBase
Definition rate_connection_instantaneous.h:86
CommonSynapseProperties CommonPropertiesType
Definition rate_connection_instantaneous.h:85
virtual size_t handles_test_event(SpikeEvent &, size_t receptor_type)
Check if the node can handle a particular event and receptor type.
Definition node.cpp:271
virtual void sends_secondary_event(GapJunctionEvent &ge)
Required to check, if source neuron may send a SecondaryEvent.
Definition node.cpp:381
const std::string delay("delay")
const std::string weight("weight")
const std::string size_of("sizeof")
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
void register_rate_connection_instantaneous(const std::string &name)
Class representing a rate connection.
Definition rate_connection_instantaneous.cpp:32
ConnectionModelProperties
Definition connector_model.h:49