Skip to content

Commit

Permalink
Temp fix: Snapshot attribute in file-based encoding
Browse files Browse the repository at this point in the history
Snapshot attribute must be written in Iteration::endStep() in file-based
encoding
  • Loading branch information
franzpoeschel committed Aug 3, 2023
1 parent 1d47d17 commit 255184f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Series.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "openPMD/IO/AbstractIOHandler.hpp"
#include "openPMD/IO/AbstractIOHandlerHelper.hpp"
#include "openPMD/IO/Format.hpp"
#include "openPMD/IterationEncoding.hpp"
#include "openPMD/ReadIterations.hpp"
#include "openPMD/auxiliary/Date.hpp"
#include "openPMD/auxiliary/Filesystem.hpp"
Expand Down Expand Up @@ -2008,7 +2009,14 @@ void Series::flushStep(bool doFlush)
{
auto &series = get();
if (!series.m_currentlyActiveIterations.empty() &&
IOHandler()->m_frontendAccess != Access::READ_ONLY)
/*
* In file-based iteration encoding, this must be triggered by
* Iteration::endStep() since the "snapshot" attribute is different
* for each file.
* Also, at this point the files might have already been closed.
*/
iterationEncoding() != IterationEncoding::fileBased &&
access::write(IOHandler()->m_frontendAccess))
{
/*
* Warning: changing attribute extents over time (probably) unsupported
Expand All @@ -2022,6 +2030,7 @@ void Series::flushStep(bool doFlush)
wAttr.resource = std::vector<unsigned long long>{
series.m_currentlyActiveIterations.begin(),
series.m_currentlyActiveIterations.end()};
series.m_currentlyActiveIterations.clear();
wAttr.dtype = Datatype::VEC_ULONGLONG;
IOHandler()->enqueue(IOTask(&series.iterations, wAttr));
if (doFlush)
Expand Down

0 comments on commit 255184f

Please sign in to comment.