Skip to content

Commit 6c203a9

Browse files
committed
Add test
1 parent 5bf1320 commit 6c203a9

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

test/SerialIOTest.cpp

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5901,6 +5901,30 @@ void variableBasedSeries(std::string const &file)
59015901
REQUIRE(
59025902
readSeries.getAttribute("some_global").get<std::string>() ==
59035903
"attribute");
5904+
if (access == Access::READ_RANDOM_ACCESS)
5905+
{
5906+
std::vector<std::shared_ptr<int>> load_E_x(
5907+
readSeries.snapshots().size());
5908+
// std::vector<std::shared_ptr<int>> load_E_y(
5909+
// readSeries.snapshots().size());
5910+
5911+
for (auto &[idx, iteration] : readSeries.snapshots())
5912+
{
5913+
iteration.open();
5914+
load_E_x[idx] = iteration.meshes["E"]["x"].loadChunk<int>();
5915+
// TODO: Changing dimensionality seems to not work in ADIOS2
5916+
// with ReadRandomAccess
5917+
// load_E_y[idx] = iteration.meshes["E"]["y"].loadChunk<int>();
5918+
}
5919+
readSeries.flush();
5920+
for (size_t i = 0; i < load_E_x.size(); ++i)
5921+
{
5922+
for (size_t j = 0; j < extent; ++j)
5923+
{
5924+
REQUIRE(load_E_x[i].get()[j] == int(i));
5925+
}
5926+
}
5927+
}
59045928
for (auto iteration : readSeries.readIterations())
59055929
{
59065930
if (access == Access::READ_LINEAR)
@@ -5999,6 +6023,34 @@ void variableBasedSeries(std::string const &file)
59996023
iteration.iterationIndex);
60006024
}
60016025
REQUIRE(last_iteration_index == (is_adios2 ? 9 : 0));
6026+
if (access == Access::READ_RANDOM_ACCESS)
6027+
{
6028+
// should be able to reopen Iterations closed previously
6029+
// should be able to read multiple Iterations at once
6030+
6031+
std::vector<std::shared_ptr<int>> load_E_x(
6032+
readSeries.snapshots().size());
6033+
6034+
// std::vector<std::shared_ptr<int>> load_E_y(
6035+
// readSeries.snapshots().size());
6036+
6037+
for (auto &[idx, iteration] : readSeries.snapshots())
6038+
{
6039+
iteration.open();
6040+
load_E_x[idx] = iteration.meshes["E"]["x"].loadChunk<int>();
6041+
// Changing dimensionality seems to not work in ADIOS2
6042+
// with ReadRandomAccess
6043+
// load_E_y[idx] = iteration.meshes["E"]["y"].loadChunk<int>();
6044+
}
6045+
readSeries.flush();
6046+
for (size_t i = 0; i < load_E_x.size(); ++i)
6047+
{
6048+
for (size_t j = 0; j < extent; ++j)
6049+
{
6050+
REQUIRE(load_E_x[i].get()[j] == int(i));
6051+
}
6052+
}
6053+
}
60026054
};
60036055

60046056
std::string jsonConfig = R"(

0 commit comments

Comments
 (0)