Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
7b5e8df
Base structure for scientific defaults
franzpoeschel Jan 12, 2026
2bef9e7
Start adding defaults
franzpoeschel Jan 12, 2026
16179ff
debugging output
franzpoeschel Jan 12, 2026
eb393d9
Fixes
franzpoeschel Jan 12, 2026
bdf8761
BaseRecord --> unitDimension
franzpoeschel Jan 12, 2026
ef41e87
nunja hehe
franzpoeschel Jan 12, 2026
b909a23
Fixes
franzpoeschel Jan 12, 2026
a0eb086
Further fixes
franzpoeschel Jan 13, 2026
f2b1a71
further fixes
franzpoeschel Jan 13, 2026
fbb3f6b
tests temporarily passing :D
franzpoeschel Jan 13, 2026
98b2af8
Cleanup
franzpoeschel Jan 13, 2026
b076606
UnitDimension for position/positionOffset
franzpoeschel Jan 13, 2026
22ff525
WIP: RecordComponent stuff
franzpoeschel Jan 13, 2026
e0b34a3
Fix coretests
franzpoeschel Jan 14, 2026
a3e4e92
Clean up Iteration finalizing logic
franzpoeschel Jan 14, 2026
c09793a
Add defaults for Iteration class
franzpoeschel Jan 14, 2026
e4460f9
Fix variadic template template parameters
franzpoeschel Jan 15, 2026
6053612
Remove flush-time check for populized components
franzpoeschel Jan 16, 2026
1daaee5
Make the default specification more flexible
franzpoeschel Jan 16, 2026
111ddf7
WIP
franzpoeschel Jan 20, 2026
52fe9a0
continue
franzpoeschel Jan 20, 2026
0cce083
Split this into internal and public header
franzpoeschel Jan 21, 2026
aba3d83
Distinguish writing from reading
franzpoeschel Jan 21, 2026
52eeb6e
Tests now working again
franzpoeschel Jan 21, 2026
088388d
Mostly move Mesh reading to ScientificDefaults
franzpoeschel Jan 21, 2026
322f0bb
Fix type conversions between char and string
franzpoeschel Jan 21, 2026
f8733f6
Somewhat working Mesh reading
franzpoeschel Jan 21, 2026
a870be8
Fix little parent call bug
franzpoeschel Jan 22, 2026
bc377db
Mention expected datatypes in attribute reading error messages
franzpoeschel Jan 22, 2026
185f50a
Move Iteration reading to ScientificDefaults class
franzpoeschel Jan 22, 2026
315c1a2
Introduce genericsetter, use for unitDimension
franzpoeschel Jan 22, 2026
2df9ce6
Record / BaseRecord Reading
franzpoeschel Jan 22, 2026
2e216ac
Readers for everything now except version-dependent stuff
franzpoeschel Jan 22, 2026
ae2e160
Add gridUnitDimension in ScientificDefaults
franzpoeschel Jan 23, 2026
9082923
Do not use templates for defaults setter
franzpoeschel Jan 26, 2026
0b0b1a9
Wew NewAttributeReader
franzpoeschel Jan 27, 2026
85b7957
Fixes
franzpoeschel Jan 27, 2026
f896c42
Fixes
franzpoeschel Jan 27, 2026
9b9f614
Defaults for patchRecord
franzpoeschel Jan 27, 2026
01f860b
Adapt PatchRecordComponent
franzpoeschel Jan 27, 2026
60dd741
Fixes
franzpoeschel Jan 27, 2026
7282feb
Cleanup
franzpoeschel Jan 28, 2026
72d345c
Cleanup
franzpoeschel Jan 28, 2026
03c46b9
Avoid overcomplex attribute type conversions
franzpoeschel Jan 28, 2026
51463d3
reduce binary size a bit
franzpoeschel Jan 28, 2026
7d618fd
Try further reducing amount of lambdas...
franzpoeschel Jan 28, 2026
edb2070
Annotate MB sizes
franzpoeschel Jan 28, 2026
6de9d31
Reduce implementation sizes for RequireScalar / RequireVector
franzpoeschel Jan 29, 2026
c817f3f
vibe-coded suggestions for size optimization
franzpoeschel Jan 29, 2026
9b63443
Avoid using lambdas for require_type
franzpoeschel Jan 29, 2026
9486f0c
Change code order
franzpoeschel Jan 29, 2026
9f2da45
Replace if constexpr with SFINAE
franzpoeschel Jan 30, 2026
1c651ed
Fix nvhpc/msvc builds
franzpoeschel Jan 30, 2026
1952b4b
doxygen fix
franzpoeschel Feb 2, 2026
12a9b70
Cleanup
franzpoeschel Feb 4, 2026
cf6ecf4
scientificdefaults_internal.cpp
franzpoeschel Feb 24, 2026
2106ac0
Add visitor pattern
franzpoeschel Feb 24, 2026
12c781f
wip: ScientificDefaults without CRT
franzpoeschel Feb 24, 2026
fc81641
Move defaults impl to classes
franzpoeschel Feb 24, 2026
889bc52
Fix visitHierarchy
franzpoeschel Feb 24, 2026
3471d13
Fix visithierarchy
franzpoeschel Feb 24, 2026
e4585c3
Compiles
franzpoeschel Feb 24, 2026
b050f78
Fix inheritance issue
franzpoeschel Feb 25, 2026
812a3a2
Cleanup
franzpoeschel Mar 3, 2026
aabe66d
Move files
franzpoeschel Mar 3, 2026
6ee88f0
Split files
franzpoeschel Mar 3, 2026
6a5894b
Cleanup, documentation
franzpoeschel Mar 3, 2026
d4aeac8
Fix JSON backend bug when missing attributes
franzpoeschel Mar 3, 2026
7d1b765
Fix bug with metadata set too late
franzpoeschel Mar 20, 2026
d7c9b5f
Write defaults upon flush, thats good enough actually
franzpoeschel Mar 25, 2026
e8ef828
... wip visitor without templates ...
franzpoeschel Mar 20, 2026
19f696c
somewhat compiles
franzpoeschel Mar 20, 2026
bf437fd
Clean up visitHierarchy API
franzpoeschel Mar 20, 2026
976acc5
Further cleanup
franzpoeschel Mar 20, 2026
f107e08
Implement lambda visitor in terms of explicit visitor
franzpoeschel Mar 20, 2026
d02bed3
Fix Python bindings
franzpoeschel Mar 20, 2026
aa0d98c
populateDefaultMetadata -> commitStructuralSetup
franzpoeschel Mar 25, 2026
34a8a43
Cleanup
franzpoeschel Mar 25, 2026
4d9d4c6
Documentation
franzpoeschel Mar 25, 2026
58dfd6f
Postfix traversal, document visitHierarchy
franzpoeschel Mar 25, 2026
33e4f88
commitStructuralSetup --> populateMissingMetadata(bool recursive)
franzpoeschel Apr 7, 2026
3c76682
CI fixes
franzpoeschel Apr 8, 2026
57d537b
Default values only upon ::close
franzpoeschel Apr 14, 2026
e70cb21
Documentation and cleanup
franzpoeschel Apr 28, 2026
44fda5a
Review fixes
franzpoeschel Apr 29, 2026
b4b4750
Review fixes
franzpoeschel Apr 29, 2026
d93d16d
Fix dirty handling
franzpoeschel Apr 29, 2026
48243ee
Fix forward declaration
franzpoeschel Apr 29, 2026
8d5fb44
Fix dirty handling
franzpoeschel Apr 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,11 @@ set(CORE_SOURCE
src/backend/PatchRecord.cpp
src/backend/PatchRecordComponent.cpp
src/backend/Writable.cpp
src/backend/scientific_defaults/ScientificDefaults.cpp
src/backend/scientific_defaults/ScientificDefaults_auxiliary.cpp
src/backend/scientific_defaults/ProcessParsedAttribute.cpp
src/backend/scientific_defaults/AttributeReader.cpp
src/backend/scientific_defaults/ConfigAttribute.cpp
src/auxiliary/OneDimensionalBlockSlicer.cpp
src/helper/list_series.cpp
src/snapshots/ContainerImpls.cpp
Expand Down
39 changes: 35 additions & 4 deletions include/openPMD/Iteration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include "openPMD/auxiliary/Variant.hpp"
#include "openPMD/backend/Attributable.hpp"
#include "openPMD/backend/Container.hpp"
#include "openPMD/backend/HierarchyVisitor.hpp"
#include "openPMD/backend/scientific_defaults/ScientificDefaults.hpp"

#include <cstdint>
#include <deque>
Expand Down Expand Up @@ -145,13 +147,28 @@ namespace internal
std::optional<DeferredParseAccess> m_deferredParseAccess{};
};
} // namespace internal

