NEST  2.6.0,not_revisioned_source_dir@0
cont_delay_connection_impl.h
Go to the documentation of this file.
1 /*
2  * cont_delay_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 "network.h"
24 #include "dictdatum.h"
25 #include "connector_model.h"
27 #include "cont_delay_connection.h"
28 #include "event.h"
29 
30 
31 namespace nest
32 {
33 
34  template<typename targetidentifierT>
37  weight_(1.0),
38  delay_offset_(0.0)
39  { }
40 
41  template<typename targetidentifierT>
43  ConnectionBase(rhs),
44  weight_(rhs.weight_),
45  delay_offset_(rhs.delay_offset_)
46  { }
47 
48  template<typename targetidentifierT>
50  {
51  ConnectionBase::get_status(d);
52 
53  def<double_t>(d, names::weight, weight_);
54  def<double_t>(d, names::delay, Time(Time::step(get_delay_steps())).get_ms()-delay_offset_);
55  }
56 
57  template<typename targetidentifierT>
59  {
60  ConnectionBase::set_status(d, cm);
61 
62  updateValue<double_t>(d, names::weight, weight_);
63 
64  //set delay if mentioned
66 
67  if (updateValue<double_t>(d, names::delay, delay))
68  {
69 
71 
72  double_t int_delay;
73  const double_t frac_delay = std::modf(delay/h, &int_delay);
74 
75  if (frac_delay == 0)
76  {
77  cm.assert_valid_delay_ms(delay);
78  set_delay_steps( Time::delay_ms_to_steps(delay) );
79  delay_offset_ = 0.0;
80  }
81  else
82  {
83  const long_t lowerbound = static_cast<long_t>(int_delay);
84  cm.assert_two_valid_delays_steps(lowerbound, lowerbound + 1);
85  set_delay_steps(lowerbound + 1);
86  delay_offset_ = h * (1.0 - frac_delay);
87  }
88  }
89  }
90 
91 } // of namespace nest
const Name delay("delay")
Connection parameters.
Definition: nest_names.h:92
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
void assert_two_valid_delays_steps(long_t, long_t)
Raise exception if either of the two delays in steps is invalid.
Definition: connector_model.cpp:113
const Name weight("weight")
Connection parameters.
Definition: nest_names.h:344
void set_status(const DictionaryDatum &d, ConnectorModel &cm)
Set properties of this connection from the values given in dictionary.
Definition: cont_delay_connection_impl.h:58
Definition: nest_time.h:230
const Name h("h")
Summed input to a neuron (Ginzburg neuron)
Definition: nest_names.h:158
ContDelayConnection()
Default Constructor.
Definition: cont_delay_connection_impl.h:35
Definition: nest_time.h:130
static delay delay_ms_to_steps(double_t ms)
Definition: nest_time.h:415
Declarations for class Network.
double double_t
Double precision floating point numbers.
Definition: nest.h:93
double_t get_ms() const
Definition: nest_time.h:389
static Time get_resolution()
Definition: nest_time.h:303
long_t delay
Delay of a connection.
Definition: nest.h:178
Base class for representing connections.
Definition: connection.h:85
void assert_valid_delay_ms(double_t)
Raise exception if delay value in milliseconds is invalid.
Definition: connector_model.cpp:67
Definition: connector_model.h:38
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
void get_status(DictionaryDatum &d) const
Get all properties of this connection and put them into a dictionary.
Definition: cont_delay_connection_impl.h:49
Definition: cont_delay_connection.h:52