File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ namespace internal
5959 class SeriesData ;
6060 struct HomogenizeExtents ;
6161 struct ConfigAttribute ;
62+ class ScientificDefaults ;
6263
6364 class SharedAttributableData
6465 {
@@ -247,6 +248,7 @@ class Attributable
247248 friend class Snapshots ;
248249 friend struct internal ::HomogenizeExtents;
249250 friend struct internal ::ConfigAttribute;
251+ friend class internal ::ScientificDefaults;
250252
251253protected:
252254 // tag for internal constructor
Original file line number Diff line number Diff line change @@ -48,6 +48,6 @@ class ScientificDefaults
4848 void writeDefaults (OpenpmdStandard);
4949
5050 // Called at appropriate places during parsing.
51- void readDefaults (OpenpmdStandard);
51+ void readDefaults (Attributable &, OpenpmdStandard);
5252};
5353} // namespace openPMD::internal
Original file line number Diff line number Diff line change @@ -599,7 +599,7 @@ void Iteration::read_impl(std::string const &groupPath)
599599 particles.setDirty (false );
600600
601601 readAttributes (ReadMode::FullyReread);
602- internal::ScientificDefaults::readDefaults (IOHandler ()->m_standard );
602+ internal::ScientificDefaults::readDefaults (* this , IOHandler ()->m_standard );
603603
604604#ifdef openPMD_USE_INVASIVE_TESTS
605605 if (containsAttribute (" __openPMD_internal_fail" ))
Original file line number Diff line number Diff line change @@ -564,7 +564,7 @@ void Mesh::read()
564564 std::move (homogenizeExtents).homogenize (*this );
565565
566566 readAttributes (ReadMode::FullyReread);
567- internal::ScientificDefaults::readDefaults (IOHandler ()->m_standard );
567+ internal::ScientificDefaults::readDefaults (* this , IOHandler ()->m_standard );
568568}
569569} // namespace openPMD
570570
Original file line number Diff line number Diff line change @@ -197,8 +197,8 @@ auto Record::read() -> internal::HomogenizeExtents
197197 }
198198 }
199199
200+ internal::ScientificDefaults::readDefaults (*this , IOHandler ()->m_standard );
200201 readAttributes (ReadMode::FullyReread);
201- internal::ScientificDefaults::readDefaults (IOHandler ()->m_standard );
202202
203203 return res;
204204}
Original file line number Diff line number Diff line change @@ -532,7 +532,7 @@ void RecordComponent::flush(
532532void RecordComponent::read ()
533533{
534534 readBase ();
535- internal::ScientificDefaults::readDefaults (IOHandler ()->m_standard );
535+ internal::ScientificDefaults::readDefaults (* this , IOHandler ()->m_standard );
536536}
537537
538538namespace
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ MeshRecordComponent::MeshRecordComponent(
4242void MeshRecordComponent::read ()
4343{
4444 readBase ();
45- internal::ScientificDefaults::readDefaults (IOHandler ()->m_standard );
45+ internal::ScientificDefaults::readDefaults (* this , IOHandler ()->m_standard );
4646}
4747
4848void MeshRecordComponent::flush (
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ void PatchRecord::read()
108108 }
109109
110110 readAttributes (ReadMode::FullyReread);
111- internal::ScientificDefaults::readDefaults (IOHandler ()->m_standard );
111+ internal::ScientificDefaults::readDefaults (* this , IOHandler ()->m_standard );
112112
113113 setDirty (false );
114114}
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ PatchRecordComponent::PatchRecordComponent(
6969void PatchRecordComponent::read ()
7070{
7171 readBase ();
72- internal::ScientificDefaults::readDefaults (IOHandler ()->m_standard );
72+ internal::ScientificDefaults::readDefaults (* this , IOHandler ()->m_standard );
7373}
7474
7575PatchRecordComponent::PatchRecordComponent () : RecordComponent(NoInit())
Original file line number Diff line number Diff line change @@ -20,8 +20,16 @@ void ScientificDefaults::writeDefaults(OpenpmdStandard standard)
2020 scientificDefaults_impl (WriteOrRead::Write, standard);
2121}
2222
23- void ScientificDefaults::readDefaults (OpenpmdStandard standard)
23+ void ScientificDefaults::readDefaults (
24+ Attributable &self, OpenpmdStandard standard)
2425{
26+ auto old_dirty = self.dirty ();
2527 scientificDefaults_impl (WriteOrRead::Read, standard);
28+ if (!old_dirty)
29+ {
30+ // did not become dirty by reading
31+ // but setAttribute() might have been used, so set it again
32+ self.setDirty (false );
33+ }
2634}
2735} // namespace openPMD::internal
You can’t perform that action at this time.
0 commit comments