Inconsistent types between DefineVariable<T> and InquireVariable<T>
Created by: germasch
To reproduce (on latest master):
#include <adios2.h>
void test1()
{
using T = char;
adios2::ADIOS ad(MPI_COMM_WORLD, adios2::DebugON);
{
adios2::IO io_writer = ad.DeclareIO("writer");
auto var = io_writer.DefineVariable<T>("var");
auto writer = io_writer.Open("test.bp", adios2::Mode::Write);
T test = 99;
writer.Put(var, test);
writer.Close();
}
{
adios2::IO io_reader = ad.DeclareIO("reader");
auto reader = io_reader.Open("test.bp", adios2::Mode::Read);
auto var = io_reader.InquireVariable<T>("var");
assert(static_cast<bool>(var));
T test;
reader.Get(var, test);
reader.Close();
assert(test == 99);
}
}
int main(int argc, char** argv)
{
MPI_Init(&argc, &argv);
test1();
MPI_Finalize()
return 0;
}
This test writes a single variable, and then tries to read it back again. The type of the variable can be changed with the using T = ...
directive. The test succeeds with using T = int;
, but using T = char;
fails.
It also fails with using T = std::size:t
and using T = unsigned long
.