mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Properly setting distance for lost particle. Updating history reset condition.
This commit is contained in:
parent
c22d5cbc15
commit
90abce144c
1 changed files with 9 additions and 1 deletions
10
src/cell.cpp
10
src/cell.cpp
|
|
@ -620,11 +620,18 @@ DAGCell::DAGCell() : Cell{} {};
|
|||
std::pair<double, int32_t>
|
||||
DAGCell::distance(Position r, Direction u, int32_t on_surface) const
|
||||
{
|
||||
if (u != last_dir) {
|
||||
|
||||
// if we've changed direction, reset the history and update last direction
|
||||
if (u != last_dir || on_surface == 0) {
|
||||
history.reset();
|
||||
last_dir = u;
|
||||
}
|
||||
|
||||
// always reset the history if we're on the surface
|
||||
// if (on_surface == 0) {
|
||||
// history.reset();
|
||||
// }
|
||||
|
||||
moab::ErrorCode rval;
|
||||
moab::EntityHandle vol = dagmc_ptr_->entity_by_index(3, dag_index_);
|
||||
moab::EntityHandle hit_surf;
|
||||
|
|
@ -638,6 +645,7 @@ DAGCell::distance(Position r, Direction u, int32_t on_surface) const
|
|||
surf_idx = dagmc_ptr_->index_by_handle(hit_surf);
|
||||
} else { // indicate that particle is lost
|
||||
surf_idx = -1;
|
||||
dist = INFINITY;
|
||||
}
|
||||
|
||||
return {dist, surf_idx};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue