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