Version: SMASH-2.2
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...
 

Function Documentation

◆ print_disclaimer()

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

Print the disclaimer.

Definition at line 179 of file smash.cc.

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

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

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

311  {
313  return ScatterActionsFinder(configuration, params);
314 }
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:494
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 324 of file smash.cc.

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

348  {
349  const std::string report = configuration.unused_values_report();
350 
351  if (report != "{}") {
352  throw std::runtime_error(
353  "The following configuration values were not used:\n" + report);
354  }
355 }
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 363 of file smash.cc.

363  {
364  for (const std::string s :
365  {"Version", "particles", "decaymodes", "Modi", "General", "Output",
366  "Lattice", "Potentials", "Forced_Thermalization"}) {
367  if (configuration.has_value({s.c_str()})) {
368  configuration.take({s.c_str()});
369  }
370  }
371 }
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: