Version: SMASH-1.8
smash::anonymous_namespace{smash.cc} Namespace Reference

Classes

struct  OutputDirectoryExists
 
struct  OutputDirectoryOutOfIds
 

Functions

void print_disclaimer ()
 Print the disclaimer. More...
 
bf::path default_output_path ()
 
void ensure_path_is_valid (const bf::path &path)
 Ensures the output path is valid. More...
 
ScatterActionsFinder actions_finder_for_dump (Configuration configuration)
 Prepares ActionsFinder for cross-section and reaction dumps. More...
 
void check_config_version_is_compatible (Configuration configuration)
 Checks if the SMASH version is compatible with the version of the configuration file. More...
 
void check_for_unused_config_values (const Configuration &configuration)
 Checks if there are unused config values. More...
 
void ignore_simulation_config_values (Configuration &configuration)
 Remove all config values that are only needed for simulations. More...
 
void initialize_particles_and_decays (Configuration &configuration)
 Initialize the particles and decays from the configuration. More...
 
void initialize_particles_and_decays (Configuration &configuration, sha256::Hash hash, bf::path tabulations_path)
 Initialize the particles and decays from the configuration, the hash and the path to the cashed resonance integrals. More...
 

Function Documentation

◆ print_disclaimer()

void smash::anonymous_namespace{smash.cc}::print_disclaimer ( )

Print the disclaimer.

Definition at line 173 of file smash.cc.

173  {
174  std::cout
175  << "###################################################################"
176  << "############"
177  << "\n"
178  << "\n"
179  << " :::s.\n"
180  << " .... ''ss:: "
181  "ah:\n"
182  << " a::''. ..:sss "
183  ".HH.\n"
184  << " mss'.. ...s'm. sSA##As mAhh##hsh##s. .hA##ASa sS###As "
185  "hMAh##h.\n"
186  << " :a':'. .'':as sM#' .HHm''HMS''AMs mMA' .AMs aMA. "
187  "'HHa..HM:\n"
188  << " .a:s'. ..''ss 'h#H#S. mMm 'M#' .HH. 'MH. :MA 'h#H#S. "
189  "hMm :M#\n"
190  << " .::ss'. .... 'SMm .HH. SMa hMm sM#..mHMs 'AMa "
191  "'MH. SMa\n"
192  << " .s::' #SMASHh aMS .MH: HM: #MMMmMM. #SMASHh "
193  "aMS .MM.\n"
194  << "\n"
195  << "###################################################################"
196  << "############"
197  << "\n"
198  << " This is SMASH version: " << VERSION_MAJOR << "\n"
199  << " Simulating Many Accelerated Strongly-interacting Hadrons"
200  << "\n"
201  << "\n"
202  << " Distributed under the GNU General Public License 3.0"
203  << " (GPLv3 or later)."
204  << "\n"
205  << " See LICENSE for details."
206  << "\n"
207  << " For the full list of contributors see AUTHORS."
208  << "\n"
209  << "\n"
210  << " When using SMASH, please cite"
211  << "\n"
212  << " J. Weil et al., Phys.Rev. C94 (2016) no.5, 054905"
213  << "\n"
214  << " together with the software DOI for the specific code version "
215  << "employed:"
216  << "\n"
217  << " https://doi.org/10.5281/zenodo.3484711."
218  << "\n"
219  << " In addition, if Pythia is used please cite"
220  << "\n"
221  << " T. Sjöstrand, S. Mrenna and P. Skands, JHEP05 (2006) 026,"
222  << "\n"
223  << " Comput. Phys. Comm. 178 (2008) 852."
224  << "\n"
225  << "\n"
226  << " Webpage: https://smash-transport.github.io"
227  << "\n"
228  << "\n"
229  << " Report issues at https://github.com/smash-transport/smash"
230  << "\n"
231  << " or contact us by email at elfner@itp.uni-frankfurt.de"
232  << "\n"
233  << "\n"
234  << "###################################################################"
235  << "############"
236  << "\n"
237  << "\n";
238 }
Here is the caller graph for this function:

◆ default_output_path()

bf::path smash::anonymous_namespace{smash.cc}::default_output_path ( )
Returns
the default path for output.

Definition at line 259 of file smash.cc.

259  {
260  const bf::path p = bf::absolute("data");
261  if (!bf::exists(p)) {
262  return p / "0";
263  }
264  bf::path p2;
265  for (int id = 0; id < std::numeric_limits<int>::max(); ++id) {
266  p2 = p / std::to_string(id);
267  if (!bf::exists(p2)) {
268  break;
269  }
270  }
271  if (p == p2) {
272  throw OutputDirectoryOutOfIds("no unique data subdir ID left");
273  }
274  return p2;
275 }
Here is the caller graph for this function:

◆ ensure_path_is_valid()

void smash::anonymous_namespace{smash.cc}::ensure_path_is_valid ( const bf::path &  path)

Ensures the output path is valid.

Exceptions
OutputDirectoryExistsif the Output directory already exists.
Parameters
[in]pathThe output path to be written to

Definition at line 283 of file smash.cc.

283  {
284  if (bf::exists(path)) {
285  if (!bf::is_directory(path)) {
286  throw OutputDirectoryExists("The given path (" + path.native() +
287  ") exists, but it is not a directory.");
288  }
289  } else {
290  if (!bf::create_directories(path)) {
291  throw OutputDirectoryExists(
292  "Race condition detected: The directory " + path.native() +
293  " did not exist a few cycles ago, but was created in the meantime by "
294  "a different process.");
295  }
296  }
297 }
Here is the caller graph for this function:

◆ actions_finder_for_dump()

