From 944afb1d206be4967ae98c5fe411e7ff71796eb5 Mon Sep 17 00:00:00 2001 From: rockfool Date: Wed, 1 Apr 2020 17:06:44 -0400 Subject: [PATCH] fix a bug in timer reset --- include/openmc/capi.h | 1 + openmc/lib/core.py | 3 +++ src/finalize.cpp | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/include/openmc/capi.h b/include/openmc/capi.h index 0c0f18baee..11c90ff3af 100644 --- a/include/openmc/capi.h +++ b/include/openmc/capi.h @@ -86,6 +86,7 @@ extern "C" { int openmc_id_map(const void* slice, int32_t* data_out); int openmc_property_map(const void* slice, double* data_out); int openmc_reset(); + int openmc_reset_timers(); int openmc_run(); void openmc_set_seed(int64_t new_seed); int openmc_simulation_finalize(); diff --git a/openmc/lib/core.py b/openmc/lib/core.py index 6a2a7cdeaa..61b8a6ed6f 100644 --- a/openmc/lib/core.py +++ b/openmc/lib/core.py @@ -63,6 +63,8 @@ _dll.openmc_run.restype = c_int _dll.openmc_run.errcheck = _error_handler _dll.openmc_reset.restype = c_int _dll.openmc_reset.errcheck = _error_handler +_dll.openmc_reset_timers.restype = c_int +_dll.openmc_reset_timers.errcheck = _error_handler _run_linsolver_argtypes = [_array_1d_dble, _array_1d_dble, _array_1d_dble, c_double] _dll.openmc_run_linsolver.argtypes = _run_linsolver_argtypes @@ -305,6 +307,7 @@ def plot_geometry(): def reset(): """Reset tallies and timers.""" _dll.openmc_reset() + _dll.openmc_reset_timers() def run(): diff --git a/src/finalize.cpp b/src/finalize.cpp index 74f02cc64c..b5d5eb0389 100644 --- a/src/finalize.cpp +++ b/src/finalize.cpp @@ -165,6 +165,12 @@ int openmc_reset() return 0; } +int openmc_reset_timers() +{ + reset_timers(); + return 0; +} + int openmc_hard_reset() { // Reset all tallies and timers