NEST  2.6.0,not_revisioned_source_dir@0
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 #include <vector>
27 #include "network.h"
28 #include "position.h"
29 #include "topologymodule.h"
30 #include "topology_names.h"
31 #include "vose.h"
32 #include "mask.h"
33 #include "parameter.h"
34 #include "selector.h"
35 
36 namespace nest
37 {
38  template<int D>
39  class Layer;
40 
41  template <int D>
42  class MaskedLayer;
43 
66  public:
67 
69 
91 
97  template<int D>
99 
100  private:
101 
108  template <int D>
110  {
111  public:
112  PoolWrapper_();
113  ~PoolWrapper_();
114  void define(MaskedLayer<D>*);
115  void define(std::vector<std::pair<Position<D>,index> >*);
116 
117  typename Ntree<D,index>::masked_iterator masked_begin(const Position<D>& pos) const;
119 
120  typename std::vector<std::pair<Position<D>,index> >::iterator begin() const;
121  typename std::vector<std::pair<Position<D>,index> >::iterator end() const;
122 
123  private:
125  std::vector<std::pair<Position<D>,index> >* positions_;
126  };
127 
128  template<typename Iterator, int D>
129  void connect_to_target_(Iterator from, Iterator to, Node* tgt_ptr,
130  const Position<D>& tgt_pos, thread tgt_thread, const Layer<D>& source);
131 
132  template<int D>
134 
135  template<int D>
137 
138  template<int D>
140 
141  template<int D>
143 
145  double_t w, double_t d, index syn);
146 
152  template<int D>
153  void get_parameters_(const Position<D> & pos, librandom::RngPtr rng,
154  double& weight, double& delay);
155 
168 
170  };
171 
172  inline
174  double_t w, double_t d, index syn)
175  {
176  // check whether the target is on this process
177  if (net_.is_local_gid(target->get_gid()))
178  {
179  // check whether the target is on our thread
180  thread tid = net_.get_thread_id();
181  if( tid == target_thread)
182  net_.connect(s, target, target_thread, syn, d, w);
183  }
184  }
185 
186 } // namespace nest
187 
188 #endif
bool allow_multapses_
Definition: connection_creator.h:158
size_t index
Unsigned long type for enumerations.
Definition: nest.h:109
This class is a representation of the dictionary of connection properties given as an argument to the...
Definition: connection_creator.h:65
void connect_to_target_(Iterator from, Iterator to, Node *tgt_ptr, const Position< D > &tgt_pos, thread tgt_thread, const Layer< D > &source)
Definition: connection_creator_impl.h:77
Definition: connection_creator.h:68
double_t weight
Weight of a connection.
Definition: nest.h:170
index get_gid() const
Return global Network ID.
Definition: node.h:753
lockPTR< Parameter > delay_
Definition: connection_creator.h:167
index synapse_model_
Definition: connection_creator.h:165
Definition: lockptrdatum.h:40
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
Iterator iterating the nodes in a Quadtree inside a Mask.
Definition: ntree.h:128
index number_of_connections_
Definition: connection_creator.h:162
Contains rules for selecting nodes from a layer when connecting.
Definition: selector.h:36
void connect(Layer< D > &source, Layer< D > &target)
Connect two layers.
Definition: connection_creator_impl.h:38
void connect_(index s, Node *target, thread target_thread, double_t w, double_t d, index syn)
Definition: connection_creator.h:173
void convergent_connect_(Layer< D > &source, Layer< D > &target)
Definition: connection_creator_impl.h:337
Class for applying masks to layers.
Definition: connection_creator.h:42
lockPTR< Parameter > weight_
Definition: connection_creator.h:166
bool allow_oversized_
Definition: connection_creator.h:159
~PoolWrapper_()
Definition: connection_creator_impl.h:109
void divergent_connect_(Layer< D > &source, Layer< D > &target)
Definition: connection_creator_impl.h:561
void connect(index s, Node *target, thread target_thread, index syn, double_t d=NAN, double_t w=NAN)
Connect two nodes.
Definition: network.cpp:867
lockPTR< AbstractMask > mask_
Definition: connection_creator.h:163
Wrapper for masked and unmasked pools.
Definition: connection_creator.h:109
const Name w("w")
Specific to Brette & Gerstner 2005 (aeif_cond-*)
Definition: nest_names.h:343
std::vector< std::pair< Position< D >, index > > * positions_
Definition: connection_creator.h:125
Selector target_filter_
Definition: connection_creator.h:161
Abstract base class for Layer of given dimension (D=2 or 3).
Definition: connection_creator.h:39
int get_thread_id() const
Gets ID of local thread.
Definition: network.h:1264
MaskedLayer< D > * masked_layer_
Definition: connection_creator.h:124
PoolWrapper_()
Definition: connection_creator_impl.h:103
Network & net_
Definition: connection_creator.h:169
Definition: connection_creator.h:68
const Name source("source")
Connection parameters.
Definition: nest_names.h:260
const Name target("target")
Connection parameters.
Definition: nest_names.h:282
ConnectionCreator(DictionaryDatum dict)
Construct a ConnectionCreator with the properties defined in the given dictionary.
Definition: connection_creator.cpp:28
Declarations for class Network.
void target_driven_connect_(Layer< D > &source, Layer< D > &target)
Definition: connection_creator_impl.h:159
Definition: connection_creator.h:68
Main administrative interface to the network.
Definition: network.h:135
std::vector< std::pair< Position< D >, index > >::iterator end() const
Definition: connection_creator_impl.h:152
void get_parameters_(const Position< D > &pos, librandom::RngPtr rng, double &weight, double &delay)
Calculate parameter values for this position.
Definition: connection_creator_impl.h:68
ConnectionType
Definition: connection_creator.h:68
double double_t
Double precision floating point numbers.
Definition: nest.h:93
void define(MaskedLayer< D > *)
Definition: connection_creator_impl.h:116
lockPTR< Parameter > kernel_
Definition: connection_creator.h:164
std::vector< std::pair< Position< D >, index > >::iterator begin() const
Definition: connection_creator_impl.h:146
bool allow_autapses_
Definition: connection_creator.h:157
const Name target_thread("target_thread")
Connection parameters.
Definition: nest_names.h:283
Ntree< D, index >::masked_iterator masked_end() const
Definition: connection_creator_impl.h:140
Selector source_filter_
Definition: connection_creator.h:160
long_t delay
Delay of a connection.
Definition: nest.h:178
Ntree< D, index >::masked_iterator masked_begin(const Position< D > &pos) const
Definition: connection_creator_impl.h:134
void source_driven_connect_(Layer< D > &source, Layer< D > &target)
Definition: connection_creator_impl.h:215
Base class for all NEST network objects.
Definition: node.h:96
bool is_local_gid(index gid) const
Return true, if the given gid is on the local machine.
Definition: network.h:1020
ConnectionType type_
Definition: connection_creator.h:156
Definition: connection_creator.h:68
int_t thread
Thread index type.
Definition: nest.h:133