ScatterActionsFinder smash::anonymous_namespace{smash.cc}::actions_finder_for_dump ( Configuration  configuration)

Prepares ActionsFinder for cross-section and reaction dumps.

Parameters
[in]configurationNecessary parameters to switch reactions on/off
Returns
The constructed Scatteractionsfinder.

Definition at line 305 of file smash.cc.

305  {
306  // The following parameters are only relevant for nucleus-nucleus collisions.
307  // Setting them to the valuing values makes sure they don't have any effect.
308  const std::vector<bool> nucleon_has_interacted = {};
309  const int N_tot = 0;
310  const int N_proj = 0;
311 
313  return ScatterActionsFinder(configuration, params, nucleon_has_interacted,
314  N_tot, N_proj);
315 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_config_version_is_compatible()

void smash::anonymous_namespace{smash.cc}::check_config_version_is_compatible ( Configuration  configuration)

Checks if the SMASH version is compatible with the version of the configuration file.

Parameters
[in]configurationThe configuration object
Exceptions
Runtimeerror if versions do not match or if config version is invalid

Definition at line 325 of file smash.cc.

325  {
326  const std::string smash_version = "1.8";
327  const std::set<std::string> compatible_config_versions = {"1.8"};
328 
329  const std::string config_version = configuration.read({"Version"});
330 
331  if (compatible_config_versions.find(config_version) ==
332  compatible_config_versions.end()) {
333  std::stringstream err;
334  err << "The version of the configuration file (" << config_version
335  << ") is not compatible with the SMASH version (" << smash_version
336  << ").\nThe following config versions are supported:\n";
337  for (auto it : compatible_config_versions) {
338  err << it << " ";
339  }
340  err << "\nPlease consider updating your config or using a compatible SMASH"
341  " version.";
342  throw std::runtime_error(err.str());
343  }
344 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_for_unused_config_values()

void smash::anonymous_namespace{smash.cc}::check_for_unused_config_values ( const Configuration configuration)

Checks if there are unused config values.

Definition at line 349 of file smash.cc.

349  {
350  const std::string report = configuration.unused_values_report();
351 
352  if (report != "{}") {
353  throw std::runtime_error(
354  "The following configuration values were not used:\n" + report);
355  }
356 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ignore_simulation_config_values()

void smash::anonymous_namespace{smash.cc}::ignore_simulation_config_values ( Configuration configuration)

Remove all config values that are only needed for simulations.

This is useful when checking for unused config value when SMASH only outputs cross sections, resonance properties or possible reactions.

Definition at line 364 of file smash.cc.

364  {
365  for (const std::string s :
366  {"Version", "particles", "decaymodes", "Modi", "General", "Output",
367  "Lattice", "Potentials", "Forced_Thermalization"}) {
368  if (configuration.has_value({s.c_str()})) {
369  configuration.take({s.c_str()});
370  }
371  }
372 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initialize_particles_and_decays() [1/2]

void smash::anonymous_namespace{smash.cc}::initialize_particles_and_decays ( Configuration configuration)

Initialize the particles and decays from the configuration.

Definition at line 375 of file smash.cc.

375  {
376  ParticleType::create_type_list(configuration.take({"particles"}));
377  DecayModes::load_decaymodes(configuration.take({"decaymodes"}));
378  ParticleType::check_consistency();
379 }
Here is the call graph for this function:

◆ initialize_particles_and_decays() [2/2]

void smash::anonymous_namespace{smash.cc}::initialize_particles_and_decays ( Configuration configuration,
sha256::Hash  hash,
bf::path  tabulations_path 
)

Initialize the particles and decays from the configuration, the hash and the path to the cashed resonance integrals.

Definition at line 384 of file smash.cc.

386  {
388  logg[LMain].info("Tabulating cross section integrals...");
389  IsoParticleType::tabulate_integrals(hash, tabulations_path);
390 }
Here is the call graph for this function:
Here is the caller graph for this function:
smash::Test::configuration
Configuration configuration(std::string overrides={})
Return a configuration object filled with data from src/config.yaml.
Definition: setup.h:161
smash::Configuration::read
Value read(std::initializer_list< const char * > keys) const
Additional interface for SMASH to read configuration values without removing them.
Definition: configuration.cc:158
smash::ScatterActionsFinder
Definition: scatteractionsfinder.h:31
smash::Configuration::unused_values_report
std::string unused_values_report() const
Returns a string listing the key/value pairs that have not been taken yet.
Definition: configuration.cc:186
smash::Configuration::has_value
bool has_value(std::initializer_list< const char * > keys) const
Returns whether there is a non-empty value behind the requested keys.
Definition: configuration.cc:181
smash::LMain
static constexpr int LMain
Definition: experiment.h:77
smash::logg
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > logg
An array that stores all pre-configured Logger objects.
Definition: logging.cc:39
smash::create_experiment_parameters
ExperimentParameters create_experiment_parameters(Configuration config)
Gathers all general Experiment parameters.
Definition: experiment.cc:328
smash::anonymous_namespace{smash.cc}::initialize_particles_and_decays
void initialize_particles_and_decays(Configuration &configuration, sha256::Hash hash, bf::path tabulations_path)
Initialize the particles and decays from the configuration, the hash and the path to the cashed reson...
Definition: smash.cc:384
smash::Configuration::take
Value take(std::initializer_list< const char * > keys)
The default interface for SMASH to read configuration values.
Definition: configuration.cc:140
smash::ExperimentParameters
Helper structure for Experiment.
Definition: experimentparameters.h:23
smash::pdg::p
constexpr int p
Proton.
Definition: pdgcode_constants.h:28