From a8ce1445859c8be4ff794648693b3f966e7848fd Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Wed, 31 Mar 2021 23:38:25 -0500 Subject: [PATCH] Resetting coordinates at lower levels in neighbor_list_find_cell. --- src/geometry.cpp | 10 +++++++++- src/particle.cpp | 4 ---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/geometry.cpp b/src/geometry.cpp index 9d612412b..06d35cace 100644 --- a/src/geometry.cpp +++ b/src/geometry.cpp @@ -188,7 +188,9 @@ find_cell_inner(Particle& p, const NeighborList* neighbor_list) coord.r -= c.translation_; // Apply rotation. - coord.rotate(c.rotation_); + if (!c.rotation_.empty()) { + coord.rotate(c.rotation_); + } } else if (c.type_ == Fill::LATTICE) { //======================================================================== @@ -245,6 +247,12 @@ find_cell_inner(Particle& p, const NeighborList* neighbor_list) bool neighbor_list_find_cell(Particle& p) { + + // Reset all the deeper coordinate levels. + for (int i = p.n_coord_; i < p.coord_.size(); i++) { + p.coord_[i].reset(); + } + // Get the cell this particle was in previously. auto coord_lvl = p.n_coord_ - 1; auto i_cell = p.coord_[coord_lvl].cell; diff --git a/src/particle.cpp b/src/particle.cpp index d05b81d84..2e2413174 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -38,10 +38,6 @@ namespace openmc { void LocalCoord::rotate(const std::vector& rotation) { - if (rotation.empty()) { - this->rotated = false; - return; - } this->r = this->r.rotate(rotation); this->u = this->u.rotate(rotation); this->rotated = true;