From: Daniel Arndt Date: Fri, 2 Dec 2022 21:57:25 +0000 (-0500) Subject: Fix some warnings in tests X-Git-Tag: v9.5.0-rc1~768^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F14521%2Fhead;p=dealii.git Fix some warnings in tests --- diff --git a/tests/base/aligned_vector_memory_02.cc b/tests/base/aligned_vector_memory_02.cc index 7a478cd9b3..f657112ecb 100644 --- a/tests/base/aligned_vector_memory_02.cc +++ b/tests/base/aligned_vector_memory_02.cc @@ -83,7 +83,7 @@ void test() { deallog << "---- Creating outer table" << std::endl; - Table<1, C> table({1}); + Table<1, C> table(1); // Copy the object, then destroy the copy again. { diff --git a/tests/base/taylor_estimate_function_bounds.cc b/tests/base/taylor_estimate_function_bounds.cc index fa8fee139c..22b21d29e8 100644 --- a/tests/base/taylor_estimate_function_bounds.cc +++ b/tests/base/taylor_estimate_function_bounds.cc @@ -79,7 +79,7 @@ namespace } SymmetricTensor<2, dim> - hessian(const Point &, const unsigned int) const + hessian(const Point &, const unsigned int) const override { SymmetricTensor<2, dim> hess; for (unsigned int i = 0; i < dim; ++i) diff --git a/tests/distributed_grids/solution_transfer_05.cc b/tests/distributed_grids/solution_transfer_05.cc index 50988329ca..931e03e252 100644 --- a/tests/distributed_grids/solution_transfer_05.cc +++ b/tests/distributed_grids/solution_transfer_05.cc @@ -70,7 +70,7 @@ main(int argc, char **argv) values[CellId("0_1:2")] = Vector{0.5, 0.5, 0.5, 0.5}; values[CellId("0_1:3")] = Vector{0.5, 0.1, 0.5, 0.5}; - for (const auto cell : dof_handler.active_cell_iterators()) + for (const auto &cell : dof_handler.active_cell_iterators()) if (cell->is_artificial() == false) cell->set_dof_values(values[cell->id()], v); diff --git a/tests/dofs/dof_test.cc b/tests/dofs/dof_test.cc index 2b433a66f7..6c114e16cc 100644 --- a/tests/dofs/dof_test.cc +++ b/tests/dofs/dof_test.cc @@ -153,13 +153,13 @@ CurvedLine::get_new_point_on_quad( { Point middle = FlatManifold::get_new_point_on_quad(quad); - // if the face is at the top of bottom + // if the face is at the top or bottom // face: do not move the midpoint in // x/y direction. Note that if the // z-value of the midpoint is either // 0 or 1, then the z-values of all // vertices of the quad is like that - if (dim == 3 && (middle(dim - 1) == 0) || (middle(dim - 1) == 1)) + if (dim == 3 && ((middle(dim - 1) == 0) || (middle(dim - 1) == 1))) return middle; double x = middle(0), y = middle(1); diff --git a/tests/fe/fe_values_views_types.cc b/tests/fe/fe_values_views_types.cc index 8100e7ec76..be4e20ce7b 100644 --- a/tests/fe/fe_values_views_types.cc +++ b/tests/fe/fe_values_views_types.cc @@ -27,11 +27,11 @@ test(const Extractor &) { typename FEValuesViews::View:: template solution_value_type - t1; + t1{}; typename FEValuesViews::View:: template solution_gradient_type - t2; + t2{}; deallog << "Test<" << Utilities::dim_string(dim, spacedim) << '>' << std::endl << Utilities::type_to_string(t1) << std::endl diff --git a/tests/grid/grid_in_out_vtu_01.cc b/tests/grid/grid_in_out_vtu_01.cc index f6e341f7d1..b0b837aca6 100644 --- a/tests/grid/grid_in_out_vtu_01.cc +++ b/tests/grid/grid_in_out_vtu_01.cc @@ -36,14 +36,14 @@ main() Triangulation<2> tria2; GridGenerator::hyper_ball(tria); - for (const auto cell : tria.active_cell_iterators()) + for (const auto &cell : tria.active_cell_iterators()) { if (cell->center()[0] < 0) cell->set_refine_flag(); } tria.execute_coarsening_and_refinement(); - for (const auto cell : tria.active_cell_iterators()) + for (const auto &cell : tria.active_cell_iterators()) { if (cell->center()[1] < 0) cell->set_refine_flag(); diff --git a/tests/grid/grid_test.cc b/tests/grid/grid_test.cc index c755056585..9bd476f48d 100644 --- a/tests/grid/grid_test.cc +++ b/tests/grid/grid_test.cc @@ -81,7 +81,7 @@ CurvedLine::get_new_point_on_line( { Point middle = FlatManifold::get_new_point_on_line(line); - // if the line is at the top of bottom + // if the line is at the top or bottom // face: do a special treatment on // this line. Note that if the // z-value of the midpoint is either @@ -135,7 +135,7 @@ CurvedLine::get_new_point_on_quad( // z-value of the midpoint is either // 0 or 1, then the z-values of all // vertices of the quad is like that - if (dim == 3 && (middle(dim - 1) == 0) || (middle(dim - 1) == 1)) + if (dim == 3 && ((middle(dim - 1) == 0) || (middle(dim - 1) == 1))) return middle; double x = middle(0), y = middle(1); diff --git a/tests/numerics/no_flux_17.cc b/tests/numerics/no_flux_17.cc index 7536dfddc8..224dd06806 100644 --- a/tests/numerics/no_flux_17.cc +++ b/tests/numerics/no_flux_17.cc @@ -92,8 +92,8 @@ compare_constraints(const AffineConstraints &constraints1, } for (unsigned int i = 0; i < constraint_entries_1->size(); ++i) { - if (std::abs((*constraint_entries_1)[i].first != - (*constraint_entries_2)[i].first) > tol || + if ((*constraint_entries_1)[i].first != + (*constraint_entries_2)[i].first || std::abs((*constraint_entries_1)[i].second - (*constraint_entries_2)[i].second) > tol) {