Skip to content

Commit

Permalink
Merge pull request dealii#14029 from drwells/gcc12-array-warning
Browse files Browse the repository at this point in the history
  • Loading branch information
masterleinad committed Jun 21, 2022
2 parents cc81950 + a6b32d6 commit c190ed1
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions include/deal.II/grid/reference_cell.h
Original file line number Diff line number Diff line change
Expand Up @@ -1311,6 +1311,9 @@ ReferenceCell::standard_vertex_to_face_and_vertex_index(
const unsigned int vertex) const
{
AssertIndexRange(vertex, n_vertices());
// Work around a GCC warning at higher optimization levels by making all of
// these tables the same size
constexpr unsigned int X = numbers::invalid_unsigned_int;

if (*this == ReferenceCells::Vertex)
{
Expand All @@ -1322,8 +1325,8 @@ ReferenceCell::standard_vertex_to_face_and_vertex_index(
}
else if (*this == ReferenceCells::Triangle)
{
static const ndarray<unsigned int, 3, 2> table = {
{{{0, 0}}, {{0, 1}}, {{1, 1}}}};
static const ndarray<unsigned int, 6, 2> table = {
{{{0, 0}}, {{0, 1}}, {{1, 1}}, {{X, X}}, {{X, X}}, {{X, X}}}};

return table[vertex];
}
Expand All @@ -1333,15 +1336,15 @@ ReferenceCell::standard_vertex_to_face_and_vertex_index(
}
else if (*this == ReferenceCells::Tetrahedron)
{
static const ndarray<unsigned int, 4, 2> table = {
{{{0, 0}}, {{0, 1}}, {{0, 2}}, {{1, 2}}}};
static const ndarray<unsigned int, 6, 2> table = {
{{{0, 0}}, {{0, 1}}, {{0, 2}}, {{1, 2}}, {{X, X}}, {{X, X}}}};

return table[vertex];
}
else if (*this == ReferenceCells::Pyramid)
{
static const ndarray<unsigned int, 5, 2> table = {
{{{0, 0}}, {{0, 1}}, {{0, 2}}, {{0, 3}}, {{1, 2}}}};
static const ndarray<unsigned int, 6, 2> table = {
{{{0, 0}}, {{0, 1}}, {{0, 2}}, {{0, 3}}, {{1, 2}}, {{X, X}}}};

return table[vertex];
}
Expand Down

0 comments on commit c190ed1

Please sign in to comment.