Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
MartyInterface.h
Go to the documentation of this file.
1#ifndef MARTY_INTERFACE_H
2#define MARTY_INTERFACE_H
3
4#include <memory>
5#include <filesystem>
6#include <iostream>
7#include <algorithm>
8#include <set>
9#include <unordered_set>
10#include <unordered_map>
11#include <optional>
12
13#include "config.hpp"
14#include "FileNameManager.h"
16#include "CodeGenerator.h"
17#include "GppCompilerStrategy.h"
19#include "Logger.h"
21#include "ICoreAPI.h"
23
59public:
68 MartyInterface(std::shared_ptr<ICoreAPI<Model>> core_api, std::shared_ptr<IMartyParameterProxy<std::string, LhaID>> sm_proxy, std::shared_ptr<IInterpreterPortsFactory> ports, std::shared_ptr<IMartyParameterProxy<std::string, LhaID>> bsm_proxy = nullptr) : core_api(core_api), param_proxy_sm(sm_proxy), ports(ports), param_proxy_bsm(bsm_proxy)
69 {}
70
80
92 void generate(std::string wilson, std::string model, std::string model_path);
93
101 void generate(std::string wilson,
102 std::string output_model,
103 std::string target_model,
104 std::string model_path,
105 bool sm_like_filter,
106 bool bsm_split_generation = false,
107 bool full_target_generation = false);
108
119 void compile_run(std::string wilson, std::string model);
120
135 void generate_numlib(std::string wilson, std::string model);
136
145 void generate_numlib(std::string wilson,
146 std::string output_model,
147 std::string target_model,
148 bool bsm_split_generation = false,
149 bool full_target_generation = false);
150
162 void compile_run_libs(std::string wilson, std::string model, double Q_match);
163
178 void calculate(std::string wilson, std::string model, double Q_match, std::string model_path);
179
183 void calculate(std::string wilson,
184 std::string output_model,
185 std::string target_model,
186 double Q_match,
187 std::string model_path,
188 bool sm_like_filter,
189 bool bsm_split_generation = false,
190 bool full_target_generation = false);
191
199 std::string calculate_isolated(std::string wilson,
200 std::string output_model,
201 std::string target_model,
202 double Q_match,
203 std::string model_path,
204 bool sm_like_filter,
205 bool bsm_split_generation = false,
206 bool full_target_generation = false);
207
220 std::unordered_set<InterpretedParam> get_dependencies(std::string wilson);
221
235 std::set<std::string> get_special_blocks();
236
237private:
246 bool already_run(std::string&& outputBinary);
247
258 std::string output_binary_name(std::string& wilson, std::string& model);
259
267 std::optional<int> resolve_model_template_index(const std::string& model) const;
268
272 void invalidate_template_model_cache_if_needed(const std::string& wilson,
273 const std::string& output_model,
274 const std::string& target_model,
275 const std::string& model_path,
276 std::optional<int> model_template_index,
277 bool sm_like_filter,
278 bool bsm_split_generation,
279 bool full_target_generation) const;
280
282 bool artifacts_ready(const std::string& wilson,
283 const std::string& output_model,
284 const std::string& target_model,
285 const std::string& model_path,
286 bool sm_like_filter,
287 bool bsm_split_generation,
288 bool full_target_generation) const;
289
291 void ensure_built(const std::string& wilson,
292 const std::string& output_model,
293 const std::string& target_model,
294 const std::string& model_path,
295 bool sm_like_filter,
296 bool bsm_split_generation,
297 bool full_target_generation);
298
300 std::unordered_map<std::string, double> snapshot_numeric_params(
301 const std::string& wilson,
302 const std::string& output_model,
303 const std::string& target_model,
304 bool bsm_split_generation,
305 bool full_target_generation
306 );
307
309 void compile_numlib(const std::string& wilson, const std::string& model);
310
312 std::set<std::string> specials_block {"KIN", "WEIN", "Finite", "REGPROP", "BETA"};
313
315 std::string num_file_path{};
316
318 std::unordered_map<std::string, std::unordered_set<InterpretedParam>> dependencies;
319
321 std::shared_ptr<ICoreAPI<Model>> core_api;
322
324 std::shared_ptr<IMartyParameterProxy<std::string, LhaID>> param_proxy_sm;
325
327 std::shared_ptr<IInterpreterPortsFactory> ports;
328
329
331 std::shared_ptr<IMartyParameterProxy<std::string, LhaID>> param_proxy_bsm = nullptr;
332};
333
334#endif
Definition of the CodeGenerator class.
Manages file and directory names for generated MARTY code and assets.
Declares a general-purpose ModelModifier for non-numeric templates.
Declares the helper used to prepare numeric MARTY models and parameter files.
Declares a compilation strategy using g++ directly.
Declares a generic interface to access parameters for MARTY adapters.
Declares a compilation strategy based on make.
Generic interface returning a single value of type T from the core.
Definition ICoreAPI.h:30
Interface for accessing parameter values from different backends.
High-level interface to MARTY-based code generation and execution.
void compile_run_libs(std::string wilson, std::string model, double Q_match)
Compiles and runs the numeric libraries.
std::set< std::string > get_special_blocks()
Returns the special blocks handled with custom logic.
std::string calculate_isolated(std::string wilson, std::string output_model, std::string target_model, double Q_match, std::string model_path, bool sm_like_filter, bool bsm_split_generation=false, bool full_target_generation=false)
Thread-safe calculation using invocation-local parameter and CSV files.
void generate(std::string wilson, std::string model, std::string model_path)
Generates a non-numeric MARTY-powered C++ template.
std::unordered_set< InterpretedParam > get_dependencies(std::string wilson)
Retrieves the set of parameter dependencies for a given Wilson basis.
void compile_run(std::string wilson, std::string model)
Compiles and runs the non-numeric generated code.
MartyInterface()
Default constructor wiring default implementations.
void calculate(std::string wilson, std::string model, double Q_match, std::string model_path)
Convenience shortcut to generate, compile, and run the full pipeline.
void generate_numlib(std::string wilson, std::string model)
Generates the numeric library wrapper for a given (Wilson, model) pair.
MartyInterface(std::shared_ptr< ICoreAPI< Model > > core_api, std::shared_ptr< IMartyParameterProxy< std::string, LhaID > > sm_proxy, std::shared_ptr< IInterpreterPortsFactory > ports, std::shared_ptr< IMartyParameterProxy< std::string, LhaID > > bsm_proxy=nullptr)
Constructs a MartyInterface with explicit dependencies.