File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -558,6 +558,28 @@ OPENPMD_protected
558558 {
559559 return writable ().dirtyRecursive ;
560560 }
561+ void determineUnsetDirty (FlushLevel fl)
562+ {
563+ switch (fl)
564+ {
565+ case FlushLevel::UserFlush:
566+ setDirty (false );
567+ break ;
568+ case FlushLevel::InternalFlush:
569+ // Used for parsing
570+ if (IOHandler ()->m_seriesStatus == internal::SeriesStatus::Parsing)
571+ {
572+ throw error::Internal (
573+ " Parsing procedures should directly unset dirty." );
574+ }
575+ break ;
576+ case FlushLevel::ImmediateFlush:
577+ case FlushLevel::SkeletonOnly:
578+ case FlushLevel::CreateOrOpenFiles:
579+ // noop
580+ break ;
581+ }
582+ }
561583 void setDirty (bool dirty_in)
562584 {
563585 auto &w = writable ();
Original file line number Diff line number Diff line change @@ -345,7 +345,7 @@ void Iteration::flush(internal::FlushParams const &flushParams)
345345 m.second .flush (m.first , flushParams);
346346 for (auto &species : particles)
347347 species.second .flush (species.first , flushParams);
348- setDirty ( false );
348+ determineUnsetDirty (flushParams. flushLevel );
349349 }
350350 else
351351 {
@@ -399,9 +399,9 @@ void Iteration::flush(internal::FlushParams const &flushParams)
399399 }
400400 if (flushParams.flushLevel != FlushLevel::SkeletonOnly)
401401 {
402- setDirty ( false );
403- meshes.setDirty ( false );
404- particles.setDirty ( false );
402+ determineUnsetDirty (flushParams. flushLevel );
403+ meshes.determineUnsetDirty (flushParams. flushLevel );
404+ particles.determineUnsetDirty (flushParams. flushLevel );
405405 }
406406}
407407
Original file line number Diff line number Diff line change @@ -190,10 +190,7 @@ void ParticleSpecies::flush(
190190 patch.second .flush (patch.first , flushParams);
191191 }
192192 }
193- if (flushParams.flushLevel != FlushLevel::SkeletonOnly)
194- {
195- particlePatches.setDirty (false );
196- setDirty (false );
197- }
193+ determineUnsetDirty (flushParams.flushLevel );
194+ particlePatches.determineUnsetDirty (flushParams.flushLevel );
198195}
199196} // namespace openPMD
Original file line number Diff line number Diff line change @@ -612,10 +612,7 @@ void RecordComponent::flush(
612612
613613 flushAttributes (flushParams);
614614 }
615- if (flushParams.flushLevel != FlushLevel::SkeletonOnly)
616- {
617- setDirty (false );
618- }
615+ determineUnsetDirty (flushParams.flushLevel );
619616}
620617
621618void RecordComponent::read ()
Original file line number Diff line number Diff line change @@ -328,10 +328,7 @@ void Attributable::flushAttributes(internal::FlushParams const &flushParams)
328328 }
329329 }
330330 // Do this outside the if branch to also setDirty to dirtyRecursive
331- if (flushParams.flushLevel != FlushLevel::SkeletonOnly)
332- {
333- setDirty (false );
334- }
331+ determineUnsetDirty (flushParams.flushLevel );
335332}
336333
337334void Attributable::readAttributes (ReadMode mode)
Original file line number Diff line number Diff line change @@ -792,10 +792,7 @@ inline void BaseRecord<T_elem>::flush(
792792 }
793793
794794 this ->flush_impl (name, flushParams);
795- if (flushParams.flushLevel != FlushLevel::SkeletonOnly)
796- {
797- this ->setDirty (false );
798- }
795+ this ->determineUnsetDirty (flushParams.flushLevel );
799796 // flush_impl must take care to correctly set the dirty() flag so this
800797 // method doesn't do it
801798}
Original file line number Diff line number Diff line change @@ -65,10 +65,7 @@ void PatchRecord::flush_impl(
6565 }
6666 else
6767 T_RecordComponent::flush (path, flushParams);
68- if (flushParams.flushLevel != FlushLevel::SkeletonOnly)
69- {
70- setDirty (false );
71- }
68+ determineUnsetDirty (flushParams.flushLevel );
7269}
7370
7471void PatchRecord::read ()
You can’t perform that action at this time.
0 commit comments