From: Bruno Turcksin Date: Wed, 21 Jul 2021 16:04:03 +0000 (+0000) Subject: Fix unused-but-set-variable warnings X-Git-Tag: v9.4.0-rc1~1129^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F12590%2Fhead;p=dealii.git Fix unused-but-set-variable warnings --- diff --git a/source/base/index_set.cc b/source/base/index_set.cc index 8815d6919b..4216908880 100644 --- a/source/base/index_set.cc +++ b/source/base/index_set.cc @@ -243,14 +243,21 @@ IndexSet::split_by_block( partitioned.reserve(n_blocks); types::global_dof_index start = 0; - types::global_dof_index sum = 0; for (const auto n_block_indices : n_indices_per_block) { partitioned.push_back(this->get_view(start, start + n_block_indices)); start += n_block_indices; - sum += partitioned.back().size(); + } + +#ifdef DEBUG + types::global_dof_index sum = 0; + for (const auto &partition : partitioned) + { + sum += partition.size(); } AssertDimension(sum, this->size()); +#endif + return partitioned; } diff --git a/source/fe/fe_bernstein.cc b/source/fe/fe_bernstein.cc index 9f1f10ff3b..aeec6aa96c 100644 --- a/source/fe/fe_bernstein.cc +++ b/source/fe/fe_bernstein.cc @@ -182,6 +182,7 @@ FE_Bernstein::get_subface_interpolation_matrix( } } +#ifdef DEBUG // make sure that the row sum of each of the matrices is 1 at this // point. this must be so since the shape functions sum up to 1 for (unsigned int j = 0; j < source_fe->n_dofs_per_face(face_no); ++j) @@ -193,6 +194,7 @@ FE_Bernstein::get_subface_interpolation_matrix( Assert(std::fabs(sum - 1) < eps, ExcInternalError()); } +#endif } else { diff --git a/source/fe/fe_dgq.cc b/source/fe/fe_dgq.cc index 9b2a90a48d..ce2a845039 100644 --- a/source/fe/fe_dgq.cc +++ b/source/fe/fe_dgq.cc @@ -330,6 +330,7 @@ FE_DGQ::get_interpolation_matrix( if (std::fabs(interpolation_matrix(i, j)) < 1e-15) interpolation_matrix(i, j) = 0.; +#ifdef DEBUG // make sure that the row sum of // each of the matrices is 1 at // this point. this must be so @@ -344,6 +345,7 @@ FE_DGQ::get_interpolation_matrix( Assert(std::fabs(sum - 1) < 5e-14 * std::max(this->degree, 1U) * dim, ExcInternalError()); } +#endif } diff --git a/source/fe/fe_face.cc b/source/fe/fe_face.cc index 44526e32e0..dd66427daa 100644 --- a/source/fe/fe_face.cc +++ b/source/fe/fe_face.cc @@ -223,6 +223,7 @@ FE_FaceQ::get_subface_interpolation_matrix( } } +#ifdef DEBUG // make sure that the row sum of each of the matrices is 1 at this // point. this must be so since the shape functions sum up to 1 for (unsigned int j = 0; j < source_fe->n_dofs_per_face(face_no); ++j) @@ -234,6 +235,7 @@ FE_FaceQ::get_subface_interpolation_matrix( Assert(std::fabs(sum - 1) < eps, ExcInternalError()); } +#endif } else if (dynamic_cast *>(&x_source_fe) != nullptr) { diff --git a/source/fe/fe_q_base.cc b/source/fe/fe_q_base.cc index ab3d5cef45..28f809838e 100644 --- a/source/fe/fe_q_base.cc +++ b/source/fe/fe_q_base.cc @@ -568,6 +568,7 @@ FE_Q_Base::get_interpolation_matrix( if (std::fabs(interpolation_matrix(i, j)) < eps) interpolation_matrix(i, j) = 0.; +#ifdef DEBUG // make sure that the row sum of each of the matrices is 1 at this // point. this must be so since the shape functions sum up to 1 for (unsigned int i = 0; i < this->n_dofs_per_cell(); ++i) @@ -578,6 +579,7 @@ FE_Q_Base::get_interpolation_matrix( Assert(std::fabs(sum - 1) < eps, ExcInternalError()); } +#endif } else if (dynamic_cast *>(&x_source_fe)) { diff --git a/source/fe/fe_raviart_thomas_nodal.cc b/source/fe/fe_raviart_thomas_nodal.cc index aa4a1b9d73..08ecfed20f 100644 --- a/source/fe/fe_raviart_thomas_nodal.cc +++ b/source/fe/fe_raviart_thomas_nodal.cc @@ -920,6 +920,7 @@ FE_RaviartThomasNodal::get_face_interpolation_matrix( } } +#ifdef DEBUG // make sure that the row sum of each of the matrices is 1 at this // point. this must be so since the shape functions sum up to 1 for (unsigned int j = 0; j < source_fe.n_dofs_per_face(face_no); ++j) @@ -932,6 +933,7 @@ FE_RaviartThomasNodal::get_face_interpolation_matrix( Assert(std::fabs(sum - 1) < 2e-13 * this->degree * (dim - 1), ExcInternalError()); } +#endif } @@ -1009,6 +1011,7 @@ FE_RaviartThomasNodal::get_subface_interpolation_matrix( } } +#ifdef DEBUG // make sure that the row sum of each of the matrices is 1 at this // point. this must be so since the shape functions sum up to 1 for (unsigned int j = 0; j < source_fe.n_dofs_per_face(face_no); ++j) @@ -1021,6 +1024,7 @@ FE_RaviartThomasNodal::get_subface_interpolation_matrix( Assert(std::fabs(sum - 1) < 2e-13 * this->degree * (dim - 1), ExcInternalError()); } +#endif } diff --git a/source/grid/grid_generator.cc b/source/grid/grid_generator.cc index 81fdd1eef0..fbf9ec8b1b 100644 --- a/source/grid/grid_generator.cc +++ b/source/grid/grid_generator.cc @@ -2961,12 +2961,10 @@ namespace GridGenerator Assert(spacing.size() == 2, ExcInvalidRepetitionsDimension(2)); std::vector repetitions(2); - unsigned int n_cells = 1; - double delta = std::numeric_limits::max(); + double delta = std::numeric_limits::max(); for (unsigned int i = 0; i < 2; i++) { repetitions[i] = spacing[i].size(); - n_cells *= repetitions[i]; for (unsigned int j = 0; j < repetitions[i]; j++) { Assert(spacing[i][j] >= 0, ExcInvalidRepetitions(-1)); @@ -3057,12 +3055,10 @@ namespace GridGenerator Assert(spacing.size() == dim, ExcInvalidRepetitionsDimension(dim)); std::vector repetitions(dim); - unsigned int n_cells = 1; - double delta = std::numeric_limits::max(); + double delta = std::numeric_limits::max(); for (unsigned int i = 0; i < dim; i++) { repetitions[i] = spacing[i].size(); - n_cells *= repetitions[i]; for (unsigned int j = 0; j < repetitions[i]; j++) { Assert(spacing[i][j] >= 0, ExcInvalidRepetitions(-1));