From: Wolfgang Bangerth Date: Mon, 29 Nov 2021 01:18:58 +0000 (-0700) Subject: Avoid a few cases where compilers complain about comparisons of unsigned<0. X-Git-Tag: v9.4.0-rc1~761^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F12953%2Fhead;p=dealii.git Avoid a few cases where compilers complain about comparisons of unsigned<0. --- diff --git a/include/deal.II/matrix_free/mapping_info.templates.h b/include/deal.II/matrix_free/mapping_info.templates.h index c17a0e561d..2c3072008f 100644 --- a/include/deal.II/matrix_free/mapping_info.templates.h +++ b/include/deal.II/matrix_free/mapping_info.templates.h @@ -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; } diff --git a/include/deal.II/numerics/data_out_dof_data.templates.h b/include/deal.II/numerics/data_out_dof_data.templates.h index 648d248bc9..29fee5604c 100644 --- a/include/deal.II/numerics/data_out_dof_data.templates.h +++ b/include/deal.II/numerics/data_out_dof_data.templates.h @@ -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()); diff --git a/source/base/function_restriction.cc b/source/base/function_restriction.cc index a21e250983..57fa91d83f 100644 --- a/source/base/function_restriction.cc +++ b/source/base/function_restriction.cc @@ -29,7 +29,7 @@ namespace internal Point 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( diff --git a/source/base/quadrature_lib.cc b/source/base/quadrature_lib.cc index 0245c5fb32..368cd980fe 100644 --- a/source/base/quadrature_lib.cc +++ b/source/base/quadrature_lib.cc @@ -1214,7 +1214,7 @@ QSimplex::QSimplex(const Quadrature &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) {