Brion  1.6.0
The Blue Brain C++ I/O library
types.h
1 /* Copyright (c) 2013-2015, 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/types.h>
29 #include <set>
30 #include <map>
31 
32 #define VMMLIB_CUSTOM_CONFIG
33 #ifndef NDEBUG
34 # define VMMLIB_SAFE_ACCESSORS
35 #endif
36 #undef VMMLIB_ALIGN
37 #define VMMLIB_ALIGN( var ) var
38 #pragma warning(push)
39 #pragma warning(disable : 4996)
40 # include <vmmlib/vmmlib.hpp>
41 #pragma warning(pop)
42 
44 namespace brion
45 {
46 
47 using namespace enums;
48 class BlueConfig;
49 class Circuit;
50 class CompartmentReport;
51 class CompartmentReportPlugin;
52 class Mesh;
53 class Morphology;
54 class SpikeReport;
55 class SpikeReportPlugin;
56 
57 class Synapse;
58 class SynapseSummary;
59 class Target;
60 
61 typedef vmml::vector< 2, int32_t > Vector2i;
62 typedef vmml::vector< 3, float > Vector3f;
63 typedef vmml::vector< 4, float > Vector4f;
64 typedef vmml::vector< 3, double > Vector3d;
65 typedef vmml::vector< 4, double > Vector4d;
66 
67 typedef std::vector< size_t > size_ts;
68 typedef std::vector< int32_t > int32_ts;
69 typedef std::vector< uint16_t > uint16_ts;
70 typedef std::vector< uint32_t > uint32_ts;
71 typedef std::vector< uint64_t > uint64_ts;
72 typedef std::vector< float > floats;
73 typedef std::vector< Vector2i > Vector2is;
74 typedef std::vector< Vector3f > Vector3fs;
75 typedef std::vector< Vector4f > Vector4fs;
76 typedef std::vector< Vector3d > Vector3ds;
77 typedef std::vector< Vector4d > Vector4ds;
78 typedef std::vector< SectionType > SectionTypes;
79 typedef std::vector< Target > Targets;
80 typedef boost::shared_ptr< int32_ts > int32_tsPtr;
81 typedef boost::shared_ptr< uint16_ts > uint16_tsPtr;
82 typedef boost::shared_ptr< uint32_ts > uint32_tsPtr;
83 typedef boost::shared_ptr< floats > floatsPtr;
84 typedef boost::shared_ptr< Vector2is > Vector2isPtr;
85 typedef boost::shared_ptr< Vector3fs > Vector3fsPtr;
86 typedef boost::shared_ptr< Vector4fs > Vector4fsPtr;
87 typedef boost::shared_ptr< Vector3ds > Vector3dsPtr;
88 typedef boost::shared_ptr< Vector4ds > Vector4dsPtr;
89 typedef boost::shared_ptr< SectionTypes > SectionTypesPtr;
90 
92 typedef std::set< uint32_t > GIDSet;
93 
94 typedef GIDSet::const_iterator GIDSetCIter;
95 typedef GIDSet::iterator GIDSetIter;
96 
100 typedef std::vector< uint64_ts > SectionOffsets;
101 
103 typedef std::vector< uint16_ts > CompartmentCounts;
104 
106 typedef boost::multi_array< std::string, 2 > NeuronMatrix;
107 
109 typedef boost::multi_array< float, 2 > SynapseMatrix;
110 
112 typedef boost::multi_array< uint32_t, 2 > SynapseSummaryMatrix;
113 
115 typedef std::multimap< float, uint32_t > Spikes;
116 
118 typedef std::pair< float, uint32_t > Spike;
119 
122 const float UNDEFINED_TIMESTAMP = std::numeric_limits< float >::max();
123 const float RESTING_VOLTAGE = -67.;
124 const float MINIMUM_VOLTAGE = -80.;
125 
126 using lunchbox::Strings;
127 using lunchbox::URI;
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
boost::multi_array< std::string, 2 > NeuronMatrix
Data matrix storing NeuronAttributes for each neuron.
Definition: types.h:106
std::vector< uint16_ts > CompartmentCounts
The number of compartments per section for each neuron.
Definition: types.h:103
vmml::vector< 3, double > Vector3d
A three-component double vector.
Definition: types.h:64
Read access to a Target file.
Definition: target.h:36
boost::multi_array< float, 2 > SynapseMatrix
Data matrix storing SynapseAttributes for each neuron.
Definition: types.h:109
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: types.h:112
std::pair< float, uint32_t > Spike
A spike.
Definition: types.h:118
const float RESTING_VOLTAGE
Resting voltage in mV.
Definition: types.h:123
vmml::vector< 3, float > Vector3f
A three-component float vector.
Definition: types.h:62
std::vector< uint64_ts > SectionOffsets
The offset for the voltage per section for each neuron, uin64_t max for sections with no compartments...
Definition: types.h:100
Blue Brain File IO classes.
Definition: blueConfig.h:29
Enumerations used in Brion.
vmml::vector< 4, float > Vector4f
A four-component float vector.
Definition: types.h:63
const float MINIMUM_VOLTAGE
Lowest voltage after hyperpolarisation.
Definition: types.h:124
std::multimap< float, uint32_t > Spikes
A list of Spikes events per cell gid, indexed by spikes times.
Definition: types.h:115
Enumeration definitions.
vmml::vector< 2, int32_t > Vector2i
A two-component int32 vector.
Definition: types.h:59
const float UNDEFINED_TIMESTAMP
A value for undefined timestamps.
Definition: types.h:122
std::set< uint32_t > GIDSet
Ordered set of GIDs of neurons.
Definition: types.h:92
vmml::vector< 4, double > Vector4d
A four-component double vector.
Definition: types.h:65