Version: SMASH-1.7
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

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

Print the disclaimer.

Definition at line 171 of file smash.cc.

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

Here is the caller graph for this function:

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

Definition at line 252 of file smash.cc.

252  {
253  const bf::path p = bf::absolute("data");
254  if (!bf::exists(p)) {
255  return p / "0";
256  }
257  bf::path p2;
258  for (int id = 0; id < std::numeric_limits<int>::max(); ++id) {
259  p2 = p / std::to_string(id);
260  if (!bf::exists(p2)) {
261  break;
262  }
263  }
264  if (p == p2) {
265  throw OutputDirectoryOutOfIds("no unique data subdir ID left");
266  }
267  return p2;
268 }
constexpr int p
Proton.

Here is the caller graph for this function:

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 276 of file smash.cc.

276  {
277  if (bf::exists(path)) {
278  if (!bf::is_directory(path)) {
279  throw OutputDirectoryExists("The given path (" + path.native() +
280  ") exists, but it is not a directory.");
281  }
282  } else {
283  if (!bf::create_directories(path)) {
284  throw OutputDirectoryExists(
285  "Race condition detected: The directory " + path.native() +
286  " did not exist a few cycles ago, but was created in the meantime by "
287  "a different process.");
288  }
289  }
290 }

Here is the caller graph for this function:

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 298 of file smash.cc.

298  {
299  // The following parameters are only relevant for nucleus-nucleus collisions.
300  // Setting them to the valuing values makes sure they don't have any effect.
301  const std::vector<bool> nucleon_has_interacted = {};
302  const int N_tot = 0;
303  const int N_proj = 0;
304 
305  ExperimentParameters params = create_experiment_parameters(configuration);
306  return ScatterActionsFinder(configuration, params, nucleon_has_interacted,
307  N_tot, N_proj);
308 }
ExperimentParameters create_experiment_parameters(Configuration config)
Gathers all general Experiment parameters.
Definition: experiment.cc:326
A simple scatter finder: Just loops through all particles and checks each pair for a collision...
Helper structure for Experiment.

Here is the call graph for this function:

Here is the caller graph for this function:

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 318 of file smash.cc.

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

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

Checks if there are unused config values.

Definition at line 342 of file smash.cc.

342  {
343  const std::string report = configuration.unused_values_report();
344 
345  if (report != "{}") {
346  throw std::runtime_error(
347  "The following configuration values were not used:\n" + report);
348  }
349 }
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:

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 357 of file smash.cc.

357  {
358  configuration.take({"Version"});
359  configuration.take({"particles"});
360  configuration.take({"decaymodes"});
361  configuration.take({"Modi"});
362  configuration.take({"General"});
363  if (configuration.has_value({"Output"})) {
364  configuration.take({"Output"});
365  }
366  if (configuration.has_value({"Lattice"})) {
367  configuration.take({"Lattice"});
368  }
369  if (configuration.has_value({"Potentials"})) {
370  configuration.take({"Potentials"});
371  }
372  if (configuration.has_value({"Forced_Thermalization"})) {
373  configuration.take({"Forced_Thermalization"});
374  }
375 }
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: