Version: SMASH-2.0
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 177 of file smash.cc.

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

263  {
264  const bf::path p = bf::absolute("data");
265  if (!bf::exists(p)) {
266  return p / "0";
267  }
268  bf::path p2;
269  for (int id = 0; id < std::numeric_limits<int>::max(); ++id) {
270  p2 = p / std::to_string(id);
271  if (!bf::exists(p2)) {
272  break;
273  }
274  }
275  if (p == p2) {
276  throw OutputDirectoryOutOfIds("no unique data subdir ID left");
277  }
278  return p2;
279 }
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 287 of file smash.cc.

287  {
288  if (bf::exists(path)) {
289  if (!bf::is_directory(path)) {
290  throw OutputDirectoryExists("The given path (" + path.native() +
291  ") exists, but it is not a directory.");
292  }
293  } else {
294  if (!bf::create_directories(path)) {
295  throw OutputDirectoryExists(
296  "Race condition detected: The directory " + path.native() +
297  " did not exist a few cycles ago, but was created in the meantime by "
298  "a different process.");
299  }
300  }
301 }
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 309 of file smash.cc.

309  {
310  // The following parameters are only relevant for nucleus-nucleus collisions.
311  // Setting them to the valuing values makes sure they don't have any effect.
312  const std::vector<bool> nucleon_has_interacted = {};
313  const int N_tot = 0;
314  const int N_proj = 0;
315 
317  return ScatterActionsFinder(configuration, params, nucleon_has_interacted,
318  N_tot, N_proj);
319 }
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 329 of file smash.cc.

329  {
330  const std::string smash_version = "1.8";
331  const std::set<std::string> compatible_config_versions = {"1.8"};
332 
333  const std::string config_version = configuration.read({"Version"});
334 
335  if (compatible_config_versions.find(config_version) ==
336  compatible_config_versions.end()) {
337  std::stringstream err;
338  err << "The version of the configuration file (" << config_version
339  << ") is not compatible with the SMASH version (" << smash_version
340  << ").\nThe following config versions are supported:\n";
341  for (auto it : compatible_config_versions) {
342  err << it << " ";
343  }
344  err << "\nPlease consider updating your config or using a compatible SMASH"
345  " version.";
346  throw std::runtime_error(err.str());
347  }
348 }
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 353 of file smash.cc.

353  {
354  const std::string report = configuration.unused_values_report();
355 
356  if (report != "{}") {
357  throw std::runtime_error(
358  "The following configuration values were not used:\n" + report);
359  }
360 }
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 368 of file smash.cc.

368  {
369  for (const std::string s :
370  {"Version", "particles", "decaymodes", "Modi", "General", "Output",
371  "Lattice", "Potentials", "Forced_Thermalization"}) {
372  if (configuration.has_value({s.c_str()})) {
373  configuration.take({s.c_str()});
374  }
375  }
376 }
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 379 of file smash.cc.

379  {
380  ParticleType::create_type_list(configuration.take({"particles"}));
381  DecayModes::load_decaymodes(configuration.take({"decaymodes"}));
382  ParticleType::check_consistency();
383 }
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 388 of file smash.cc.

390  {
392  logg[LMain].info("Tabulating cross section integrals...");
393  IsoParticleType::tabulate_integrals(hash, tabulations_path);
394 }
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:162
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:30
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:82
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:335
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:388
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:24
smash::pdg::p
constexpr int p
Proton.
Definition: pdgcode_constants.h:28