From f46d3ee37c36be746dddba24df99263a2ba89757 Mon Sep 17 00:00:00 2001 From: John Tramm Date: Mon, 11 Sep 2023 12:26:46 -0500 Subject: [PATCH] Streamlined URR PRNG stream selection to avoid unneeded store/load ops (#2689) --- src/nuclide.cpp | 5 ++--- src/physics.cpp | 4 +--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/nuclide.cpp b/src/nuclide.cpp index 8f73a5309..6b70ad9e3 100644 --- a/src/nuclide.cpp +++ b/src/nuclide.cpp @@ -857,9 +857,8 @@ void Nuclide::calculate_urr_xs(int i_temp, Particle& p) const // This guarantees the randomness and, at the same time, makes sure we // reuse random numbers for the same nuclide at different temperatures, // therefore preserving correlation of temperature in probability tables. - p.stream() = STREAM_URR_PTABLE; - double r = future_prn(static_cast(index_), *p.current_seed()); - p.stream() = STREAM_TRACKING; + double r = + future_prn(static_cast(index_), p.seeds(STREAM_URR_PTABLE)); // Warning: this assumes row-major order of cdf_values_ int i_low = upper_bound_index(&urr.cdf_values_(i_energy, 0), diff --git a/src/physics.cpp b/src/physics.cpp index 28c316c68..7101a2969 100644 --- a/src/physics.cpp +++ b/src/physics.cpp @@ -150,9 +150,7 @@ void sample_neutron_reaction(Particle& p) // Advance URR seed stream 'N' times after energy changes if (p.E() != p.E_last()) { - p.stream() = STREAM_URR_PTABLE; - advance_prn_seed(data::nuclides.size(), p.current_seed()); - p.stream() = STREAM_TRACKING; + advance_prn_seed(data::nuclides.size(), &p.seeds(STREAM_URR_PTABLE)); } // Play russian roulette if survival biasing is turned on