NEST main@f146f75
Loading...
Searching...
No Matches
target_table_devices_impl.h
Go to the documentation of this file.
1/*
2 * target_table_devices_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 TARGET_TABLE_DEVICES_IMPL_H
24#define TARGET_TABLE_DEVICES_IMPL_H
25
26// Includes from nestkernel:
27#include "connector_base.h"
28#include "kernel_manager.h"
29#include "model_manager.h"
30#include "node.h"
32#include "vp_manager_impl.h"
33
34namespace nest
35{
36
37inline void
39 Node& target,
40 const size_t source_node_id,
41 const size_t tid,
42 const synindex syn_id,
43 const Dictionary& p,
44 const double d,
45 const double w )
46{
47 const size_t lid = kernel().vp_manager.node_id_to_lid( source_node_id );
48 assert( lid < target_to_devices_[ tid ].size() );
49 assert( syn_id < target_to_devices_[ tid ][ lid ].size() );
50
51 kernel()
53 .add_connection( source, target, target_to_devices_[ tid ][ lid ], syn_id, p, d, numerics::nan, numerics::nan, w );
54}
55
56inline void
58 Node& target,
59 const size_t tid,
60 const synindex syn_id,
61 const Dictionary& p,
62 const double d,
63 const double w )
64{
65 const size_t ldid = source.get_local_device_id();
66 assert( ldid != invalid_index );
67 assert( ldid < target_from_devices_[ tid ].size() );
68 assert( syn_id < target_from_devices_[ tid ][ ldid ].size() );
69
70 kernel()
73 source, target, target_from_devices_[ tid ][ ldid ], syn_id, p, d, numerics::nan, numerics::nan, w );
74
75 // store node ID of sending device
76 sending_devices_node_ids_[ tid ][ ldid ] = source.get_node_id();
77}
78
79inline void
81 const size_t source_node_id,
82 Event& e,
83 const std::vector< ConnectorModel* >& cm )
84{
85 const size_t lid = kernel().vp_manager.node_id_to_lid( source_node_id );
86 for ( std::vector< ConnectorBase* >::iterator it = target_to_devices_[ tid ][ lid ].begin();
87 it != target_to_devices_[ tid ][ lid ].end();
88 ++it )
89 {
90 if ( *it )
91 {
92 ( *it )->send_to_all( tid, cm, e );
93 }
94 }
95}
96
97inline void
99 const size_t source_node_id,
101 const std::vector< ConnectorModel* >& cm )
102{
103 const size_t lid = kernel().vp_manager.node_id_to_lid( source_node_id );
104 for ( auto& synid : e.get_supported_syn_ids() )
105 {
106 if ( target_to_devices_[ tid ][ lid ][ synid ] )
107 {
108 target_to_devices_[ tid ][ lid ][ synid ]->send_to_all( tid, cm, e );
109 }
110 }
111}
112
113inline void
115 const size_t source_node_id,
116 const synindex syn_id,
117 Dictionary& dict,
118 const size_t lcid ) const
119{
120 const size_t lid = kernel().vp_manager.node_id_to_lid( source_node_id );
121 if ( target_to_devices_[ tid ][ lid ][ syn_id ] )
122 {
123 target_to_devices_[ tid ][ lid ][ syn_id ]->get_synapse_status( tid, lcid, dict );
124 }
125}
126
127inline void
129 const size_t source_node_id,
130 const synindex syn_id,
131 ConnectorModel& cm,
132 const Dictionary& dict,
133 const size_t lcid )
134{
135 const size_t lid = kernel().vp_manager.node_id_to_lid( source_node_id );
136 if ( target_to_devices_[ tid ][ lid ][ syn_id ] )
137 {
138 target_to_devices_[ tid ][ lid ][ syn_id ]->set_synapse_status( lcid, dict, cm );
139 }
140}
141
142} // namespace nest
143
144#endif /* TARGET_TABLE_DEVICES_IMPL_H */
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
Definition connector_model.h:69
virtual void add_connection(Node &src, Node &tgt, std::vector< ConnectorBase * > &hetconn, const synindex syn_id, const Dictionary &d, const double delay=numerics::nan, const double dendritic_delay=numerics::nan, const double axonal_delay=numerics::nan, const double weight=numerics::nan)=0
Adds a connection.
Encapsulate information sent between nodes.
Definition event.h:103
ConnectorModel & get_connection_model(synindex syn_id, size_t thread_id)
Return pointer to protoype for given synapse id.
Definition model_manager.h:297
Base class for all NEST network objects.
Definition node.h:99
Base class of secondary events.
Definition secondary_event.h:50
void set_synapse_status_to_device(const size_t tid, const size_t source_node_id, const synindex syn_id, ConnectorModel &cm, const Dictionary &dict, const size_t lcid)
Sets synapse status of connection from neuron to device.
Definition target_table_devices_impl.h:128
void add_connection_to_device(Node &source, Node &target, const size_t s_node_id, const size_t tid, const synindex syn_id, const Dictionary &p, const double d, const double w)
Adds a connection from the neuron source to the device target.
Definition target_table_devices_impl.h:38
void send_to_device(const size_t tid, const size_t s_node_id, Event &e, const std::vector< ConnectorModel * > &cm)
Sends a spike event to all targets of the source neuron.
Definition target_table_devices_impl.h:80
void get_synapse_status_to_device(const size_t tid, const size_t source_node_id, const synindex syn_id, Dictionary &dict, const size_t lcid) const
Returns synapse status of connection from neuron to device.
Definition target_table_devices_impl.h:114
std::vector< std::vector< std::vector< ConnectorBase * > > > target_to_devices_
3d structure storing connections from neurons to devices
Definition target_table_devices.h:54
void add_connection_from_device(Node &source, Node &target, const size_t tid, const synindex syn_id, const Dictionary &p, const double d, const double w)
Adds a connection from the device source to the neuron target.
Definition target_table_devices_impl.h:57
std::vector< std::vector< size_t > > sending_devices_node_ids_
Definition target_table_devices.h:61
std::vector< std::vector< std::vector< ConnectorBase * > > > target_from_devices_
3d structure storing connections from devices to neurons
Definition target_table_devices.h:57
size_t node_id_to_lid(const size_t node_id) const
Returns thread local index of a given global node.
Definition vp_manager_impl.h:79
ModelManager model_manager
Definition kernel_manager.h:243
VPManager vp_manager
Definition kernel_manager.h:234
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
KernelManager & kernel()
Definition kernel_manager.h:311
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:121
const double nan
Definition numerics.cpp:36
Declarations for base class Node.