Skip to content

Commit 3c90163

Browse files
committed
Default values only upon ::close
1 parent afcf608 commit 3c90163

File tree

7 files changed

+7
-25
lines changed

7 files changed

+7
-25
lines changed

include/openPMD/backend/Attributable.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -480,10 +480,6 @@ OPENPMD_protected
480480

481481
void flushAttributes(internal::FlushParams const &);
482482

483-
void populateDefaults(
484-
internal::ScientificDefaults *self,
485-
internal::FlushParams const &params);
486-
487483
enum ReadMode
488484
{
489485
/**

src/Iteration.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ Iteration &Iteration::close(bool _flush)
135135
break;
136136
}
137137

138-
// if (access::write(IOHandler()->m_frontendAccess))
139-
// {
140-
// commitStructuralSetup();
141-
// }
138+
if (access::write(IOHandler()->m_frontendAccess))
139+
{
140+
populateMissingMetadata(true);
141+
}
142142

143143
if (_flush)
144144
{
@@ -442,7 +442,6 @@ void Iteration::flush(internal::FlushParams const &flushParams)
442442
particles.setDirty(false);
443443
}
444444

445-
populateDefaults(this, flushParams);
446445
flushAttributes(flushParams);
447446
}
448447
if (flushParams.flushLevel != FlushLevel::SkeletonOnly)

src/ParticleSpecies.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ void ParticleSpecies::flush(
182182
}
183183
else
184184
{
185-
populateDefaults(this, flushParams);
186185
Container<Record>::flush(path, flushParams);
187186

188187
for (auto &record : *this)

src/RecordComponent.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,6 @@ void RecordComponent::flush(
521521
rc.m_chunks.pop();
522522
}
523523

524-
populateDefaults(this, flushParams);
525524
flushAttributes(flushParams);
526525
}
527526
if (flushParams.flushLevel != FlushLevel::SkeletonOnly)

src/backend/Attributable.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -383,16 +383,6 @@ void Attributable::flushAttributes(internal::FlushParams const &flushParams)
383383
}
384384
}
385385

386-
void Attributable::populateDefaults(
387-
internal::ScientificDefaults *self, internal::FlushParams const &params)
388-
{
389-
if (params.flushLevel != FlushLevel::UserFlush)
390-
{
391-
return;
392-
}
393-
self->writeDefaults(IOHandler()->m_standard);
394-
}
395-
396386
void Attributable::readAttributes(ReadMode mode)
397387
{
398388
auto &attri = get();

src/backend/BaseRecord.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -792,10 +792,6 @@ inline void BaseRecord<T_elem>::flush(
792792
"one or more regular components.");
793793
}
794794

795-
if (access::write(this->IOHandler()->m_backendAccess))
796-
{
797-
this->populateDefaults(this, flushParams);
798-
}
799795
this->flush_impl(name, flushParams);
800796
if (flushParams.flushLevel != FlushLevel::SkeletonOnly)
801797
{

test/python/unittest/API/APITest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2376,6 +2376,7 @@ def get_component_only():
23762376
mesh.axis_labels = ["x", "y"]
23772377
component.reset_dataset(io.Dataset(np.dtype("float"), [10, 10]))
23782378

2379+
iteration.populate_missing_metadata(recursive=True)
23792380
del iteration
23802381
del mesh
23812382
del series
@@ -2423,6 +2424,7 @@ def get_component_only():
24232424
position.reset_dataset(
24242425
io.Dataset(np.dtype("float"), [num_particles]))
24252426

2427+
iteration.populate_missing_metadata(recursive=True)
24262428
del iteration
24272429
del particles
24282430
del series
@@ -2474,6 +2476,7 @@ def get_component_only():
24742476
num_particles_comp.store(0, np.uint64(10))
24752477
num_particles_comp.store(1, np.uint64(20))
24762478

2479+
iteration.populate_missing_metadata(recursive=True)
24772480
del iteration
24782481
del particles
24792482
del series

0 commit comments

Comments
 (0)