Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
08eb916
Base structure for scientific defaults
franzpoeschel Jan 12, 2026
faf1670
Start adding defaults
franzpoeschel Jan 12, 2026
6e034a9
debugging output
franzpoeschel Jan 12, 2026
2ddef6e
Fixes
franzpoeschel Jan 12, 2026
8fd66f9
BaseRecord --> unitDimension
franzpoeschel Jan 12, 2026
3b2eb72
nunja hehe
franzpoeschel Jan 12, 2026
31f6b21
Fixes
franzpoeschel Jan 12, 2026
b22f816
Further fixes
franzpoeschel Jan 13, 2026
f33ff57
further fixes
franzpoeschel Jan 13, 2026
ee09603
tests temporarily passing :D
franzpoeschel Jan 13, 2026
994a6eb
Cleanup
franzpoeschel Jan 13, 2026
121b9b4
UnitDimension for position/positionOffset
franzpoeschel Jan 13, 2026
b09c386
WIP: RecordComponent stuff
franzpoeschel Jan 13, 2026
17dcadd
Fix coretests
franzpoeschel Jan 14, 2026
50864a9
Clean up Iteration finalizing logic
franzpoeschel Jan 14, 2026
ff7252b
Add defaults for Iteration class
franzpoeschel Jan 14, 2026
26afddb
Fix variadic template template parameters
franzpoeschel Jan 15, 2026
2caac49
Remove flush-time check for populized components
franzpoeschel Jan 16, 2026
c25606b
Make the default specification more flexible
franzpoeschel Jan 16, 2026
0d6a852
WIP
franzpoeschel Jan 20, 2026
003547c
continue
franzpoeschel Jan 20, 2026
7360a36
Split this into internal and public header
franzpoeschel Jan 21, 2026
fcef505
Distinguish writing from reading
franzpoeschel Jan 21, 2026
5ca0859
Tests now working again
franzpoeschel Jan 21, 2026
aa5d94c
Mostly move Mesh reading to ScientificDefaults
franzpoeschel Jan 21, 2026
c3f9e0b
Fix type conversions between char and string
franzpoeschel Jan 21, 2026
357ee0b
Somewhat working Mesh reading
franzpoeschel Jan 21, 2026
e1f0ea7
Fix little parent call bug
franzpoeschel Jan 22, 2026
7495b11
Mention expected datatypes in attribute reading error messages
franzpoeschel Jan 22, 2026
ef3a590
Move Iteration reading to ScientificDefaults class
franzpoeschel Jan 22, 2026
2c9441b
Introduce genericsetter, use for unitDimension
franzpoeschel Jan 22, 2026
027d70f
Record / BaseRecord Reading
franzpoeschel Jan 22, 2026
093b7f5
Readers for everything now except version-dependent stuff
franzpoeschel Jan 22, 2026
0b41570
Add gridUnitDimension in ScientificDefaults
franzpoeschel Jan 23, 2026
dc05ccb
Do not use templates for defaults setter
franzpoeschel Jan 26, 2026
f93a194
Wew NewAttributeReader
franzpoeschel Jan 27, 2026
ff640b1
Fixes
franzpoeschel Jan 27, 2026
1d556ee
Fixes
franzpoeschel Jan 27, 2026
ab74bbd
Defaults for patchRecord
franzpoeschel Jan 27, 2026
3982624
Adapt PatchRecordComponent
franzpoeschel Jan 27, 2026
df2e6d2
Fixes
franzpoeschel Jan 27, 2026
bfe290e
Cleanup
franzpoeschel Jan 28, 2026
4306430
Cleanup
franzpoeschel Jan 28, 2026
066bcd1
Avoid overcomplex attribute type conversions
franzpoeschel Jan 28, 2026
3240e76
reduce binary size a bit
franzpoeschel Jan 28, 2026
5a55a55
Try further reducing amount of lambdas...
franzpoeschel Jan 28, 2026
f21e264
Annotate MB sizes
franzpoeschel Jan 28, 2026
4f3b143
Reduce implementation sizes for RequireScalar / RequireVector
franzpoeschel Jan 29, 2026
5507d62
vibe-coded suggestions for size optimization
franzpoeschel Jan 29, 2026
1d733bd
Avoid using lambdas for require_type
franzpoeschel Jan 29, 2026
761e08a
Change code order
franzpoeschel Jan 29, 2026
d67ccc7
Replace if constexpr with SFINAE
franzpoeschel Jan 30, 2026
eacad1f
Fix nvhpc/msvc builds
franzpoeschel Jan 30, 2026
ffdb4f5
doxygen fix
franzpoeschel Feb 2, 2026
62fd923
Cleanup
franzpoeschel Feb 4, 2026
24e2d63
scientificdefaults_internal.cpp
franzpoeschel Feb 24, 2026
5f9c6ae
Add visitor pattern
franzpoeschel Feb 24, 2026
4003c6d
wip: ScientificDefaults without CRT
franzpoeschel Feb 24, 2026
3f627d6
Move defaults impl to classes
franzpoeschel Feb 24, 2026
836adc7
Fix visitHierarchy
franzpoeschel Feb 24, 2026
f22213f
Fix visithierarchy
franzpoeschel Feb 24, 2026
e20e658
Compiles
franzpoeschel Feb 24, 2026
adc0907
Fix inheritance issue
franzpoeschel Feb 25, 2026
cf30f7d
Cleanup
franzpoeschel Mar 3, 2026
92478f8
Move files
franzpoeschel Mar 3, 2026
db95cbb
Split files
franzpoeschel Mar 3, 2026
53e31f1
Cleanup, documentation
franzpoeschel Mar 3, 2026
377af76
Fix JSON backend bug when missing attributes
franzpoeschel Mar 3, 2026
36e464c
Fix bug with metadata set too late
franzpoeschel Mar 20, 2026
ada85a2
Write defaults upon flush, thats good enough actually
franzpoeschel Mar 25, 2026
ffa37f4
Flush structural info of resetDataset() to backend immediately
franzpoeschel Mar 11, 2026
eeee3cd
Erase flushMeshes/ParticlesPath
franzpoeschel Mar 11, 2026
c314ffd
Move flushing from storeChunk to resetDataset
franzpoeschel Mar 11, 2026
05922f0
Hmm, move CREATE_DATASET task back to storeChunk
franzpoeschel Mar 12, 2026
52a0c8d
Fix attribute flushing logic
franzpoeschel Mar 12, 2026
4738ebb
flush mode helpers
franzpoeschel Jan 14, 2026
f0b7f52
Fix dirty handling
franzpoeschel Jan 14, 2026
70ea47e
Add TODO comment
franzpoeschel Mar 12, 2026
e32a0a1
WIP Runtime verification of flush level
franzpoeschel Mar 12, 2026
213d5d7
dont flush to IO handler yet in resetDataset
franzpoeschel Mar 13, 2026
8ae23ca
Revert "dont flush to IO handler yet in resetDataset"
franzpoeschel Mar 13, 2026
a39f630
Continue fixing and breaking things..
franzpoeschel Mar 13, 2026
88d35f5
Fix API call after rebase
franzpoeschel Mar 16, 2026
9feaf30
Fix dirty handling filebased
franzpoeschel Mar 16, 2026
96a704c
TMP REVERT ME: deactivate span table tests
franzpoeschel Mar 16, 2026
07fb558
TMP REVERT ME take out hanging parallel test
franzpoeschel Mar 16, 2026
8058f15
Fix ranktable logic
franzpoeschel Mar 27, 2026
e0b089e
Take out the next hanging parallel test
franzpoeschel Mar 27, 2026
58ea0a4
Separate MPI tests by MPI barriers
franzpoeschel Mar 27, 2026
6731a76
Fix wrong MPI_COMM_WORLD
franzpoeschel Mar 27, 2026
c4b450e
wip: debugging state
franzpoeschel Mar 27, 2026
2f719e7
deactivate malicious tests
franzpoeschel Mar 30, 2026
304b370
Consistently set written / not written
franzpoeschel Mar 30, 2026
1e8a6b7
Revert "deactivate malicious tests"
franzpoeschel Mar 30, 2026
38d3852
Revert "wip: debugging state"
franzpoeschel Mar 30, 2026
edd8545
Revert "TMP REVERT ME take out hanging parallel test"
franzpoeschel Mar 30, 2026
e61b646
Fix flushing of ADIOS2 files
franzpoeschel Mar 30, 2026
4fcb328
Revert some WIPs
franzpoeschel Mar 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
62 changes: 62 additions & 0 deletions include/openPMD/IO/AbstractIOHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "openPMD/IterationEncoding.hpp"
#include "openPMD/config.hpp"
#include "openPMD/version.hpp"
#include <ostream>

#if openPMD_HAVE_MPI
#include <mpi.h>
Expand Down Expand Up @@ -81,6 +82,66 @@ enum class FlushLevel
CreateOrOpenFiles
};

std::ostream &operator<<(std::ostream &, FlushLevel);

namespace flush_level
{
inline constexpr auto global_flushpoint(FlushLevel fl)
{
switch (fl)
{
case FlushLevel::UserFlush:
return true;
case FlushLevel::InternalFlush:
case FlushLevel::SkeletonOnly:
case FlushLevel::CreateOrOpenFiles:
return false;
}
return false; // unreachable
}
// same as global_flushpoint for now, but we will soon introduce
// immediate_flush
inline constexpr auto write_datasets(FlushLevel fl)
{
switch (fl)
{
case FlushLevel::UserFlush:
return true;
case FlushLevel::InternalFlush:
case FlushLevel::SkeletonOnly:
case FlushLevel::CreateOrOpenFiles:
return false;
}
return false; // unreachable
}
inline constexpr auto write_attributes(FlushLevel fl)
{
switch (fl)
{
case FlushLevel::UserFlush:
case FlushLevel::InternalFlush:
return true;
case FlushLevel::SkeletonOnly:
case FlushLevel::CreateOrOpenFiles:
return false;
}
return false; // unreachable
}
inline constexpr auto flush_hierarchy(FlushLevel fl)
{
switch (fl)
{
case FlushLevel::UserFlush:
case FlushLevel::InternalFlush:
case FlushLevel::SkeletonOnly:
return true;
case FlushLevel::CreateOrOpenFiles:
return false;
}
return false; // unreachable
}
} // namespace flush_level