class Meshes : public Container<Mesh>
{
public:
void visitHierarchy(HierarchyVisitor &v, bool recursive) override;
};

class Particles : public Container<ParticleSpecies>
{
public:
void visitHierarchy(HierarchyVisitor &v, bool recursive) override;
};

/** @brief Logical compilation of data from one snapshot (e.g. a single
* simulation cycle).
*
* @see
* https://github.com/openPMD/openPMD-standard/blob/latest/STANDARD.md#required-attributes-for-the-basepath
*/
class Iteration : public Attributable
class Iteration
: public Attributable
, internal::ScientificDefaults
{
template <typename T, typename T_key, typename T_container>
friend class Container;
Expand All @@ -164,6 +181,8 @@ class Iteration : public Attributable
friend class StatefulSnapshotsContainer;
template <typename>
friend struct traits::GenerationPolicy;
friend class internal::ScientificDefaults;
friend class Attributable;

public:
Iteration(Iteration const &) = default;
Expand Down Expand Up @@ -279,8 +298,10 @@ class Iteration : public Attributable
[[deprecated("This attribute is no longer set by the openPMD-api.")]] bool
closedByWriter() const;

Container<Mesh> meshes{};
Container<ParticleSpecies> particles{}; // particleSpecies?
void visitHierarchy(HierarchyVisitor &v, bool recursive) override;

Meshes meshes{};
Particles particles{};

virtual ~Iteration() = default;

Expand Down Expand Up @@ -442,14 +463,18 @@ class Iteration : public Attributable
*
* @param w The Writable representing the parent.
*/
virtual void linkHierarchy(Writable &w);
void linkHierarchy(Writable &w) override;

/**
* @brief Access an iteration in read mode that has potentially not been
* parsed yet.
*
*/
void runDeferredParseAccess();

protected:
void scientificDefaults_impl(
internal::WriteOrRead, OpenpmdStandard) override;
}; // Iteration

