Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
wgroup_ids.hpp
Go to the documentation of this file.
1#ifndef WGROUP_IDS_H
2#define WGROUP_IDS_H
3
4#include "generic_mapper.h"
5#include "Map.h"
6#include "scaletype_ids.hpp"
7#include "wilsonbasis_ids.hpp"
8
27inline const std::map<WGroup, std::string>& group_external_mapping(){
28 static const std::map<WGroup, std::string> empty{};
29 return empty;
30}
31
33struct WGroupTag {};
34
37
58 WGroupTag,
59 WGroup,
60 std::string,
61 std::hash<std::string>,
62 group_mapping,
63 group_external_mapping
64 >
65{
66public:
68 WGroupTag, WGroup, std::string, std::hash<std::string>,
70 >;
71
73 using Base::id_of;
74 using Base::list_all;
77 using Base::to_id; // WGroup -> WGroupId
78 using Base::enum_of; // WGroupId -> optional<WGroup>
79 using Base::str; // overloads: str(WGroupId) and str(WGroup)
80 using Base::enum_elt; // string -> WGroupId (keeps new runtime id API)
81 using Base::enum_elt_legacy;// string -> WGroup (legacy enum API)
82
94 static bool register_custom(std::string canonical,
95 std::vector<std::string> aliases = {},
96 std::optional<std::string> ext = std::nullopt)
97 {
98 return Base::register_custom(std::move(canonical), std::move(aliases), std::move(ext));
99 }
100
114 static std::string str(const WGroupId& gid, ScaleType s, WilsonBasis b = WilsonBasis::B_STANDARD){
115 return str_impl(gid.str(), s, b);
116 }
117
130 return str_impl(Base::str(g), s, b);
131 }
132
133private:
137 static std::string str_impl(const std::string& base, ScaleType s, WilsonBasis b){
138 std::string out = base + "_" + ScaleTypeMapper::str(s);
139 if (s == ScaleType::HADRONIC) out += "_" + WilsonBasisMapper::str(b);
140 return out;
141 }
142};
143
144#endif
WilsonBasis
ScaleType
WGroup
const std::map< WGroup, std::string > & group_mapping()
Returns the mapping between WGroup and its string representation.
Definition Map.cpp:1123
Static mappings between enum classes and string (or FLHA) identifiers.
static std::string str(const IdOf< ScaleTypeTag > &id)
Returns the string representation associated with an identifier.
Generic enum↔string mapper with external keys and dynamic aliases.
static bool register_custom(std::string canonical, std::vector< std::string > aliases={}, std::optional< std::string > ext=std::nullopt)
Registers a custom entry with optional external key.
static std::vector< IdOf< WGroupTag > > list_all()
Lists all distinct identifiers currently registered.
static WGroup enum_elt_legacy(std::string_view s)
Legacy enum lookup using only the static MapFn() table.
static std::optional< std::string > external_of(const IdOf< WGroupTag > &id)
Returns the external key associated with a given identifier.
static std::optional< WGroup > enum_of(const IdOf< WGroupTag > &id)
Attempts to recover the enum value associated with an identifier.
static IdOf< WGroupTag > enum_elt(std::string_view s)
Alias for id_of(), kept for compatibility.
static std::optional< IdOf< WGroupTag > > from_external(const std::string &k)
Resolves an external key into an identifier.
static IdOf< WGroupTag > id_of(std::string_view s)
Resolves a string into an IdOf<Tag> via the registry.
static std::string str(const IdOf< WGroupTag > &id)
Returns the string representation of an identifier.
Mapper for WGroup <-> WGroupId <-> optional external string.
static std::string str(const WGroupId &gid, ScaleType s, WilsonBasis b=WilsonBasis::B_STANDARD)
Builds a composite block name using a WGroupId, scale and basis.
static bool register_custom(std::string canonical, std::vector< std::string > aliases={}, std::optional< std::string > ext=std::nullopt)
Registers a custom Wilson group with optional external label.
static std::string str(WGroup g, ScaleType s, WilsonBasis b=WilsonBasis::B_STANDARD)
Builds a composite block name using a WGroup enum, scale and basis.
Returns an uppercase copy of the input string.
const std::string & str() const
Returns the underlying string.
constexpr double g
Generic enum↔string (and optional external key) mappers built on DynamicRegistry.
Tag type for Wilson-group identifiers.
const std::map< WGroup, std::string > & group_external_mapping()
Placeholder for a WGroup -> external string mapping.