From 947fc27bef3beae3b95b556f6495efbcc2036caf Mon Sep 17 00:00:00 2001 From: Greg Eisenhauer Date: Mon, 28 Aug 2023 14:28:29 -0400 Subject: [PATCH] Fix local values block reading --- .../toolkit/format/bp5/BP5Deserializer.cpp | 39 +++++++++++++------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/source/adios2/toolkit/format/bp5/BP5Deserializer.cpp b/source/adios2/toolkit/format/bp5/BP5Deserializer.cpp index 7dc7ade910..ddb297eddd 100644 --- a/source/adios2/toolkit/format/bp5/BP5Deserializer.cpp +++ b/source/adios2/toolkit/format/bp5/BP5Deserializer.cpp @@ -1393,18 +1393,33 @@ bool BP5Deserializer::QueueGetSingle(core::VariableBase &variable, if (VarRec->OrigShapeID == ShapeID::LocalValue) { // Shows up as global array with one element per writer rank - for (size_t WriterRank = variable.m_Start[0]; - WriterRank < variable.m_Count[0] + variable.m_Start[0]; - WriterRank++) - { - (void)GetSingleValueFromMetadata(variable, VarRec, DestData, Step, - WriterRank); - DestData = (char *)DestData + - variable.m_ElementSize; // use variable.m_ElementSize - // because it's the size in local - // memory, VarRec->ElementSize is - // the size in metadata - } + if (variable.m_SelectionType == adios2::SelectionType::BoundingBox) { + for (size_t WriterRank = variable.m_Start[0]; + WriterRank < variable.m_Count[0] + variable.m_Start[0]; + WriterRank++) + { + (void)GetSingleValueFromMetadata(variable, VarRec, DestData, Step, + WriterRank); + DestData = (char *)DestData + + variable.m_ElementSize; // use variable.m_ElementSize + // because it's the size in local + // memory, VarRec->ElementSize is + // the size in metadata + } + + } + else if (variable.m_SelectionType == adios2::SelectionType::WriteBlock) + { + size_t WriterRank = variable.m_BlockID; + (void)GetSingleValueFromMetadata(variable, VarRec, DestData, Step, + WriterRank); + } + else + { + helper::Throw( + "Toolkit", "format::bp::BP5Deserializer", "QueueGetSingle", + "Unexpected selection type"); + } return false; } MemorySpace MemSpace = variable.GetMemorySpace(DestData);