Skip to content

Commit

Permalink
Merge pull request #1453 from franzpoeschel/fix-attribute-indexing
Browse files Browse the repository at this point in the history
Fix the creation of fresh attribute indices in DefineAttribute
  • Loading branch information
williamfgc authored May 28, 2019
2 parents 421f29d + 0039a98 commit d4238ee
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions source/adios2/core/IO.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,13 @@ Attribute<T> &IO::DefineAttribute(const std::string &name, const T *array,
}

auto &attributeMap = GetAttributeMap<T>();
const unsigned int size = static_cast<unsigned int>(attributeMap.size());
const unsigned int newIndex =
attributeMap.empty() ? 0 : attributeMap.rbegin()->first + 1;

auto itAttributePair =
attributeMap.emplace(size, Attribute<T>(globalName, array, elements));
auto itAttributePair = attributeMap.emplace(
newIndex, Attribute<T>(globalName, array, elements));
m_Attributes.emplace(globalName,
std::make_pair(helper::GetType<T>(), size));
std::make_pair(helper::GetType<T>(), newIndex));

return itAttributePair.first->second;
}
Expand Down

0 comments on commit d4238ee

Please sign in to comment.