namespace traits
Expand Down Expand Up @@ -513,4 +538,10 @@ class IndexedIteration : public Iteration
: Iteration(std::forward<Iteration_t>(it)), iterationIndex(index)
{}
};

class Iterations : public Container<Iteration, Iteration::IterationIndex_t>
{
public:
void visitHierarchy(HierarchyVisitor &v, bool recursive) override;
};
} // namespace openPMD
12 changes: 12 additions & 0 deletions include/openPMD/Mesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
#include "openPMD/UnitDimension.hpp"
#include "openPMD/backend/Attributable.hpp"
#include "openPMD/backend/BaseRecord.hpp"
#include "openPMD/backend/Container.hpp"
#include "openPMD/backend/MeshRecordComponent.hpp"
#include "openPMD/backend/scientific_defaults/ScientificDefaults.hpp"
#include "openPMD/backend/scientific_defaults/ScientificDefaults_auxiliary.hpp"

#include <ostream>
#include <string>
Expand All @@ -41,6 +44,8 @@ class Mesh : public BaseRecord<MeshRecordComponent>
{
friend class Container<Mesh>;
friend class Iteration;
friend class internal::ScientificDefaults;
friend class Attributable;

public:
Mesh(Mesh const &) = default;
Expand Down Expand Up @@ -322,12 +327,19 @@ class Mesh : public BaseRecord<MeshRecordComponent>
typename = std::enable_if_t<std::is_floating_point<T>::value>>
Mesh &setTimeOffset(T timeOffset);

void visitHierarchy(HierarchyVisitor &v, bool recursive) override;

private:
Mesh();

void
flush_impl(std::string const &, internal::FlushParams const &) override;
void read();
auto retrieveDimensionality() const -> uint64_t;

protected:
void scientificDefaults_impl(
internal::WriteOrRead, OpenpmdStandard) override;
}; // Mesh

template <typename T>
Expand Down
2 changes: 2 additions & 0 deletions include/openPMD/ParticlePatches.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class ParticlePatches : public Container<PatchRecord>
size_t numPatches() const;
~ParticlePatches() override = default;

void visitHierarchy(HierarchyVisitor &v, bool recursive) override;

private:
ParticlePatches() = default;
void read();
Expand Down
15 changes: 14 additions & 1 deletion include/openPMD/ParticleSpecies.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,32 @@
#include "openPMD/Record.hpp"
#include "openPMD/backend/Attributable.hpp"
#include "openPMD/backend/Container.hpp"
#include "openPMD/backend/HierarchyVisitor.hpp"
#include "openPMD/backend/scientific_defaults/ScientificDefaults.hpp"
#include "openPMD/backend/scientific_defaults/ScientificDefaults_auxiliary.hpp"

#include <string>

namespace openPMD
{

class ParticleSpecies : public Container<Record>
class ParticleSpecies
: public Container<Record>
, internal::ScientificDefaults
{
friend class Container<ParticleSpecies>;
friend class Container<Record>;
friend class Iteration;
template <typename T>
friend T &internal::makeOwning(T &self, Series);
friend class internal::ScientificDefaults;
friend class Attributable;

public:
ParticlePatches particlePatches;

void visitHierarchy(HierarchyVisitor &v, bool recursive) override;

private:
ParticleSpecies();

Expand All @@ -53,6 +62,10 @@ class ParticleSpecies : public Container<Record>
{
return m_containerData;
}

protected:
void scientificDefaults_impl(
internal::WriteOrRead, OpenpmdStandard) override;
};

namespace traits
Expand Down
8 changes: 8 additions & 0 deletions include/openPMD/Record.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "openPMD/RecordComponent.hpp"
#include "openPMD/UnitDimension.hpp"
#include "openPMD/backend/BaseRecord.hpp"
#include "openPMD/backend/scientific_defaults/ScientificDefaults.hpp"

#include <string>
#include <type_traits>
Expand All @@ -34,6 +35,7 @@ class Record : public BaseRecord<RecordComponent>
friend class Container<Record>;
friend class Iteration;
friend class ParticleSpecies;
friend class internal::ScientificDefaults;

public:
Record(Record const &) = default;
Expand All @@ -48,13 +50,19 @@ class Record : public BaseRecord<RecordComponent>
template <typename T>
Record &setTimeOffset(T);

void visitHierarchy(HierarchyVisitor &v, bool recursive) override;

private:
Record();

void
flush_impl(std::string const &, internal::FlushParams const &) override;

[[nodiscard]] internal::HomogenizeExtents read();

protected:
void scientificDefaults_impl(
internal::WriteOrRead, OpenpmdStandard) override;
}; // Record

template <typename T>
Expand Down
18 changes: 15 additions & 3 deletions include/openPMD/RecordComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include "openPMD/auxiliary/UniquePtr.hpp"
#include "openPMD/backend/Attributable.hpp"
#include "openPMD/backend/BaseRecordComponent.hpp"
#include "openPMD/backend/HierarchyVisitor.hpp"
#include "openPMD/backend/scientific_defaults/ScientificDefaults.hpp"

// comment to prevent this include from being moved by clang-format
#include "openPMD/DatatypeMacros.hpp"
Expand Down Expand Up @@ -110,7 +112,9 @@ namespace internal
template <typename>
class BaseRecord;

class RecordComponent : public BaseRecordComponent
class RecordComponent
: public BaseRecordComponent
, protected internal::ScientificDefaults
{
template <typename T, typename T_key, typename T_container>
friend class Container;
Expand All @@ -128,6 +132,8 @@ class RecordComponent : public BaseRecordComponent
friend class MeshRecordComponent;
template <typename T>
friend T &internal::makeOwning(T &self, Series);
friend class internal::ScientificDefaults;
friend class Attributable;

public:
enum class Allocation
Expand Down Expand Up @@ -482,11 +488,13 @@ class RecordComponent : public BaseRecordComponent
auto visit(Args &&...args) -> decltype(Visitor::template call<char>(
std::declval<RecordComponent &>(), std::forward<Args>(args)...));

void visitHierarchy(HierarchyVisitor &v, bool recursive) override;

static constexpr char const *const SCALAR = "\vScalar";

protected:
void flush(std::string const &, internal::FlushParams const &);
void read(bool require_unit_si);
void read();

private:
/**
Expand Down Expand Up @@ -534,12 +542,16 @@ OPENPMD_protected
BaseRecordComponent::setData(m_recordComponentData);
}

void readBase(bool require_unit_si);
void readBase();

template <typename T>
void verifyChunk(Offset const &, Extent const &) const;

void verifyChunk(Datatype, Offset const &, Extent const &) const;

protected:
void scientificDefaults_impl(
internal::WriteOrRead, OpenpmdStandard) override;
}; // RecordComponent

namespace internal
Expand Down
10 changes: 6 additions & 4 deletions include/openPMD/Series.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "openPMD/auxiliary/Variant.hpp"
#include "openPMD/backend/Attributable.hpp"
#include "openPMD/backend/Container.hpp"
#include "openPMD/backend/HierarchyVisitor.hpp"
#include "openPMD/backend/ParsePreference.hpp"
#include "openPMD/config.hpp"
#include "openPMD/snapshots/Snapshots.hpp"
Expand Down Expand Up @@ -64,7 +65,6 @@ namespace openPMD
class ReadIterations;
class StatefulIterator;
class Series;
class Series;

namespace internal
{
Expand Down Expand Up @@ -100,8 +100,8 @@ namespace internal
SeriesData &operator=(SeriesData &&) = delete;

using IterationIndex_t = Iteration::IterationIndex_t;
using IterationsContainer_t = Container<Iteration, IterationIndex_t>;
IterationsContainer_t iterations{};
using IterationsContainer_t = Iterations;
Iterations iterations{};

/**
* Series::readIterations() returns an iterator type that modifies the
Expand Down Expand Up @@ -385,7 +385,7 @@ class Series : public Attributable
* Type for a container of Iterations indexed by IterationIndex_t.
*/
using IterationsContainer_t = internal::SeriesData::IterationsContainer_t;
IterationsContainer_t iterations;
Iterations iterations;

/**
* @brief Is this a usable Series object?
Expand Down Expand Up @@ -778,6 +778,8 @@ class Series : public Attributable
*/
void close();

void visitHierarchy(HierarchyVisitor &v, bool recursive) override;

/**
* This overrides Attributable::iterationFlush() which will fail on Series.
*/
Expand Down
Loading
Loading