@@ -5096,6 +5096,39 @@ bool areEqual(T a, T b)
50965096} // namespace epsilon
50975097
50985098#if openPMD_HAVE_ADIOS2
5099+
5100+ #define openPMD_VERBOSE_CHUNKS 0
5101+
5102+ #if openPMD_VERBOSE_CHUNKS
5103+ static std::string format_chunk (ChunkInfo const &chunk_info)
5104+ {
5105+ std::stringstream result;
5106+ auto print_vector = [&result](auto const &vec) {
5107+ if (vec.empty ())
5108+ {
5109+ result << " []" ;
5110+ }
5111+ else
5112+ {
5113+ auto it = vec.begin ();
5114+ result << ' [' << *it++;
5115+ auto end = vec.end ();
5116+ for (; it != end; ++it)
5117+ {
5118+ result << ' ,' << *it;
5119+ }
5120+ result << ' ]' ;
5121+ }
5122+ };
5123+ result << ' (' ;
5124+ print_vector (chunk_info.offset );
5125+ result << ' |' ;
5126+ print_vector (chunk_info.extent );
5127+ result << ' )' ;
5128+ return result.str ();
5129+ }
5130+ #endif
5131+
50995132TEST_CASE (" git_adios2_sample_test" , " [serial][adios2]" )
51005133{
51015134 using namespace epsilon ;
@@ -5105,11 +5138,73 @@ TEST_CASE("git_adios2_sample_test", "[serial][adios2]")
51055138
51065139 std::string const samplePath =
51075140 " ../samples/git-sample/3d-bp4/example-3d-bp4.bp" ;
5141+ std::string const samplePathFilebased =
5142+ " ../samples/git-sample/3d-bp4/example-3d-bp4_%T.bp" ;
51085143 if (!auxiliary::directory_exists (samplePath))
51095144 {
51105145 std::cerr << " git sample '" << samplePath << " ' not accessible \n " ;
51115146 return ;
51125147 }
5148+
5149+ /*
5150+ * This checks a regression introduced by
5151+ * https://github.com/openPMD/openPMD-api/pull/1498 and fixed by
5152+ * https://github.com/openPMD/openPMD-api/pull/1586
5153+ */
5154+ for (auto const &[filepath, access] :
5155+ {std::make_pair (samplePath, Access::READ_ONLY),
5156+ std::make_pair (samplePathFilebased, Access::READ_ONLY),
5157+ std::make_pair (samplePath, Access::READ_LINEAR),
5158+ std::make_pair (samplePathFilebased, Access::READ_LINEAR)})
5159+ {
5160+ Series read (filepath, access);
5161+
5162+ // false positive by clang-tidy?
5163+ // NOLINTNEXTLINE(performance-for-range-copy)
5164+ for (auto iteration : read.readIterations ())
5165+ {
5166+ for (auto &mesh : iteration.meshes )
5167+ {
5168+ for (auto &component : mesh.second )
5169+ {
5170+ #if openPMD_VERBOSE_CHUNKS
5171+ std::cout << " Chunks for '"
5172+ << component.second .myPath ().openPMDPath ()
5173+ << " ':" << std::endl;
5174+ for (auto const &chunk : component.second .availableChunks ())
5175+ {
5176+ std::cout << " \t " << format_chunk (chunk) << std::endl;
5177+ }
5178+ #else
5179+ component.second .availableChunks ();
5180+ #endif
5181+ }
5182+ }
5183+ for (auto &particle_species : iteration.particles )
5184+ {
5185+ for (auto &record : particle_species.second )
5186+ {
5187+ for (auto &component : record.second )
5188+ {
5189+ #if openPMD_VERBOSE_CHUNKS
5190+ std::cout << " Chunks for '"
5191+ << component.second .myPath ().openPMDPath ()
5192+ << " ':" << std::endl;
5193+ for (auto const &chunk :
5194+ component.second .availableChunks ())
5195+ {
5196+ std::cout << " \t " << format_chunk (chunk)
5197+ << std::endl;
5198+ }
5199+ #else
5200+ component.second .availableChunks ();
5201+ #endif
5202+ }
5203+ }
5204+ }
5205+ }
5206+ }
5207+
51135208 Series o (samplePath, Access::READ_ONLY, R"( {"backend": "adios2"})" );
51145209 REQUIRE (o.openPMD () == " 1.1.0" );
51155210 REQUIRE (o.openPMDextension () == 0 );
0 commit comments