From bc888b6b65419eb43d36b0aaf9b75f15b96f1243 Mon Sep 17 00:00:00 2001 From: Richard Schussnig Date: Tue, 16 May 2023 09:23:32 +0200 Subject: [PATCH] fixed some compiler warnings in tria.cc --- source/grid/tria.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/source/grid/tria.cc b/source/grid/tria.cc index 619a0581d3..2890f0a60f 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -5708,7 +5708,11 @@ namespace internal { unsigned int k = 0; - for (const unsigned int i : hex->vertex_indices()) + // avoid a compiler warning by fixing the max number of + // loop iterations to 8 + const unsigned int n_vertices = + std::min(hex->n_vertices(), 8u); + for (unsigned int i = 0; i < n_vertices; ++i) vertex_indices[k++] = hex->vertex_index(i); const std::array line_indices = @@ -14943,7 +14947,10 @@ void Triangulation::execute_coarsening() { const auto line_indices = internal::TriaAccessorImplementation:: Implementation::get_line_indices_of_cell(*cell); - for (unsigned int l = 0; l < cell->n_lines(); ++l) + // avoid a compiler warning by fixing the max number of + // loop iterations to 12 + const unsigned int n_lines = std::min(cell->n_lines(), 12u); + for (unsigned int l = 0; l < n_lines; ++l) ++line_cell_count[line_indices[l]]; for (unsigned int q : cell->face_indices()) ++quad_cell_count[cell->face_index(q)]; -- 2.39.5