diff --git a/include/openmc/geometry.h b/include/openmc/geometry.h index 6947201a2..a7ac53ea3 100644 --- a/include/openmc/geometry.h +++ b/include/openmc/geometry.h @@ -7,7 +7,7 @@ #include #include "openmc/particle.h" -//#include "openmc/tallies/filter.h" +#include "openmc/tallies/filter.h" namespace openmc { diff --git a/include/openmc/simulation.h b/include/openmc/simulation.h index 21414ff67..e6f82e7f6 100644 --- a/include/openmc/simulation.h +++ b/include/openmc/simulation.h @@ -65,8 +65,6 @@ void initialize_generation(); void initialize_history(Particle* p, int64_t index_source); -void transport_history_based_single_particle(Particle& p); - //! Finalize a batch //! //! Handles synchronization and accumulation of tallies, calculation of Shannon @@ -86,6 +84,13 @@ void broadcast_results(); void free_memory_simulation(); +//! Simulate a single particle history (and all generated secondary particles, +//! if enabled), from birth to death +void transport_history_based_single_particle(Particle& p); + +//! Simulate all particle histories using history-based parallelism +void transport_history_based(); + } // namespace openmc #endif // OPENMC_SIMULATION_H diff --git a/src/simulation.cpp b/src/simulation.cpp index cb603c403..6ac776639 100644 --- a/src/simulation.cpp +++ b/src/simulation.cpp @@ -37,31 +37,6 @@ namespace openmc { -void transport_history_based_single_particle(Particle& p) -{ - while(true) { - p.event_calculate_xs(); - p.event_advance(); - if( p.collision_distance_ > p.boundary_.distance ) - p.event_cross_surface(); - else - p.event_collide(); - p.event_revive_from_secondary(); - if(!p.alive_) - break; - } - p.event_death(); -} - -void transport_history_based() -{ - #pragma omp parallel for schedule(runtime) - for (int64_t i_work = 1; i_work <= simulation::work_per_rank; ++i_work) { - Particle p; - initialize_history(&p, i_work); - transport_history_based_single_particle(p); - } -} } // namespace openmc @@ -590,4 +565,30 @@ void free_memory_simulation() simulation::entropy.clear(); } +void transport_history_based_single_particle(Particle& p) +{ + while(true) { + p.event_calculate_xs(); + p.event_advance(); + if( p.collision_distance_ > p.boundary_.distance ) + p.event_cross_surface(); + else + p.event_collide(); + p.event_revive_from_secondary(); + if(!p.alive_) + break; + } + p.event_death(); +} + +void transport_history_based() +{ + #pragma omp parallel for schedule(runtime) + for (int64_t i_work = 1; i_work <= simulation::work_per_rank; ++i_work) { + Particle p; + initialize_history(&p, i_work); + transport_history_based_single_particle(p); + } +} + } // namespace openmc