NEST main@f146f75
Loading...
Searching...
No Matches
connector_base_impl.h
Go to the documentation of this file.
1/*
2 * connector_base_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 "connector_base.h"
24
25// Includes from nestkernel:
27#include "kernel_manager.h"
28
29// Includes from models:
30#include "weight_recorder.h"
31
32#ifndef CONNECTOR_BASE_IMPL_H
33#define CONNECTOR_BASE_IMPL_H
34
35namespace nest
36{
37
38template < typename ConnectionT >
39void
41{
42 if constexpr ( ConnectionT::requires_axonal_delay_correction )
43 {
44 if ( c.get_axonal_delay_steps() >= c.get_dendritic_delay_steps() )
45 {
47 kernel().connection_manager.register_predominant_axonal_delay( kernel().vp_manager.get_thread_id() );
48 }
49 }
50}
51
52template < typename ConnectionT >
53void
55 const unsigned int lcid,
56 Event& e,
57 const CommonSynapseProperties& cp )
58{
59 // If the pointer to the receiver node in the event is invalid,
60 // the event was not sent, and a WeightRecorderEvent is therefore not created.
61 if ( cp.get_weight_recorder() and e.receiver_is_valid() )
62 {
63 // Create new event to record the weight and copy relevant content.
65 wr_e.set_port( e.get_port() );
66 wr_e.set_rport( e.get_rport() );
67 wr_e.set_stamp( e.get_stamp() );
68 // Sender is not available for SecondaryEvents, and not needed, so we do not
69 // set it to avoid undefined behavior.
70 wr_e.set_sender_node_id( kernel().connection_manager.get_source_node_id( tid, syn_id_, lcid ) );
71 wr_e.set_weight( e.get_weight() );
72 wr_e.set_delay_steps( e.get_delay_steps() );
73 wr_e.set_receiver( *static_cast< Node* >( cp.get_weight_recorder() ) );
74 // Set the node_id of the postsynaptic node as receiver node ID
75 wr_e.set_receiver_node_id( e.get_receiver_node_id() );
76 wr_e();
77 }
78}
79
80template < typename ConnectionT >
81void
84 const double t_spike_critical_interval_end,
85 const double t_post_spike )
86{
87 typename ConnectionT::CommonPropertiesType const& cp = static_cast< GenericConnectorModel< ConnectionT >* >(
89 ->get_common_properties();
90 C_[ entry.get_lcid() ].correct_weight_stdp_ax_delay( tid, entry, t_spike_critical_interval_end, t_post_spike, cp );
91}
92
93} // of namespace nest
94
95#endif
Class containing the common properties for all connections of a certain type.
Definition common_synapse_properties.h:50
weight_recorder * get_weight_recorder() const
Get weight_recorder.
Definition common_synapse_properties.h:98
void register_predominant_axonal_delay(const size_t tid)
Definition connection_manager.h:868
void correct_weight_stdp_ax_delay(const size_t tid, CorrectionEntrySTDPAxDelay &entry, const double t_spike_critical_interval_end, const double t_post_spike) override
On occurrence of a post-synaptic spike, correct the weight update of a previous pre-synaptic spike wh...
Definition connector_base_impl.h:82
bool axonal_delay_correction_required_
Whether any connection held here can ever require a retrospective correction.
Definition connector_base.h:244
const synindex syn_id_
Definition connector_base.h:235
void send_weight_event(const size_t tid, const unsigned int lcid, Event &e, const CommonSynapseProperties &cp) override
Definition connector_base_impl.h:54
BlockVector< ConnectionT > C_
Definition connector_base.h:234
void register_axonal_delay_correction_required_(const ConnectionT &c)
Fold a newly added or modified connection into axonal_delay_correction_required_ and the kernel-wide ...
Definition connector_base_impl.h:40
Information on a received pre-synaptic spike which is buffered by an AxonalDelayArchivingNode,...
Definition axonal_delay_archiving_node.h:46
size_t get_lcid() const
Local connection index of the synapse which transmitted the spike.
Definition axonal_delay_archiving_node.h:67
synindex get_syn_id() const
Synapse type of the synapse which transmitted the spike.
Definition axonal_delay_archiving_node.h:74
Encapsulate information sent between nodes.
Definition event.h:103
void set_receiver(Node &)
Change pointer to receiving Node.
Definition event.h:953
void set_port(size_t p)
Set the port number.
Definition event.h:1084
void set_stamp(Time const &)
Set the time stamp of the event.
Definition event.h:1017
void set_weight(double t)
Set weight of the event.
Definition event.h:1005
void set_sender_node_id(const size_t)
Change node ID of sending Node.
Definition event.h:965
void set_delay_steps(long)
Set the transmission delay of the event.
Definition event.h:1054
void set_rport(size_t p)
Set the receiver port number (r-port).
Definition event.h:1090
Definition connector_model.h:156
const std::vector< ConnectorModel * > & get_connection_models(size_t tid)
Definition model_manager.h:304
Base class for all NEST network objects.
Definition node.h:99
Event for recording the weight of a spike.
Definition event.h:498
void set_receiver_node_id(size_t)
Change node ID of receiving Node.
Definition event.h:531
ConnectionManager connection_manager
Definition kernel_manager.h:239
ModelManager model_manager
Definition kernel_manager.h:243
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
KernelManager & kernel()
Definition kernel_manager.h:311