enum class OpenpmdStandard
{
v_1_0_0,
Expand Down Expand Up @@ -121,6 +182,7 @@ namespace internal
* To be used for reading
*/
FlushParams const defaultFlushParams{};
FlushParams const publicFlush{FlushLevel::UserFlush};

struct ParsedFlushParams;

Expand Down
2 changes: 1 addition & 1 deletion include/openPMD/IO/AbstractIOHandlerImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class AbstractIOHandlerImpl

virtual ~AbstractIOHandlerImpl() = default;

std::future<void> flush();
std::future<void> flush(FlushLevel);

/**
* Close the file corresponding with the writable and release file handles.
Expand Down
7 changes: 5 additions & 2 deletions include/openPMD/IO/AbstractIOHandlerImplCommon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
#include "openPMD/auxiliary/StringManip.hpp"
#include "openPMD/backend/Writable.hpp"

#include <set>
#include <stdexcept>
#include <string>
#include <unordered_map>
#include <unordered_set>

namespace openPMD
{
Expand All @@ -50,7 +50,10 @@ class AbstractIOHandlerImplCommon : public AbstractIOHandlerImpl
* without the OS path
*/
std::unordered_map<Writable *, InvalidatableFile> m_files;
std::unordered_set<InvalidatableFile> m_dirty;
// MUST be an ordered set in order to consistently flush on different
// parallel processes (same logic cant apply to m_files since Writable*
// pointers are not predictable)
std::set<InvalidatableFile> m_dirty;

enum PossiblyExisting
{
Expand Down
3 changes: 3 additions & 0 deletions include/openPMD/IO/IOTask.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <cstddef>
#include <memory>
#include <optional>
#include <ostream>
#include <string>
#include <utility>
#include <variant>
Expand Down Expand Up @@ -89,6 +90,8 @@ OPENPMDAPI_EXPORT_ENUM_CLASS(Operation){
}; // note: if you change the enum members here, please update
// docs/source/dev/design.rst

std::ostream &operator<<(std::ostream &os, Operation op);

namespace internal
{
/*
Expand Down
10 changes: 10 additions & 0 deletions include/openPMD/IO/InvalidatableFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,14 @@ struct hash<openPMD::InvalidatableFile>

result_type operator()(argument_type const &s) const noexcept;
};

template <>
struct less<openPMD::InvalidatableFile>
{
using first_argument_type = openPMD::InvalidatableFile;
using second_argument_type = first_argument_type;
using result_type = typename std::less<std::string>::result_type;
result_type
operator()(first_argument_type const &, second_argument_type const &) const;
};
} // namespace std
2 changes: 1 addition & 1 deletion include/openPMD/IO/JSON/JSONIOHandlerImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class JSONIOHandlerImpl : public AbstractIOHandlerImpl

void touch(Writable *, Parameter<Operation::TOUCH> const &) override;

std::future<void> flush();
std::future<void> flush(internal::ParsedFlushParams &params);

private:
#if openPMD_HAVE_MPI
Expand Down
24 changes: 22 additions & 2 deletions include/openPMD/Iteration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "openPMD/auxiliary/Variant.hpp"
#include "openPMD/backend/Attributable.hpp"
#include "openPMD/backend/Container.hpp"
#include "openPMD/backend/scientific_defaults/ScientificDefaults.hpp"

#include <cstdint>
#include <deque>
Expand Down Expand Up @@ -151,7 +152,9 @@ namespace internal
* @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 +167,7 @@ class Iteration : public Attributable
friend class StatefulSnapshotsContainer;
template <typename>
friend struct traits::GenerationPolicy;
friend class internal::ScientificDefaults;

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

template <typename Visitor>
void visitHierarchy(Visitor &&v)
{
v(*this);
meshes.visitHierarchy(v);
particles.visitHierarchy(v);
}

// TODO: make this available on every class that inherits from
// scientificdefaults for this, somehow make visitHierarchy a non-template,
// so we can use it as a virtual function of attributable
void populateDefaultMetadata();

Container<Mesh> meshes{};
Container<ParticleSpecies> particles{}; // particleSpecies?

Expand Down Expand Up @@ -442,14 +459,17 @@ 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(bool write, OpenpmdStandard) override;
}; // Iteration

namespace traits
Expand Down
7 changes: 7 additions & 0 deletions include/openPMD/Mesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
#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 <ostream>
#include <string>
Expand All @@ -41,6 +43,7 @@ class Mesh : public BaseRecord<MeshRecordComponent>
{
friend class Container<Mesh>;
friend class Iteration;
friend class internal::ScientificDefaults;

public:
Mesh(Mesh const &) = default;
Expand Down Expand Up @@ -328,6 +331,10 @@ class Mesh : public BaseRecord<MeshRecordComponent>
void
flush_impl(std::string const &, internal::FlushParams const &) override;
void read();
auto retrieveDimensionality() const -> uint64_t;

protected:
void scientificDefaults_impl(bool write, OpenpmdStandard) override;
}; // Mesh

template <typename T>
Expand Down
16 changes: 15 additions & 1 deletion include/openPMD/ParticleSpecies.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,34 @@
#include "openPMD/Record.hpp"
#include "openPMD/backend/Attributable.hpp"
#include "openPMD/backend/Container.hpp"
#include "openPMD/backend/scientific_defaults/ScientificDefaults.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;

public:
ParticlePatches particlePatches;

template <typename Visitor>
void visitHierarchy(Visitor &&v)
{
Container<Record>::visitHierarchy(v);
particlePatches.visitHierarchy(v);
}

private:
ParticleSpecies();

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

protected:
void scientificDefaults_impl(bool write, OpenpmdStandard) override;
};

namespace traits
Expand Down
5 changes: 5 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 @@ -55,6 +57,9 @@ class Record : public BaseRecord<RecordComponent>
flush_impl(std::string const &, internal::FlushParams const &) override;

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

protected:
void scientificDefaults_impl(bool write, OpenpmdStandard) override;
}; // Record

template <typename T>
Expand Down
19 changes: 16 additions & 3 deletions include/openPMD/RecordComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "openPMD/auxiliary/UniquePtr.hpp"
#include "openPMD/backend/Attributable.hpp"
#include "openPMD/backend/BaseRecordComponent.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 +111,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 +131,7 @@ class RecordComponent : public BaseRecordComponent
friend class MeshRecordComponent;
template <typename T>
friend T &internal::makeOwning(T &self, Series);
friend class internal::ScientificDefaults;

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

template <typename Visitor>
void visitHierarchy(Visitor &&v)
{
v(*this);
}

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 +544,15 @@ 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(bool write, OpenpmdStandard) override;
}; // RecordComponent

namespace internal
Expand Down
Loading
Loading