From: Richard Schussnig Date: Tue, 16 May 2023 07:23:32 +0000 (+0200) Subject: fixed some compiler warnings in tria.cc X-Git-Tag: v9.5.0-rc1~223^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc888b6b65419eb43d36b0aaf9b75f15b96f1243;p=dealii.git fixed some compiler warnings in tria.cc --- 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)];