NEST main@caf0ae8
 
Loading...
Searching...
No Matches
target_table.h
Go to the documentation of this file.
1/*
2 * target_table.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_H
24#define TARGET_TABLE_H
25
26// C++ includes:
27#include <cassert>
28#include <iostream>
29#include <map>
30#include <vector>
31
32// Includes from nestkernel:
33#include "nest_types.h"
34#include "spike_data.h"
35#include "target.h"
36#include "target_data.h"
37
38namespace nest
39{
40
47{
48private:
57 std::vector< std::vector< std::vector< Target > > > targets_;
58
69 std::vector< std::vector< std::vector< std::vector< size_t > > > > secondary_send_buffer_pos_;
70
71public:
75 void initialize();
76
80 void finalize();
81
85 void prepare( const size_t tid );
86
90 void add_target( const size_t tid, const size_t target_rank, const TargetData& target_data );
91
96 const std::vector< Target >& get_targets( const size_t tid, const size_t lid ) const;
97
103 const std::vector< size_t >&
104 get_secondary_send_buffer_positions( const size_t tid, const size_t lid, const synindex syn_id ) const;
105
109 void clear( const size_t tid );
110
115 void compress_secondary_send_buffer_pos( const size_t tid );
116};
117
118inline const std::vector< Target >&
119TargetTable::get_targets( const size_t tid, const size_t lid ) const
120{
121 return targets_[ tid ][ lid ];
122}
123
124inline const std::vector< size_t >&
125TargetTable::get_secondary_send_buffer_positions( const size_t tid, const size_t lid, const synindex syn_id ) const
126{
127 assert( syn_id < secondary_send_buffer_pos_[ tid ][ lid ].size() );
128 return secondary_send_buffer_pos_[ tid ][ lid ][ syn_id ];
129}
130
131inline void
132TargetTable::clear( const size_t tid )
133{
134 targets_[ tid ].clear();
135 secondary_send_buffer_pos_[ tid ].clear();
136}
137
138} // namespace nest
139
140#endif /* #ifndef TARGET_TABLE_H */
Used to communicate part of the connection infrastructure from post- to presynaptic side.
Definition target_data.h:175
This data structure stores all targets of the local neurons.
Definition target_table.h:47
void clear(const size_t tid)
Clears all entries of targets_.
Definition target_table.h:132
void add_target(const size_t tid, const size_t target_rank, const TargetData &target_data)
Adds entry to targets_.
Definition target_table.cpp:90
std::vector< std::vector< std::vector< Target > > > targets_
Stores targets of local neurons.
Definition target_table.h:57
const std::vector< Target > & get_targets(const size_t tid, const size_t lid) const
Returns all targets of a neuron.
Definition target_table.h:119
void finalize()
Deletes data structure.
Definition target_table.cpp:49
const std::vector< size_t > & get_secondary_send_buffer_positions(const size_t tid, const size_t lid, const synindex syn_id) const
Returns all MPI send buffer positions of a neuron.
Definition target_table.h:125
void compress_secondary_send_buffer_pos(const size_t tid)
Removes identical MPI send buffer positions to avoid writing data multiple times.
Definition target_table.cpp:74
std::vector< std::vector< std::vector< std::vector< size_t > > > > secondary_send_buffer_pos_
Stores MPI send buffer positions for secondary targets of local neurons.
Definition target_table.h:69
void initialize()
Initializes data structures.
Definition target_table.cpp:34
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
void prepare()
do calibrations for network, open files, ... before run()
Definition nest.cpp:528
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:115