mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Prevent segfault in distance to boundary calculation (#2659)
This commit is contained in:
parent
d21b653d32
commit
1cae2f712a
2 changed files with 32 additions and 1 deletions
|
|
@ -419,13 +419,14 @@ BoundaryInfo distance_to_boundary(Particle& p)
|
|||
double& d = info.distance;
|
||||
if (d_surf < d_lat - FP_COINCIDENT) {
|
||||
if (d == INFINITY || (d - d_surf) / d >= FP_REL_PRECISION) {
|
||||
// Update closest distance
|
||||
d = d_surf;
|
||||
|
||||
// If the cell is not simple, it is possible that both the negative and
|
||||
// positive half-space were given in the region specification. Thus, we
|
||||
// have to explicitly check which half-space the particle would be
|
||||
// traveling into if the surface is crossed
|
||||
if (c.is_simple()) {
|
||||
if (c.is_simple() || d == INFTY) {
|
||||
info.surface_index = level_surf_cross;
|
||||
} else {
|
||||
Position r_hit = r + d_surf * u;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue