Skip to content

Commit fc13164

Browse files
committed
Check for dirtyRecursive more fine-grained
1 parent d8233a5 commit fc13164

File tree

8 files changed

+35
-6
lines changed

8 files changed

+35
-6
lines changed

src/Iteration.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -362,10 +362,10 @@ void Iteration::flush(internal::FlushParams const &flushParams)
362362
s.setMeshesPath("meshes/");
363363
s.flushMeshesPath();
364364
}
365-
meshes.flush(s.meshesPath(), flushParams);
366-
for (auto &m : meshes)
365+
if (meshes.dirtyRecursive())
367366
{
368-
if (m.second.dirtyRecursive())
367+
meshes.flush(s.meshesPath(), flushParams);
368+
for (auto &m : meshes)
369369
{
370370
m.second.flush(m.first, flushParams);
371371
}
@@ -383,10 +383,10 @@ void Iteration::flush(internal::FlushParams const &flushParams)
383383
s.setParticlesPath("particles/");
384384
s.flushParticlesPath();
385385
}
386-
particles.flush(s.particlesPath(), flushParams);
387-
for (auto &species : particles)
386+
if (particles.dirtyRecursive())
388387
{
389-
if (species.second.dirtyRecursive())
388+
particles.flush(s.particlesPath(), flushParams);
389+
for (auto &species : particles)
390390
{
391391
species.second.flush(species.first, flushParams);
392392
}

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
@@ -249,6 +249,10 @@ bool RecordComponent::empty() const
249249
void RecordComponent::flush(
250250
std::string const &name, internal::FlushParams const &flushParams)
251251
{
252+
if (!dirtyRecursive())
253+
{
254+
return;
255+
}
252256
auto &rc = get();
253257
if (flushParams.flushLevel == FlushLevel::SkeletonOnly)
254258
{

src/backend/BaseRecord.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,11 @@ template <typename T_elem>
819819
inline void BaseRecord<T_elem>::flush(
820820
std::string const &name, internal::FlushParams const &flushParams)
821821
{
822+
if (!this->dirtyRecursive())
823+
{
824+
return;
825+
}
826+
822827
if (!this->written() && this->empty() && !this->datasetDefined())
823828
throw std::runtime_error(
824829
"A Record can not be written without any contained "

src/backend/MeshRecordComponent.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ void MeshRecordComponent::read()
7272
void MeshRecordComponent::flush(
7373
std::string const &name, internal::FlushParams const &params)
7474
{
75+
if (!dirtyRecursive())
76+
{
77+
return;
78+
}
7579
if (access::write(IOHandler()->m_frontendAccess) &&
7680
!containsAttribute("position"))
7781
{

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)