File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -553,6 +553,28 @@ OPENPMD_protected
553553 {
554554 return writable ().dirtyRecursive ;
555555 }
556+ void determineUnsetDirty (FlushLevel fl)
557+ {
558+ switch (fl)
559+ {
560+ case FlushLevel::UserFlush:
561+ setDirty (false );
562+ break ;
563+ case FlushLevel::InternalFlush:
564+ // Used for parsing
565+ if (IOHandler ()->m_seriesStatus == internal::SeriesStatus::Parsing)
566+ {
567+ throw error::Internal (
568+ " Parsing procedures should directly unset dirty." );
569+ }
570+ break ;
571+ case FlushLevel::ImmediateFlush:
572+ case FlushLevel::SkeletonOnly:
573+ case FlushLevel::CreateOrOpenFiles:
574+ // noop
575+ break ;
576+ }
577+ }
556578 void setDirty (bool dirty_in)
557579 {
558580 auto &w = writable ();
Original file line number Diff line number Diff line change @@ -393,7 +393,7 @@ void Iteration::flush(internal::FlushParams const &flushParams)
393393 m.second .flush (m.first , flushParams);
394394 for (auto &species : particles)
395395 species.second .flush (species.first , flushParams);
396- setDirty ( false );
396+ determineUnsetDirty (flushParams. flushLevel );
397397 }
398398 else
399399 {
@@ -447,9 +447,9 @@ void Iteration::flush(internal::FlushParams const &flushParams)
447447 }
448448 if (flushParams.flushLevel != FlushLevel::SkeletonOnly)
449449 {
450- setDirty ( false );
451- meshes.setDirty ( false );
452- particles.setDirty ( false );
450+ determineUnsetDirty (flushParams. flushLevel );
451+ meshes.determineUnsetDirty (flushParams. flushLevel );
452+ particles.determineUnsetDirty (flushParams. flushLevel );
453453 }
454454}
455455
Original file line number Diff line number Diff line change @@ -188,11 +188,8 @@ void ParticleSpecies::flush(
188188 patch.second .flush (patch.first , flushParams);
189189 }
190190 }
191- if (flushParams.flushLevel != FlushLevel::SkeletonOnly)
192- {
193- particlePatches.setDirty (false );
194- setDirty (false );
195- }
191+ determineUnsetDirty (flushParams.flushLevel );
192+ particlePatches.determineUnsetDirty (flushParams.flushLevel );
196193}
197194void ParticleSpecies::scientificDefaults_impl (bool /* write */ , OpenpmdStandard)
198195{
Original file line number Diff line number Diff line change @@ -611,10 +611,7 @@ void RecordComponent::flush(
611611
612612 flushAttributes (flushParams);
613613 }
614- if (flushParams.flushLevel != FlushLevel::SkeletonOnly)
615- {
616- setDirty (false );
617- }
614+ determineUnsetDirty (flushParams.flushLevel );
618615}
619616
620617void 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 @@ -793,10 +793,7 @@ inline void BaseRecord<T_elem>::flush(
793793 }
794794
795795 this ->flush_impl (name, flushParams);
796- if (flushParams.flushLevel != FlushLevel::SkeletonOnly)
797- {
798- this ->setDirty (false );
799- }
796+ this ->determineUnsetDirty (flushParams.flushLevel );
800797 // flush_impl must take care to correctly set the dirty() flag so this
801798 // method doesn't do it
802799}
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