|
DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
|
Per-type configuration field registry with JSON serialization, JSON Schema (draft-07) emission, and cross-field validation. More...
#include "Defines.hpp"#include "JsonUtil.hpp"#include "Errors.hpp"#include <string>#include <vector>#include <map>#include <functional>#include <optional>#include <stdexcept>#include <fmt/core.h>Go to the source code of this file.
Classes | |
| struct | DNDS::CheckResult |
| Result of a single validation check. More... | |
| struct | DNDS::ConfigContext |
| Runtime context supplied to context-aware validation checks. More... | |
| struct | DNDS::FieldMeta |
| Descriptor for a single configuration field. More... | |
| class | DNDS::ConfigRegistry< T > |
| Per-type singleton registry of config field metadata and validation checks. More... | |
Namespaces | |
| namespace | DNDS |
| the host side operators are provided as implemented | |
Typedefs | |
| using | DNDS::CrossFieldCheck = std::function< CheckResult(const void *obj)> |
| A cross-field validation check that does not require runtime context. | |
| using | DNDS::ContextualCheck = std::function< CheckResult(const void *obj, const ConfigContext &ctx)> |
| A cross-field validation check that requires runtime context. | |
Enumerations | |
| enum class | DNDS::ConfigTypeTag { DNDS::Bool , DNDS::Int , DNDS::Real , DNDS::String , DNDS::Enum , DNDS::Array , DNDS::Object , DNDS::ArrayOfObjects , DNDS::MapOfObjects , DNDS::Json } |
| Enumerates the JSON Schema type associated with a config field. More... | |
Per-type configuration field registry with JSON serialization, JSON Schema (draft-07) emission, and cross-field validation.
ConfigRegistry<T> is a singleton that stores, for each config struct T:
FieldMeta descriptors (one per JSON-visible member).The registry is populated lazily on first use by the DNDS_DECLARE_CONFIG machinery in ConfigParam.hpp. It never affects the layout or trivial copyability of T itself — all metadata lives in static singletons, so T remains a POD struct safe for CUDA device views.
DNDS_DECLARE_CONFIG generates only static methods and friend functions. The struct has no base class, no virtual methods, and no added instance data. Structs embedded in CUDA device views (e.g. FiniteVolumeSettings) remain trivially copyable.FieldMeta stores std::function lambdas for read, write, and schema emission. These capture a pointer-to-member and live only in host-side static storage.readField closure at parse time. Multi-field constraints (mutual exclusion, conditional requirements, derived-value consistency) are registered as standalone check lambdas via config.check() / config.check_ctx().nVars, model). These use ConfigContext, passed to validateWithContext().DNDS_NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_ORDERED_JSON keep working. The --emit-schema flag falls back to type-inference from default JSON for unmigrated sections. Migrated and unmigrated sections coexist.Users interact with this file indirectly through ConfigParam.hpp:
Direct registry access (for tooling, --emit-schema, etc.):
Definition in file ConfigRegistry.hpp.