Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
WilsonCoefficientRegistry.h
Go to the documentation of this file.
1#ifndef WILSON_COEFFICIENT_REGISTRY_H
2#define WILSON_COEFFICIENT_REGISTRY_H
3
4#include <functional>
5#include <memory>
6#include <unordered_map>
7
8#include "GroupDefinition.h"
9#include "Wilson.h"
10
61using CoefPtr = std::shared_ptr<WilsonCoefficient>;
62
64using CoefMaker = std::function<CoefPtr(const BuildContext&, WCoef)>;
65
81public:
91 table_[key(c,m,b)] = std::move(mk);
92 }
93
108 CoefPtr create(const BuildContext& ctx, WCoef c) const;
109private:
116 struct Key {
117 int c;
118 int m;
119 int b;
120 bool operator==(const Key& o) const noexcept {
121 return c==o.c && m==o.m && b==o.b;
122 }
123 };
124
131 struct KeyHash {
132 std::size_t operator()(const Key& k) const noexcept {
133 // hash (boost-like)
134 std::size_t h = std::hash<int>{}(k.c);
135 h ^= std::hash<int>{}(k.m) + 0x9e3779b97f4a7c15ULL + (h<<6) + (h>>2);
136 h ^= std::hash<int>{}(k.b) + 0x9e3779b97f4a7c15ULL + (h<<6) + (h>>2);
137 return h;
138 }
139 };
140
142 static Key key(WCoef c, Model m, Backend b) {
143 return Key{(int)c, (int)m, (int)b};
144 }
145
147 std::unordered_map<Key, CoefMaker, KeyHash> table_;
148};
149
158
163
168
173
178
183
188
193
198
203
208
209#endif
bool operator==(const std::string &lhs, const BlockName &rhs)
Symmetric comparison between std::string and BlockName.
Definition BlockName.h:335
Model
WCoef
Declarative registry describing Wilson coefficient groups, their sources, and setup hooks.
Backend
void register_CC_bu(CoefficientRegistry &)
Registers coefficient factories for charged-current b->u (C_V1_bu, ...).
void register_BPrime(CoefficientRegistry &)
Registers coefficient factories for the B' group (CP1..CP10, CPQ1, CPQ2).
void register_CC_su(CoefficientRegistry &)
Registers coefficient factories for charged-current s->u (C_V1_su, ...).
void register_B(CoefficientRegistry &)
Registers coefficient factories for the B group (C1..C10).
std::shared_ptr< WilsonCoefficient > CoefPtr
Shared pointer type used to store coefficients in groups.
void register_BScalar(CoefficientRegistry &)
Registers coefficient factories for the scalar B group (CQ1, CQ2).
void register_K(CoefficientRegistry &reg)
Registers coefficient factories for the K group (CK9, CK10, ...).
std::function< CoefPtr(const BuildContext &, WCoef)> CoefMaker
Factory signature for constructing a coefficient instance given a build context and enum id.
void register_CC_cs(CoefficientRegistry &)
Registers coefficient factories for charged-current c->s (C_V1_cs, ...).
void register_CC_du(CoefficientRegistry &)
Registers coefficient factories for charged-current d->u (C_V1_du, ...).
void register_CC_bc(CoefficientRegistry &)
Registers coefficient factories for charged-current b->c (C_V1_bc, ...).
void register_CC_cd(CoefficientRegistry &)
Registers coefficient factories for charged-current c->d (C_V1_cd, ...).
void register_MesonMixing(CoefficientRegistry &)
Registers coefficient factories for meson mixing coefficients.
Domain objects representing Wilson coefficients and their matching metadata.
Registry mapping (WCoef, Model, Backend) -> coefficient factory function.
void register_creator(WCoef c, Model m, Backend b, CoefMaker mk)
Registers a creator function for a given (coefficient, model, backend).
CoefPtr create(const BuildContext &ctx, WCoef c) const
Creates a coefficient instance according to the provided build context.
complex_t h(double s, double m_q, double mu_b)
Build-time context passed to group setup hooks.