diff --git a/src/cell.cpp b/src/cell.cpp index c5d53dda4a..ae121d2ba1 100644 --- a/src/cell.cpp +++ b/src/cell.cpp @@ -816,10 +816,8 @@ DAGCell::distance(Position r, Direction u, int32_t on_surface, Particle* p) cons Expects(p); // if we've changed direction or we're not on a surface, // reset the history and update last direction - if (u != p->last_dir() || on_surface == 0) { - p->history().reset(); - p->last_dir() = u; - } + if (u != p->last_dir()) { p->last_dir() = u; p->history().reset(); } + if (on_surface == 0) { p->history().reset(); } const auto& univ = model::universes[p->coord_[p->n_coord_ - 1].universe]; @@ -841,6 +839,7 @@ DAGCell::distance(Position r, Direction u, int32_t on_surface, Particle* p) cons // indicate that particle is lost surf_idx = -1; dist = INFINITY; + p->mark_as_lost(fmt::format("No intersection found with DAGMC cell {}", id_)); } return {dist, surf_idx};