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 @@ -351,12 +351,13 @@ void Iteration::flushIteration(internal::FlushParams const &flushParams)
351351 s.setParticlesPath (particlesPaths);
352352 }
353353
354- if (access::write (IOHandler ()->m_frontendAccess ))
355- {
356- flushAttributes (flushParams);
357- }
358- if (flushParams.flushLevel != FlushLevel::SkeletonOnly)
354+ if (flushParams.flushLevel != FlushLevel::SkeletonOnly &&
355+ flushParams.flushLevel != FlushLevel::CreateOrOpenFiles)
359356 {
357+ if (access::write (IOHandler ()->m_frontendAccess ))
358+ {
359+ flushAttributes (flushParams);
360+ }
360361 setDirty (false );
361362 meshes.setDirty (false );
362363 particles.setDirty (false );
Original file line number Diff line number Diff line change @@ -1134,9 +1134,13 @@ void Series::flushFileBased(
11341134 case Access::READ_WRITE:
11351135 case Access::CREATE:
11361136 case Access::APPEND: {
1137- bool allDirty = dirty ();
1137+ bool const allDirty = dirty ();
11381138 for (auto it = begin; it != end; ++it)
11391139 {
1140+ /* reset the dirty bit for every iteration (i.e. file)
1141+ * otherwise only the first iteration will have updates attributes
1142+ */
1143+ setDirty (allDirty);
11401144 // Phase 1
11411145 switch (openIterationIfDirty (it->first , it->second ))
11421146 {
@@ -1187,12 +1191,7 @@ void Series::flushFileBased(
11871191 {
11881192 IOHandler ()->flush (flushParams);
11891193 }
1190- /* reset the dirty bit for every iteration (i.e. file)
1191- * otherwise only the first iteration will have updates attributes
1192- */
1193- setDirty (allDirty);
11941194 }
1195- setDirty (false );
11961195 break ;
11971196 }
11981197 }
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"
@@ -283,10 +284,10 @@ void Attributable::flushAttributes(internal::FlushParams const &flushParams)
283284 }
284285 }
285286 // Do this outside the if branch to also setDirty to dirtyRecursive
286- if (flushParams. flushLevel != FlushLevel::SkeletonOnly)
287- {
288- setDirty ( false );
289- }
287+ assert (
288+ flushParams. flushLevel != FlushLevel::SkeletonOnly &&
289+ flushParams. flushLevel != FlushLevel::CreateOrOpenFiles );
290+ setDirty ( false );
290291}
291292
292293void Attributable::readAttributes (ReadMode mode)
You can’t perform that action at this time.
0 commit comments