From 595a00d8d5a291413a00d4bd4eda04580d68cf7f Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Fri, 30 Jul 2021 10:42:52 -0500 Subject: [PATCH] Lowering nesting of check for non-material-filled cell instances. --- src/tallies/filter_cell_instance.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/tallies/filter_cell_instance.cpp b/src/tallies/filter_cell_instance.cpp index d846aa294..0dcc4b094 100644 --- a/src/tallies/filter_cell_instance.cpp +++ b/src/tallies/filter_cell_instance.cpp @@ -86,19 +86,19 @@ CellInstanceFilter::get_all_bins(const Particle& p, TallyEstimator estimator, } } - if (!material_cells_only_) { - for (int i = 0; i < p.n_coord() - 1; i++) { - gsl::index index_cell = p.coord(i).cell; - // if this cell isn't used on the filter, move on - if (cells_.count(index_cell) == 0) continue; + if (material_cells_only_) return; - // if this cell is used in the filter, check the instance as well - gsl::index instance = cell_instance_at_level(p, i); - auto search = map_.find({index_cell, instance}); - if (search != map_.end()) { - match.bins_.push_back(search->second); - match.weights_.push_back(1.0); - } + for (int i = 0; i < p.n_coord() - 1; i++) { + gsl::index index_cell = p.coord(i).cell; + // if this cell isn't used on the filter, move on + if (cells_.count(index_cell) == 0) continue; + + // if this cell is used in the filter, check the instance as well + gsl::index instance = cell_instance_at_level(p, i); + auto search = map_.find({index_cell, instance}); + if (search != map_.end()) { + match.bins_.push_back(search->second); + match.weights_.push_back(1.0); } } }