From d763806c43ea05adb25831b8fd11c828fd40d06a Mon Sep 17 00:00:00 2001 From: stevendargaville Date: Thu, 13 Feb 2020 14:52:44 +0000 Subject: [PATCH] Also made rel_max_lost_particle name consistent between C++ and python layers --- include/openmc/settings.h | 2 +- openmc/lib/settings.py | 2 +- src/particle.cpp | 2 +- src/settings.cpp | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/openmc/settings.h b/include/openmc/settings.h index 8cee3c72ab..2b4203646f 100644 --- a/include/openmc/settings.h +++ b/include/openmc/settings.h @@ -66,7 +66,7 @@ extern "C" std::string path_statepoint; //!< path to a statepoint file extern "C" int32_t n_batches; //!< number of (inactive+active) batches extern "C" int32_t n_inactive; //!< number of inactive batches extern "C" int32_t max_lost_particles; //!< maximum number of lost particles -extern double relative_max_lost_particles; //!< maximum number of lost particles, relative to the total number of particles +extern double rel_max_lost_particles; //!< maximum number of lost particles, relative to the total number of particles extern "C" int32_t gen_per_batch; //!< number of generations per batch extern "C" int64_t n_particles; //!< number of particles per generation diff --git a/openmc/lib/settings.py b/openmc/lib/settings.py index fa72e13234..68d68c29e0 100644 --- a/openmc/lib/settings.py +++ b/openmc/lib/settings.py @@ -23,7 +23,7 @@ class _Settings(object): generations_per_batch = _DLLGlobal(c_int32, 'gen_per_batch') inactive = _DLLGlobal(c_int32, 'n_inactive') max_lost_particles = _DLLGlobal(c_int32, 'max_lost_particles') - rel_max_lost_particles = _DLLGlobal(c_double, 'relative_max_lost_particles') + rel_max_lost_particles = _DLLGlobal(c_double, 'rel_max_lost_particles') particles = _DLLGlobal(c_int64, 'n_particles') restart_run = _DLLGlobal(c_bool, 'restart_run') run_CE = _DLLGlobal(c_bool, 'run_CE') diff --git a/src/particle.cpp b/src/particle.cpp index 7e98b2ce67..8f6dba803f 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -631,7 +631,7 @@ Particle::mark_as_lost(const char* message) // Abort the simulation if the maximum number of lost particles has been // reached if (simulation::n_lost_particles >= settings::max_lost_particles && - simulation::n_lost_particles >= settings::relative_max_lost_particles*n) { + simulation::n_lost_particles >= settings::rel_max_lost_particles*n) { fatal_error("Maximum number of lost particles has been reached."); } } diff --git a/src/settings.cpp b/src/settings.cpp index 933f9a2172..706a171458 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -80,7 +80,7 @@ std::string path_statepoint; int32_t n_batches; int32_t n_inactive {0}; int32_t max_lost_particles {10}; -double relative_max_lost_particles {1.0e-6}; +double rel_max_lost_particles {1.0e-6}; int32_t gen_per_batch {1}; int64_t n_particles {-1}; @@ -152,7 +152,7 @@ void get_run_parameters(pugi::xml_node node_base) // Get relative number of lost particles if (check_for_node(node_base, "rel_max_lost_particles")) { - relative_max_lost_particles = std::stod(get_node_value(node_base, "rel_max_lost_particles")); + rel_max_lost_particles = std::stod(get_node_value(node_base, "rel_max_lost_particles")); } // Get number of inactive batches @@ -364,7 +364,7 @@ void read_settings_xml() fatal_error("Number of particles must be greater than zero."); } else if (max_lost_particles <= 0) { fatal_error("Number of max lost particles must be greater than zero."); - } else if (relative_max_lost_particles <= 0.0 || relative_max_lost_particles >= 1.0) { + } else if (rel_max_lost_particles <= 0.0 || rel_max_lost_particles >= 1.0) { fatal_error("Relative max lost particles must be between zero and one."); } }