@@ -2730,6 +2730,9 @@ void score_pulse_height_tally(Particle& p, const vector<int>& tallies)
27302730 int orig_cell = p.coord (0 ).cell ();
27312731 double orig_E_last = p.E_last ();
27322732
2733+ // Set particle in top level
2734+ p.n_coord () = 1 ;
2735+
27332736 for (auto i_tally : tallies) {
27342737 auto & tally {*model::tallies[i_tally]};
27352738
@@ -2740,7 +2743,6 @@ void score_pulse_height_tally(Particle& p, const vector<int>& tallies)
27402743
27412744 for (auto cell_id : cells) {
27422745 // Temporarily change cell of particle
2743- p.n_coord () = 1 ;
27442746 p.coord (0 ).cell () = cell_id;
27452747
27462748 // Determine index of cell in model::pulse_height_cells
@@ -2756,31 +2758,31 @@ void score_pulse_height_tally(Particle& p, const vector<int>& tallies)
27562758 // we skip the assume_separate break below.
27572759 auto filter_iter = FilterBinIter (tally, p);
27582760 auto end = FilterBinIter (tally, true , &p.filter_matches ());
2759- if (filter_iter == end)
2760- continue ;
2761+ if (filter_iter != end) {
27612762
2762- // Loop over filter bins.
2763- for (; filter_iter != end; ++filter_iter) {
2764- auto filter_index = filter_iter.index_ ;
2765- auto filter_weight = filter_iter.weight_ ;
2763+ // Loop over filter bins.
2764+ for (; filter_iter != end; ++filter_iter) {
2765+ auto filter_index = filter_iter.index_ ;
2766+ auto filter_weight = filter_iter.weight_ ;
27662767
2767- // Loop over scores.
2768- for (auto score_index = 0 ; score_index < tally.scores_ .size ();
2769- ++score_index) {
2768+ // Loop over scores.
2769+ for (auto score_index = 0 ; score_index < tally.scores_ .size ();
2770+ ++score_index) {
27702771#pragma omp atomic
2771- tally.results_ (filter_index, score_index, TallyResult::VALUE ) +=
2772- filter_weight;
2772+ tally.results_ (filter_index, score_index, TallyResult::VALUE ) +=
2773+ filter_weight;
2774+ }
27732775 }
27742776 }
27752777
27762778 // Reset all the filter matches for the next tally event.
27772779 for (auto & match : p.filter_matches ())
27782780 match.bins_present_ = false ;
27792781 }
2780- // Restore cell/energy
2781- p.n_coord () = orig_n_coord;
2782- p.coord (0 ).cell () = orig_cell;
2783- p.E_last () = orig_E_last;
27842782 }
2783+ // Restore cell/energy
2784+ p.n_coord () = orig_n_coord;
2785+ p.coord (0 ).cell () = orig_cell;
2786+ p.E_last () = orig_E_last;
27852787}
27862788} // namespace openmc
0 commit comments