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

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

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

243  {
244  const bf::path p = bf::absolute("data");
245  if (!bf::exists(p)) {
246  return p / "0";
247  }
248  bf::path p2;
249  for (int id = 0; id < std::numeric_limits<int>::max(); ++id) {
250  p2 = p / std::to_string(id);
251  if (!bf::exists(p2)) {
252  break;
253  }
254  }
255  if (p == p2) {
256  throw OutputDirectoryOutOfIds("no unique data subdir ID left");
257  }
258  return p2;
259 }
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 267 of file smash.cc.

267  {
268  if (bf::exists(path)) {
269  if (!bf::is_directory(path)) {
270  throw OutputDirectoryExists("The given path (" + path.native() +
271  ") exists, but it is not a directory.");
272  }
273  } else {
274  if (!bf::create_directories(path)) {
275  throw OutputDirectoryExists(
276  "Race condition detected: The directory " + path.native() +
277  " did not exist a few cycles ago, but was created in the meantime by "
278  "a different process.");
279  }
280  }
281 }

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

289  {
290  // The following parameters are only relevant for nucleus-nucleus collisions.
291  // Setting them to the valuing values makes sure they don't have any effect.
292  const std::vector<bool> nucleon_has_interacted = {};
293  const int N_tot = 0;
294  const int N_proj = 0;
295 
296  ExperimentParameters params = create_experiment_parameters(configuration);
297  return ScatterActionsFinder(configuration, params, nucleon_has_interacted,
298  N_tot, N_proj);
299 }
ExperimentParameters create_experiment_parameters(Configuration config)
Gathers all general Experiment parameters.
Definition: experiment.cc:281
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 309 of file smash.cc.

309  {
310  const std::string smash_version = "1.5";
311  const std::set<std::string> compatible_config_versions = {"1.5"};
312 
313  const std::string config_version = configuration.read({"Version"});
314 
315  if (compatible_config_versions.find(config_version) ==
316  compatible_config_versions.end()) {
317  std::stringstream err;
318  err << "The version of the configuration file (" << config_version
319  << ") is not compatible with the SMASH version (" << smash_version
320  << ").\nThe following config versions are supported:\n";
321  for (auto it : compatible_config_versions) {
322  err << it << " ";
323  }
324  err << "\nPlease consider updating your config or using a compatible SMASH"
325  " version.";
326  throw std::runtime_error(err.str());
327  }
328 }
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 333 of file smash.cc.

333  {
334  const std::string report = configuration.unused_values_report();
335 
336  if (report != "{}") {
337  throw std::runtime_error(
338  "The following configuration values were not used:\n" + report);
339  }
340 }
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 348 of file smash.cc.

348  {
349  configuration.take({"Version"});
350  configuration.take({"particles"});
351  configuration.take({"decaymodes"});
352  configuration.take({"Modi"});
353  configuration.take({"General"});
354  if (configuration.has_value({"Output"})) {
355  configuration.take({"Output"});
356  }
357  if (configuration.has_value({"Lattice"})) {
358  configuration.take({"Lattice"});
359  }
360  if (configuration.has_value({"Potentials"})) {
361  configuration.take({"Potentials"});
362  }
363  if (configuration.has_value({"Forced_Thermalization"})) {
364  configuration.take({"Forced_Thermalization"});
365  }
366 }
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: