23 static constexpr
int LMain = LogArea::Main::id;
26 const std::vector<std::string> &);
34 const std::string &config_file,
const std::string &particles_file,
35 const std::string &decaymodes_file,
36 const std::vector<std::string> &extra_config) {
41 particles_file, decaymodes_file, configuration);
47 const std::string &tabulations_dir) {
49 " create ParticleType and DecayModes");
50 const std::string particles_string = configuration.
take({
"particles"});
51 const std::string decaymodes_string = configuration.
take({
"decaymodes"});
58 hash_context.
update(version);
59 hash_context.
update(particles_string);
60 hash_context.
update(decaymodes_string);
61 const auto hash = hash_context.
finalize();
64 logg[
LMain].info(
"Tabulating cross section integrals...");
65 std::filesystem::path tabulations_path(tabulations_dir);
66 if (!tabulations_path.empty()) {
68 std::filesystem::create_directories(tabulations_path);
69 logg[
LMain].info() <<
"Tabulations path: " << tabulations_path;
75 const std::string &config_file,
76 const std::vector<std::string> &extra_config) {
78 std::filesystem::path config_path(config_file);
80 config_path.filename());
83 for (
const auto &config : extra_config) {
90 const std::string conf_tag = LogArea::Configuration::textual();
91 const std::string main_tag = LogArea::Main::textual();
93 conf_tag.size() > main_tag.size() ? conf_tag.size() : main_tag.size();
101 throw std::runtime_error(
"Validation of SMASH input failed.");
113 const std::string &particles_file,
const std::string &decaymodes_file,
116 std::filesystem::path particles_path(particles_file);
117 std::filesystem::path decaymodes_path(decaymodes_file);
118 auto particles_and_decays =
122 if (configuration.
has_value({
"particles"}) && !particles_path.empty()) {
124 "Ambiguity: particles from external file ", particles_path,
125 " requested, but there is also particle list in the config."
126 " Using particles from ",
129 if (!configuration.
has_value({
"particles"}) || !particles_path.empty()) {
130 configuration.
set_value({
"particles"}, particles_and_decays.first);
133 if (configuration.
has_value({
"decaymodes"}) && !decaymodes_path.empty()) {
135 "Ambiguity: decaymodes from external file ", decaymodes_path,
136 " requested, but there is also decaymodes list in the config."
137 " Using decaymodes from",
140 if (!configuration.
has_value({
"decaymodes"}) || !decaymodes_path.empty()) {
141 configuration.
set_value({
"decaymodes"}, particles_and_decays.second);
Interface to the SMASH configuration files.
bool has_value(std::initializer_list< const char * > keys) const
Return whether there is a non-empty value behind the requested keys.
void merge_yaml(const std::string &yaml)
Merge the configuration in yaml into the existing tree.
void set_value(std::initializer_list< const char * > keys, T &&value)
Overwrite the value of the specified YAML node.
Configuration extract_sub_configuration(std::initializer_list< const char * > keys, Configuration::GetEmpty empty_if_not_existing=Configuration::GetEmpty::No)
Create a new configuration from a then-removed section of the present object.
Value take(std::initializer_list< const char * > keys)
The default interface for SMASH to read configuration values.
Is validate(bool full_validation=true) const
Validate content of configuration in terms of YAML keys.
static void load_decaymodes(const std::string &input)
Loads the DecayModes map as described in the input string.
static void tabulate_integrals(sha256::Hash hash, const std::filesystem::path &tabulations_path)
Tabulate all relevant integrals.
static void check_consistency()
static void create_type_list(const std::string &particles)
Initialize the global ParticleType list (list_all) from the given input data.
void update(uint8_t const *buffer, size_t buffer_size)
Add data to the SHA256 context.
Hash finalize()
Performs the final calculation of the hash and returns the digest (32 byte buffer containing 256bit h...
#define SMASH_SOURCE_LOCATION
Hackery that is required to output the location in the source code where the log statement occurs.
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > logg
An array that stores all pre-configured Logger objects.
void set_default_loglevel(einhard::LogLevel level)
Set the default log level (what will be returned from subsequent default_loglevel calls).
void create_all_loggers(Configuration config)
Called from main() right after the Configuration object is fully set up to create all logger objects ...
std::string hash_to_string(Hash hash)
Convert a SHA256 hash to a hexadecimal string.
std::string fill_both(const std::string &s, size_t width, char fill=' ')
Fill string with characters at both sides until the given width is reached.
void initialize_particles_decays_and_tabulations(Configuration &configuration, const std::string &version, const std::string &tabulations_dir={})
Initialize the particles and decays from the given configuration, plus tabulate the resonance integra...
static void do_minimal_loggers_setup_for_config_validation()
static void read_particles_and_decaymodes_files_setting_keys_in_configuration(const std::string &, const std::string &, Configuration &)
Configuration setup_config_and_logging(const std::string &config_file, const std::string &particles_file={}, const std::string &decaymodes_file={}, const std::vector< std::string > &extra_config={})
Set up configuration and logging from input files and extra config.
static Configuration create_configuration(const std::string &, const std::vector< std::string > &)
static void setup_logging(Configuration &)
std::pair< std::string, std::string > load_particles_and_decaymodes(const std::filesystem::path &particles_file, const std::filesystem::path &decaymodes_file)
Loads particles and decaymodes from provided files particles_file and decaymodes_file.
static constexpr int LMain
static void fully_validate_configuration(const Configuration &)