File tree Expand file tree Collapse file tree 4 files changed +21
-16
lines changed Expand file tree Collapse file tree 4 files changed +21
-16
lines changed Original file line number Diff line number Diff line change @@ -634,7 +634,11 @@ void CustomHierarchy::flush_internal(
634634 {
635635 dataset.flush (name, flushParams, /* set_defaults = */ false );
636636 }
637- setDirty (false );
637+ if (flushParams.flushLevel != FlushLevel::SkeletonOnly &&
638+ flushParams.flushLevel != FlushLevel::CreateOrOpenFiles)
639+ {
640+ setDirty (false );
641+ }
638642}
639643
640644void CustomHierarchy::flush (
Original file line number Diff line number Diff line change @@ -364,12 +364,13 @@ void Iteration::flushIteration(internal::FlushParams const &flushParams)
364364 s.setParticlesPath (particlesPaths);
365365 }
366366
367- if (access::write (IOHandler ()->m_frontendAccess ))
368- {
369- flushAttributes (flushParams);
370- }
371- if (flushParams.flushLevel != FlushLevel::SkeletonOnly)
367+ if (flushParams.flushLevel != FlushLevel::SkeletonOnly &&
368+ flushParams.flushLevel != FlushLevel::CreateOrOpenFiles)
372369 {
370+ if (access::write (IOHandler ()->m_frontendAccess ))
371+ {
372+ flushAttributes (flushParams);
373+ }
373374 setDirty (false );
374375 meshes.setDirty (false );
375376 particles.setDirty (false );
Original file line number Diff line number Diff line change @@ -1406,9 +1406,13 @@ void Series::flushFileBased(
14061406 case Access::READ_WRITE:
14071407 case Access::CREATE:
14081408 case Access::APPEND: {
1409- bool allDirty = dirty ();
1409+ bool const allDirty = dirty ();
14101410 for (auto it = begin; it != end; ++it)
14111411 {
1412+ /* reset the dirty bit for every iteration (i.e. file)
1413+ * otherwise only the first iteration will have updates attributes
1414+ */
1415+ setDirty (allDirty);
14121416 // Phase 1
14131417 switch (openIterationIfDirty (it->first , it->second ))
14141418 {
@@ -1455,12 +1459,7 @@ void Series::flushFileBased(
14551459 it->second .get ().m_closed =
14561460 internal::CloseStatus::ClosedInBackend;
14571461 }
1458- /* reset the dirty bit for every iteration (i.e. file)
1459- * otherwise only the first iteration will have updates attributes
1460- */
1461- setDirty (allDirty);
14621462 }
1463- setDirty (false );
14641463
14651464 // Phase 3
14661465 if (flushIOHandler)
Original file line number Diff line number Diff line change 1919 * If not, see <http://www.gnu.org/licenses/>.
2020 */
2121#include " openPMD/backend/Attributable.hpp"
22+ #include " openPMD/IO/AbstractIOHandler.hpp"
2223#include " openPMD/Iteration.hpp"
2324#include " openPMD/Series.hpp"
2425#include " openPMD/auxiliary/DerefDynamicCast.hpp"
@@ -275,10 +276,10 @@ void Attributable::flushAttributes(internal::FlushParams const &flushParams)
275276 }
276277 }
277278 // Do this outside the if branch to also setDirty to dirtyRecursive
278- if (flushParams. flushLevel != FlushLevel::SkeletonOnly)
279- {
280- setDirty ( false );
281- }
279+ assert (
280+ flushParams. flushLevel != FlushLevel::SkeletonOnly &&
281+ flushParams. flushLevel != FlushLevel::CreateOrOpenFiles );
282+ setDirty ( false );
282283}
283284
284285void Attributable::readAttributes (ReadMode mode)
You can’t perform that action at this time.
0 commit comments