Commit 42299267 authored by Podhorszki, Norbert's avatar Podhorszki, Norbert
Browse files

Fix adios_reorganize to handle cases where variables are not always present....

Fix adios_reorganize to handle cases where variables are not always present. The variable map from ADIOS2 contains all variables present in a file even if stepping through the file and a specific variable is not present in the current step. Need to rely on InquireVariable returing a null pointer to check if a variable is present.
parent 38b36d51
......@@ -197,7 +197,7 @@ void Reorganize::Run()
const core::DataMap &variables = io.GetVariablesDataMap();
const core::DataMap &attributes = io.GetAttributesDataMap();
print0("File info:");
print0("____________________\n\nFile info:");
print0(" current step: ", curr_step);
print0(" # of variables: ", variables.size());
print0(" # of attributes: ", attributes.size());
......@@ -489,12 +489,8 @@ int Reorganize::ProcessMetadata(core::Engine &rStream, core::IO &io,
varinfo[varidx].v = variable;
if (variable == nullptr)
if (variable != nullptr)
{
std::cerr << "rank " << m_Rank << ": ERROR: Variable " << name
<< " inquiry failed" << std::endl;
return 1;
}
// print variable type and dimensions
if (!m_Rank)
......@@ -511,7 +507,7 @@ int Reorganize::ProcessMetadata(core::Engine &rStream, core::IO &io,
}
else
{
print0("\tscalar\n");
print0("\tscalar");
}
}
......@@ -526,6 +522,11 @@ int Reorganize::ProcessMetadata(core::Engine &rStream, core::IO &io,
if (largest_block < varinfo[varidx].writesize)
largest_block = varinfo[varidx].writesize;
}
}
else
{
print0(" Not available in this step");
}
++varidx;
}
......@@ -574,6 +575,8 @@ int Reorganize::ReadWrite(core::Engine &rStream, core::Engine &wStream,
* Read all variables into memory
*/
for (size_t varidx = 0; varidx < nvars; ++varidx)
{
if (varinfo[varidx].v != nullptr)
{
const std::string &name = varinfo[varidx].v->m_Name;
assert(varinfo[varidx].readbuf == nullptr);
......@@ -609,6 +612,7 @@ int Reorganize::ReadWrite(core::Engine &rStream, core::Engine &wStream,
#undef declare_template_instantiation
}
}
}
rStream.EndStep(); // read in data into allocated pointers
/*
......@@ -616,6 +620,8 @@ int Reorganize::ReadWrite(core::Engine &rStream, core::Engine &wStream,
*/
wStream.BeginStep();
for (size_t varidx = 0; varidx < nvars; ++varidx)
{
if (varinfo[varidx].v != nullptr)
{
const std::string &name = varinfo[varidx].v->m_Name;
if (varinfo[varidx].writesize != 0)
......@@ -649,6 +655,7 @@ int Reorganize::ReadWrite(core::Engine &rStream, core::Engine &wStream,
#undef declare_template_instantiation
}
}
}
wStream.EndStep(); // write output buffer to file
return retval;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment