NEST  2.6.0,not_revisioned_source_dir@0
connection_creator_impl.h
Go to the documentation of this file.
1 /*
2  * connection_creator_impl.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_IMPL_H
24 #define CONNECTION_CREATOR_IMPL_H
25 
26 #include <vector>
27 #ifdef _OPENMP
28 #include <omp.h>
29 #endif
30 
31 
32 #include "connection_creator.h"
33 #include "binomial_randomdev.h"
34 
35 namespace nest
36 {
37  template<int D>
39  {
40  switch (type_) {
41  case Target_driven:
42 
43  target_driven_connect_(source, target);
44  break;
45 
46  case Convergent:
47 
48  convergent_connect_(source, target);
49  break;
50 
51  case Divergent:
52 
53  divergent_connect_(source, target);
54  break;
55 
56  case Source_driven:
57 
58  source_driven_connect_(source, target);
59  break;
60 
61  default:
62  throw BadProperty("Unknown connection type.");
63  }
64 
65  }
66 
67  template<int D>
69  double& weight, double& delay)
70  {
71  // keeping this function temporarily until all connection variants are cleaned up
72  weight = weight_->value(pos, rng);
73  delay = delay_ ->value(pos, rng);
74  }
75 
76  template<typename Iterator, int D>
77  void ConnectionCreator::connect_to_target_(Iterator from, Iterator to, Node* tgt_ptr,
78  const Position<D>& tgt_pos, thread tgt_thread,
79  const Layer<D>& source)
80  {
81  librandom::RngPtr rng = net_.get_rng(tgt_thread);
82 
83  const bool without_kernel = not kernel_.valid();
84  for ( Iterator iter = from ; iter != to ; ++iter )
85  {
86  if ( (not allow_autapses_) and (iter->second == tgt_ptr->get_gid()) )
87  continue;
88 
89  if ( without_kernel or
90  rng->drand() < kernel_->value(source.compute_displacement(tgt_pos, iter->first), rng)
91  )
92  {
93  const Position<D> disp = source.compute_displacement(tgt_pos,iter->first);
94  connect_(iter->second, tgt_ptr, tgt_thread,
95  weight_->value(disp, rng),
96  delay_->value(disp, rng),
98  }
99  }
100  }
101 
102  template <int D>
104  masked_layer_(0),
105  positions_(0)
106  {}
107 
108  template <int D>
110  {
111  if ( masked_layer_ )
112  delete masked_layer_;
113  }
114 
115  template <int D>
117  {
118  assert(masked_layer_ == 0);
119  assert(positions_ == 0);
120  assert(ml != 0);
121  masked_layer_ = ml;
122  }
123 
124  template <int D>
126  {
127  assert(masked_layer_ == 0);
128  assert(positions_ == 0);
129  assert(pos != 0);
130  positions_ = pos;
131  }
132 
133  template <int D>
135  {
136  return masked_layer_->begin(pos);
137  }
138 
139  template <int D>
141  {
142  return masked_layer_->end();
143  }
144 
145  template <int D>
146  typename std::vector<std::pair<Position<D>,index> >::iterator ConnectionCreator::PoolWrapper_<D>::begin() const
147  {
148  return positions_->begin();
149  }
150 
151  template <int D>
152  typename std::vector<std::pair<Position<D>,index> >::iterator ConnectionCreator::PoolWrapper_<D>::end() const
153  {
154  return positions_->end();
155  }
156 
157 
158  template<int D>
160  {
161  // Target driven connect
162  // For each local target node:
163  // 1. Apply Mask to source layer
164  // 2. For each source node: Compute probability, draw random number, make
165  // connection conditionally
166 
167  // Nodes in the subnet are grouped by depth, so to select by depth, we
168  // just adjust the begin and end pointers:
169  std::vector<Node*>::const_iterator target_begin;
170  std::vector<Node*>::const_iterator target_end;
172  target_begin = target.local_begin(target_filter_.depth);
173  target_end = target.local_end(target_filter_.depth);
174  } else {
175  target_begin = target.local_begin();
176  target_end = target.local_end();
177  }
178 
179  // retrieve global positions, either for masked or unmasked pool
180  PoolWrapper_<D> pool;
181  if ( mask_.valid() ) // MaskedLayer will be freed by PoolWrapper d'tor
183  else
185 
186  // sharing specs on next line commented out because gcc 4.2 cannot handle them
187 #pragma omp parallel //default(none) shared(source, target, masked_layer, target_begin, target_end)
188  {
189  for ( std::vector<Node*>::const_iterator tgt_it = target_begin;
190  tgt_it != target_end;
191  ++tgt_it )
192  {
193  const thread target_thread = (*tgt_it)->get_thread();
194 
195  if ( target_thread != net_.get_thread_id() )
196  continue;
197 
198  if (target_filter_.select_model() && ((*tgt_it)->get_model_id() != target_filter_.model))
199  continue;
200 
201  const Position<D> target_pos = target.get_position((*tgt_it)->get_subnet_index());
202 
203  if ( mask_.valid() )
204  connect_to_target_(pool.masked_begin(target_pos), pool.masked_end(),
205  *tgt_it, target_pos, target_thread, source);
206  else
207  connect_to_target_(pool.begin(), pool.end(),
208  *tgt_it, target_pos, target_thread, source);
209  } // for target_begin
210  } // omp parallel
211  }
212 
213 
214  template<int D>
216  {
217  // Source driven connect is actually implemented as target driven,
218  // but with displacements computed in the target layer. The Mask has been
219  // reversed so that it can be applied to the source instead of the target.
220  // For each local target node:
221  // 1. Apply (Converse)Mask to source layer
222  // 2. For each source node: Compute probability, draw random number, make
223  // connection conditionally
224 
225  // Nodes in the subnet are grouped by depth, so to select by depth, we
226  // just adjust the begin and end pointers:
227  std::vector<Node*>::const_iterator target_begin;
228  std::vector<Node*>::const_iterator target_end;
230  target_begin = target.local_begin(target_filter_.depth);
231  target_end = target.local_end(target_filter_.depth);
232  } else {
233  target_begin = target.local_begin();
234  target_end = target.local_end();
235  }
236 
237  if (mask_.valid()) {
238 
239  // By supplying the target layer to the MaskedLayer constructor, the
240  // mask is mirrored so it may be applied to the source layer instead
241  MaskedLayer<D> masked_layer(source,source_filter_,mask_,true,allow_oversized_,target);
242 
243  for (std::vector<Node*>::const_iterator tgt_it = target_begin;tgt_it != target_end;++tgt_it) {
244 
245  if (target_filter_.select_model() && ((*tgt_it)->get_model_id() != target_filter_.model))
246  continue;
247 
248  index target_id = (*tgt_it)->get_gid();
249  thread target_thread = (*tgt_it)->get_thread();
250  librandom::RngPtr rng = net_.get_rng(target_thread);
251  Position<D> target_pos = target.get_position((*tgt_it)->get_subnet_index());
252 
253  // If there is a kernel, we create connections conditionally,
254  // otherwise all sources within the mask are created. Test moved
255  // outside the loop for efficiency.
256  if (kernel_.valid()) {
257 
258  for(typename Ntree<D,index>::masked_iterator iter=masked_layer.begin(target_pos); iter!=masked_layer.end(); ++iter) {
259 
260  if ((not allow_autapses_) and (iter->second == target_id))
261  continue;
262 
263  if (rng->drand() < kernel_->value(target.compute_displacement(iter->first, target_pos), rng)) {
264  double w, d;
265  get_parameters_(target.compute_displacement(iter->first, target_pos), rng, w, d);
266  net_.connect(iter->second, *tgt_it, target_thread, synapse_model_, d, w);
267  }
268 
269  }
270 
271  } else {
272 
273  // no kernel
274 
275  for(typename Ntree<D,index>::masked_iterator iter=masked_layer.begin(target_pos); iter!=masked_layer.end(); ++iter) {
276 
277  if ((not allow_autapses_) and (iter->second == target_id))
278  continue;
279  double w, d;
280  get_parameters_(target.compute_displacement(iter->first,target_pos), rng, w, d);
281  net_.connect(iter->second, *tgt_it, target_thread, synapse_model_, d, w);
282  }
283 
284  }
285 
286  }
287 
288  } else {
289  // no mask
290 
291  std::vector<std::pair<Position<D>,index> >* positions = source.get_global_positions_vector(source_filter_);
292  for (std::vector<Node*>::const_iterator tgt_it = target_begin;tgt_it != target_end;++tgt_it) {
293 
294  if (target_filter_.select_model() && ((*tgt_it)->get_model_id() != target_filter_.model))
295  continue;
296 
297  index target_id = (*tgt_it)->get_gid();
298  thread target_thread = (*tgt_it)->get_thread();
299  librandom::RngPtr rng = net_.get_rng(target_thread);
300  Position<D> target_pos = target.get_position((*tgt_it)->get_subnet_index());
301 
302  // If there is a kernel, we create connections conditionally,
303  // otherwise all sources within the mask are created. Test moved
304  // outside the loop for efficiency.
305  if (kernel_.valid()) {
306 
307  for(typename std::vector<std::pair<Position<D>,index> >::iterator iter=positions->begin();iter!=positions->end();++iter) {
308 
309  if ((not allow_autapses_) and (iter->second == target_id))
310  continue;
311 
312  if (rng->drand() < kernel_->value(target.compute_displacement(iter->first,target_pos), rng)) {
313  double w,d;
314  get_parameters_(target.compute_displacement(iter->first,target_pos), rng, w, d);
315  net_.connect(iter->second, *tgt_it, target_thread, synapse_model_, d, w);
316  }
317  }
318 
319  } else {
320 
321  for(typename std::vector<std::pair<Position<D>,index> >::iterator iter=positions->begin();iter!=positions->end();++iter) {
322 
323  if ((not allow_autapses_) and (iter->second == target_id))
324  continue;
325  double w,d;
326  get_parameters_(target.compute_displacement(iter->first,target_pos), rng, w, d);
327  net_.connect(iter->second, *tgt_it, target_thread, synapse_model_, d, w);
328  }
329 
330  }
331  }
332  }
333 
334  }
335 
336  template<int D>
338  {
339  // Convergent connections (fixed fan in)
340  //
341  // For each local target node:
342  // 1. Apply Mask to source layer
343  // 2. Compute connection probability for each source position
344  // 3. Draw source nodes and make connections
345 
346 
347  // Nodes in the subnet are grouped by depth, so to select by depth, we
348  // just adjust the begin and end pointers:
349  std::vector<Node*>::const_iterator target_begin;
350  std::vector<Node*>::const_iterator target_end;
352  target_begin = target.local_begin(target_filter_.depth);
353  target_end = target.local_end(target_filter_.depth);
354  } else {
355  target_begin = target.local_begin();
356  target_end = target.local_end();
357  }
358 
359  if (mask_.valid()) {
360 
361  for (std::vector<Node*>::const_iterator tgt_it = target_begin;tgt_it != target_end;++tgt_it) {
362 
363  if (target_filter_.select_model() && ((*tgt_it)->get_model_id() != target_filter_.model))
364  continue;
365 
366  index target_id = (*tgt_it)->get_gid();
367  thread target_thread = (*tgt_it)->get_thread();
368  librandom::RngPtr rng = net_.get_rng(target_thread);
369  Position<D> target_pos = target.get_position((*tgt_it)->get_subnet_index());
370 
371  // Get (position,GID) pairs for sources inside mask
372  std::vector<std::pair<Position<D>,index> > positions =
374  target.get_position((*tgt_it)->get_subnet_index()),
376 
377  // We will select `number_of_connections_` sources within the mask.
378  // If there is no kernel, we can just draw uniform random numbers,
379  // but with a kernel we have to set up a probability distribution
380  // function using the Vose class.
381  if (kernel_.valid()) {
382 
383  std::vector<double_t> probabilities;
384 
385  // Collect probabilities for the sources
386  for(typename std::vector<std::pair<Position<D>,index> >::iterator iter=positions.begin();iter!=positions.end();++iter) {
387 
388  probabilities.push_back(kernel_->value(source.compute_displacement(target_pos,iter->first), rng));
389 
390  }
391 
392  if ( positions.empty() or
393  ((not allow_autapses_) and (positions.size()==1) and (positions[0].second==target_id)) or
394  ((not allow_multapses_) and (positions.size()<number_of_connections_)) ) {
395  std::string msg = String::compose("Global target ID %1: Not enough sources found inside mask", target_id);
396  throw KernelException(msg.c_str());
397  }
398 
399  // A Vose object draws random integers with a non-uniform
400  // distribution.
401  Vose lottery(probabilities);
402 
403  // If multapses are not allowed, we must keep track of which
404  // sources have been selected already.
405  std::vector<bool> is_selected(positions.size());
406 
407  // Draw `number_of_connections_` sources
408  for(int i=0;i<(int)number_of_connections_;++i) {
409  index random_id = lottery.get_random_id(rng);
410  if ((not allow_multapses_) and (is_selected[random_id])) {
411  --i;
412  continue;
413  }
414 
415  index source_id = positions[random_id].second;
416  if ((not allow_autapses_) and (source_id == target_id)) {
417  --i;
418  continue;
419  }
420  double w,d;
421  get_parameters_(source.compute_displacement(target_pos,positions[random_id].first), rng, w,d);
422  net_.connect(source_id, *tgt_it, target_thread, synapse_model_, d, w);
423  is_selected[random_id] = true;
424  }
425 
426  } else {
427 
428  // no kernel
429 
430  if ( positions.empty() or
431  ((not allow_autapses_) and (positions.size()==1) and (positions[0].second==target_id)) or
432  ((not allow_multapses_) and (positions.size()<number_of_connections_)) ) {
433  std::string msg = String::compose("Global target ID %1: Not enough sources found inside mask", target_id);
434  throw KernelException(msg.c_str());
435  }
436 
437  // If multapses are not allowed, we must keep track of which
438  // sources have been selected already.
439  std::vector<bool> is_selected(positions.size());
440 
441  // Draw `number_of_connections_` sources
442  for(int i=0;i<(int)number_of_connections_;++i) {
443  index random_id = rng->ulrand(positions.size());
444  if ((not allow_multapses_) and (is_selected[random_id])) {
445  --i;
446  continue;
447  }
448  index source_id = positions[random_id].second;
449  double w,d;
450  get_parameters_(source.compute_displacement(target_pos,positions[random_id].first), rng, w,d);
451  net_.connect(source_id, *tgt_it, target_thread, synapse_model_, d, w);
452  is_selected[random_id] = true;
453  }
454 
455  }
456 
457  }
458 
459  } else {
460  // no mask
461 
462  // Get (position,GID) pairs for all nodes in source layer
463  std::vector<std::pair<Position<D>,index> >* positions = source.get_global_positions_vector(source_filter_);
464 
465  for (std::vector<Node*>::const_iterator tgt_it = target_begin;tgt_it != target_end;++tgt_it) {
466 
467  if (target_filter_.select_model() && ((*tgt_it)->get_model_id() != target_filter_.model))
468  continue;
469 
470  index target_id = (*tgt_it)->get_gid();
471  thread target_thread = (*tgt_it)->get_thread();
472  librandom::RngPtr rng = net_.get_rng(target_thread);
473  Position<D> target_pos = target.get_position((*tgt_it)->get_subnet_index());
474 
475  if ( (positions->size()==0) or
476  ((not allow_autapses_) and (positions->size()==1) and ((*positions)[0].second==target_id)) or
477  ((not allow_multapses_) and (positions->size()<number_of_connections_)) ) {
478  std::string msg = String::compose("Global target ID %1: Not enough sources found", target_id);
479  throw KernelException(msg.c_str());
480  }
481 
482  // We will select `number_of_connections_` sources within the mask.
483  // If there is no kernel, we can just draw uniform random numbers,
484  // but with a kernel we have to set up a probability distribution
485  // function using the Vose class.
486  if (kernel_.valid()) {
487 
488  std::vector<double_t> probabilities;
489 
490  // Collect probabilities for the sources
491  for(typename std::vector<std::pair<Position<D>,index> >::iterator iter=positions->begin();iter!=positions->end();++iter) {
492  probabilities.push_back(kernel_->value(source.compute_displacement(target_pos,iter->first), rng));
493  }
494 
495  // A Vose object draws random integers with a non-uniform
496  // distribution.
497  Vose lottery(probabilities);
498 
499  // If multapses are not allowed, we must keep track of which
500  // sources have been selected already.
501  std::vector<bool> is_selected(positions->size());
502 
503  // Draw `number_of_connections_` sources
504  for(int i=0;i<(int)number_of_connections_;++i) {
505  index random_id = lottery.get_random_id(rng);
506  if ((not allow_multapses_) and (is_selected[random_id])) {
507  --i;
508  continue;
509  }
510 
511  index source_id = (*positions)[random_id].second;
512  if ((not allow_autapses_) and (source_id == target_id)) {
513  --i;
514  continue;
515  }
516 
517  Position<D> source_pos = (*positions)[random_id].first;
518  double w,d;
519  get_parameters_(source.compute_displacement(target_pos,source_pos), rng, w,d);
520  net_.connect(source_id, *tgt_it, target_thread, synapse_model_, d, w);
521  is_selected[random_id] = true;
522  }
523 
524  } else {
525 
526  // no kernel
527 
528  // If multapses are not allowed, we must keep track of which
529  // sources have been selected already.
530  std::vector<bool> is_selected(positions->size());
531 
532  // Draw `number_of_connections_` sources
533  for(int i=0;i<(int)number_of_connections_;++i) {
534  index random_id = rng->ulrand(positions->size());
535  if ((not allow_multapses_) and (is_selected[random_id])) {
536  --i;
537  continue;
538  }
539 
540  index source_id = (*positions)[random_id].second;
541  if ((not allow_autapses_) and (source_id == target_id)) {
542  --i;
543  continue;
544  }
545 
546  Position<D> source_pos = (*positions)[random_id].first;
547  double w,d;
548  get_parameters_(source.compute_displacement(target_pos,source_pos), rng, w,d);
549  net_.connect(source_id, *tgt_it, target_thread, synapse_model_, d, w);
550  is_selected[random_id] = true;
551  }
552 
553  }
554 
555  }
556  }
557  }
558 
559 
560  template<int D>
562  {
563  // Divergent connections (fixed fan out)
564  //
565  // For each (global) source: (All connections made on all mpi procs)
566  // 1. Apply mask to global targets
567  // 2. If using kernel: Compute connection probability for each global target
568  // 3. Draw connections to make using global rng
569 
570  MaskedLayer<D> masked_target(target,target_filter_,mask_,true,allow_oversized_);
571 
572  std::vector<std::pair<Position<D>,index> >* sources = source.get_global_positions_vector(source_filter_);
573 
574  for (typename std::vector<std::pair<Position<D>,index> >::iterator src_it = sources->begin(); src_it != sources->end(); ++src_it) {
575 
576  Position<D> source_pos = src_it->first;
577  index source_id = src_it->second;
578  std::vector<index> targets;
579  std::vector<Position<D> > displacements;
580  std::vector<double_t> probabilities;
581 
582  // Find potential targets and probabilities
583 
584  for(typename Ntree<D,index>::masked_iterator tgt_it=masked_target.begin(source_pos); tgt_it!=masked_target.end(); ++tgt_it) {
585 
586  if ((not allow_autapses_) and (source_id == tgt_it->second))
587  continue;
588 
589  Position<D> target_displ = target.compute_displacement(source_pos, tgt_it->first);
591 
592  targets.push_back(tgt_it->second);
593  displacements.push_back(target_displ);
594 
595  if (kernel_.valid())
596  probabilities.push_back(kernel_->value(target_displ, rng));
597  else
598  probabilities.push_back(1.0);
599  }
600 
601  if ( targets.empty() or
602  ((not allow_multapses_) and (targets.size()<number_of_connections_)) ) {
603  std::string msg = String::compose("Global source ID %1: Not enough targets found", source_id);
604  throw KernelException(msg.c_str());
605  }
606 
607  // Draw targets. A Vose object draws random integers with a
608  // non-uniform distribution.
609  Vose lottery(probabilities);
610 
611  // If multapses are not allowed, we must keep track of which
612  // targets have been selected already.
613  std::vector<bool> is_selected(targets.size());
614 
615  // Draw `number_of_connections_` targets
616  for(long_t i=0;i<(long_t)number_of_connections_;++i) {
617  index random_id = lottery.get_random_id(net_.get_grng());
618  if ((not allow_multapses_) and (is_selected[random_id])) {
619  --i;
620  continue;
621  }
622  Position<D> target_displ = displacements[random_id];
623  index target_id = targets[random_id];
624  Node* target_ptr = net_.get_node(target_id);
625  double w,d;
626  get_parameters_(target_displ, net_.get_grng(), w,d);
627  net_.connect(source_id, target_ptr, target_ptr->get_thread(), synapse_model_, d, w);
628  is_selected[random_id] = true;
629  }
630 
631  }
632 
633  }
634 
635 } // namespace nest
636 
637 #endif
bool allow_multapses_
Definition: connection_creator.h:158
size_t index
Unsigned long type for enumerations.
Definition: nest.h:109
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
std::vector< Node * >::iterator local_end(int_t depth)
End of local children at given depth.
Definition: layer.cpp:173
Ntree< D, index >::masked_iterator begin(const Position< D > &anchor)
Iterate over nodes inside mask.
Definition: layer.h:506
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
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
Vose's alias method for selecting a random number using a discrete probability distribution.
Definition: vose.h:41
Ntree< D, index >::masked_iterator end()
Definition: layer.h:517
std::vector< Node * >::iterator local_begin(int_t depth)
Start of local children at given depth.
Definition: layer.cpp:159
index number_of_connections_
Definition: connection_creator.h:162
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
librandom::RngPtr get_grng() const
Get global random number client.
Definition: network.h:1163
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
assert(pNet!=0)
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
bool valid(void) const
< returns true if and only if obj->pointee != NULL
Definition: lockptr.h:307
const Name w("w")
Specific to Brette & Gerstner 2005 (aeif_cond-*)
Definition: nest_names.h:343
bool select_depth() const
Definition: selector.h:58
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
index get_random_id(librandom::RngPtr rng) const
Definition: vose.cpp:81
PoolWrapper_()
Definition: connection_creator_impl.h:103
Network & net_
Definition: connection_creator.h:169
Base class for all Kernel exceptions.
Definition: exceptions.h:54
Definition: connection_creator.h:68
long_t model
The model to select, or -1 if all models are allowed.
Definition: selector.h:69
const Name source("source")
Connection parameters.
Definition: nest_names.h:260
virtual Position< D > get_position(index sind) const =0
Get position of node.
const Name target("target")
Connection parameters.
Definition: nest_names.h:282
const Name positions("positions")
Definition: topology_names.h:53
void target_driven_connect_(Layer< D > &source, Layer< D > &target)
Definition: connection_creator_impl.h:159
const Name sources("sources")
Definition: topology_names.h:56
librandom::RngPtr get_rng(thread thrd=0) const
Get random number client of a thread.
Definition: network.h:1157
virtual Position< D > compute_displacement(const Position< D > &from_pos, const Position< D > &to_pos) const
Returns displacement of a position from another position.
Definition: layer_impl.h:43
Node * get_node(index, thread thr=0)
Return pointer of the specified Node.
Definition: network.cpp:619
Definition: connection_creator.h:68
Exception to be thrown if a status parameter is incomplete or inconsistent.
Definition: exceptions.h:420
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
long_t depth
The depth to select, or -1 if all depths are allowed.
Definition: selector.h:73
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
thread get_thread() const
Retrieve the number of the thread to which the node is assigned.
Definition: node.h:825
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
const Name targets("targets")
Connection parameters.
Definition: nest_names.h:284
std::vector< std::pair< Position< D >, index > > * get_global_positions_vector(Selector filter=Selector())
Definition: layer_impl.h:184
bool select_model() const
Definition: selector.h:53
ConnectionType type_
Definition: connection_creator.h:156
Definition: connection_creator.h:68
int_t thread
Thread index type.
Definition: nest.h:133
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96