include/pops/runtime/dynamic/model_registry.hpp File ReferenceΒΆ

adc_cpp: include/pops/runtime/dynamic/model_registry.hpp File Reference
adc_cpp 0.3.0
Model-free C++23 core for coupled hyperbolic-elliptic systems on adaptive (AMR) meshes, with MPI and GPU (Kokkos) backends
model_registry.hpp File Reference

SINGLE registry of builtin MODEL BRICK tags (transport / source / elliptic): the shared source of truth for every model dispatch – detail::dispatch_transport / dispatch_source / dispatch_elliptic (model_factory.hpp), the polar dispatch (block_builder_polar.hpp) and the per-transport seams in python/system.cpp / python/amr_system.cpp. More...

#include <cstddef>
#include <stdexcept>
#include <string>
+ Include dependency graph for model_registry.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pops::TransportTag
 Builtin TRANSPORT brick tag. More...
 
struct  pops::SourceTag
 Builtin SOURCE brick tag. More...
 
struct  pops::EllipticTag
 Builtin ELLIPTIC right-hand-side brick tag. More...
 

Namespaces

namespace  pops
 
namespace  pops::detail
 

Functions

template<class TagT , std::size_t N>
std::string pops::detail::join_tag_names (const TagT(&tbl)[N], const char *sep, bool quote)
 Joins the name field of a tag table into "a<sep>b<sep>..." (optionally each name single-quoted).
 
std::string pops::transport_tags_csv (bool polar=false)
 Pipe list of transport tags ("exb|compressible|isothermal"), as used in the dispatch rejection messages.
 
std::string pops::source_tags_csv ()
 Pipe list of source / elliptic tags (e.g. "charge|background|gravity").
 
std::string pops::elliptic_tags_csv ()
 
std::string pops::transport_choices ()
 Quoted " | "-separated choices (e.g.
 
std::string pops::source_choices ()
 
std::string pops::elliptic_choices ()
 
bool pops::is_transport (const std::string &tag)
 Membership against the builtin tables.
 
bool pops::is_source (const std::string &tag)
 
bool pops::is_elliptic (const std::string &tag)
 
int pops::transport_n_vars (const std::string &tag)
 Conservative-variable count of a transport tag (source of truth for the static_assert below), or -1 if unknown.
 
constexpr int pops::transport_n_vars_ct (const char *name)
 
std::string pops::unknown_transport_msg (const std::string &tag)
 Rejection message for an unknown transport / elliptic tag, BYTE-IDENTICAL to the historical inline throws (the tag list now comes from the SINGLE table).
 
std::string pops::unknown_elliptic_msg (const std::string &tag)
 
void pops::validate_transport (const std::string &tag)
 Validates a transport / elliptic tag against the builtin registry.
 
void pops::validate_elliptic (const std::string &tag)
 

Variables

constexpr TransportTag pops::kTransports []
 SINGLE SOURCE of the builtin transports (order = historical display priority, used by the CSV / choices messages).
 
constexpr SourceTag pops::kSources []
 SINGLE SOURCE of the builtin sources.
 
constexpr EllipticTag pops::kElliptics []
 SINGLE SOURCE of the builtin elliptic right-hand sides.
 

Detailed Description

SINGLE registry of builtin MODEL BRICK tags (transport / source / elliptic): the shared source of truth for every model dispatch – detail::dispatch_transport / dispatch_source / dispatch_elliptic (model_factory.hpp), the polar dispatch (block_builder_polar.hpp) and the per-transport seams in python/system.cpp / python/amr_system.cpp.

Counterpart of dispatch_tags.hpp (limiters + Riemann fluxes) for the MODEL axis. Before this header each model dispatch inlined its OWN tag list inside its rejection message: the transport list (exb|compressible|isothermal) was repeated in FIVE sites and the source / elliptic lists once each. Adding a builtin brick then meant editing every message by hand, with silent drift if one was forgotten. Here: ONE kTransports / kSources / kElliptics table plus ONE set of CSV / choices / validation helpers (messages STRICTLY identical to the old inline throws), so a new builtin brick is ONE table row plus its compile-time dispatch case.

LIGHT by design (no brick TYPE dependency: only names + small integer capability metadata): it stays included early and cost-free, exactly like dispatch_tags.hpp, and can drive validate_model_spec without pulling physics/bricks.hpp. The string->TYPE dispatch stays an if / if constexpr per call-site (the brick types are COMPILE-TIME, not tabulable); the registry is the source of truth for the VALID TAG LIST + the rejection messages, while a non-drift static_assert on the model_factory.hpp side (which sees BOTH the table and the brick types) locks the n_vars column against the real bricks.

This is the "registry of builtin bricks" layer of ADC-331, kept distinct from the ModelSpec / capabilities surface (model_spec.hpp) and from the compiled / native backend (the dispatch, which MAY close some combinations – e.g. compressible is not wired in polar geometry, a fluid source needs a transport with >= 3 variables). The capability columns (polar_ok, min_vars) document those supported-vs-not-routed combinations as DATA, read directly by the tests and docs.