Skip to content

Commit 8c976f9

Browse files
committed
Fixes
1 parent c2babcc commit 8c976f9

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

include/openPMD/backend/ScientificDefaults_internal.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,11 @@ struct ConfigAttribute
216216

217217
void read()
218218
{
219+
if (attributeReaders.empty())
220+
{
221+
// No readers emplaced for this attribute
222+
return;
223+
}
219224
AttributeReadResult res = attribute_read_result::TypeUnmatched{};
220225
Parameter<Operation::READ_ATT> aRead;
221226
aRead.name = this->attrName;
@@ -237,11 +242,6 @@ struct ConfigAttribute
237242
}
238243

239244
Attribute attribute(Attribute::from_any, std::move(*aRead.m_resource));
240-
if (attributeReaders.empty())
241-
{
242-
// No readers emplaced for this attribute
243-
return;
244-
}
245245
for (auto &attributeReader : attributeReaders)
246246
{
247247

src/backend/ScientificDefaults.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,14 @@ void ScientificDefaults<Child>::defaults_impl(OpenpmdStandard standard)
552552
// We don't require unitSI for PatchRecordComponent
553553
//
554554
// addParentDefaults<RecordComponent, write>();
555+
//
556+
// But we still set it when writing. Doesnt hurt and some readers might
557+
// expect it.
558+
defaultAttribute("unitSI").template withSetter<PatchRecordComponent>(
559+
1.0, &PatchRecordComponent::setUnitSI)
560+
// Do NOT add a reader here.
561+
// .withReader(float_types, require_type<double>())
562+
(wor);
555563
}
556564
else if constexpr (auxiliary::IsTemplateBaseOf_v<BaseRecord, Child>)
557565
{

0 commit comments

Comments
 (0)