]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Re-implement a compiler warning workaround 14687/head
authorDavid Wells <drwells@email.unc.edu>
Mon, 16 Jan 2023 18:09:42 +0000 (13:09 -0500)
committerDavid Wells <drwells@email.unc.edu>
Mon, 16 Jan 2023 18:09:42 +0000 (13:09 -0500)
source/grid/tria.cc

index 78ca6cecbb3edb0e8ed149a3bce7ca15c5f9749b..00740c5c4549dc5a940ab9084296682d286c1b09 100644 (file)
@@ -5716,7 +5716,10 @@ namespace internal
                     const std::array<unsigned int, 12> line_indices =
                       TriaAccessorImplementation::Implementation::
                         get_line_indices_of_cell(*hex);
-                    for (unsigned int l = 0; l < hex->n_lines(); ++l)
+                    // avoid a compiler warning by fixing the max number of
+                    // loop iterations to 12
+                    const unsigned int n_lines = std::min(hex->n_lines(), 12u);
+                    for (unsigned int l = 0; l < n_lines; ++l)
                       {
                         raw_line_iterator line(&triangulation,
                                                0,

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.