no error when getting a variable that doesn't exist in current step
Created by: germasch
To reproduce:
TEST_F(ADIOS2_CXX11_API_IO, StreamingWrite)
{
adios2::Engine writer = m_Io.Open("xxx.bp", adios2::Mode::Write);
double x[3];
auto var = m_Io.DefineVariable<double>("x", {3}, {0}, {3});
for (int step = 0; step < 3; step++) {
x[0] = 10 + step;
x[1] = 20 + step;
x[2] = 30 + step;
writer.BeginStep();
if (step > 0) {
writer.Put(var, x);
}
writer.EndStep();
}
writer.Close();
}
TEST_F(ADIOS2_CXX11_API_IO, StreamingRead)
{
adios2::Engine reader = m_Io.Open("xxx.bp", adios2::Mode::Read);
double x[3];
auto var = m_Io.InquireVariable<double>("x");
for (int step = 0; step < 3; step++) {
reader.BeginStep();
reader.Get(var, x);
reader.EndStep();
printf("step %d: %g %g %g\n", step, x[0], x[1], x[2]);
}
reader.Close();
}
The second test, when run, gives
[ RUN ] ADIOS2_CXX11_API_IO.StreamingRead
step 0: 6.95312e-310 2.19424e-314 5.2286e-310
step 1: 11 21 31
step 2: 12 22 32
[ OK ] ADIOS2_CXX11_API_IO.StreamingRead (2 ms)
The file doesn't contain the variable x
in step 0, so I don't expect it to read anything (ie, non-initialized nonsense in x
is fine), but I do expect to get some kind of an error when the Get
call does not succeed.