NEST  2.6.0,not_revisioned_source_dir@0
quantal_stp_connection_impl.h
Go to the documentation of this file.
1 /*
2  * quantal_stp_connection_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 #include "quantal_stp_connection.h"
24 #include "network.h"
25 #include "connection.h"
26 #include "connector_model.h"
27 #include "nest_names.h"
28 #include "dictutils.h"
29 
30 namespace nest
31 {
32 
33 
34  /* Polymorphic version of update_value.
35  * This version is needed, because DataConnect will pass all properties as doubles.
36  * This code will take either an int or a double and convert is to an int.
37  */
38  bool update_value_int(const DictionaryDatum & d, Name propname, int &prop)
39  {
40  if (d->known(propname))
41  {
42  Datum *dat= (*d)[propname].datum();
43  IntegerDatum *intdat= dynamic_cast<IntegerDatum *>(dat);
44  if(intdat !=0)
45  {
46  prop = static_cast<int>(intdat->get());
47  return true;
48  }
49  DoubleDatum *doubledat= dynamic_cast<DoubleDatum *>(dat);
50  if(doubledat !=0)
51  {
52  prop = static_cast<int>(doubledat->get());
53  return true;
54  }
55  else
56  throw TypeMismatch();
57  }
58 
59  return false;
60  }
61 
62  template<typename targetidentifierT>
65  weight_(1.0),
66  U_(0.5),
67  u_(U_),
68  tau_rec_(800.0),
69  tau_fac_(10.0),
70  n_(1),
71  a_(n_)
72  {}
73 
74  template<typename targetidentifierT>
76  ConnectionBase(rhs),
77  weight_(rhs.weight_),
78  U_(rhs.U_),
79  u_(rhs.u_),
80  tau_rec_(rhs.tau_rec_),
81  tau_fac_(rhs.tau_fac_),
82  n_(rhs.n_),
83  a_(rhs.a_)
84  {}
85 
86 
87  template<typename targetidentifierT>
89  {
90  ConnectionBase::get_status(d);
91  def<double_t>(d, names::weight, weight_);
92  def<double_t>(d, names::dU, U_);
93  def<double_t>(d, names::u, u_);
94  def<double_t>(d, names::tau_rec, tau_rec_);
95  def<double_t>(d, names::tau_fac, tau_fac_);
96  def<int>(d, names::n, n_);
97  def<int>(d, names::a, a_);
98  }
99 
100 
101  template<typename targetidentifierT>
103  {
104  ConnectionBase::set_status(d, cm);
105  updateValue<double_t>(d, names::weight, weight_);
106 
107  updateValue<double_t>(d, names::dU, U_);
108  updateValue<double_t>(d, names::u, u_);
109  updateValue<double_t>(d, names::tau_rec, tau_rec_);
110  updateValue<double_t>(d, names::tau_fac, tau_fac_);
111  update_value_int(d, names::n, n_);
112  update_value_int(d, names::a, a_);
113  }
114 
115 } // of namespace nest
Definition: lockptrdatum.h:40
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
const Name tau_fac("tau_fac")
facilitation time constant (ms) (Tsodyks2_connection)
Definition: nest_names.h:289
Exception to be thrown if a given SLI type does not match the expected type.
Definition: sliexceptions.h:147
const Name weight("weight")
Connection parameters.
Definition: nest_names.h:344
Represent strings by ints to facilitate fast comparison.
Definition: name.h:53
bool update_value_int(const DictionaryDatum &d, Name propname, int &prop)
Definition: quantal_stp_connection_impl.h:38
const Name a("a")
Specific to Brette & Gerstner 2005 (aeif_cond-*)
Definition: nest_names.h:41
const D & get(void) const
Definition: genericdatum.h:61
const Name dU("U")
Unit increment of the utilization for a facilitating synapse [0...1] (Tsodyks2_connection) ...
Definition: nest_names.h:106
Quantal_StpConnection()
Default Constructor.
Definition: quantal_stp_connection_impl.h:63
const Name tau_rec("tau_rec")
time constant for recovery (ms) (Tsodyks2_connection)
Definition: nest_names.h:296
Declarations for class Network.
Definition: quantal_stp_connection.h:84
Definition: numericdatum.h:40
const Name n("n")
Number of synaptic release sites (int >=0) (Tsodyks2_connection)
Definition: nest_names.h:202
void set_status(const DictionaryDatum &d, ConnectorModel &cm)
Set default properties of this connection from the values given in dictionary.
Definition: quantal_stp_connection_impl.h:102
Base class for representing connections.
Definition: connection.h:85
const Name u("u")
probability of release [0...1] (Tsodyks2_connection)
Definition: nest_names.h:320
Definition: datum.h:33
void get_status(DictionaryDatum &d) const
Get all properties of this connection and put them into a dictionary.
Definition: quantal_stp_connection_impl.h:88
Definition: connector_model.h:38