Brion  1.8.0
The Blue Brain C++ I/O library
brion/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 <servus/uri.h>
30 #include <set>
31 #include <map>
32 
33 #pragma warning(push)
34 #pragma warning(disable : 4996)
35 # include <vmmlib/types.hpp>
36 #pragma warning(pop)
37 
39 namespace brion
40 {
41 
42 using namespace enums;
43 class BlueConfig;
44 class Circuit;
45 class CompartmentReport;
46 class CompartmentReportPlugin;
47 class Mesh;
48 class Morphology;
49 class SpikeReport;
50 class SpikeReportPlugin;
51 class Synapse;
52 class SynapseSummary;
53 class Target;
54 
55 using vmml::Vector2i;
56 using vmml::Vector3f;
57 using vmml::Vector4f;
58 using vmml::Vector3d;
59 using vmml::Vector4d;
60 
61 typedef std::vector< size_t > size_ts;
62 typedef std::vector< int32_t > int32_ts;
63 typedef std::vector< uint16_t > uint16_ts;
64 typedef std::vector< uint32_t > uint32_ts;
65 typedef std::vector< uint64_t > uint64_ts;
66 typedef std::vector< float > floats;
67 typedef std::vector< Vector2i > Vector2is;
68 typedef std::vector< Vector3f > Vector3fs;
69 typedef std::vector< Vector4f > Vector4fs;
70 typedef std::vector< Vector3d > Vector3ds;
71 typedef std::vector< Vector4d > Vector4ds;
72 typedef std::vector< SectionType > SectionTypes;
73 typedef std::vector< Target > Targets;
74 typedef boost::shared_ptr< int32_ts > int32_tsPtr;
75 typedef boost::shared_ptr< uint16_ts > uint16_tsPtr;
76 typedef boost::shared_ptr< uint32_ts > uint32_tsPtr;
77 typedef boost::shared_ptr< floats > floatsPtr;
78 typedef boost::shared_ptr< Vector2is > Vector2isPtr;
79 typedef boost::shared_ptr< Vector3fs > Vector3fsPtr;
80 typedef boost::shared_ptr< Vector4fs > Vector4fsPtr;
81 typedef boost::shared_ptr< Vector3ds > Vector3dsPtr;
82 typedef boost::shared_ptr< Vector4ds > Vector4dsPtr;
83 typedef boost::shared_ptr< SectionTypes > SectionTypesPtr;
84 
86 typedef std::set< uint32_t > GIDSet;
87 
88 typedef GIDSet::const_iterator GIDSetCIter;
89 typedef GIDSet::iterator GIDSetIter;
90 
94 typedef std::vector< uint64_ts > SectionOffsets;
95 
97 typedef std::vector< uint16_ts > CompartmentCounts;
98 
100 typedef boost::multi_array< std::string, 2 > NeuronMatrix;
101 
103 typedef boost::multi_array< float, 2 > SynapseMatrix;
104 
106 typedef boost::multi_array< uint32_t, 2 > SynapseSummaryMatrix;
107 
109 typedef std::multimap< float, uint32_t > Spikes;
110 
112 typedef std::pair< float, uint32_t > Spike;
113 
116 const float UNDEFINED_TIMESTAMP = std::numeric_limits< float >::max();
117 const float RESTING_VOLTAGE = -67.;
118 const float MINIMUM_VOLTAGE = -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 > inline
148 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
boost::multi_array< std::string, 2 > NeuronMatrix
Data matrix storing NeuronAttributes for each neuron.
Definition: brion/types.h:100
std::vector< uint16_ts > CompartmentCounts
The number of compartments per section for each neuron.
Definition: brion/types.h:97
boost::multi_array< float, 2 > SynapseMatrix
Data matrix storing SynapseAttributes for each neuron.
Definition: brion/types.h:103
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:106
std::pair< float, uint32_t > Spike
A spike.
Definition: brion/types.h:112
const float RESTING_VOLTAGE
Resting voltage in mV.
Definition: brion/types.h:117
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:94
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
std::multimap< float, uint32_t > Spikes
A list of Spikes events per cell gid, indexed by spikes times.
Definition: brion/types.h:109
Enumeration definitions.
const float UNDEFINED_TIMESTAMP
A value for undefined timestamps.
Definition: brion/types.h:116
std::set< uint32_t > GIDSet
Ordered set of GIDs of neurons.
Definition: brion/types.h:86