26
26
27
27
#include < boost/filesystem.hpp>
28
28
#include < boost/program_options.hpp>
29
- #include < boost/progress.hpp>
30
29
31
30
#include < chrono>
32
31
@@ -62,7 +61,7 @@ void requireEqualCollections(const T& a, const T& b)
62
61
REQUIRE_EQUAL (i, a.end ());
63
62
REQUIRE_EQUAL (j, b.end ());
64
63
}
65
- }
64
+ } // namespace
66
65
67
66
/* *
68
67
* Convert a compartment report to an HDF5 report.
@@ -108,25 +107,21 @@ int main(const int argc, char** argv)
108
107
109
108
if (vm.count (" help" ) || vm.count (" input" ) == 0 )
110
109
{
111
- std::cout << " Usage: " << argv[0 ]
112
- << " input-uri [output-uri=dummy://] [options]" << std::endl
110
+ std::cout << " Usage: " << argv[0 ] << " input-uri [output-uri=dummy://] [options]" << std::endl
113
111
<< std::endl
114
112
<< " Supported input and output URIs:" << std::endl
115
- << brion::CompartmentReport::getDescriptions ()
116
- << std::endl
113
+ << brion::CompartmentReport::getDescriptions () << std::endl
117
114
#ifdef BRION_USE_BBPTESTDATA
118
115
<< std::endl
119
- << " Test data set (only for input):\n test:"
120
- << std::endl
116
+ << " Test data set (only for input):\n test:" << std::endl
121
117
#endif
122
118
<< std::endl
123
119
<< options << std::endl;
124
120
return EXIT_SUCCESS;
125
121
}
126
122
if (vm.count (" version" ))
127
123
{
128
- std::cout << " Brion compartment report converter "
129
- << brion::Version::getString () << std::endl;
124
+ std::cout << " Brion compartment report converter " << brion::Version::getString () << std::endl;
130
125
return EXIT_SUCCESS;
131
126
}
132
127
@@ -136,8 +131,7 @@ int main(const int argc, char** argv)
136
131
}
137
132
catch (const po::error& e)
138
133
{
139
- std::cerr << " Command line parse error: " << e.what () << std::endl
140
- << options << std::endl;
134
+ std::cerr << " Command line parse error: " << e.what () << std::endl << options << std::endl;
141
135
return EXIT_FAILURE;
142
136
}
143
137
@@ -151,29 +145,25 @@ int main(const int argc, char** argv)
151
145
return EXIT_FAILURE;
152
146
}
153
147
154
- const size_t maxFrames = vm.count (" maxFrames" ) == 1
155
- ? vm[" maxFrames" ].as <size_t >()
156
- : std::numeric_limits<size_t >::max ();
148
+ const size_t maxFrames =
149
+ vm.count (" maxFrames" ) == 1 ? vm[" maxFrames" ].as <size_t >() : std::numeric_limits<size_t >::max ();
157
150
158
151
std::string input = vm[" input" ].as <std::string>();
159
152
#ifdef BRION_USE_BBPTESTDATA
160
153
if (input == " test:" )
161
154
{
162
- input = std::string (BBP_TESTDATA) +
163
- " /circuitBuilding_1000neurons/Neurodamus_output/voltages.bbp" ;
155
+ input = std::string (BBP_TESTDATA) + " /circuitBuilding_1000neurons/Neurodamus_output/voltages.bbp" ;
164
156
}
165
157
#endif
166
158
if (input == vm[" output" ].as <std::string>())
167
159
{
168
- std::cerr << " Cowardly refusing to convert " << input << " onto itself"
169
- << std::endl;
160
+ std::cerr << " Cowardly refusing to convert " << input << " onto itself" << std::endl;
170
161
return EXIT_FAILURE;
171
162
}
172
163
173
164
brion::URI inURI (input);
174
165
brion::CompartmentReport in (inURI, brion::MODE_READ);
175
- const std::chrono::high_resolution_clock::time_point loadTime1
176
- = std::chrono::high_resolution_clock::now ();
166
+ const std::chrono::high_resolution_clock::time_point loadTime1 = std::chrono::high_resolution_clock::now ();
177
167
178
168
const double start = in.getStartTime ();
179
169
const double step = in.getTimestep ();
@@ -182,9 +172,8 @@ int main(const int argc, char** argv)
182
172
if (vm.count (" dump" ))
183
173
{
184
174
std::cout << " Compartment report " << inURI << " :" << std::endl
185
- << " " << (end - start) / step << " frames: " << start
186
- << " .." << end << " / " << step << " " << in.getTimeUnit ()
187
- << std::endl
175
+ << " " << (end - start) / step << " frames: " << start << " .." << end << " / " << step << " "
176
+ << in.getTimeUnit () << std::endl
188
177
<< " " << in.getGIDs ().size () << " neurons" << std::endl
189
178
<< " " << in.getFrameSize () << " compartments" << std::endl;
190
179
return EXIT_SUCCESS;
@@ -209,8 +198,7 @@ int main(const int argc, char** argv)
209
198
{
210
199
try
211
200
{
212
- outURI.setPath (
213
- boost::filesystem::canonical (inURI.getPath ()).generic_string ());
201
+ outURI.setPath (boost::filesystem::canonical (inURI.getPath ()).generic_string ());
214
202
}
215
203
catch (const boost::filesystem::filesystem_error&)
216
204
{
@@ -219,14 +207,12 @@ int main(const int argc, char** argv)
219
207
}
220
208
}
221
209
222
- const std::chrono::high_resolution_clock::time_point loadTime2
223
- = std::chrono::high_resolution_clock::now ();
224
- const std::chrono::duration<float > loadTimeSpan
225
- = std::chrono::duration_cast<std::chrono::duration<float >>(loadTime2 - loadTime1);
210
+ const std::chrono::high_resolution_clock::time_point loadTime2 = std::chrono::high_resolution_clock::now ();
211
+ const std::chrono::duration<float > loadTimeSpan =
212
+ std::chrono::duration_cast<std::chrono::duration<float >>(loadTime2 - loadTime1);
226
213
float loadTime = loadTimeSpan.count ();
227
214
228
- const std::chrono::high_resolution_clock::time_point writeTime1
229
- = std::chrono::high_resolution_clock::now ();
215
+ const std::chrono::high_resolution_clock::time_point writeTime1 = std::chrono::high_resolution_clock::now ();
230
216
231
217
brion::CompartmentReport to (outURI, brion::MODE_OVERWRITE);
232
218
to.writeHeader (start, end, step, in.getDataUnit (), in.getTimeUnit ());
@@ -257,23 +243,20 @@ int main(const int argc, char** argv)
257
243
}
258
244
}
259
245
260
- const std::chrono::high_resolution_clock::time_point writeTime2
261
- = std::chrono::high_resolution_clock::now ();
246
+ const std::chrono::high_resolution_clock::time_point writeTime2 = std::chrono::high_resolution_clock::now ();
262
247
263
- const std::chrono::duration<float > writeTimeSpan
264
- = std::chrono::duration_cast<std::chrono::duration<float >>(writeTime2 - writeTime1);
248
+ const std::chrono::duration<float > writeTimeSpan =
249
+ std::chrono::duration_cast<std::chrono::duration<float >>(writeTime2 - writeTime1);
265
250
float writeTime = writeTimeSpan.count ();
266
251
// Adding step / 2 to the window to avoid off by 1 errors during truncation
267
252
const size_t nFrames = (end - start + step * 0.5 ) / step;
268
- boost::progress_display progress (nFrames);
269
253
270
254
for (size_t frameIndex = 0 ; frameIndex < nFrames; ++frameIndex)
271
255
{
272
256
// Making the timestamp fall in the middle of the frame
273
257
const double timestamp = start + frameIndex * step + step * 0.5 ;
274
258
275
- const std::chrono::high_resolution_clock::time_point loadPivot1
276
- = std::chrono::high_resolution_clock::now ();
259
+ const std::chrono::high_resolution_clock::time_point loadPivot1 = std::chrono::high_resolution_clock::now ();
277
260
278
261
brion::floatsPtr data;
279
262
try
@@ -286,10 +269,9 @@ int main(const int argc, char** argv)
286
269
::exit (EXIT_FAILURE);
287
270
}
288
271
289
- const std::chrono::high_resolution_clock::time_point loadPivot2
290
- = std::chrono::high_resolution_clock::now ();
291
- const std::chrono::duration<float > loadPivotSpan
292
- = std::chrono::duration_cast<std::chrono::duration<float >>(loadPivot2 - loadPivot1);
272
+ const std::chrono::high_resolution_clock::time_point loadPivot2 = std::chrono::high_resolution_clock::now ();
273
+ const std::chrono::duration<float > loadPivotSpan =
274
+ std::chrono::duration_cast<std::chrono::duration<float >>(loadPivot2 - loadPivot1);
293
275
loadTime += loadPivotSpan.count ();
294
276
295
277
if (!data)
@@ -300,8 +282,7 @@ int main(const int argc, char** argv)
300
282
301
283
const brion::floats& values = *data.get ();
302
284
303
- const std::chrono::high_resolution_clock::time_point witePivot1
304
- = std::chrono::high_resolution_clock::now ();
285
+ const std::chrono::high_resolution_clock::time_point witePivot1 = std::chrono::high_resolution_clock::now ();
305
286
306
287
if (isFrameSorted)
307
288
{
@@ -329,31 +310,24 @@ int main(const int argc, char** argv)
329
310
return EXIT_FAILURE;
330
311
}
331
312
332
- const std::chrono::high_resolution_clock::time_point witePivot2
333
- = std::chrono::high_resolution_clock::now ();
334
- const std::chrono::duration<float > writePivotSpan
335
- = std::chrono::duration_cast<std::chrono::duration<float >>(witePivot2 - witePivot1);
313
+ const std::chrono::high_resolution_clock::time_point witePivot2 = std::chrono::high_resolution_clock::now ();
314
+ const std::chrono::duration<float > writePivotSpan =
315
+ std::chrono::duration_cast<std::chrono::duration<float >>(witePivot2 - witePivot1);
336
316
writeTime += writePivotSpan.count ();
337
- ++progress;
338
317
}
339
318
340
- const std::chrono::high_resolution_clock::time_point flushPivot1
341
- = std::chrono::high_resolution_clock::now ();
319
+ const std::chrono::high_resolution_clock::time_point flushPivot1 = std::chrono::high_resolution_clock::now ();
342
320
to.flush ();
343
- const std::chrono::high_resolution_clock::time_point flushPivot2
344
- = std::chrono::high_resolution_clock::now ();
345
- const std::chrono::duration<float > flushPivotSpan
346
- = std::chrono::duration_cast<std::chrono::duration<float >>(flushPivot2 - flushPivot1);
321
+ const std::chrono::high_resolution_clock::time_point flushPivot2 = std::chrono::high_resolution_clock::now ();
322
+ const std::chrono::duration<float > flushPivotSpan =
323
+ std::chrono::duration_cast<std::chrono::duration<float >>(flushPivot2 - flushPivot1);
347
324
writeTime += flushPivotSpan.count ();
348
325
349
- std::cout << " Converted " << inURI << " to " << outURI << " (in "
350
- << size_t (loadTime) << " out " << size_t (writeTime) << " ms, "
351
- << gids.size () << " cells X " << nFrames << " frames)"
352
- << std::endl;
326
+ std::cout << " Converted " << inURI << " to " << outURI << " (in " << size_t (loadTime) << " out "
327
+ << size_t (writeTime) << " ms, " << gids.size () << " cells X " << nFrames << " frames)" << std::endl;
353
328
354
329
if (vm.count (" compare" ))
355
330
{
356
- progress.restart (nFrames);
357
331
brion::CompartmentReport result (outURI, brion::MODE_READ);
358
332
359
333
REQUIRE_EQUAL (in.getStartTime (), result.getStartTime ());
@@ -396,7 +370,6 @@ int main(const int argc, char** argv)
396
370
REQUIRE_EQUAL ((*frame1)[o1], (*frame2)[o2]);
397
371
}
398
372
}
399
- ++progress;
400
373
}
401
374
}
402
375
0 commit comments