]> https://gitweb.dealii.org/ - dealii.git/commitdiff
fixed some compiler warnings in tria.cc 15220/head
authorRichard Schussnig <richard.schussnig@uni-a.de>
Tue, 16 May 2023 07:23:32 +0000 (09:23 +0200)
committerRichard Schussnig <richard.schussnig@uni-a.de>
Tue, 16 May 2023 07:23:32 +0000 (09:23 +0200)
source/grid/tria.cc

index 619a0581d312f1b80ae470754813af0920bed0e9..2890f0a60f79fb97e3f5b895476aec27640fdc18 100644 (file)
@@ -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<unsigned int, 12> line_indices =
@@ -14943,7 +14947,10 @@ void Triangulation<dim, spacedim>::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)];

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.