@@ -5,6 +5,19 @@ namespace filebased_write_test
55{
66using namespace openPMD ;
77
8+ #define OPENPMD_TEST_VERBOSE 0
9+
10+ namespace
11+ {
12+ template <typename ... Args>
13+ auto write_to_stdout ([[maybe_unused]] Args &&...args) -> void
14+ {
15+ #if OPENPMD_TEST_VERBOSE
16+ (std::cout << ... << args);
17+ #endif
18+ }
19+ } // namespace
20+
821auto close_and_reopen_iterations (
922 const std::string &filename,
1023 openPMD::Access access,
@@ -18,32 +31,32 @@ auto close_and_reopen_iterations(
1831 auto chunk = component.loadChunkVariant ();
1932 iteration.seriesFlush ();
2033 auto num_particles = component.getExtent ()[0 ];
21- std::cout << " Particles: " ;
34+ write_to_stdout ( " Particles: " ) ;
2235 if (num_particles > 0 )
2336 {
2437 std::visit (
2538 [&](auto const &shared_ptr) {
2639 auto it = shared_ptr.get ();
2740 auto end = it + num_particles;
28- std::cout << ' [' << *it++;
41+ write_to_stdout ( ' [' , *it++) ;
2942 for (; it != end; ++it)
3043 {
31- std::cout << " , " << *it;
44+ write_to_stdout ( " , " , *it) ;
3245 }
3346 },
3447 chunk);
35- std::cout << " ]" ;
48+ write_to_stdout ( " ]" ) ;
3649 }
3750 else
3851 {
39- std::cout << " []" ;
52+ write_to_stdout ( " []" ) ;
4053 }
41- std::cout << std::endl ;
54+ write_to_stdout ( ' \n ' ) ;
4255 };
4356
4457 for (auto &[idx, iteration] : list.snapshots ())
4558 {
46- std::cout << " Seeing iteration " << idx << std::endl ;
59+ write_to_stdout ( " Seeing iteration " , idx, ' \n ' ) ;
4760 if (need_to_explitly_open_iterations)
4861 {
4962 iteration.open ();
@@ -52,20 +65,20 @@ auto close_and_reopen_iterations(
5265 {
5366 test_read (iteration);
5467 }
55- std::cout << " Closing iteration " << idx << std::endl ;
68+ write_to_stdout ( " Closing iteration " , idx, ' \n ' ) ;
5669 iteration.close ();
5770 }
58- std::cout << " Trying to read iteration 3 out of line" << std::endl ;
71+ write_to_stdout ( " Trying to read iteration 3 out of line" , ' \n ' ) ;
5972 if (need_to_explitly_open_iterations || access == Access::READ_ONLY)
6073 {
6174 list.snapshots ()[3 ].open ();
6275 }
6376 test_read (list.snapshots ()[3 ]);
6477
65- std::cout << " ----------\n Going again\n ----------" << std::endl ;
78+ write_to_stdout ( " ----------\n Going again\n ----------" , ' \n ' ) ;
6679 for (auto &[idx, iteration] : list.snapshots ())
6780 {
68- std::cout << " Seeing iteration " << idx << std::endl ;
81+ write_to_stdout ( " Seeing iteration " , idx, ' \n ' ) ;
6982 if (need_to_explitly_open_iterations || access == Access::READ_ONLY)
7083 {
7184 iteration.open ();
0 commit comments