Skip to content

Commit

Permalink
Use a conditional to avoid accesses the compiler flags as possibly ou…
Browse files Browse the repository at this point in the history
…t of bounds.

Co-authored-by: Daniel Arndt <arndtd@ornl.gov>
  • Loading branch information
bangerth and masterleinad committed Jan 11, 2023
1 parent 5fbe2ae commit c297e81
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/deal.II/grid/reference_cell.h
Original file line number Diff line number Diff line change
Expand Up @@ -2195,11 +2195,11 @@ ReferenceCell::contains_point(const Point<dim> &p, const double tolerance) const
else if (*this == ReferenceCells::Pyramid)
{
// A pyramid only lives in the upper half-space:
if (p[2] < -tolerance)
if (p[dim < 3 ? 0 : 2] < -tolerance)
return false;

// It also only lives in the space below z=1:
if (p[2] > 1 + tolerance)
if (p[dim < 3 ? 0 : 2] > 1 + tolerance)
return false;

// Within what's left of the space, a pyramid is a cone that tapers
Expand Down

0 comments on commit c297e81

Please sign in to comment.