diff --git a/include/openmc/capi.h b/include/openmc/capi.h index 11c90ff3af..a2bab1e2c9 100644 --- a/include/openmc/capi.h +++ b/include/openmc/capi.h @@ -87,6 +87,7 @@ extern "C" { int openmc_property_map(const void* slice, double* data_out); int openmc_reset(); int openmc_reset_timers(); + int openmc_restart_timers(); int openmc_run(); void openmc_set_seed(int64_t new_seed); int openmc_simulation_finalize(); diff --git a/include/openmc/timer.h b/include/openmc/timer.h index cc20751a85..0ebbe0e8de 100644 --- a/include/openmc/timer.h +++ b/include/openmc/timer.h @@ -69,6 +69,8 @@ private: void reset_timers(); +void restart_timers(); + } // namespace openmc #endif // OPENMC_TIMER_H diff --git a/openmc/lib/core.py b/openmc/lib/core.py index 61b8a6ed6f..a30341ed5d 100644 --- a/openmc/lib/core.py +++ b/openmc/lib/core.py @@ -65,6 +65,8 @@ _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 +_dll.openmc_restart_timers.restype = c_int +_dll.openmc_restart_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 @@ -308,6 +310,7 @@ def reset(): """Reset tallies and timers.""" _dll.openmc_reset() _dll.openmc_reset_timers() + _dll.openmc_restart_timers() def run(): diff --git a/src/finalize.cpp b/src/finalize.cpp index b5d5eb0389..7d80b9fdfb 100644 --- a/src/finalize.cpp +++ b/src/finalize.cpp @@ -171,6 +171,12 @@ int openmc_reset_timers() return 0; } +int openmc_restart_timers() +{ + restart_timers(); + return 0; +} + int openmc_hard_reset() { // Reset all tallies and timers diff --git a/src/timer.cpp b/src/timer.cpp index fdb10f0f20..449e2dce01 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -87,4 +87,26 @@ void reset_timers() simulation::time_event_death.reset(); } +void restart_timers() +{ + simulation::time_active.restart(); + simulation::time_bank.restart(); + simulation::time_bank_sample.restart(); + simulation::time_bank_sendrecv.restart(); + simulation::time_finalize.restart(); + simulation::time_inactive.restart(); + simulation::time_initialize.restart(); + simulation::time_read_xs.restart(); + simulation::time_sample_source.restart(); + simulation::time_tallies.restart(); + simulation::time_total.restart(); + simulation::time_transport.restart(); + simulation::time_event_init.restart(); + simulation::time_event_calculate_xs.restart(); + simulation::time_event_advance_particle.restart(); + simulation::time_event_surface_crossing.restart(); + simulation::time_event_collision.restart(); + simulation::time_event_death.restart(); +} + } // namespace openmc