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

Function Documentation

◆ print_disclaimer()

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

Print the disclaimer.

Definition at line 156 of file smash.cc.

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

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

261  {
262  if (bf::exists(path)) {
263  if (!bf::is_directory(path)) {
264  throw OutputDirectoryExists("The given path (" + path.native() +
265  ") exists, but it is not a directory.");
266  }
267  } else {
268  if (!bf::create_directories(path)) {
269  throw OutputDirectoryExists(
270  "Race condition detected: The directory " + path.native() +
271  " did not exist a few cycles ago, but was created in the meantime by "
272  "a different process.");
273  }
274  }
275 }
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 283 of file smash.cc.

283  {
284  std::vector<bool> nucleon_has_interacted = {};
286  return ScatterActionsFinder(configuration, params, nucleon_has_interacted, 0,
287  0);
288 }
Configuration configuration(std::string overrides={})
Return a configuration object filled with data from src/config.yaml.
Definition: setup.h:161
ExperimentParameters create_experiment_parameters(Configuration config)
Gathers all general Experiment parameters.
Definition: experiment.cc:269
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:

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

298  {
299  const std::string smash_version = "1.5";
300  const std::set<std::string> compatible_config_versions = {"1.5"};
301 
302  const std::string config_version = configuration.read({"Version"});
303 
304  if (compatible_config_versions.find(config_version) ==
305  compatible_config_versions.end()) {
306  std::stringstream err;
307  err << "The version of the configuration file (" << config_version
308  << ") is not compatible with the SMASH version (" << smash_version
309  << ").\nThe following config versions are supported:\n";
310  for (auto it : compatible_config_versions) {
311  err << it << " ";
312  }
313  err << "\nPlease consider updating your config or using a compatible SMASH"
314  " version.";
315  throw std::runtime_error(err.str());
316  }
317 }
Value read(std::initializer_list< const char *> keys) const
Additional interface for SMASH to read configuration values without removing them.
Configuration configuration(std::string overrides={})
Return a configuration object filled with data from src/config.yaml.
Definition: setup.h:161
Here is the call graph for this function:
Here is the caller graph for this function: