Brion  1.10.0
The Blue Brain C++ I/O library
brion/types.h
1 /* Copyright (c) 2013-2017, EPFL/Blue Brain Project
2  * Daniel Nachbaur <daniel.nachbaur@epfl.ch>
3  *
4  * This file is part of Brion <https://github.com/BlueBrain/Brion>
5  *
6  * This library is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License version 3.0 as published
8  * by the Free Software Foundation.
9  *
10  * This library is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13  * details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef BRION_TYPES
21 #define BRION_TYPES
22 
23 #include <brion/enums.h>
24 
25 #include <boost/multi_array.hpp>
26 #include <lunchbox/compiler.h>
27 #include <lunchbox/types.h>
28 #include <servus/uri.h>
29 #include <set>
30 #include <map>
31 
32 #pragma warning(push)
33 #pragma warning(disable : 4996)
34 # include <vmmlib/types.hpp>
35 #pragma warning(pop)
36 
38 namespace brion
39 {
40 
41 using namespace enums;
42 class BlueConfig;
43 class Circuit;
44 class CompartmentReport;
45 class CompartmentReportPlugin;
46 class Mesh;
47 class Morphology;
48 class SpikeReport;
49 class SpikeReportPlugin;
50 class Synapse;
51 class SynapseSummary;
52 class Target;
53 
54 using vmml::Vector2i;
55 using vmml::Vector3f;
56 using vmml::Vector4f;
57 using vmml::Vector3d;
58 using vmml::Vector4d;
59 
60 typedef std::vector< size_t > size_ts;
61 typedef std::vector< int32_t > int32_ts;
62 typedef std::vector< uint16_t > uint16_ts;
63 typedef std::vector< uint32_t > uint32_ts;
64 typedef std::vector< uint64_t > uint64_ts;
65 typedef std::vector< float > floats;
66 typedef std::vector< Vector2i > Vector2is;
67 typedef std::vector< Vector3f > Vector3fs;
68 typedef std::vector< Vector4f > Vector4fs;
69 typedef std::vector< Vector3d > Vector3ds;
70 typedef std::vector< Vector4d > Vector4ds;
71 typedef std::vector< SectionType > SectionTypes;
72 typedef std::vector< Target > Targets;
73 typedef std::shared_ptr< int32_ts > int32_tsPtr;
74 typedef std::shared_ptr< uint16_ts > uint16_tsPtr;
75 typedef std::shared_ptr< uint32_ts > uint32_tsPtr;
76 typedef std::shared_ptr< floats > floatsPtr;
77 typedef std::shared_ptr< Vector2is > Vector2isPtr;
78 typedef std::shared_ptr< Vector3fs > Vector3fsPtr;
79 typedef std::shared_ptr< Vector4fs > Vector4fsPtr;
80 typedef std::shared_ptr< Vector3ds > Vector3dsPtr;
81 typedef std::shared_ptr< Vector4ds > Vector4dsPtr;
82 typedef std::shared_ptr< SectionTypes > SectionTypesPtr;
83 
85 typedef std::set< uint32_t > GIDSet;
86 
87 typedef GIDSet::const_iterator GIDSetCIter;
88 typedef GIDSet::iterator GIDSetIter;
89 
93 typedef std::vector< uint64_ts > SectionOffsets;
94 
96 typedef std::vector< uint16_ts > CompartmentCounts;
97 
99 typedef boost::multi_array< std::string, 2 > NeuronMatrix;
100 
102 typedef boost::multi_array< float, 2 > SynapseMatrix;
103 
105 typedef boost::multi_array< uint32_t, 2 > SynapseSummaryMatrix;
106 
108 typedef std::pair< float, uint32_t > Spike;
109 typedef std::vector< Spike > Spikes;
110 
112 typedef std::multimap< float, uint32_t > SpikeMap;
113 
114 
115 
118 const float UNDEFINED_TIMESTAMP LB_UNUSED = std::numeric_limits< float >::max();
119 const float RESTING_VOLTAGE LB_UNUSED = -67.;
120 
121 const float MINIMUM_VOLTAGE LB_UNUSED = -80.;
122 
123 using lunchbox::Strings;
124 
125 using servus::URI;
126 
127 typedef std::vector< URI > URIs;
128 }
129 
130 // if you have a type T in namespace N, the operator << for T needs to be in
131 // namespace N too
132 namespace boost
133 {
134 template< typename T >
135 inline std::ostream& operator << ( std::ostream& os,
136  const boost::multi_array< T, 2 >& data )
137 {
138  for( size_t i = 0; i < data.shape()[0]; ++i )
139  {
140  for( size_t j = 0; j < data.shape()[1]; ++j )
141  os << data[i][j] << " ";
142  os << std::endl;
143  }
144  return os;
145 }
146 }
147 
148 namespace std
149 {
150 template< class T, class U > inline
151 std::ostream& operator << ( std::ostream& os, const std::pair< T, U >& pair )
152 {
153  return os << "[ " << pair.first << ", " << pair.second << " ]";
154 }
155 }
156 
157 #endif
std::multimap< float, uint32_t > SpikeMap
A list of Spikes events per cell gid, indexed by spikes times.
Definition: brion/types.h:112
boost::multi_array< std::string, 2 > NeuronMatrix
Data matrix storing NeuronAttributes for each neuron.
Definition: brion/types.h:99
std::vector< uint16_ts > CompartmentCounts
The number of compartments per section for each neuron.
Definition: brion/types.h:96
boost::multi_array< float, 2 > SynapseMatrix
Data matrix storing SynapseAttributes for each neuron.
Definition: brion/types.h:102
STL namespace.
std::ostream & operator<<(std::ostream &, const BlueConfig &)
Stream out content of BlueConfig or CircuitConfig file.
boost::multi_array< uint32_t, 2 > SynapseSummaryMatrix
Data matrix storing GID, numEfferent, numAfferent for each neuron.
Definition: brion/types.h:105
std::pair< float, uint32_t > Spike
A spike.
Definition: brion/types.h:108
const float RESTING_VOLTAGE
Resting voltage in mV.
Definition: brion/types.h:119
std::vector< uint64_ts > SectionOffsets
The offset for the voltage per section for each neuron, uin64_t max for sections with no compartments...
Definition: brion/types.h:93
Blue Brain File IO classes.
Definition: blueConfig.h:29
Enumerations used in Brion.
const float MINIMUM_VOLTAGE
Lowest voltage after hyperpolarisation.
Definition: brion/types.h:121
const float UNDEFINED_TIMESTAMP
A value for undefined timestamps.
Definition: brion/types.h:118
std::set< uint32_t > GIDSet
Ordered set of GIDs of neurons.
Definition: brion/types.h:85