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

Classes

struct  OutputDirectoryExists
 Exception class that is thrown, if the requested output directory already exists and -f was not specified on the command line. More...
 
struct  OutputDirectoryOutOfIds
 Exception class that is thrown, if no new output path can be generated (there is a directory name for each positive integer value) More...
 

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 }
constexpr int p
Proton.
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  {
311  return ScatterActionsFinder(configuration, params);
312 }
A simple scatter finder: Just loops through all particles and checks each pair for a collision.
Configuration configuration(std::string overrides={})
Return a configuration object filled with data from src/config.yaml.
Definition: setup.h:173
ExperimentParameters create_experiment_parameters(Configuration config)
Gathers all general Experiment parameters.
Definition: experiment.cc:474
Helper structure for Experiment.
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 322 of file smash.cc.

322  {
323  const std::string smash_version = "1.8";
324  const std::set<std::string> compatible_config_versions = {"1.8"};
325 
326  const std::string config_version = configuration.read({"Version"});
327 
328  if (compatible_config_versions.find(config_version) ==
329  compatible_config_versions.end()) {
330  std::stringstream err;
331  err << "The version of the configuration file (" << config_version
332  << ") is not compatible with the SMASH version (" << smash_version
333  << ").\nThe following config versions are supported:\n";
334  for (auto it : compatible_config_versions) {
335  err << it << " ";
336  }
337  err << "\nPlease consider updating your config or using a compatible SMASH"
338  " version.";
339  throw std::runtime_error(err.str());
340  }
341 }
Value read(std::initializer_list< const char * > keys) const
Additional interface for SMASH to read configuration values without removing them.
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 346 of file smash.cc.

346  {
347  const std::string report = configuration.unused_values_report();
348 
349  if (report != "{}") {
350  throw std::runtime_error(
351  "The following configuration values were not used:\n" + report);
352  }
353 }
std::string unused_values_report() const
Returns a string listing the key/value pairs that have not been taken yet.
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 361 of file smash.cc.

361  {
362  for (const std::string s :
363  {"Version", "particles", "decaymodes", "Modi", "General", "Output",
364  "Lattice", "Potentials", "Forced_Thermalization"}) {
365  if (configuration.has_value({s.c_str()})) {
366  configuration.take({s.c_str()});
367  }
368  }
369 }
bool has_value(std::initializer_list< const char * > keys) const
Returns whether there is a non-empty value behind the requested keys.
Value take(std::initializer_list< const char * > keys)
The default interface for SMASH to read configuration values.
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 372 of file smash.cc.

372  {
373  ParticleType::create_type_list(configuration.take({"particles"}));
374  DecayModes::load_decaymodes(configuration.take({"decaymodes"}));
375  ParticleType::check_consistency();
376 }
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 381 of file smash.cc.

383  {
385  logg[LMain].info("Tabulating cross section integrals...");
386  IsoParticleType::tabulate_integrals(hash, tabulations_path);
387 }
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > logg
An array that stores all pre-configured Logger objects.
Definition: logging.cc:39
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:381
static constexpr int LMain
Definition: experiment.h:87
Here is the call graph for this function:
Here is the caller graph for this function: