From 1f2f859cb8151c0d16d559cf09f3c37d163c1768 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 10 Feb 2022 15:10:11 -0600 Subject: [PATCH] Addressing PR comments from PR --- src/cell.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/cell.cpp b/src/cell.cpp index 0c0e749c4d..2b6555d128 100644 --- a/src/cell.cpp +++ b/src/cell.cpp @@ -1321,7 +1321,6 @@ vector Cell::find_parent_cells( // create a temporary particle Particle dummy_particle {}; - dummy_particle.clear(); dummy_particle.r() = r; dummy_particle.u() = {0., 0., 1.}; @@ -1331,7 +1330,7 @@ vector Cell::find_parent_cells( vector Cell::find_parent_cells( int32_t instance, Particle& p) const { // look up the particle's location - openmc::exhaustive_find_cell(p); + exhaustive_find_cell(p); const auto& coords = p.coord(); // build a parent cell stack from the particle coordinates @@ -1339,7 +1338,7 @@ vector Cell::find_parent_cells( bool cell_found = false; for (auto it = coords.begin(); it != coords.end(); it++) { const auto& coord = *it; - auto& cell = model::cells[coord.cell]; + const auto& cell = model::cells[coord.cell]; // if the cell at this level matches the current cell, stop adding to the stack if (coord.cell == model::cell_map[this->id_]) { cell_found = true; @@ -1469,10 +1468,8 @@ std::unordered_map> Cell::get_contained_cells( // if a positional hint is provided, attempt to do a fast lookup // of the parent cells - if (hint) - parent_cells = find_parent_cells(instance, *hint); - else - parent_cells = exhaustive_find_parent_cells(instance); + parent_cells = hint ? find_parent_cells(instance, *hint) + : exhaustive_find_parent_cells(instance); // if this cell is filled w/ a material, it contains no other cells if (type_ != Fill::MATERIAL) {