Also made rel_max_lost_particle name consistent between C++ and python layers

This commit is contained in:
stevendargaville 2020-02-13 14:52:44 +00:00
parent a9fc400863
commit d763806c43
4 changed files with 6 additions and 6 deletions

View file

@ -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

View file

@ -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')

View file

@ -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.");
}
}

View file

@ -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.");
}
}