include/pops/core/state/aux_names.hpp Source FileΒΆ

adc_cpp: include/pops/core/state/aux_names.hpp Source File
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
aux_names.hpp
Go to the documentation of this file.
1
11
12#pragma once
13
14#include <string_view>
15#include <utility>
16
18
19namespace pops {
20
25inline constexpr std::pair<std::string_view, int> kAuxCanonicalNames[] = {
26 {"phi", 0},
27 {"grad_x", 1},
28 {"grad_y", 2},
29#define POPS_AUX_NAME_ENTRY(name, idx) {#name, idx},
31#undef POPS_AUX_NAME_ENTRY
32};
33
36constexpr int aux_canonical_index(std::string_view name) {
37 for (const auto& [n, c] : kAuxCanonicalNames)
38 if (n == name)
39 return c;
40 return -1;
41}
42
45constexpr std::string_view aux_canonical_name(int comp) {
46 for (const auto& [n, c] : kAuxCanonicalNames)
47 if (c == comp)
48 return n;
49 return {};
50}
51
52} // namespace pops
#define POPS_AUX_NAME_ENTRY(name, idx)
Definition amr_hierarchy.hpp:29
constexpr int aux_canonical_index(std::string_view name)
Component of the CANONICAL aux field name, or -1 if name is not a canonical field (it may then be a m...
Definition aux_names.hpp:36
constexpr std::string_view aux_canonical_name(int comp)
Inverse: CANONICAL name of component comp, or an empty view if comp is not a canonical component (e....
Definition aux_names.hpp:45
constexpr std::pair< std::string_view, int > kAuxCanonicalNames[]
CANONICAL aux name -> component table (mirror of AUX_CANONICAL on the DSL side).
Definition aux_names.hpp:25
Pointwise types of the physics layer: StateVec<N> (conserved state) and Aux (auxiliary fields from th...
#define POPS_AUX_FIELDS(X)
SINGLE SOURCE of the layout of the EXTRA aux fields (X-macro).
Definition state.hpp:92