File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -549,6 +549,27 @@ OPENPMD_protected
549549 {
550550 return writable ().dirtyRecursive ;
551551 }
552+ void determineUnsetDirty (FlushLevel fl)
553+ {
554+ switch (fl)
555+ {
556+ case FlushLevel::UserFlush:
557+ setDirty (false );
558+ break ;
559+ case FlushLevel::InternalFlush:
560+ // Used for parsing
561+ if (IOHandler ()->m_seriesStatus == internal::SeriesStatus::Parsing)
562+ {
563+ throw error::Internal (
564+ " Parsing procedures should directly unset dirty." );
565+ }
566+ break ;
567+ case FlushLevel::SkeletonOnly:
568+ case FlushLevel::CreateOrOpenFiles:
569+ // noop
570+ break ;
571+ }
572+ }
552573 void setDirty (bool dirty_in)
553574 {
554575 auto &w = writable ();
Original file line number Diff line number Diff line change @@ -351,7 +351,7 @@ void Iteration::flush(internal::FlushParams const &flushParams)
351351 m.second .flush (m.first , flushParams);
352352 for (auto &species : particles)
353353 species.second .flush (species.first , flushParams);
354- setDirty ( false );
354+ determineUnsetDirty (flushParams. flushLevel );
355355 }
356356 else
357357 {
@@ -405,9 +405,9 @@ void Iteration::flush(internal::FlushParams const &flushParams)
405405 }
406406 if (flushParams.flushLevel != FlushLevel::SkeletonOnly)
407407 {
408- setDirty ( false );
409- meshes.setDirty ( false );
410- particles.setDirty ( false );
408+ determineUnsetDirty (flushParams. flushLevel );
409+ meshes.determineUnsetDirty (flushParams. flushLevel );
410+ particles.determineUnsetDirty (flushParams. flushLevel );
411411 }
412412}
413413
Original file line number Diff line number Diff line change @@ -208,9 +208,7 @@ void ParticleSpecies::flush(
208208 particlePatches.setDirty (false );
209209 }
210210 }
211- if (flushParams.flushLevel != FlushLevel::SkeletonOnly)
212- {
213- setDirty (false );
214- }
211+ determineUnsetDirty (flushParams.flushLevel );
212+ particlePatches.determineUnsetDirty (flushParams.flushLevel );
215213}
216214} // namespace openPMD
Original file line number Diff line number Diff line change @@ -549,10 +549,7 @@ void RecordComponent::flush(
549549
550550 flushAttributes (flushParams);
551551 }
552- if (flushParams.flushLevel != FlushLevel::SkeletonOnly)
553- {
554- setDirty (false );
555- }
552+ determineUnsetDirty (flushParams.flushLevel );
556553}
557554
558555void RecordComponent::read (bool require_unit_si)
Original file line number Diff line number Diff line change @@ -299,10 +299,7 @@ void Attributable::flushAttributes(internal::FlushParams const &flushParams)
299299 }
300300 }
301301 // Do this outside the if branch to also setDirty to dirtyRecursive
302- if (flushParams.flushLevel != FlushLevel::SkeletonOnly)
303- {
304- setDirty (false );
305- }
302+ determineUnsetDirty (flushParams.flushLevel );
306303}
307304
308305void Attributable::readAttributes (ReadMode mode)
Original file line number Diff line number Diff line change @@ -840,10 +840,7 @@ inline void BaseRecord<T_elem>::flush(
840840 }
841841
842842 this ->flush_impl (name, flushParams);
843- if (flushParams.flushLevel != FlushLevel::SkeletonOnly)
844- {
845- this ->setDirty (false );
846- }
843+ this ->determineUnsetDirty (flushParams.flushLevel );
847844 // flush_impl must take care to correctly set the dirty() flag so this
848845 // method doesn't do it
849846}
Original file line number Diff line number Diff line change @@ -56,10 +56,7 @@ void PatchRecord::flush_impl(
5656 }
5757 else
5858 T_RecordComponent::flush (path, flushParams);
59- if (flushParams.flushLevel != FlushLevel::SkeletonOnly)
60- {
61- setDirty (false );
62- }
59+ determineUnsetDirty (flushParams.flushLevel );
6360}
6461
6562void PatchRecord::read ()
You can’t perform that action at this time.
0 commit comments