Skip to content

Conversation

@franzpoeschel
Copy link
Contributor

@franzpoeschel franzpoeschel commented Jan 14, 2026

Close #1439
This PR focuses on Iteration-level attributes (including attributes included below Iteration level)
Needed for introducing a synchronous mode

TODO:

  • Write side changes
  • Read side changes: Move attribute initializations to new ScientificDefaults logic as well, be more lenient about missing attributes
  • Maybe expose the finalize() method publically, so users can request openPMD to set defaults now
  • Reduce use of templates, size of ScientificDefaults.o

@franzpoeschel franzpoeschel added api: breaking breaking API changes internal labels Jan 14, 2026
Comment on lines +281 to +284
// for (size_t i = 0; i < udims.size(); ++i)
// {
// res[7 * i] = 1;
// }

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
Comment on lines +698 to +701
// TODO: unitSI
// REQUIRE(r["x"].numAttributes() == 0);
// REQUIRE(r["y"].numAttributes() == 0);
// REQUIRE(r["z"].numAttributes() == 0);

Check notice

Code scanning / CodeQL

Commented-out code Note test

This comment appears to contain commented-out code.
@franzpoeschel
Copy link
Contributor Author

TODO: Move this check into finalize, maybe only print a warning

            throw std::runtime_error(
                "A Record can not be written without any contained "
                "RecordComponents: " +
                name);

@ax3l
Copy link
Member

ax3l commented Jan 14, 2026

@franzpoeschel is this for 0.18.0? :)

@franzpoeschel
Copy link
Contributor Author

@franzpoeschel is this for 0.18.0? :)

Yup, this is still under development

@ax3l ax3l added this to the 0.18.0 milestone Jan 14, 2026
Comment on lines 367 to 423
switch (wor)
{
case WriteOrRead::Write:
break;
case WriteOrRead::Read: {
Parameter<Operation::READ_ATT> aRead;
aRead.name = this->attrName;
auto IOHandler = this->child.IOHandler();
IOHandler->enqueue(IOTask(&this->child, aRead));
try
{
IOHandler->flush(defaultFlushParams);
}
catch (error::ReadError const &e)
{
std::cerr << "Could not read expected attribute '"
<< this->attrName << "' in '"
<< this->child.myPath().openPMDPath()
<< ". Will initialize it with a default value. "
"Original error: "
<< e.what() << std::endl;
this->set(this->get());
return;
}

Attribute attribute(
Attribute::from_any, std::move(*aRead.m_resource));
auto dt = attribute.dtype;
AttributeReadResult readResult =
attributeReader(this->child, attribute);
std::visit(
auxiliary::overloaded{
[&](attribute_read_result::TypeUnmatched) {
std::cerr << "Unexpected type '" << dt
<< "' for attribute '" << this->attrName
<< "' in '"
<< this->child.myPath().openPMDPath()
<< "' with value '";
write_to_stderr(attribute)
<< "'. Expected one of [UNIMPLEMENTED: PRINT TYPES "
"HERE] or convertible to such a type."
<< std::endl;
},
[&](error::ReadError const &err) {
std::cerr << "Unexpected error while trying to read "
"attribute '"
<< this->attrName << "' in '"
<< this->child.myPath().openPMDPath()
<< "'' with value '";
write_to_stderr(attribute)
<< "': " << err.what() << std::endl;
},
[](attribute_read_result::Success) { /* no-op */ }},
std::move(readResult));
}
break;
}

Check notice

Code scanning / CodeQL

Long switch case Note

Switch has at least one case that is too long:
Read (51 lines)
.
template <typename ExpectedAttributeType, typename... Args>
[[nodiscard]] auto
ConfigAttributeWithSetter<RecordType, GetDefaultValue, SetDefaultValue>::
withReader(Args &&...args) &&

Check notice

Code scanning / CodeQL

Unused static variable Note

Static variable args is never read.
template <typename ExpectedAttributeType, typename... Args>
[[nodiscard]] auto
ConfigAttributeWithSetter<RecordType, GetDefaultValue, SetDefaultValue>::
withReader(Args &&...args) &&

Check notice

Code scanning / CodeQL

Unused local variable Note

Variable args is not used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: breaking breaking API changes internal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scientific default values

2 participants