Brion  2.0.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 <map>
29 #include <servus/uri.h>
30 #include <set>
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 using namespace enums;
41 class BlueConfig;
42 class Circuit;
43 class CompartmentReport;
44 class CompartmentReportPlugin;
45 class Mesh;
46 class Morphology;
47 class SpikeReport;
48 class SpikeReportPlugin;
49 class Synapse;
50 class SynapseSummary;
51 class Target;
52 
53 using vmml::Vector2i;
54 using vmml::Vector3f;
55 using vmml::Vector4f;
56 using vmml::Vector3d;
57 using vmml::Vector4d;
58 
59 typedef std::vector<size_t> size_ts;
60 typedef std::vector<int32_t> int32_ts;
61 typedef std::vector<uint16_t> uint16_ts;
62 typedef std::vector<uint32_t> uint32_ts;
63 typedef std::vector<uint64_t> uint64_ts;
64 typedef std::vector<float> floats;
65 typedef std::vector<Vector2i> Vector2is;
66 typedef std::vector<Vector3f> Vector3fs;
67 typedef std::vector<Vector4f> Vector4fs;
68 typedef std::vector<Vector3d> Vector3ds;
69 typedef std::vector<Vector4d> Vector4ds;
70 typedef std::vector<SectionType> SectionTypes;
71 typedef std::vector<Target> Targets;
72 typedef std::shared_ptr<int32_ts> int32_tsPtr;
73 typedef std::shared_ptr<uint16_ts> uint16_tsPtr;
74 typedef std::shared_ptr<uint32_ts> uint32_tsPtr;
75 typedef std::shared_ptr<floats> floatsPtr;
76 typedef std::shared_ptr<Vector2is> Vector2isPtr;
77 typedef std::shared_ptr<Vector3fs> Vector3fsPtr;
78 typedef std::shared_ptr<Vector4fs> Vector4fsPtr;
79 typedef std::shared_ptr<Vector3ds> Vector3dsPtr;
80 typedef std::shared_ptr<Vector4ds> Vector4dsPtr;
81 typedef std::shared_ptr<SectionTypes> SectionTypesPtr;
82 
84 typedef std::set<uint32_t> GIDSet;
85 
86 typedef GIDSet::const_iterator GIDSetCIter;
87 typedef GIDSet::iterator GIDSetIter;
88 
92 typedef std::vector<uint64_ts> SectionOffsets;
93 
95 typedef std::vector<uint16_ts> CompartmentCounts;
96 
98 typedef boost::multi_array<std::string, 2> NeuronMatrix;
99 
101 typedef boost::multi_array<float, 2> SynapseMatrix;
102 
104 typedef boost::multi_array<uint32_t, 2> SynapseSummaryMatrix;
105 
107 typedef std::pair<float, uint32_t> Spike;
108 typedef std::vector<Spike> Spikes;
109 
111 typedef std::multimap<float, uint32_t> SpikeMap;
112 
115 const float UNDEFINED_TIMESTAMP LB_UNUSED = std::numeric_limits<float>::max();
116 const float RESTING_VOLTAGE LB_UNUSED = -67.;
117 
118 const float MINIMUM_VOLTAGE LB_UNUSED = -80.;
119 
120 using lunchbox::Strings;
121 
122 using servus::URI;
123 
124 typedef std::vector<URI> URIs;
125 }
126 
127 // if you have a type T in namespace N, the operator << for T needs to be in
128 // namespace N too
129 namespace boost
130 {
131 template <typename T>
132 inline std::ostream& operator<<(std::ostream& os,
133  const boost::multi_array<T, 2>& data)
134 {
135  for (size_t i = 0; i < data.shape()[0]; ++i)
136  {
137  for (size_t j = 0; j < data.shape()[1]; ++j)
138  os << data[i][j] << " ";
139  os << std::endl;
140  }
141  return os;
142 }
143 }
144 
145 namespace std
146 {
147 template <class T, class U>
148 inline std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& pair)
149 {
150  return os << "[ " << pair.first << ", " << pair.second << " ]";
151 }
152 }
153 
154 #endif
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:92
STL namespace.
std::multimap< float, uint32_t > SpikeMap
A list of Spikes events per cell gid, indexed by spikes times.
Definition: brion/types.h:111
std::pair< float, uint32_t > Spike
A spike.
Definition: brion/types.h:107
std::set< uint32_t > GIDSet
Ordered set of GIDs of neurons.
Definition: brion/types.h:84
boost::multi_array< std::string, 2 > NeuronMatrix
Data matrix storing NeuronAttributes for each neuron.
Definition: brion/types.h:98
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:104
const float RESTING_VOLTAGE
Resting voltage in mV.
Definition: brion/types.h:116
std::vector< uint16_ts > CompartmentCounts
The number of compartments per section for each neuron.
Definition: brion/types.h:95
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:118
boost::multi_array< float, 2 > SynapseMatrix
Data matrix storing SynapseAttributes for each neuron.
Definition: brion/types.h:101
const float UNDEFINED_TIMESTAMP
A value for undefined timestamps.
Definition: brion/types.h:115