include/pops/core/state/variables.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
|
Descriptor of a model's variables (Vars). More...
#include <stdexcept>#include <string>#include <vector>
Include dependency graph for variables.hpp:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Classes | |
| struct | pops::Variable |
| A variable: name, physical role, component index in the state. More... | |
| struct | pops::VariableSet |
A model's variable set: kind (cons/prim), names, size, canonical roles (optional, parallel to names; absent -> Custom), and user_roles (optional string labels parallel to names, for components whose role is OUTSIDE the canonical enum). More... | |
Namespaces | |
| namespace | pops |
Macros | |
| #define | POPS_EXPORT_BLOCK_METADATA(MODEL) |
| Exports the OPTIONAL "names + roles" metadata of a .so block via extern "C" symbols read by dlsym on the System side. | |
| #define | POPS_EXPORT_BLOCK_GAMMA(GAMMA) |
| Exports the block's gamma (adiabatic index) via the optional symbol pops_compiled_gamma, read by the System's inter-species couplings (collision, thermal exchange, T_e). | |
Typedefs | |
| using | pops::Variables = VariableSet |
Old name (compat): VariableSet used to be Variables. Kept for existing and generated code. | |
Enumerations | |
| enum class | pops::VariableKind { pops::Conservative , pops::Primitive } |
| Kind of a variable set: conserved (U) or primitive (W). More... | |
| enum class | pops::VariableRole { pops::Density , pops::MomentumX , pops::MomentumY , pops::MomentumZ , pops::Energy , pops::VelocityX , pops::VelocityY , pops::VelocityZ , pops::Pressure , pops::Temperature , pops::Scalar , pops::Custom } |
| PHYSICAL role of a component. More... | |
Functions | |
| VariableRole | pops::role_from_name (const std::string &s) |
| Forward declaration: VariableSet::index_of(const std::string&) resolves a canonical role NAME via role_from_name (defined below) before matching a user-defined role label. | |
| const char * | pops::role_name (VariableRole r) |
| Human-readable name of a role (introspection, Python binding). | |
| std::string | pops::names_csv (const VariableSet &vs) |
| CSV of a VariableSet's names (separator ','). | |
| std::string | pops::roles_csv (const VariableSet &vs) |
| CSV of a VariableSet's roles (role_name, separator ','). | |
| void | pops::parse_roles_into (VariableSet &vs, const std::string &csv) |
Inverse of roles_csv: fill vs.roles (and vs.user_roles for any NON-canonical token) from a roles CSV. | |
| int | pops::coupling_role_index (const VariableSet &vs, VariableRole role, int fallback, const char *origin, const std::string &block) |
Resolve a REQUIRED canonical role to its component in vs, for a NAMED coupling (add_collision / add_thermal_exchange / ionization) that historically targeted the canonical layout. | |
| template<class Model > | |
| std::string | pops::var_names_meta () |
| A model's "names" metadata: "cons_csv|prim_csv" (separator '|' between the two sets). | |
| template<class Model > | |
| std::string | pops::roles_meta () |
| A model's "roles" metadata: "cons_roles_csv|prim_roles_csv" (empty side = roles not provided). | |
Detailed Description
Descriptor of a model's variables (Vars).
Carried by the HYPERBOLIC brick (along with the flux and the conversions), because variables and flux are physically linked; this is NOT a standalone brick that can be combined freely.
Variables DESCRIBES the variables (conservative or primitive): kind, names, size. It is HOST metadata (it does not drive the computation, which works per component via the cons<->prim conversions), but it is a MANDATORY CONTRACT of the hyperbolic model (HyperbolicModel concept): conservative_vars() and primitive_vars(). Used for introspection, named diagnostics, and labelled output.
Macro Definition Documentation
◆ POPS_EXPORT_BLOCK_GAMMA
| #define POPS_EXPORT_BLOCK_GAMMA | ( | GAMMA | ) |
Exports the block's gamma (adiabatic index) via the optional symbol pops_compiled_gamma, read by the System's inter-species couplings (collision, thermal exchange, T_e).
EMITTED ONLY if the model declares a gamma: otherwise the symbol stays absent and the System keeps its default 1.4.
◆ POPS_EXPORT_BLOCK_METADATA
| #define POPS_EXPORT_BLOCK_METADATA | ( | MODEL | ) |
Exports the OPTIONAL "names + roles" metadata of a .so block via extern "C" symbols read by dlsym on the System side.
SHARED by the two generated backends (AOT compiled_block and JIT dynamic_model): the lost metadata (names/roles) is carried without breaking the flat ABI. BACKWARD-COMPATIBLE: a .so that does not define these symbols (generated before this work) stays valid – the System does not find the symbol and falls back (names u0.., no roles). MODEL = type of the model (carries conservative_vars / primitive_vars).
Generated by