Skip to content

Commit e73adad

Browse files
committed
Check for dirtyRecursive more fine-grained
1 parent beb04f6 commit e73adad

File tree

8 files changed

+35
-6
lines changed

8 files changed

+35
-6
lines changed

include/openPMD/backend/BaseRecord.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,11 @@ template <typename T_elem>
984984
inline void BaseRecord<T_elem>::flush(
985985
std::string const &name, internal::FlushParams const &flushParams)
986986
{
987+
if (!this->dirtyRecursive())
988+
{
989+
return;
990+
}
991+
987992
if (!this->written() && this->empty() && !this->datasetDefined())
988993
throw std::runtime_error(
989994
"A Record can not be written without any contained "

src/Iteration.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,10 @@ void Iteration::flush(internal::FlushParams const &flushParams)
361361
s.setMeshesPath("meshes/");
362362
s.flushMeshesPath();
363363
}
364-
meshes.flush(s.meshesPath(), flushParams);
365-
for (auto &m : meshes)
364+
if (meshes.dirtyRecursive())
366365
{
367-
if (m.second.dirtyRecursive())
366+
meshes.flush(s.meshesPath(), flushParams);
367+
for (auto &m : meshes)
368368
{
369369
m.second.flush(m.first, flushParams);
370370
}
@@ -382,10 +382,10 @@ void Iteration::flush(internal::FlushParams const &flushParams)
382382
s.setParticlesPath("particles/");
383383
s.flushParticlesPath();
384384
}
385-
particles.flush(s.particlesPath(), flushParams);
386-
for (auto &species : particles)
385+
if (particles.dirtyRecursive())
387386
{
388-
if (species.second.dirtyRecursive())
387+
particles.flush(s.particlesPath(), flushParams);
388+
for (auto &species : particles)
389389
{
390390
species.second.flush(species.first, flushParams);
391391
}

src/Mesh.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,10 @@ template Mesh &Mesh::setTimeOffset(float);
366366
void Mesh::flush_impl(
367367
std::string const &name, internal::FlushParams const &flushParams)
368368
{
369+
if (!dirtyRecursive())
370+
{
371+
return;
372+
}
369373
if (access::readOnly(IOHandler()->m_frontendAccess))
370374
{
371375
auto &m = get();

src/ParticleSpecies.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ namespace
155155
void ParticleSpecies::flush(
156156
std::string const &path, internal::FlushParams const &flushParams)
157157
{
158+
if (!dirtyRecursive())
159+
{
160+
return;
161+
}
158162
if (access::readOnly(IOHandler()->m_frontendAccess))
159163
{
160164
for (auto &record : *this)

src/Record.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ Record &Record::setUnitDimension(unit_representations::AsArray const &udim)
5252
void Record::flush_impl(
5353
std::string const &name, internal::FlushParams const &flushParams)
5454
{
55+
if (!dirtyRecursive())
56+
{
57+
return;
58+
}
5559
if (access::readOnly(IOHandler()->m_frontendAccess))
5660
{
5761
if (scalar())

src/RecordComponent.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,10 @@ bool RecordComponent::empty() const
239239
void RecordComponent::flush(
240240
std::string const &name, internal::FlushParams const &flushParams)
241241
{
242+
if (!dirtyRecursive())
243+
{
244+
return;
245+
}
242246
auto &rc = get();
243247
if (flushParams.flushLevel == FlushLevel::SkeletonOnly)
244248
{

src/backend/MeshRecordComponent.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ void MeshRecordComponent::read()
7070
void MeshRecordComponent::flush(
7171
std::string const &name, internal::FlushParams const &params)
7272
{
73+
if (!dirtyRecursive())
74+
{
75+
return;
76+
}
7377
if (access::write(IOHandler()->m_frontendAccess) &&
7478
!containsAttribute("position"))
7579
{

src/backend/PatchRecord.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ PatchRecord::setUnitDimension(std::map<UnitDimension, double> const &udim)
4141
void PatchRecord::flush_impl(
4242
std::string const &path, internal::FlushParams const &flushParams)
4343
{
44+
if (!dirtyRecursive())
45+
{
46+
return;
47+
}
4448
if (!this->datasetDefined())
4549
{
4650
if (IOHandler()->m_frontendAccess != Access::READ_ONLY)

0 commit comments

Comments
 (0)