NEST main@f146f75
Loading...
Searching...
No Matches
connection_creator.h
Go to the documentation of this file.
1/*
2 * connection_creator.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 CONNECTION_CREATOR_H
24#define CONNECTION_CREATOR_H
25
26// C++ includes:
27#include <vector>
28
29// Includes from libnestutil:
30#include "numerics.h"
31
32// Includes from nestkernel:
33#include "kernel_manager.h"
34#include "mask.h"
35#include "nest_names.h"
36#include "ntree.h"
37#include "position.h"
38
39namespace nest
40{
41template < int D >
42class Layer;
43
44template < int D >
45class MaskedLayer;
46
66{
67public:
76
97 ConnectionCreator( const Dictionary& dict );
98
107 template < int D >
108 void connect( Layer< D >& source, NodeCollectionPTR source_nc, Layer< D >& target, NodeCollectionPTR target_nc );
109
110private:
117 template < int D >
119 {
120 public:
121 PoolWrapper_();
123 void define( MaskedLayer< D >* );
124 void define( std::vector< std::pair< Position< D >, size_t > >* );
125
128
129 typename std::vector< std::pair< Position< D >, size_t > >::iterator begin() const;
130 typename std::vector< std::pair< Position< D >, size_t > >::iterator end() const;
131
132 private:
134 std::vector< std::pair< Position< D >, size_t > >* positions_;
135 };
136
137 void extract_params_( const Dictionary&, std::vector< Dictionary >& );
138
145 template < typename... Args >
146 static double
147 evaluate_delay_( const ParameterPTR& delay_parameter, Args&&... args )
148 {
149 return delay_parameter ? delay_parameter->value( std::forward< Args >( args )... ) : numerics::nan;
150 }
151
152 template < typename Iterator, int D >
153 void connect_to_target_( Iterator from,
154 Iterator to,
155 Node* tgt_ptr,
156 const Position< D >& tgt_pos,
157 size_t tgt_thread,
158 const Layer< D >& source );
159
160 template < typename Iterator, int D >
161 void connect_to_target_poisson_( Iterator from,
162 Iterator to,
163 Node* tgt_ptr,
164 const Position< D >& tgt_pos,
165 size_t tgt_thread,
166 const Layer< D >& source );
167
168 template < int D >
170 NodeCollectionPTR source_nc,
171 Layer< D >& target,
172 NodeCollectionPTR target_nc );
173
174 template < int D >
176 NodeCollectionPTR source_nc,
177 Layer< D >& target,
178 NodeCollectionPTR target_nc );
179
180 template < int D >
181 void
182 pairwise_poisson_( Layer< D >& source, NodeCollectionPTR source_nc, Layer< D >& target, NodeCollectionPTR target_nc );
183
184 template < int D >
185 void
186 fixed_indegree_( Layer< D >& source, NodeCollectionPTR source_nc, Layer< D >& target, NodeCollectionPTR target_nc );
187
188 template < int D >
189 void
190 fixed_outdegree_( Layer< D >& source, NodeCollectionPTR source_nc, Layer< D >& target, NodeCollectionPTR target_nc );
191
199 std::vector< size_t > synapse_model_;
200 std::vector< std::vector< Dictionary > > param_dicts_;
201 std::vector< ParameterPTR > weight_;
202 std::vector< ParameterPTR > delay_;
203 std::vector< ParameterPTR > dendritic_delay_;
204 std::vector< ParameterPTR > axonal_delay_;
205};
206
207} // namespace nest
208
209#endif
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
void define(MaskedLayer< D > *)
Definition connection_creator_impl.h:183
Ntree< D, size_t >::masked_iterator masked_begin(const Position< D > &pos) const
Definition connection_creator_impl.h:203
~PoolWrapper_()
Definition connection_creator_impl.h:173
MaskedLayer< D > * masked_layer_
Definition connection_creator.h:133
std::vector< std::pair< Position< D >, size_t > >::iterator begin() const
Definition connection_creator_impl.h:217
std::vector< std::pair< Position< D >, size_t > > * positions_
Definition connection_creator.h:134
Ntree< D, size_t >::masked_iterator masked_end() const
Definition connection_creator_impl.h:210
PoolWrapper_()
Definition connection_creator_impl.h:166
std::vector< std::pair< Position< D >, size_t > >::iterator end() const
Definition connection_creator_impl.h:224
void pairwise_bernoulli_on_source_(Layer< D > &source, NodeCollectionPTR source_nc, Layer< D > &target, NodeCollectionPTR target_nc)
Definition connection_creator_impl.h:232
void pairwise_poisson_(Layer< D > &source, NodeCollectionPTR source_nc, Layer< D > &target, NodeCollectionPTR target_nc)
Definition connection_creator_impl.h:389
void connect_to_target_poisson_(Iterator from, Iterator to, Node *tgt_ptr, const Position< D > &tgt_pos, size_t tgt_thread, const Layer< D > &source)
Definition connection_creator_impl.h:120
static double evaluate_delay_(const ParameterPTR &delay_parameter, Args &&... args)
Evaluate a delay parameter.
Definition connection_creator.h:147
MaskPTR mask_
Definition connection_creator.h:197
std::vector< std::vector< Dictionary > > param_dicts_
Definition connection_creator.h:200
void connect_to_target_(Iterator from, Iterator to, Node *tgt_ptr, const Position< D > &tgt_pos, size_t tgt_thread, const Layer< D > &source)
Definition connection_creator_impl.h:77
ConnectionType
Definition connection_creator.h:69
@ Pairwise_bernoulli_on_source
Definition connection_creator.h:70
@ Pairwise_poisson
Definition connection_creator.h:72
@ Pairwise_bernoulli_on_target
Definition connection_creator.h:71
@ Fixed_outdegree
Definition connection_creator.h:74
@ Fixed_indegree
Definition connection_creator.h:73
std::vector< ParameterPTR > weight_
Definition connection_creator.h:201
void extract_params_(const Dictionary &, std::vector< Dictionary > &)
Definition connection_creator.cpp:206
ParameterPTR number_of_connections_
Definition connection_creator.h:196
std::vector< ParameterPTR > delay_
Definition connection_creator.h:202
ParameterPTR kernel_
Definition connection_creator.h:198
void fixed_indegree_(Layer< D > &source, NodeCollectionPTR source_nc, Layer< D > &target, NodeCollectionPTR target_nc)
Definition connection_creator_impl.h:460
ConnectionCreator(const Dictionary &dict)
Construct a ConnectionCreator with the properties defined in the given dictionary.
Definition connection_creator.cpp:31
std::vector< ParameterPTR > axonal_delay_
Definition connection_creator.h:204
bool allow_autapses_
Definition connection_creator.h:193
void pairwise_bernoulli_on_target_(Layer< D > &source, NodeCollectionPTR source_nc, Layer< D > &target, NodeCollectionPTR target_nc)
Definition connection_creator_impl.h:303
bool allow_oversized_
Definition connection_creator.h:195
void connect(Layer< D > &source, NodeCollectionPTR source_nc, Layer< D > &target, NodeCollectionPTR target_nc)
Connect two layers.
Definition connection_creator_impl.h:38
std::vector< ParameterPTR > dendritic_delay_
Definition connection_creator.h:203
ConnectionType type_
Definition connection_creator.h:192
std::vector< size_t > synapse_model_
Definition connection_creator.h:199
void fixed_outdegree_(Layer< D > &source, NodeCollectionPTR source_nc, Layer< D > &target, NodeCollectionPTR target_nc)
Definition connection_creator_impl.h:803
bool allow_multapses_
Definition connection_creator.h:194
Abstract base class for Layer of given dimension (D=2 or 3).
Definition layer.h:218
Class for applying masks to layers.
Definition layer.h:458
Base class for all NEST network objects.
Definition node.h:99
Iterator iterating the nodes in a Quadtree inside a Mask.
Definition ntree.h:153
Definition position.h:57
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
std::shared_ptr< NodeCollection > NodeCollectionPTR
Definition node_collection.h:50
std::shared_ptr< Parameter > ParameterPTR
Definition parameter.h:40
std::shared_ptr< AbstractMask > MaskPTR
Definition mask.h:44
const double nan
Definition numerics.cpp:36