NEST main@caf0ae8
 
Loading...
Searching...
No Matches
sonata_connector.h
Go to the documentation of this file.
1/*
2 * sonata_connector.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 SONATA_CONNECTOR_H
24#define SONATA_CONNECTOR_H
25
26#include "config.h"
27
28#ifdef HAVE_HDF5
29
30// C++ includes:
31#include <map>
32#include <string>
33#include <vector>
34
35// Includes from libnestutil
36#include "dict_util.h"
37
38// Includes from nestkernel:
39#include "conn_parameter.h"
40#include "kernel_manager.h"
41
42#include "H5Cpp.h"
43
44namespace nest
45{
46
69class SonataConnector
70{
71public:
78 SonataConnector( const Dictionary& graph_specs, const long hyperslab_size );
79
80 ~SonataConnector();
81
85 void connect();
86
87private:
96 H5::H5File* open_file_( std::string& fname );
97
104 H5::Group* open_group_( const H5::H5File* file, const std::string& grp_name );
105
112 H5::Group* open_group_( const H5::Group* group, const std::string& grp_name );
113
121 void open_required_dsets_( const H5::Group* pop_grp );
122
130 void try_open_edge_group_dsets_( const H5::Group* edge_grp );
131
135 void check_dsets_consistency();
136
140 void close_dsets_();
141
148 void get_attribute_( std::string& attribute_value, const H5::DataSet& dataset, const std::string& attribute_name );
149
150
160 void create_edge_type_id_2_syn_spec_( Dictionary edge_dict );
161
162
172 void set_synapse_params_( Dictionary syn_dict, size_t synapse_model_id, int type_id );
173
185 void get_synapse_params_( size_t snode_id, Node& target, size_t target_thread, RngPtr rng, int edge_type_id );
186
200 double get_syn_property_( const Dictionary& syn_spec,
201 hsize_t index,
202 const bool dataset_exists,
203 std::vector< double >& data,
204 const std::string& name );
205
209 void sequential_chunkwise_connector_();
210
216 void connect_chunk_( const hsize_t hyperslab_size, const hsize_t offset );
217
227 template < typename T >
228 void read_subset_( const H5::DataSet& dataset,
229 std::vector< T >& data_buf,
230 H5::PredType datatype,
231 hsize_t hyperslab_size,
232 hsize_t offset );
233
249 hsize_t find_edge_groups_( H5::Group* pop_grp, std::vector< std::string >& edge_grp_names );
250
260 hsize_t get_nrows_( H5::DataSet dataset );
261
265 void reset_params_();
266
267 typedef std::map< std::string, std::shared_ptr< ConnParameter > > ConnParameterMap;
268
270 std::set< std::string > skip_syn_params_;
271
273 Dictionary graph_specs_;
274
276 hsize_t hyperslab_size_;
277
279 bool weight_dataset_exist_;
280
282 bool delay_dataset_exist_;
283
285 std::string source_attribute_value_;
286
288 std::string target_attribute_value_;
289
291 Dictionary cur_edge_params_;
292
294 std::map< int, size_t > edge_type_id_2_syn_model_;
295
297 std::map< int, ConnParameterMap > edge_type_id_2_syn_spec_;
298
300 std::map< int, std::vector< Dictionary > > edge_type_id_2_param_dicts_;
301
303 std::string cur_fname_;
304 H5::DataSet src_node_id_dset_;
305 H5::DataSet tgt_node_id_dset_;
306 H5::DataSet edge_type_id_dset_;
307 H5::DataSet syn_weight_dset_;
308 H5::DataSet delay_dset_;
309};
310
311
312} // namespace nest
313
314#endif // ifdef HAVE_HDF5
315#endif /* ifdef SONATA_CONNECTOR_H */
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
void connect(NodeCollectionPTR sources, NodeCollectionPTR targets, const Dictionary &connectivity, const std::vector< Dictionary > &synapse_params)
Create bipartite connections.
Definition nest.cpp:424