Skip to content

Commit 5711ac1

Browse files
committed
Defaults for patchRecord
1 parent 9224a5d commit 5711ac1

1 file changed

Lines changed: 3 additions & 19 deletions

File tree

src/backend/PatchRecord.cpp

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
*/
2121
#include "openPMD/backend/PatchRecord.hpp"
2222
#include "openPMD/auxiliary/Memory.hpp"
23+
#include "openPMD/backend/ScientificDefaults.hpp"
2324

2425
#include <iostream>
2526

@@ -72,25 +73,8 @@ void PatchRecord::flush_impl(
7273

7374
void PatchRecord::read()
7475
{
75-
Parameter<Operation::READ_ATT> aRead;
76-
aRead.name = "unitDimension";
77-
IOHandler()->enqueue(IOTask(this, aRead));
78-
IOHandler()->flush(internal::defaultFlushParams);
79-
80-
if (auto val = Attribute(Attribute::from_any, *aRead.m_resource)
81-
.getOptional<std::array<double, 7> >();
82-
val.has_value())
83-
this->setAttribute("unitDimension", val.value());
84-
else
85-
throw error::ReadError(
86-
error::AffectedObject::Attribute,
87-
error::Reason::UnexpectedContent,
88-
{},
89-
"Unexpected Attribute datatype for 'unitDimension' (expected an "
90-
"array of seven floating point numbers, found " +
91-
datatypeToString(
92-
Attribute(Attribute::from_any, *aRead.m_resource).dtype) +
93-
")");
76+
internal::ScientificDefaults<PatchRecord>::readDefaults(
77+
IOHandler()->m_standard);
9478

9579
Parameter<Operation::LIST_DATASETS> dList;
9680
IOHandler()->enqueue(IOTask(this, dList));

0 commit comments

Comments
 (0)