]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Avoid a few cases where compilers complain about comparisons of unsigned<0. 12953/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Mon, 29 Nov 2021 01:18:58 +0000 (18:18 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Mon, 29 Nov 2021 01:18:58 +0000 (18:18 -0700)
include/deal.II/matrix_free/mapping_info.templates.h
include/deal.II/numerics/data_out_dof_data.templates.h
source/base/function_restriction.cc
source/base/quadrature_lib.cc

index c17a0e561ddf0195302a9a6bd927be3170c7b4aa..2c3072008f27b35e8fe281a7423c8fcb7e22e23d 100644 (file)
@@ -100,7 +100,7 @@ namespace internal
       for (unsigned int i = 0; i < n_q_points; ++i)
         quadrature_weights[i] = quadrature.weight(i);
 
-      for (unsigned int d = 0; d < structdim; ++d)
+      for (int d = 0; d < structdim; ++d)
         {
           tensor_quadrature_weights[d].resize(quadrature_1d.size());
           for (unsigned int i = 0; i < quadrature_1d.size(); ++i)
@@ -149,7 +149,7 @@ namespace internal
       std::size_t memory = sizeof(this) + quadrature.memory_consumption() +
                            quadrature_weights.memory_consumption() +
                            face_orientations.memory_consumption();
-      for (unsigned int d = 0; d < structdim; ++d)
+      for (int d = 0; d < structdim; ++d)
         memory += tensor_quadrature_weights[d].memory_consumption();
       return memory;
     }
index 648d248bc94fac2e1afaea9ff615433cb1a1ef11..29fee5604c065a10d01bfea9341b547f0e782ca3 100644 (file)
@@ -942,6 +942,22 @@ namespace internal
 
         for (unsigned int b = 0; b < src.n_blocks(); ++b)
           {
+            Assert(src.block(b).locally_owned_elements().is_contiguous(),
+                   ExcMessage(
+                     "Using non-contiguous vector blocks is not currently "
+                     "supported by DataOut and related classes. The typical "
+                     "way you may end up with such vectors is if you order "
+                     "degrees of freedom via DoFRenumber::component_wise() "
+                     "but then group several vector components into one "
+                     "vector block -- for example, all 'dim' components "
+                     "of a velocity are grouped into the same vector block. "
+                     "If you do this, you don't want to renumber degrees "
+                     "of freedom based on vector component, but instead "
+                     "based on the 'blocks' you will later use for grouping "
+                     "things into vectors. Take a look at step-32 and step-55 "
+                     "and how they use the second argument of "
+                     "DoFRenumber::component_wise()."));
+
             dst.block(b).reinit(locally_owned_dofs_b[b],
                                 locally_relevant_dofs_b[b],
                                 dof_handler.get_communicator());
index a21e250983c3ef697a88243c7d7c821c10251eb6..57fa91d83f39324146b3a176d66b44589fcbae69 100644 (file)
@@ -29,7 +29,7 @@ namespace internal
 
     Point<dim + 1> output;
     output(component_in_dim_plus_1) = coordinate_value;
-    for (unsigned int d = 0; d < dim; ++d)
+    for (int d = 0; d < dim; ++d)
       {
         const unsigned int component_to_write_to =
           dealii::internal::coordinate_to_one_dim_higher<dim>(
index 0245c5fb324a856f1f082b3068725ddaed646b50..368cd980feee46a4e7afe66c741f415bea794854 100644 (file)
@@ -1214,7 +1214,7 @@ QSimplex<dim>::QSimplex(const Quadrature<dim> &quad)
        * around a wrong diagnostic in gcc-10.3.0 that warns about that the
        * comparison "d < dim" is always false in case of "dim == 0".
        * MM 2021 */
-      for (unsigned int d = 0; d < dim; ++d)
+      for (int d = 0; d < dim; ++d)
         r += quad.point(i)[d];
       if (r <= 1 + 1e-10)
         {

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.