From e6f4fd15ee2e313b993cd9e9876e4f432bda10b8 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Fri, 10 Jan 2025 12:07:09 -0600 Subject: [PATCH 1/9] Add a new empty surface constant --- include/openmc/cell.h | 7 ------- include/openmc/constants.h | 8 ++++++++ include/openmc/particle_data.h | 4 ++-- src/output.cpp | 2 +- src/particle.cpp | 6 +++--- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/include/openmc/cell.h b/include/openmc/cell.h index 032475ce982..b34e7facc3c 100644 --- a/include/openmc/cell.h +++ b/include/openmc/cell.h @@ -29,13 +29,6 @@ namespace openmc { enum class Fill { MATERIAL, UNIVERSE, LATTICE }; -// TODO: Convert to enum -constexpr int32_t OP_LEFT_PAREN {std::numeric_limits::max()}; -constexpr int32_t OP_RIGHT_PAREN {std::numeric_limits::max() - 1}; -constexpr int32_t OP_COMPLEMENT {std::numeric_limits::max() - 2}; -constexpr int32_t OP_INTERSECTION {std::numeric_limits::max() - 3}; -constexpr int32_t OP_UNION {std::numeric_limits::max() - 4}; - //============================================================================== // Global variables //============================================================================== diff --git a/include/openmc/constants.h b/include/openmc/constants.h index 605ae1839d8..a28e103d460 100644 --- a/include/openmc/constants.h +++ b/include/openmc/constants.h @@ -350,6 +350,14 @@ enum class RandomRaySourceShape { FLAT, LINEAR, LINEAR_XY }; enum class GeometryType { CSG, DAG }; +constexpr int32_t OP_LEFT_PAREN {std::numeric_limits::max()}; +constexpr int32_t OP_RIGHT_PAREN {std::numeric_limits::max() - 1}; +constexpr int32_t OP_COMPLEMENT {std::numeric_limits::max() - 2}; +constexpr int32_t OP_INTERSECTION {std::numeric_limits::max() - 3}; +constexpr int32_t OP_UNION {std::numeric_limits::max() - 4}; +constexpr int32_t NO_SURFACE {std::numeric_limits::max() - 5}; + + } // namespace openmc #endif // OPENMC_CONSTANTS_H diff --git a/include/openmc/particle_data.h b/include/openmc/particle_data.h index 164148cce10..ceb80963e1c 100644 --- a/include/openmc/particle_data.h +++ b/include/openmc/particle_data.h @@ -226,7 +226,7 @@ class GeometryState { void init_from_r_u(Position r_a, Direction u_a) { clear(); - surface() = 0; + surface() = NO_SURFACE; material() = C_NONE; r() = r_a; u() = u_a; @@ -337,7 +337,7 @@ class GeometryState { Position r_last_; //!< previous coordinates Direction u_last_; //!< previous direction coordinates - int surface_ {0}; //!< index for surface particle is on + int surface_ {NO_SURFACE}; //!< index for surface particle is on BoundaryInfo boundary_; //!< Info about the next intersection diff --git a/src/output.cpp b/src/output.cpp index a430fe9a6c6..dcd9ada7a53 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -200,7 +200,7 @@ void print_particle(Particle& p) } // Display miscellaneous info. - if (p.surface() != 0) { + if (p.surface() != NO_SURFACE) { // Surfaces identifiers are >= 1, but indices are >= 0 so we need -1 const Surface& surf {*model::surfaces[std::abs(p.surface()) - 1]}; fmt::print(" Surface = {}\n", (p.surface() > 0) ? surf.id_ : -surf.id_); diff --git a/src/particle.cpp b/src/particle.cpp index 0ea8650143d..ca93d422051 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -108,7 +108,7 @@ void Particle::from_source(const SourceSite* src) { // Reset some attributes clear(); - surface() = 0; + surface() = NO_SURFACE; cell_born() = C_NONE; material() = C_NONE; n_collision() = 0; @@ -328,7 +328,7 @@ void Particle::event_collide() score_surface_tally(*this, model::active_meshsurf_tallies); // Clear surface component - surface() = 0; + surface() = NO_SURFACE; if (settings::run_CE) { collision(*this); @@ -587,7 +587,7 @@ void Particle::cross_surface(const Surface& surf) // the particle is really traveling tangent to a surface, if we move it // forward a tiny bit it should fix the problem. - surface() = 0; + surface() = NO_SURFACE; n_coord() = 1; r() += TINY_BIT * u(); From 223dd1ae52ec99601f25333bb615c3c00585b853 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Sat, 11 Jan 2025 13:03:40 -0600 Subject: [PATCH 2/9] Move region operator constants back into cell header --- include/openmc/cell.h | 6 ++++++ include/openmc/constants.h | 9 +++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/openmc/cell.h b/include/openmc/cell.h index b34e7facc3c..d01020f8e7a 100644 --- a/include/openmc/cell.h +++ b/include/openmc/cell.h @@ -29,6 +29,12 @@ namespace openmc { enum class Fill { MATERIAL, UNIVERSE, LATTICE }; +constexpr int32_t OP_LEFT_PAREN {std::numeric_limits::max()}; +constexpr int32_t OP_RIGHT_PAREN {std::numeric_limits::max() - 1}; +constexpr int32_t OP_COMPLEMENT {std::numeric_limits::max() - 2}; +constexpr int32_t OP_INTERSECTION {std::numeric_limits::max() - 3}; +constexpr int32_t OP_UNION {std::numeric_limits::max() - 4}; + //============================================================================== // Global variables //============================================================================== diff --git a/include/openmc/constants.h b/include/openmc/constants.h index a28e103d460..974956da3ad 100644 --- a/include/openmc/constants.h +++ b/include/openmc/constants.h @@ -350,12 +350,9 @@ enum class RandomRaySourceShape { FLAT, LINEAR, LINEAR_XY }; enum class GeometryType { CSG, DAG }; -constexpr int32_t OP_LEFT_PAREN {std::numeric_limits::max()}; -constexpr int32_t OP_RIGHT_PAREN {std::numeric_limits::max() - 1}; -constexpr int32_t OP_COMPLEMENT {std::numeric_limits::max() - 2}; -constexpr int32_t OP_INTERSECTION {std::numeric_limits::max() - 3}; -constexpr int32_t OP_UNION {std::numeric_limits::max() - 4}; -constexpr int32_t NO_SURFACE {std::numeric_limits::max() - 5}; +// a surface token cannot be zero due to the unsigned nature of zero for integer +// representations. This value represents no surface. +constexpr int32_t SURFACE_NONE {0}; } // namespace openmc From 62352f36276221236639b297e38bb0bf34b0383b Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Sat, 11 Jan 2025 13:07:23 -0600 Subject: [PATCH 3/9] Updating name from NO_SURFACE to SURFACE_NONE --- include/openmc/constants.h | 1 - include/openmc/particle_data.h | 12 +++++++++--- src/output.cpp | 2 +- src/particle.cpp | 6 +++--- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/include/openmc/constants.h b/include/openmc/constants.h index 974956da3ad..a83a4a07d4b 100644 --- a/include/openmc/constants.h +++ b/include/openmc/constants.h @@ -354,7 +354,6 @@ enum class GeometryType { CSG, DAG }; // representations. This value represents no surface. constexpr int32_t SURFACE_NONE {0}; - } // namespace openmc #endif // OPENMC_CONSTANTS_H diff --git a/include/openmc/particle_data.h b/include/openmc/particle_data.h index ceb80963e1c..7c6fbc76c60 100644 --- a/include/openmc/particle_data.h +++ b/include/openmc/particle_data.h @@ -185,7 +185,7 @@ struct CacheDataMG { struct BoundaryInfo { double distance {INFINITY}; //!< distance to nearest boundary - int surface_index {0}; //!< if boundary is surface, index in surfaces vector + int surface_index {SURFACE_NONE}; //!< if boundary is surface, index in surfaces vector int coord_level; //!< coordinate level after crossing boundary array lattice_translation {}; //!< which way lattice indices will change @@ -226,7 +226,7 @@ class GeometryState { void init_from_r_u(Position r_a, Direction u_a) { clear(); - surface() = NO_SURFACE; + surface() = SURFACE_NONE; material() = C_NONE; r() = r_a; u() = u_a; @@ -300,6 +300,12 @@ class GeometryState { int& surface() { return surface_; } const int& surface() const { return surface_; } + // Surface index based on the current value of the surface_ attribute + int surface_index() const + { + return std::abs(surface_) - 1; + } + // Boundary information BoundaryInfo& boundary() { return boundary_; } @@ -337,7 +343,7 @@ class GeometryState { Position r_last_; //!< previous coordinates Direction u_last_; //!< previous direction coordinates - int surface_ {NO_SURFACE}; //!< index for surface particle is on + int surface_ {SURFACE_NONE}; //!< index for surface particle is on BoundaryInfo boundary_; //!< Info about the next intersection diff --git a/src/output.cpp b/src/output.cpp index dcd9ada7a53..6ed758f0b6e 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -200,7 +200,7 @@ void print_particle(Particle& p) } // Display miscellaneous info. - if (p.surface() != NO_SURFACE) { + if (p.surface() != SURFACE_NONE) { // Surfaces identifiers are >= 1, but indices are >= 0 so we need -1 const Surface& surf {*model::surfaces[std::abs(p.surface()) - 1]}; fmt::print(" Surface = {}\n", (p.surface() > 0) ? surf.id_ : -surf.id_); diff --git a/src/particle.cpp b/src/particle.cpp index ca93d422051..f702731e4d3 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -108,7 +108,7 @@ void Particle::from_source(const SourceSite* src) { // Reset some attributes clear(); - surface() = NO_SURFACE; + surface() = SURFACE_NONE; cell_born() = C_NONE; material() = C_NONE; n_collision() = 0; @@ -328,7 +328,7 @@ void Particle::event_collide() score_surface_tally(*this, model::active_meshsurf_tallies); // Clear surface component - surface() = NO_SURFACE; + surface() = SURFACE_NONE; if (settings::run_CE) { collision(*this); @@ -587,7 +587,7 @@ void Particle::cross_surface(const Surface& surf) // the particle is really traveling tangent to a surface, if we move it // forward a tiny bit it should fix the problem. - surface() = NO_SURFACE; + surface() = SURFACE_NONE; n_coord() = 1; r() += TINY_BIT * u(); From fe5c666b56f851086a6720da6d6c83f2efda3ba4 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Sat, 11 Jan 2025 13:23:39 -0600 Subject: [PATCH 4/9] Implement surface_index methods and update documentation on attributes --- include/openmc/particle_data.h | 6 +++++- src/boundary_condition.cpp | 6 ++---- src/dagmc.cpp | 2 +- src/geometry.cpp | 10 +++++----- src/output.cpp | 2 +- src/particle.cpp | 6 +++--- src/plot.cpp | 6 +++--- src/tallies/filter_musurface.cpp | 2 +- src/tallies/filter_surface.cpp | 2 +- 9 files changed, 22 insertions(+), 20 deletions(-) diff --git a/include/openmc/particle_data.h b/include/openmc/particle_data.h index 7c6fbc76c60..12a8e33aa02 100644 --- a/include/openmc/particle_data.h +++ b/include/openmc/particle_data.h @@ -185,10 +185,13 @@ struct CacheDataMG { struct BoundaryInfo { double distance {INFINITY}; //!< distance to nearest boundary - int surface_index {SURFACE_NONE}; //!< if boundary is surface, index in surfaces vector + int surface {SURFACE_NONE}; //!< surface token, non-zero if boundary is surface int coord_level; //!< coordinate level after crossing boundary array lattice_translation {}; //!< which way lattice indices will change + + // TODO: off-by-one + int surface_index() const { return std::abs(surface) - 1; } }; /* @@ -303,6 +306,7 @@ class GeometryState { // Surface index based on the current value of the surface_ attribute int surface_index() const { + // TODO: off-by-one on surface indices throughout this function. return std::abs(surface_) - 1; } diff --git a/src/boundary_condition.cpp b/src/boundary_condition.cpp index b58054dce8c..7216ac89649 100644 --- a/src/boundary_condition.cpp +++ b/src/boundary_condition.cpp @@ -129,8 +129,7 @@ TranslationalPeriodicBC::TranslationalPeriodicBC(int i_surf, int j_surf) void TranslationalPeriodicBC::handle_particle( Particle& p, const Surface& surf) const { - // TODO: off-by-one on surface indices throughout this function. - int i_particle_surf = std::abs(p.surface()) - 1; + int i_particle_surf = p.surface_index(); // Figure out which of the two BC surfaces were struck then find the // particle's new location and surface. @@ -255,8 +254,7 @@ RotationalPeriodicBC::RotationalPeriodicBC(int i_surf, int j_surf) void RotationalPeriodicBC::handle_particle( Particle& p, const Surface& surf) const { - // TODO: off-by-one on surface indices throughout this function. - int i_particle_surf = std::abs(p.surface()) - 1; + int i_particle_surf = p.surface_index(); // Figure out which of the two BC surfaces were struck to figure out if a // forward or backward rotation is required. Specify the other surface as diff --git a/src/dagmc.cpp b/src/dagmc.cpp index 134e31ecf3c..94c220850f3 100644 --- a/src/dagmc.cpp +++ b/src/dagmc.cpp @@ -847,7 +847,7 @@ void check_dagmc_root_univ() int32_t next_cell(int32_t surf, int32_t curr_cell, int32_t univ) { - auto surfp = dynamic_cast(model::surfaces[surf - 1].get()); + auto surfp = dynamic_cast(model::surfaces[surf].get()); auto cellp = dynamic_cast(model::cells[curr_cell].get()); auto univp = static_cast(model::universes[univ].get()); diff --git a/src/geometry.cpp b/src/geometry.cpp index 445b19faac1..185e1384c77 100644 --- a/src/geometry.cpp +++ b/src/geometry.cpp @@ -421,15 +421,15 @@ BoundaryInfo distance_to_boundary(GeometryState& p) // have to explicitly check which half-space the particle would be // traveling into if the surface is crossed if (c.is_simple() || d == INFTY) { - info.surface_index = level_surf_cross; + info.surface = level_surf_cross; } else { Position r_hit = r + d_surf * u; - Surface& surf {*model::surfaces[std::abs(level_surf_cross) - 1]}; + Surface& surf {*model::surfaces[info.surface_index()]}; Direction norm = surf.normal(r_hit); if (u.dot(norm) > 0) { - info.surface_index = std::abs(level_surf_cross); + info.surface = std::abs(level_surf_cross); } else { - info.surface_index = -std::abs(level_surf_cross); + info.surface = -std::abs(level_surf_cross); } } @@ -441,7 +441,7 @@ BoundaryInfo distance_to_boundary(GeometryState& p) } else { if (d == INFINITY || (d - d_lat) / d >= FP_REL_PRECISION) { d = d_lat; - info.surface_index = 0; + info.surface = SURFACE_NONE; info.lattice_translation = level_lat_trans; info.coord_level = i + 1; } diff --git a/src/output.cpp b/src/output.cpp index 6ed758f0b6e..8494450c409 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -202,7 +202,7 @@ void print_particle(Particle& p) // Display miscellaneous info. if (p.surface() != SURFACE_NONE) { // Surfaces identifiers are >= 1, but indices are >= 0 so we need -1 - const Surface& surf {*model::surfaces[std::abs(p.surface()) - 1]}; + const Surface& surf {*model::surfaces[p.surface_index()]}; fmt::print(" Surface = {}\n", (p.surface() > 0) ? surf.id_ : -surf.id_); } fmt::print(" Weight = {}\n", p.wgt()); diff --git a/src/particle.cpp b/src/particle.cpp index f702731e4d3..65e8065fded 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -277,7 +277,7 @@ void Particle::event_cross_surface() n_coord_last() = n_coord(); // Set surface that particle is on and adjust coordinate levels - surface() = boundary().surface_index; + surface() = boundary().surface; n_coord() = boundary().coord_level; if (boundary().lattice_translation[0] != 0 || @@ -291,7 +291,7 @@ void Particle::event_cross_surface() } else { // Particle crosses surface // TODO: off-by-one - const auto& surf {model::surfaces[std::abs(surface()) - 1].get()}; + const auto& surf {model::surfaces[surface_index()].get()}; // If BC, add particle to surface source before crossing surface if (surf->surf_source_ && surf->bc_) { add_surf_source_to_bank(*this, *surf); @@ -549,7 +549,7 @@ void Particle::cross_surface(const Surface& surf) #ifdef DAGMC // in DAGMC, we know what the next cell should be if (surf.geom_type() == GeometryType::DAG) { - int32_t i_cell = next_cell(std::abs(surface()), cell_last(n_coord() - 1), + int32_t i_cell = next_cell(surface_index(), cell_last(n_coord() - 1), lowest_coord().universe) - 1; // save material and temp diff --git a/src/plot.cpp b/src/plot.cpp index 85131d67a01..b36ed6f5d93 100644 --- a/src/plot.cpp +++ b/src/plot.cpp @@ -1301,7 +1301,7 @@ void ProjectionPlot::create_output() const while (intersection_found) { bool inside_cell = false; - int32_t i_surface = std::abs(p.surface()) - 1; + int32_t i_surface = p.surface_index(); if (i_surface > 0 && model::surfaces[i_surface]->geom_type() == GeometryType::DAG) { #ifdef DAGMC @@ -1334,13 +1334,13 @@ void ProjectionPlot::create_output() const this_line_segments[tid][horiz].emplace_back( color_by_ == PlotColorBy::mats ? p.material() : p.lowest_coord().cell, - dist.distance, std::abs(dist.surface_index)); + dist.distance, std::abs(dist.surface)); // Advance particle for (int lev = 0; lev < p.n_coord(); ++lev) { p.coord(lev).r += dist.distance * p.coord(lev).u; } - p.surface() = dist.surface_index; + p.surface() = dist.surface; p.n_coord_last() = p.n_coord(); p.n_coord() = dist.coord_level; if (dist.lattice_translation[0] != 0 || diff --git a/src/tallies/filter_musurface.cpp b/src/tallies/filter_musurface.cpp index 58fe39b9113..340149d4cff 100644 --- a/src/tallies/filter_musurface.cpp +++ b/src/tallies/filter_musurface.cpp @@ -12,7 +12,7 @@ void MuSurfaceFilter::get_all_bins( const Particle& p, TallyEstimator estimator, FilterMatch& match) const { // Get surface normal (and make sure it is a unit vector) - const auto surf {model::surfaces[std::abs(p.surface()) - 1].get()}; + const auto surf {model::surfaces[p.surface_index()].get()}; auto n = surf->normal(p.r()); n /= n.norm(); diff --git a/src/tallies/filter_surface.cpp b/src/tallies/filter_surface.cpp index a84d1772822..1fbf8d44e38 100644 --- a/src/tallies/filter_surface.cpp +++ b/src/tallies/filter_surface.cpp @@ -47,7 +47,7 @@ void SurfaceFilter::set_surfaces(gsl::span surfaces) void SurfaceFilter::get_all_bins( const Particle& p, TallyEstimator estimator, FilterMatch& match) const { - auto search = map_.find(std::abs(p.surface()) - 1); + auto search = map_.find(p.surface_index()); if (search != map_.end()) { match.bins_.push_back(search->second); if (p.surface() < 0) { From 3f27fbd9ec168bd0cebe568a10293115a1192a6b Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Sat, 11 Jan 2025 13:24:24 -0600 Subject: [PATCH 5/9] Quick documentation update --- include/openmc/particle_data.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/openmc/particle_data.h b/include/openmc/particle_data.h index 12a8e33aa02..4618b2d8099 100644 --- a/include/openmc/particle_data.h +++ b/include/openmc/particle_data.h @@ -347,7 +347,7 @@ class GeometryState { Position r_last_; //!< previous coordinates Direction u_last_; //!< previous direction coordinates - int surface_ {SURFACE_NONE}; //!< index for surface particle is on + int surface_ {SURFACE_NONE}; //!< surface token for surface the particle is currently on BoundaryInfo boundary_; //!< Info about the next intersection From 3866dd430d19d099d6182364e01c48a9e54e3a9f Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Sat, 11 Jan 2025 13:26:21 -0600 Subject: [PATCH 6/9] Style --- include/openmc/particle_data.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/openmc/particle_data.h b/include/openmc/particle_data.h index 4618b2d8099..283a3532d8f 100644 --- a/include/openmc/particle_data.h +++ b/include/openmc/particle_data.h @@ -185,8 +185,9 @@ struct CacheDataMG { struct BoundaryInfo { double distance {INFINITY}; //!< distance to nearest boundary - int surface {SURFACE_NONE}; //!< surface token, non-zero if boundary is surface - int coord_level; //!< coordinate level after crossing boundary + int surface { + SURFACE_NONE}; //!< surface token, non-zero if boundary is surface + int coord_level; //!< coordinate level after crossing boundary array lattice_translation {}; //!< which way lattice indices will change @@ -347,7 +348,8 @@ class GeometryState { Position r_last_; //!< previous coordinates Direction u_last_; //!< previous direction coordinates - int surface_ {SURFACE_NONE}; //!< surface token for surface the particle is currently on + int surface_ { + SURFACE_NONE}; //!< surface token for surface the particle is currently on BoundaryInfo boundary_; //!< Info about the next intersection From 7bfbee73ecc9dda3cf8a51229ae9df33a43cadd0 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Sat, 11 Jan 2025 14:53:07 -0600 Subject: [PATCH 7/9] Correcting suface lookup --- src/geometry.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/geometry.cpp b/src/geometry.cpp index 185e1384c77..f7ed4995e42 100644 --- a/src/geometry.cpp +++ b/src/geometry.cpp @@ -424,7 +424,7 @@ BoundaryInfo distance_to_boundary(GeometryState& p) info.surface = level_surf_cross; } else { Position r_hit = r + d_surf * u; - Surface& surf {*model::surfaces[info.surface_index()]}; + Surface& surf {*model::surfaces[std::abs(level_surf_cross)-1]}; Direction norm = surf.normal(r_hit); if (u.dot(norm) > 0) { info.surface = std::abs(level_surf_cross); From 2452fd9111fd46a1556fc49cc00074917ebfeac1 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Sun, 12 Jan 2025 13:10:29 -0600 Subject: [PATCH 8/9] Improving comments a bit --- include/openmc/particle_data.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/openmc/particle_data.h b/include/openmc/particle_data.h index 283a3532d8f..86461229415 100644 --- a/include/openmc/particle_data.h +++ b/include/openmc/particle_data.h @@ -300,14 +300,14 @@ class GeometryState { Direction& u_local() { return coord_[n_coord_ - 1].u; } const Direction& u_local() const { return coord_[n_coord_ - 1].u; } - // Surface that the particle is on + // Surface token for the surfae that the particle is currently on int& surface() { return surface_; } const int& surface() const { return surface_; } // Surface index based on the current value of the surface_ attribute int surface_index() const { - // TODO: off-by-one on surface indices throughout this function. + // TODO: off-by-one on return std::abs(surface_) - 1; } From 30b413a6dfe26091f846271164ea277c0fd4e864 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Sun, 12 Jan 2025 13:13:10 -0600 Subject: [PATCH 9/9] Style for geometry cpp --- src/geometry.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/geometry.cpp b/src/geometry.cpp index f7ed4995e42..9e975c00dee 100644 --- a/src/geometry.cpp +++ b/src/geometry.cpp @@ -424,7 +424,7 @@ BoundaryInfo distance_to_boundary(GeometryState& p) info.surface = level_surf_cross; } else { Position r_hit = r + d_surf * u; - Surface& surf {*model::surfaces[std::abs(level_surf_cross)-1]}; + Surface& surf {*model::surfaces[std::abs(level_surf_cross) - 1]}; Direction norm = surf.normal(r_hit); if (u.dot(norm) > 0) { info.surface = std::abs(level_surf_cross);