12 #include <boost/filesystem.hpp>
21 static constexpr
int LMain = LogArea::Main::id;
24 const std::string &config_file,
const std::string &particles_file,
25 const std::string &decaymodes_file,
26 const std::vector<std::string> &extra_config) {
28 bf::path config_path(config_file);
30 config_path.filename());
33 for (
const auto &config : extra_config) {
44 bf::path particles_path(particles_file);
45 bf::path decaymodes_path(decaymodes_file);
46 auto particles_and_decays =
53 "Ambiguity: particles from external file ", particles_path,
54 " requested, but there is also particle list in the config."
55 " Using particles from ",
64 "Ambiguity: decaymodes from external file ", decaymodes_path,
65 " requested, but there is also decaymodes list in the config."
66 " Using decaymodes from",
78 const std::string &tabulations_dir) {
80 " create ParticleType and DecayModes");
89 hash_context.
update(version);
90 hash_context.
update(particle_string);
91 hash_context.
update(decay_string);
92 const auto hash = hash_context.
finalize();
95 logg[
LMain].info(
"Tabulating cross section integrals...");
96 bf::path tabulations_path(tabulations_dir);
97 if (!tabulations_path.empty()) {
99 bf::create_directories(tabulations_path);
100 logg[
LMain].info() <<
"Tabulations path: " << tabulations_path;
Interface to the SMASH configuration files.
bool has_value(std::initializer_list< const char * > keys) const
Returns 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.
std::string to_string() const
Returns a YAML string of the current tree.
Value take(std::initializer_list< const char * > keys)
The default interface for SMASH to read configuration values.
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 bf::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 ...
Configuration configuration(std::string overrides={})
Return a configuration object filled with data from src/config.yaml.
std::string hash_to_string(Hash hash)
Convert a SHA256 hash to a hexadecimal string.
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...
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 constexpr int LMain
std::pair< std::string, std::string > load_particles_and_decaymodes(const boost::filesystem::path &particles_file, const boost::filesystem::path &decaymodes_file)
Loads particles and decaymodes from provided files particles_file and decaymodes_file.