forked from nest/nest-simulator
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrate_connection_instantaneous.h
More file actions
200 lines (158 loc) · 5.34 KB
/
Copy pathrate_connection_instantaneous.h
File metadata and controls
200 lines (158 loc) · 5.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
/*
* rate_connection_instantaneous.h
*
* This file is part of NEST.
*
* Copyright (C) 2004 The NEST Initiative
*
* NEST is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* NEST is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NEST. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef RATE_CONNECTION_INSTANTANEOUS_H
#define RATE_CONNECTION_INSTANTANEOUS_H
#include "connection.h"
namespace nest
{
/* BeginUserDocs: synapse, rate, instantaneous
Short description
+++++++++++++++++
Synapse type for instantaneous rate connections
Description
+++++++++++
``rate_connection_instantaneous`` is a connector to create
instantaneous connections between rate model neurons.
The value of the parameter delay is ignored for connections of
this type. To create rate connections with delay please use
the synapse type ``rate_connection_delayed``.
See also [1]_.
Transmits
+++++++++
InstantaneousRateConnectionEvent
References
++++++++++
.. [1] Hahne J, Dahmen D, Schuecker J, Frommer A, Bolten M, Helias M,
Diesmann M (2017). Integration of continuous-time dynamics in a
spiking neural network simulator. Frontiers in Neuroinformatics, 11:34.
DOI: https://doi.org/10.3389/fninf.2017.00034
See also
++++++++
rate_connection_delayed, rate_neuron_ipn, rate_neuron_opn
Examples using this model
+++++++++++++++++++++++++
.. listexamples:: rate_connection_instantaneous
EndUserDocs */
/**
* Class representing a rate connection. A rate connection
* has the properties weight and receiver port.
*/
void register_rate_connection_instantaneous( const std::string& name );
template < typename targetidentifierT >
class rate_connection_instantaneous : public Connection< targetidentifierT >
{
public:
// this line determines which common properties to use
typedef CommonSynapseProperties CommonPropertiesType;
typedef Connection< targetidentifierT > ConnectionBase;
static constexpr ConnectionModelProperties properties = ConnectionModelProperties::SUPPORTS_WFR;
/**
* Default Constructor.
* Sets default values for all parameters. Needed by GenericConnectorModel.
*/
rate_connection_instantaneous()
: ConnectionBase()
, weight_( 1.0 )
{
}
std::unique_ptr< SecondaryEvent > get_secondary_event();
// Explicitly declare all methods inherited from the dependent base
// ConnectionBase.
// This avoids explicit name prefixes in all places these functions are used.
// Since ConnectionBase depends on the template parameter, they are not
// automatically
// found in the base class.
using ConnectionBase::get_delay_steps;
using ConnectionBase::get_rport;
using ConnectionBase::get_target;
void
check_connection( Node& s, Node& t, size_t receptor_type, const CommonPropertiesType& )
{
InstantaneousRateConnectionEvent ge;
s.sends_secondary_event( ge );
ge.set_sender( s );
Connection< targetidentifierT >::target_.set_rport( t.handles_test_event( ge, receptor_type ) );
Connection< targetidentifierT >::target_.set_target( &t );
}
/**
* Send an event to the receiver of this connection.
* \param e The event to send
* \param p The port under which this connection is stored in the Connector.
*/
bool
send( Event& e, size_t t, const CommonSynapseProperties& )
{
e.set_weight( weight_ );
e.set_receiver( *get_target( t ) );
e.set_rport( get_rport() );
e();
return true;
}
void get_status( DictionaryDatum& d ) const;
void set_status( const DictionaryDatum& d, ConnectorModel& cm );
void
set_weight( double w )
{
weight_ = w;
}
void
set_delay( double )
{
throw BadProperty(
"rate_connection_instantaneous has no delay. Please use "
"rate_connection_delayed." );
}
private:
double weight_; //!< connection weight
};
template < typename targetidentifierT >
constexpr ConnectionModelProperties rate_connection_instantaneous< targetidentifierT >::properties;
template < typename targetidentifierT >
void
rate_connection_instantaneous< targetidentifierT >::get_status( DictionaryDatum& d ) const
{
ConnectionBase::get_status( d );
def< double >( d, names::weight, weight_ );
def< long >( d, names::size_of, sizeof( *this ) );
}
template < typename targetidentifierT >
void
rate_connection_instantaneous< targetidentifierT >::set_status( const DictionaryDatum& d, ConnectorModel& cm )
{
// If the delay is set, we throw a BadProperty
if ( d->known( names::delay ) )
{
throw BadProperty(
"rate_connection_instantaneous has no delay. Please use "
"rate_connection_delayed." );
}
ConnectionBase::set_status( d, cm );
updateValue< double >( d, names::weight, weight_ );
}
template < typename targetidentifierT >
std::unique_ptr< SecondaryEvent >
rate_connection_instantaneous< targetidentifierT >::get_secondary_event()
{
return std::make_unique< InstantaneousRateConnectionEvent >();
}
} // namespace
#endif /* #ifndef RATE_CONNECTION_INSTANTANEOUS_H */