NEST main@f146f75
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, TotalDelay >
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, const size_t receptor_type, const synindex, const CommonPropertiesType& )
114 {
116
117 s.sends_secondary_event( ge );
118 ge.set_sender( s );
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_ms( double )
150 {
151 throw BadProperty( "rate_connection_instantaneous has no delay. Please use rate_connection_delayed." );
152 }
153
154 void
156 {
157 throw BadProperty( "rate_connection_instantaneous has no delay. Please use rate_connection_delayed." );
158 }
159
160private:
161 double weight_;
162};
163
164template < typename targetidentifierT >
166
167template < typename targetidentifierT >
168void
170{
172 d[ names::weight ] = weight_;
173 d[ names::size_of ] = static_cast< long >( sizeof( *this ) );
174}
175
176template < typename targetidentifierT >
177void
179{
180 // If the delay is set, we throw a BadProperty
181 if ( d.known( names::delay ) )
182 {
183 throw BadProperty( "rate_connection_instantaneous has no delay. Please use rate_connection_delayed." );
184 }
185
187 d.update_value( names::weight, weight_ );
188}
189
190template < typename targetidentifierT >
191std::unique_ptr< SecondaryEvent >
193{
194 return std::make_unique< InstantaneousRateConnectionEvent >();
195}
196
197} // namespace
198
199#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
size_t get_rport() const
Definition connection.h:316
long get_delay_steps() const
Definition connection.h:271
void set_status(const Dictionary &d, ConnectorModel &cm)
Node * get_target(const size_t tid) const
Definition connection.h:311
targetidentifierT target_
Definition connection.h:383
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:959
Event for rate model connections without delay.
Definition secondary_event.h:315
Base class for all NEST network objects.
Definition node.h:99
std::unique_ptr< SecondaryEvent > get_secondary_event()
Definition rate_connection_instantaneous.h:192
size_t get_rport() const
Definition connection.h:316
double weight_
connection weight
Definition rate_connection_instantaneous.h:161
void set_delay_steps(long)
Definition rate_connection_instantaneous.h:155
static constexpr ConnectionModelProperties properties
Definition rate_connection_instantaneous.h:88
void check_connection(Node &s, Node &t, const size_t receptor_type, const synindex, const CommonPropertiesType &)
Definition rate_connection_instantaneous.h:113
Node * get_target(const size_t tid) const
Definition connection.h:311
void set_status(const Dictionary &d, ConnectorModel &cm)
Definition rate_connection_instantaneous.h:178
void set_weight(double w)
Definition rate_connection_instantaneous.h:143
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 set_delay_ms(double)
Definition rate_connection_instantaneous.h:149
void get_status(Dictionary &d) const
Definition rate_connection_instantaneous.h:169
CommonSynapseProperties CommonPropertiesType
Definition rate_connection_instantaneous.h:85
Connection< targetidentifierT, TotalDelay > ConnectionBase
Definition rate_connection_instantaneous.h:86
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:282
virtual void sends_secondary_event(GapJunctionEvent &ge)
Required to check, if source neuron may send a SecondaryEvent.
Definition node.cpp:400
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
@ SUPPORTS_WFR
Definition connector_model.h:55
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:121