From: Matthias Maier Date: Sun, 12 May 2019 04:18:48 +0000 (-0500) Subject: tests: favor auto & cell X-Git-Tag: v9.1.0-rc1~43^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f252313b02869a07267f0d89d9ddf3836eea5278;p=dealii.git tests: favor auto & cell --- diff --git a/tests/bits/cone_04.cc b/tests/bits/cone_04.cc index be6477fcc2..877bd0b944 100644 --- a/tests/bits/cone_04.cc +++ b/tests/bits/cone_04.cc @@ -39,7 +39,7 @@ check() triangulation.refine_global(2); - for (const auto cell : triangulation.active_cell_iterators()) + for (const auto &cell : triangulation.active_cell_iterators()) for (unsigned int face_no = 0; face_no < GeometryInfo::faces_per_cell; ++face_no) { diff --git a/tests/data_out/data_out_12.cc b/tests/data_out/data_out_12.cc index d4a064a8bf..598d45fbfd 100644 --- a/tests/data_out/data_out_12.cc +++ b/tests/data_out/data_out_12.cc @@ -107,7 +107,7 @@ check() const Quadrature support_quadrature(fe.get_unit_support_points()); FEValues fe_values(fe, support_quadrature, update_quadrature_points); - for (const auto cell : dof_handler.active_cell_iterators()) + for (const auto &cell : dof_handler.active_cell_iterators()) { fe_values.reinit(cell); const auto &qp = fe_values.get_quadrature_points(); diff --git a/tests/data_out/data_out_13.cc b/tests/data_out/data_out_13.cc index 582285c0d2..1f888117b6 100644 --- a/tests/data_out/data_out_13.cc +++ b/tests/data_out/data_out_13.cc @@ -107,7 +107,7 @@ check() const Quadrature support_quadrature(fe.get_unit_support_points()); FEValues fe_values(fe, support_quadrature, update_quadrature_points); - for (const auto cell : dof_handler.active_cell_iterators()) + for (const auto &cell : dof_handler.active_cell_iterators()) { fe_values.reinit(cell); const auto &qp = fe_values.get_quadrature_points(); diff --git a/tests/dofs/dof_renumbering_10.cc b/tests/dofs/dof_renumbering_10.cc index ff0204b525..e6d4a59a36 100644 --- a/tests/dofs/dof_renumbering_10.cc +++ b/tests/dofs/dof_renumbering_10.cc @@ -50,12 +50,12 @@ test(const bool adaptive_ref = true) tria.refine_global(1); if (adaptive_ref) { - for (auto cell : tria.active_cell_iterators()) + for (auto &cell : tria.active_cell_iterators()) if (cell->is_locally_owned()) if (cell->center().norm() < 0.5) cell->set_refine_flag(); tria.execute_coarsening_and_refinement(); - for (auto cell : tria.active_cell_iterators()) + for (auto &cell : tria.active_cell_iterators()) if (cell->is_locally_owned()) if (cell->center()[0] < 0.2) cell->set_refine_flag(); diff --git a/tests/dofs/dof_tools_04a.cc b/tests/dofs/dof_tools_04a.cc index 2716d76cd0..c786808a9a 100644 --- a/tests/dofs/dof_tools_04a.cc +++ b/tests/dofs/dof_tools_04a.cc @@ -88,7 +88,7 @@ check(const FiniteElement &fe, const std::string &name) tria.refine_global(1); for (unsigned int ref = 0; ref < 2; ++ref) { - for (auto cell : tria.active_cell_iterators()) + for (auto &cell : tria.active_cell_iterators()) if (cell->is_locally_owned() && cell->center()(0) < .5 && cell->center()(1) < .5) cell->set_refine_flag(); diff --git a/tests/dofs/locally_owned_dofs_per_subdomain_01.cc b/tests/dofs/locally_owned_dofs_per_subdomain_01.cc index fc143e0c0c..b130008086 100644 --- a/tests/dofs/locally_owned_dofs_per_subdomain_01.cc +++ b/tests/dofs/locally_owned_dofs_per_subdomain_01.cc @@ -58,7 +58,7 @@ main() GridTools::partition_triangulation(n_subdomains, tria); hp::DoFHandler hp_dof_handler(tria); - for (auto cell : hp_dof_handler.active_cell_iterators()) + for (auto &cell : hp_dof_handler.active_cell_iterators()) { if (cell == hp_dof_handler.begin_active()) cell->set_active_fe_index(0); // FE_Q diff --git a/tests/dofs/range_based_for_step-6.cc b/tests/dofs/range_based_for_step-6.cc index b3ec2c9b2a..6e7b342a4e 100644 --- a/tests/dofs/range_based_for_step-6.cc +++ b/tests/dofs/range_based_for_step-6.cc @@ -223,7 +223,7 @@ Step6::assemble_system() const Coefficient coefficient; std::vector coefficient_values(n_q_points); - for (auto cell : dof_handler.active_cell_iterators()) + for (auto &cell : dof_handler.active_cell_iterators()) { cell_matrix = 0; cell_rhs = 0; diff --git a/tests/dofs/range_based_for_tria.cc b/tests/dofs/range_based_for_tria.cc index 236c7c9ec2..1e9876d9f6 100644 --- a/tests/dofs/range_based_for_tria.cc +++ b/tests/dofs/range_based_for_tria.cc @@ -39,11 +39,11 @@ check() { // set flags on active cells tr.clear_user_flags(); - for (auto cell : tr.active_cell_iterators()) + for (auto &cell : tr.active_cell_iterators()) cell->set_user_flag(); // now verify that it is really only the active cells - for (auto cell : tr.cell_iterators()) + for (auto &cell : tr.cell_iterators()) AssertThrow(cell->user_flag_set() == !cell->has_children(), ExcInternalError()); } @@ -52,14 +52,14 @@ check() for (unsigned int l = 0; l < tr.n_levels(); ++l) { tr.clear_user_flags(); - for (auto cell : tr.active_cell_iterators_on_level(l)) + for (auto &cell : tr.active_cell_iterators_on_level(l)) cell->set_user_flag(); - for (auto cell : tr.cell_iterators_on_level(l)) + for (auto &cell : tr.cell_iterators_on_level(l)) AssertThrow(cell->user_flag_set() == !cell->has_children(), ExcInternalError()); - for (auto cell : tr.cell_iterators()) + for (auto &cell : tr.cell_iterators()) AssertThrow((cell->user_flag_set() == !cell->has_children()) || (l != (unsigned int)cell->level()), ExcInternalError()); diff --git a/tests/fe/fe_enriched_color_07.cc b/tests/fe/fe_enriched_color_07.cc index 1ff3fa834e..6a761f8d4a 100644 --- a/tests/fe/fe_enriched_color_07.cc +++ b/tests/fe/fe_enriched_color_07.cc @@ -934,7 +934,7 @@ plot_shape_function(hp::DoFHandler &dof_handler, unsigned int patches = 5) // find set of dofs which belong to enriched cells std::set enriched_cell_dofs; - for (auto cell : dof_handler.active_cell_iterators()) + for (auto &cell : dof_handler.active_cell_iterators()) if (cell->active_fe_index() != 0) { unsigned int dofs_per_cell = cell->get_fe().dofs_per_cell; @@ -1014,7 +1014,7 @@ plot_shape_function(hp::DoFHandler &dof_handler, unsigned int patches = 5) // get material ids: Vector fe_index(dof_handler.get_triangulation().n_active_cells()); - for (auto cell : dof_handler.active_cell_iterators()) + for (auto &cell : dof_handler.active_cell_iterators()) { fe_index[cell->active_cell_index()] = cell->active_fe_index(); } @@ -1500,7 +1500,7 @@ LaplaceProblem::assemble_system() update_JxW_values); - for (auto cell : dof_handler.active_cell_iterators()) + for (auto &cell : dof_handler.active_cell_iterators()) if (cell->subdomain_id() == this_mpi_process) { fe_values_hp.reinit(cell); diff --git a/tests/fe/fe_enriched_color_08.cc b/tests/fe/fe_enriched_color_08.cc index 8457335bbc..9669a9e68c 100644 --- a/tests/fe/fe_enriched_color_08.cc +++ b/tests/fe/fe_enriched_color_08.cc @@ -64,7 +64,7 @@ plot_shape_function(hp::DoFHandler &dof_handler, unsigned int patches = 5) // find set of dofs which belong to enriched cells std::set enriched_cell_dofs; - for (auto cell : dof_handler.active_cell_iterators()) + for (auto &cell : dof_handler.active_cell_iterators()) if (cell->active_fe_index() != 0) { unsigned int dofs_per_cell = cell->get_fe().dofs_per_cell; @@ -146,7 +146,7 @@ plot_shape_function(hp::DoFHandler &dof_handler, unsigned int patches = 5) // get material ids: Vector fe_index(dof_handler.get_triangulation().n_active_cells()); - for (auto cell : dof_handler.active_cell_iterators()) + for (auto &cell : dof_handler.active_cell_iterators()) { fe_index[cell->active_cell_index()] = cell->active_fe_index(); } diff --git a/tests/grid/accessor_01.cc b/tests/grid/accessor_01.cc index b340738dcf..285b9e23d1 100644 --- a/tests/grid/accessor_01.cc +++ b/tests/grid/accessor_01.cc @@ -42,7 +42,7 @@ test() std::map::face_iterator, double> mymap; - for (auto cell : tria.active_cell_iterators()) + for (auto &cell : tria.active_cell_iterators()) { for (unsigned int i = 0; i < GeometryInfo::faces_per_cell; ++i) { diff --git a/tests/grid/cell_id_05.cc b/tests/grid/cell_id_05.cc index 2f2ec9af1b..0ac68f8f96 100644 --- a/tests/grid/cell_id_05.cc +++ b/tests/grid/cell_id_05.cc @@ -35,7 +35,7 @@ test(const unsigned int &ref) GridGenerator::hyper_cube(tria); tria.refine_global(ref); std::vector cell_ids; - for (auto cell : tria.active_cell_iterators()) + for (auto &cell : tria.active_cell_iterators()) { cell_ids.push_back(cell->id()); } @@ -46,7 +46,7 @@ test(const unsigned int &ref) unsigned int i = 0; bool ok = true; - for (auto cell : tria.active_cell_iterators()) + for (auto &cell : tria.active_cell_iterators()) { if (cell->id() != unpacked[i++]) { diff --git a/tests/grid/distributed_compute_point_locations_02.cc b/tests/grid/distributed_compute_point_locations_02.cc index 13a7377b3c..bd7c0498af 100644 --- a/tests/grid/distributed_compute_point_locations_02.cc +++ b/tests/grid/distributed_compute_point_locations_02.cc @@ -86,7 +86,7 @@ test_compute_pt_loc(unsigned int ref_cube, unsigned int ref_sphere) std::vector> computed_ranks; unsigned int computed_pts = 0; - for (auto cell : sphere.active_cell_iterators()) + for (auto &cell : sphere.active_cell_iterators()) { // The points we consider are the cell centers auto center_pt = cell->center(); diff --git a/tests/grid/distributed_compute_point_locations_03.cc b/tests/grid/distributed_compute_point_locations_03.cc index 0475061708..ce5f8ac8a0 100644 --- a/tests/grid/distributed_compute_point_locations_03.cc +++ b/tests/grid/distributed_compute_point_locations_03.cc @@ -62,7 +62,7 @@ test_distributed_cpt(unsigned int ref_cube) Triangulation cube; GridGenerator::hyper_cube(cube); cube.refine_global(ref_cube); - for (auto cell : cube.active_cell_iterators()) + for (auto &cell : cube.active_cell_iterators()) test_points.emplace_back(cell->center()); deallog << " Testing on " << test_points.size() << " points" << std::endl; diff --git a/tests/grid/get_coarse_mesh_description_01.cc b/tests/grid/get_coarse_mesh_description_01.cc index 23980a44a1..c7e21dc99c 100644 --- a/tests/grid/get_coarse_mesh_description_01.cc +++ b/tests/grid/get_coarse_mesh_description_01.cc @@ -28,13 +28,13 @@ void setup_tria(Triangulation<1> &tria) { GridGenerator::subdivided_hyper_rectangle( tria, std::vector(5u, 1), Point<1>(), Point<1>(1.5), true); - for (auto cell : tria.active_cell_iterators()) + for (auto &cell : tria.active_cell_iterators()) cell->set_material_id( static_cast(10.0 * (3.0 + cell->center()[0]))); for (auto face : tria.active_face_iterators()) if (0.5 < face->center()[0]) face->set_all_manifold_ids(42); - for (auto cell : tria.active_cell_iterators()) + for (auto &cell : tria.active_cell_iterators()) cell->set_manifold_id( static_cast(10.0 * (2.0 + cell->center()[0]))); } @@ -51,7 +51,7 @@ setup_tria(Triangulation &tria) for (auto face : tria.active_face_iterators()) if (face->at_boundary() && 0.0 < face->center()[0]) face->set_boundary_id(42); - for (auto cell : tria.active_cell_iterators()) + for (auto &cell : tria.active_cell_iterators()) if (cell->center() != Point()) { const double angle = std::atan2(cell->center()[0], cell->center()[1]); @@ -63,7 +63,7 @@ setup_tria(Triangulation &tria) for (auto face : tria.active_face_iterators()) if (-0.1 < face->center()[0]) face->set_all_manifold_ids(42); - for (auto cell : tria.active_cell_iterators()) + for (auto &cell : tria.active_cell_iterators()) if (cell->center() != Point()) { const double angle = std::atan2(cell->center()[0], cell->center()[1]); diff --git a/tests/grid/grid_tools_propagate_manifold_ids_01.cc b/tests/grid/grid_tools_propagate_manifold_ids_01.cc index d6ab8c290d..e0e32fa341 100644 --- a/tests/grid/grid_tools_propagate_manifold_ids_01.cc +++ b/tests/grid/grid_tools_propagate_manifold_ids_01.cc @@ -44,7 +44,7 @@ test() }; GridTools::assign_co_dimensional_manifold_indicators(tria, validate); - for (auto cell : tria.active_cell_iterators()) + for (auto &cell : tria.active_cell_iterators()) { deallog << "Cell: " << (int)cell->manifold_id() << std::endl; if (dim > 1) diff --git a/tests/grid/merge_triangulations_04.cc b/tests/grid/merge_triangulations_04.cc index 7f56bb4707..e1ecc17aa0 100644 --- a/tests/grid/merge_triangulations_04.cc +++ b/tests/grid/merge_triangulations_04.cc @@ -36,7 +36,7 @@ main() Point<2>(2.2, 0.41)); std::set::active_cell_iterator> cells_to_remove; Tensor<1, 2> cylinder_triangulation_offset; - for (const auto cell : bulk_triangulation.active_cell_iterators()) + for (const auto &cell : bulk_triangulation.active_cell_iterators()) { if ((cell->center() - Point<2>(0.2, 0.2)).norm() < 0.15) cells_to_remove.insert(cell); @@ -67,13 +67,13 @@ main() 0.41 / 4.0); GridTools::shift(cylinder_triangulation_offset, cylinder_triangulation); // dumb hack - for (const auto cell : cylinder_triangulation.active_cell_iterators()) + for (const auto &cell : cylinder_triangulation.active_cell_iterators()) cell->set_material_id(2); // merge them together auto minimal_line_length = [](const Triangulation<2> &tria) -> double { double min_line_length = std::numeric_limits::max(); - for (const auto cell : tria.active_cell_iterators()) + for (const auto &cell : tria.active_cell_iterators()) for (unsigned int line_n = 0; line_n < GeometryInfo<2>::lines_per_cell; ++line_n) min_line_length = std::min(min_line_length, @@ -100,7 +100,7 @@ main() const types::manifold_id tfi_id = 1; const types::manifold_id polar_id = 0; - for (const auto cell : result_2.active_cell_iterators()) + for (const auto &cell : result_2.active_cell_iterators()) { // set all non-boundary manifold ids to the new TFI manifold id. if (cell->material_id() == 2) @@ -125,7 +125,7 @@ main() result_2.set_manifold(tfi_id, inner_manifold); std::vector *> inner_pointers; - for (const auto cell : result_2.active_cell_iterators()) + for (const auto &cell : result_2.active_cell_iterators()) { for (unsigned int face_n = 0; face_n < GeometryInfo<2>::faces_per_cell; ++face_n) @@ -153,7 +153,7 @@ main() *ptr += Point<2>(0.2, 0.2) - center; result_2.refine_global(1); - for (const auto cell : result_2.active_cell_iterators()) + for (const auto &cell : result_2.active_cell_iterators()) { if (cell->at_boundary()) { diff --git a/tests/grid/n_faces_01.cc b/tests/grid/n_faces_01.cc index 802d35f06c..f2851d6656 100644 --- a/tests/grid/n_faces_01.cc +++ b/tests/grid/n_faces_01.cc @@ -42,7 +42,7 @@ test() mymap; unsigned int face_counter = 0; - for (auto cell : tria.active_cell_iterators()) + for (auto &cell : tria.active_cell_iterators()) { for (unsigned int i = 0; i < GeometryInfo::faces_per_cell; ++i) { diff --git a/tests/grid/oned_vertex_manifold.cc b/tests/grid/oned_vertex_manifold.cc index 026f344efc..7b254e6ee7 100644 --- a/tests/grid/oned_vertex_manifold.cc +++ b/tests/grid/oned_vertex_manifold.cc @@ -38,7 +38,7 @@ main() triangulation.begin_active()->set_all_manifold_ids(spherical_manifold_id); - for (const auto cell : triangulation.active_cell_iterators()) + for (const auto &cell : triangulation.active_cell_iterators()) { deallog << "current cell manifold id: " << cell->manifold_id() << std::endl; diff --git a/tests/grid/project_to_object_01.cc b/tests/grid/project_to_object_01.cc index 4c2addd377..efdc426481 100644 --- a/tests/grid/project_to_object_01.cc +++ b/tests/grid/project_to_object_01.cc @@ -225,7 +225,7 @@ main() << std::endl; MappingQGeneric<2, 3> mapping(6); - for (auto cell : triangulation.active_cell_iterators()) + for (auto &cell : triangulation.active_cell_iterators()) { const Point<3> projected_point = GridTools::project_to_object(cell, trial_point); diff --git a/tests/hp/fe_nothing_19.cc b/tests/hp/fe_nothing_19.cc index dfc50eedb7..c04a64efd6 100644 --- a/tests/hp/fe_nothing_19.cc +++ b/tests/hp/fe_nothing_19.cc @@ -58,7 +58,7 @@ test() dof_handler.distribute_dofs(fe); deallog << "n_dofs=" << dof_handler.n_dofs() << std::endl; - for (auto cell : dof_handler.active_cell_iterators()) + for (auto &cell : dof_handler.active_cell_iterators()) { deallog << cell << ": "; std::vector dof_indices( diff --git a/tests/manifold/flat_manifold_09.cc b/tests/manifold/flat_manifold_09.cc index c035ea4bce..bbda5eea89 100644 --- a/tests/manifold/flat_manifold_09.cc +++ b/tests/manifold/flat_manifold_09.cc @@ -134,7 +134,7 @@ test() for (unsigned int step = 0; step < 10; ++step) { std::cout << "step " << step << std::endl; - for (auto cell : tria.active_cell_iterators()) + for (auto &cell : tria.active_cell_iterators()) { for (unsigned int v = 0; v < GeometryInfo::vertices_per_cell; ++v) diff --git a/tests/manifold/spherical_manifold_09.cc b/tests/manifold/spherical_manifold_09.cc index 2ad30e08a3..f84e406f41 100644 --- a/tests/manifold/spherical_manifold_09.cc +++ b/tests/manifold/spherical_manifold_09.cc @@ -40,7 +40,7 @@ main() tria.set_all_manifold_ids(0); tria.set_manifold(0, spherical); - for (auto cell : tria.active_cell_iterators()) + for (auto &cell : tria.active_cell_iterators()) for (unsigned int f = 0; f < GeometryInfo::faces_per_cell; ++f) if (cell->at_boundary(f)) { @@ -79,7 +79,7 @@ main() << std::endl; } } - for (auto cell : tria.active_cell_iterators()) + for (auto &cell : tria.active_cell_iterators()) for (unsigned int f = 0; f < GeometryInfo::faces_per_cell; ++f) if (cell->at_boundary(f)) { diff --git a/tests/manifold/spherical_manifold_10.cc b/tests/manifold/spherical_manifold_10.cc index 6bc472fd81..0d78cbbd9f 100644 --- a/tests/manifold/spherical_manifold_10.cc +++ b/tests/manifold/spherical_manifold_10.cc @@ -54,7 +54,7 @@ main() quadrature, update_normal_vectors | update_quadrature_points); - for (auto cell : tria.active_cell_iterators()) + for (auto &cell : tria.active_cell_iterators()) for (unsigned int f = 0; f < GeometryInfo::faces_per_cell; ++f) { fe_values.reinit(cell, f); diff --git a/tests/manifold/spherical_manifold_12.cc b/tests/manifold/spherical_manifold_12.cc index bd8a8c849c..71c8f1706f 100644 --- a/tests/manifold/spherical_manifold_12.cc +++ b/tests/manifold/spherical_manifold_12.cc @@ -57,7 +57,7 @@ main() quadrature, update_normal_vectors | update_quadrature_points); - for (auto cell : tria.active_cell_iterators()) + for (auto &cell : tria.active_cell_iterators()) for (unsigned int f = 0; f < GeometryInfo::faces_per_cell; ++f) if (cell->at_boundary(f)) { diff --git a/tests/manifold/transfinite_manifold_06.cc b/tests/manifold/transfinite_manifold_06.cc index d189915b05..af63cd4b19 100644 --- a/tests/manifold/transfinite_manifold_06.cc +++ b/tests/manifold/transfinite_manifold_06.cc @@ -65,7 +65,7 @@ main() deallog.precision(10); deallog << "Cell centers" << std::endl; - for (auto cell : tria.cell_iterators()) + for (auto &cell : tria.cell_iterators()) deallog << cell->id() << " has center " << cell->center(/*respect_manifold*/ true) << std::endl; diff --git a/tests/matrix_free/cell_categorization_02.cc b/tests/matrix_free/cell_categorization_02.cc index d893c3cbf4..2f3ee24b42 100644 --- a/tests/matrix_free/cell_categorization_02.cc +++ b/tests/matrix_free/cell_categorization_02.cc @@ -71,7 +71,7 @@ test() bottom_left, top_right); - for (auto cell : tria.active_cell_iterators()) + for (auto &cell : tria.active_cell_iterators()) { if (cell->center()[0] < 24.) cell->set_material_id(0); diff --git a/tests/matrix_free/dof_info_01.cc b/tests/matrix_free/dof_info_01.cc index 462abcac78..9596192e9d 100644 --- a/tests/matrix_free/dof_info_01.cc +++ b/tests/matrix_free/dof_info_01.cc @@ -52,12 +52,12 @@ test(const bool adaptive_ref = true) tria.refine_global(1); if (adaptive_ref) { - for (auto cell : tria.active_cell_iterators()) + for (auto &cell : tria.active_cell_iterators()) if (cell->is_locally_owned()) if (cell->center().norm() < 0.5) cell->set_refine_flag(); tria.execute_coarsening_and_refinement(); - for (auto cell : tria.active_cell_iterators()) + for (auto &cell : tria.active_cell_iterators()) if (cell->is_locally_owned()) if (cell->center()[0] < 0.2) cell->set_refine_flag(); diff --git a/tests/matrix_free/dof_info_02.cc b/tests/matrix_free/dof_info_02.cc index a980641a68..70dbdc726b 100644 --- a/tests/matrix_free/dof_info_02.cc +++ b/tests/matrix_free/dof_info_02.cc @@ -53,12 +53,12 @@ test(const bool adaptive_ref = true) tria.refine_global(1); if (adaptive_ref) { - for (auto cell : tria.active_cell_iterators()) + for (auto &cell : tria.active_cell_iterators()) if (cell->is_locally_owned()) if (cell->center().norm() < 0.5) cell->set_refine_flag(); tria.execute_coarsening_and_refinement(); - for (auto cell : tria.active_cell_iterators()) + for (auto &cell : tria.active_cell_iterators()) if (cell->is_locally_owned()) if (cell->center()[0] < 0.2) cell->set_refine_flag(); diff --git a/tests/mpi/hp_renumber_01.cc b/tests/mpi/hp_renumber_01.cc index 739b30609a..3edd3a1233 100644 --- a/tests/mpi/hp_renumber_01.cc +++ b/tests/mpi/hp_renumber_01.cc @@ -68,7 +68,7 @@ test() fe.push_back(FE_Q(2)); hp::DoFHandler dof_handler(triangulation); - for (auto cell : dof_handler.active_cell_iterators()) + for (auto &cell : dof_handler.active_cell_iterators()) { if (cell->is_locally_owned()) { @@ -94,7 +94,7 @@ test() deallog << "Processor: " << Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) << std::endl; - for (auto cell : dof_handler.active_cell_iterators()) + for (auto &cell : dof_handler.active_cell_iterators()) { deallog << " Cell: " << cell << std::endl; diff --git a/tests/mpi/hp_unify_dof_indices_01.cc b/tests/mpi/hp_unify_dof_indices_01.cc index 100bdea0c4..d2d369a0c9 100644 --- a/tests/mpi/hp_unify_dof_indices_01.cc +++ b/tests/mpi/hp_unify_dof_indices_01.cc @@ -73,7 +73,7 @@ test() deallog << "Processor: " << Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) << std::endl; - for (auto cell : dof_handler.active_cell_iterators()) + for (auto &cell : dof_handler.active_cell_iterators()) { deallog << " Cell: " << cell << std::endl; diff --git a/tests/mpi/hp_unify_dof_indices_02.cc b/tests/mpi/hp_unify_dof_indices_02.cc index f2da85198f..d8f9b6d938 100644 --- a/tests/mpi/hp_unify_dof_indices_02.cc +++ b/tests/mpi/hp_unify_dof_indices_02.cc @@ -71,7 +71,7 @@ test() fe.push_back(FE_Q(2)); hp::DoFHandler dof_handler(triangulation); - for (auto cell : dof_handler.active_cell_iterators()) + for (auto &cell : dof_handler.active_cell_iterators()) { if (cell->is_locally_owned()) { @@ -89,7 +89,7 @@ test() deallog << "Processor: " << Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) << std::endl; - for (auto cell : dof_handler.active_cell_iterators()) + for (auto &cell : dof_handler.active_cell_iterators()) { deallog << " Cell: " << cell << std::endl; diff --git a/tests/mpi/hp_unify_dof_indices_03.cc b/tests/mpi/hp_unify_dof_indices_03.cc index 2789e71f24..a015890988 100644 --- a/tests/mpi/hp_unify_dof_indices_03.cc +++ b/tests/mpi/hp_unify_dof_indices_03.cc @@ -68,7 +68,7 @@ test() fe.push_back(FE_Q(2)); hp::DoFHandler dof_handler(triangulation); - for (auto cell : dof_handler.active_cell_iterators()) + for (auto &cell : dof_handler.active_cell_iterators()) { if (cell->is_locally_owned()) { diff --git a/tests/mpi/hp_unify_dof_indices_04.cc b/tests/mpi/hp_unify_dof_indices_04.cc index 798d79f220..8dd4d5d60b 100644 --- a/tests/mpi/hp_unify_dof_indices_04.cc +++ b/tests/mpi/hp_unify_dof_indices_04.cc @@ -69,7 +69,7 @@ test() fe.push_back(FE_Q(2)); hp::DoFHandler dof_handler(triangulation); - for (auto cell : dof_handler.active_cell_iterators()) + for (auto &cell : dof_handler.active_cell_iterators()) { if (cell->is_locally_owned()) { diff --git a/tests/mpi/hp_unify_dof_indices_05.cc b/tests/mpi/hp_unify_dof_indices_05.cc index 60360cec43..76bf989679 100644 --- a/tests/mpi/hp_unify_dof_indices_05.cc +++ b/tests/mpi/hp_unify_dof_indices_05.cc @@ -69,7 +69,7 @@ test() fe.push_back(FE_Q(2)); hp::DoFHandler dof_handler(triangulation); - for (auto cell : dof_handler.active_cell_iterators()) + for (auto &cell : dof_handler.active_cell_iterators()) { if (cell->is_locally_owned()) { diff --git a/tests/mpi/hp_unify_dof_indices_06.cc b/tests/mpi/hp_unify_dof_indices_06.cc index e71891d80d..de4d8602a6 100644 --- a/tests/mpi/hp_unify_dof_indices_06.cc +++ b/tests/mpi/hp_unify_dof_indices_06.cc @@ -70,7 +70,7 @@ test() hp::DoFHandler dof_handler(triangulation); - for (auto cell : dof_handler.active_cell_iterators()) + for (auto &cell : dof_handler.active_cell_iterators()) { if (cell->is_locally_owned()) { diff --git a/tests/mpi/hp_unify_dof_indices_08.cc b/tests/mpi/hp_unify_dof_indices_08.cc index dd02c90afe..e6e43bf71b 100644 --- a/tests/mpi/hp_unify_dof_indices_08.cc +++ b/tests/mpi/hp_unify_dof_indices_08.cc @@ -88,7 +88,7 @@ test() // that to build a hash value from it that is then used to assign an // active_fe_index hp::DoFHandler dof_handler(triangulation); - for (auto cell : dof_handler.active_cell_iterators()) + for (auto &cell : dof_handler.active_cell_iterators()) if (cell->is_locally_owned()) cell->set_active_fe_index( (cell->active_cell_index() + diff --git a/tests/mpi/hp_unify_dof_indices_10.cc b/tests/mpi/hp_unify_dof_indices_10.cc index bb30a6297f..9a9962dbe5 100644 --- a/tests/mpi/hp_unify_dof_indices_10.cc +++ b/tests/mpi/hp_unify_dof_indices_10.cc @@ -72,7 +72,7 @@ test() fe.push_back(FESystem(FE_Q(2), dim)); hp::DoFHandler dof_handler(triangulation); - for (auto cell : dof_handler.active_cell_iterators()) + for (auto &cell : dof_handler.active_cell_iterators()) { if (cell->is_locally_owned()) { diff --git a/tests/mpi/periodicity_06.cc b/tests/mpi/periodicity_06.cc index cd86b29669..5fcc7a8b8d 100644 --- a/tests/mpi/periodicity_06.cc +++ b/tests/mpi/periodicity_06.cc @@ -80,7 +80,7 @@ test(const unsigned numRefinementLevels = 2) GridGenerator::hyper_cube(triangulation, -L, L, /*colorize*/ false); // mark faces - for (auto cell : triangulation.active_cell_iterators()) + for (auto &cell : triangulation.active_cell_iterators()) for (unsigned int f = 0; f < GeometryInfo::faces_per_cell; ++f) { const Point &face_center = cell->face(f)->center(); @@ -122,7 +122,7 @@ test(const unsigned numRefinementLevels = 2) for (unsigned int ilevel = 0; ilevel < numRefinementLevels; ilevel++) { // pick an corner cell and refine - for (auto cell : triangulation.active_cell_iterators()) + for (auto &cell : triangulation.active_cell_iterators()) { try { diff --git a/tests/mpi/periodicity_07.cc b/tests/mpi/periodicity_07.cc index 6b4b72fb4b..e38c8c37e0 100644 --- a/tests/mpi/periodicity_07.cc +++ b/tests/mpi/periodicity_07.cc @@ -53,7 +53,7 @@ test(const unsigned numRefinementLevels = 2) GridGenerator::hyper_cube(triangulation, -L, L, /*colorize*/ false); // mark faces - for (auto cell : triangulation.active_cell_iterators()) + for (auto &cell : triangulation.active_cell_iterators()) for (unsigned int f = 0; f < GeometryInfo::faces_per_cell; ++f) { const Point &face_center = cell->face(f)->center(); @@ -95,7 +95,7 @@ test(const unsigned numRefinementLevels = 2) for (unsigned int ilevel = 0; ilevel < numRefinementLevels; ilevel++) { // pick an corner cell and refine - for (auto cell : triangulation.active_cell_iterators()) + for (auto &cell : triangulation.active_cell_iterators()) { try { diff --git a/tests/mpi/step-37.cc b/tests/mpi/step-37.cc index fbbc626106..8525419053 100644 --- a/tests/mpi/step-37.cc +++ b/tests/mpi/step-37.cc @@ -542,7 +542,7 @@ namespace Step37 } else { - for (auto cell : triangulation.active_cell_iterators()) + for (auto &cell : triangulation.active_cell_iterators()) if (cell->is_locally_owned()) { if ((cell->center()[0] < -8. && cell->center()[1] < 0) || diff --git a/tests/multigrid/renumbering_05.cc b/tests/multigrid/renumbering_05.cc index 3ed0f75f7c..1cfee79575 100644 --- a/tests/multigrid/renumbering_05.cc +++ b/tests/multigrid/renumbering_05.cc @@ -39,7 +39,7 @@ print_dof_numbers(const DoFHandler &dof) { std::vector dof_indices(dof.get_fe().dofs_per_cell); deallog << "DoF numbers on active cells" << std::endl; - for (auto cell : dof.active_cell_iterators()) + for (auto &cell : dof.active_cell_iterators()) if (!cell->is_artificial()) { cell->get_dof_indices(dof_indices); @@ -51,7 +51,7 @@ print_dof_numbers(const DoFHandler &dof) for (unsigned int l = 0; l < dof.get_triangulation().n_global_levels(); ++l) { deallog << "DoF numbers on level " << l << std::endl; - for (auto cell : dof.cell_iterators_on_level(l)) + for (auto &cell : dof.cell_iterators_on_level(l)) if (cell->level_subdomain_id() != numbers::artificial_subdomain_id) { cell->get_mg_dof_indices(dof_indices); diff --git a/tests/multigrid/renumbering_06.cc b/tests/multigrid/renumbering_06.cc index 36fcd7d63d..3a89beacb3 100644 --- a/tests/multigrid/renumbering_06.cc +++ b/tests/multigrid/renumbering_06.cc @@ -47,7 +47,7 @@ print_dof_numbers(const DoFHandler &dof) { std::vector dof_indices(dof.get_fe().dofs_per_cell); deallog << "DoF numbers on active cells" << std::endl; - for (auto cell : dof.active_cell_iterators()) + for (auto &cell : dof.active_cell_iterators()) if (!cell->is_artificial()) { cell->get_dof_indices(dof_indices); @@ -59,7 +59,7 @@ print_dof_numbers(const DoFHandler &dof) for (unsigned int l = 0; l < dof.get_triangulation().n_global_levels(); ++l) { deallog << "DoF numbers on level " << l << std::endl; - for (auto cell : dof.cell_iterators_on_level(l)) + for (auto &cell : dof.cell_iterators_on_level(l)) if (cell->level_subdomain_id() != numbers::artificial_subdomain_id) { cell->get_mg_dof_indices(dof_indices); diff --git a/tests/multigrid/renumbering_07.cc b/tests/multigrid/renumbering_07.cc index 38f9a681cc..43e86d1e45 100644 --- a/tests/multigrid/renumbering_07.cc +++ b/tests/multigrid/renumbering_07.cc @@ -47,7 +47,7 @@ print_dof_numbers(const DoFHandler &dof) { std::vector dof_indices(dof.get_fe().dofs_per_cell); deallog << "DoF numbers on active cells" << std::endl; - for (auto cell : dof.active_cell_iterators()) + for (auto &cell : dof.active_cell_iterators()) if (!cell->is_artificial()) { cell->get_dof_indices(dof_indices); @@ -59,7 +59,7 @@ print_dof_numbers(const DoFHandler &dof) for (unsigned int l = 0; l < dof.get_triangulation().n_global_levels(); ++l) { deallog << "DoF numbers on level " << l << std::endl; - for (auto cell : dof.cell_iterators_on_level(l)) + for (auto &cell : dof.cell_iterators_on_level(l)) if (cell->level_subdomain_id() != numbers::artificial_subdomain_id) { cell->get_mg_dof_indices(dof_indices); diff --git a/tests/multigrid/renumbering_08.cc b/tests/multigrid/renumbering_08.cc index 64d388beb4..0e94f8d065 100644 --- a/tests/multigrid/renumbering_08.cc +++ b/tests/multigrid/renumbering_08.cc @@ -39,7 +39,7 @@ print_dof_numbers(const DoFHandler &dof) { std::vector dof_indices(dof.get_fe().dofs_per_cell); deallog << "DoF numbers on active cells" << std::endl; - for (auto cell : dof.active_cell_iterators()) + for (auto &cell : dof.active_cell_iterators()) if (!cell->is_artificial()) { cell->get_dof_indices(dof_indices); @@ -51,7 +51,7 @@ print_dof_numbers(const DoFHandler &dof) for (unsigned int l = 0; l < dof.get_triangulation().n_global_levels(); ++l) { deallog << "DoF numbers on level " << l << std::endl; - for (auto cell : dof.cell_iterators_on_level(l)) + for (auto &cell : dof.cell_iterators_on_level(l)) if (cell->level_subdomain_id() != numbers::artificial_subdomain_id) { cell->get_mg_dof_indices(dof_indices); diff --git a/tests/non_matching/coupling_05.cc b/tests/non_matching/coupling_05.cc index 81d2462057..a273bcd8ec 100644 --- a/tests/non_matching/coupling_05.cc +++ b/tests/non_matching/coupling_05.cc @@ -117,7 +117,7 @@ test() FullMatrix cell_matrix(fe.dofs_per_cell, fe.dofs_per_cell); AffineConstraints constraints; - for (auto cell : dh.active_cell_iterators()) + for (auto &cell : dh.active_cell_iterators()) if (cell->is_locally_owned()) { cell_matrix = 0; diff --git a/tests/non_matching/coupling_06.cc b/tests/non_matching/coupling_06.cc index c5c70fdc4f..3b8f08f7d7 100644 --- a/tests/non_matching/coupling_06.cc +++ b/tests/non_matching/coupling_06.cc @@ -120,7 +120,7 @@ test() FullMatrix cell_matrix(fe.dofs_per_cell, fe.dofs_per_cell); AffineConstraints constraints; - for (auto cell : dh.active_cell_iterators()) + for (auto &cell : dh.active_cell_iterators()) if (cell->is_locally_owned()) { cell_matrix = 0; diff --git a/tests/sharedtria/communicate_active_fe_indices_01.cc b/tests/sharedtria/communicate_active_fe_indices_01.cc index 82eba703ad..a0ac5cb958 100644 --- a/tests/sharedtria/communicate_active_fe_indices_01.cc +++ b/tests/sharedtria/communicate_active_fe_indices_01.cc @@ -64,7 +64,7 @@ test() // set the active_fe_index on all locally active cells equal to the // subdomain_id. we can later verify this equality also on ghost // cells - for (auto cell : dof_handler.active_cell_iterators()) + for (auto &cell : dof_handler.active_cell_iterators()) if (cell->is_locally_owned()) cell->set_active_fe_index(cell->subdomain_id()); @@ -75,7 +75,7 @@ test() << std::endl; // verify that the information has been communicated between processors - for (auto cell : dof_handler.active_cell_iterators()) + for (auto &cell : dof_handler.active_cell_iterators()) { if (cell->is_locally_owned()) Assert(cell->active_fe_index() == cell->subdomain_id(), diff --git a/tests/sharedtria/communicate_active_fe_indices_01a.cc b/tests/sharedtria/communicate_active_fe_indices_01a.cc index e53b02c4ab..795eeee470 100644 --- a/tests/sharedtria/communicate_active_fe_indices_01a.cc +++ b/tests/sharedtria/communicate_active_fe_indices_01a.cc @@ -66,7 +66,7 @@ test() // set the active_fe_index on all locally active cells equal to the // subdomain_id. we can later verify this equality also on ghost // cells - for (auto cell : dof_handler.active_cell_iterators()) + for (auto &cell : dof_handler.active_cell_iterators()) if (cell->is_locally_owned()) cell->set_active_fe_index(cell->subdomain_id()); @@ -77,7 +77,7 @@ test() << std::endl; // verify that the information has been communicated between processors - for (auto cell : dof_handler.active_cell_iterators()) + for (auto &cell : dof_handler.active_cell_iterators()) { if (cell->is_locally_owned()) Assert(cell->active_fe_index() == cell->subdomain_id(), diff --git a/tests/sharedtria/communicate_active_fe_indices_01b.cc b/tests/sharedtria/communicate_active_fe_indices_01b.cc index 68a358c139..c13225b15a 100644 --- a/tests/sharedtria/communicate_active_fe_indices_01b.cc +++ b/tests/sharedtria/communicate_active_fe_indices_01b.cc @@ -66,7 +66,7 @@ test() // set the active_fe_index on all locally active cells equal to the // subdomain_id. we can later verify this equality also on ghost // cells - for (auto cell : dof_handler.active_cell_iterators()) + for (auto &cell : dof_handler.active_cell_iterators()) if (cell->is_locally_owned()) cell->set_active_fe_index(cell->subdomain_id()); @@ -77,7 +77,7 @@ test() << std::endl; // verify that the information has been communicated between processors - for (auto cell : dof_handler.active_cell_iterators()) + for (auto &cell : dof_handler.active_cell_iterators()) { if (cell->is_locally_owned()) Assert(cell->active_fe_index() == cell->subdomain_id(), diff --git a/tests/sharedtria/communicate_active_fe_indices_02.cc b/tests/sharedtria/communicate_active_fe_indices_02.cc index 1a1c3e99ef..104f98720e 100644 --- a/tests/sharedtria/communicate_active_fe_indices_02.cc +++ b/tests/sharedtria/communicate_active_fe_indices_02.cc @@ -62,7 +62,7 @@ test() // set the active_fe_index on all locally active cells equal to the // subdomain_id. we can later verify this equality also on ghost // cells - for (auto cell : dof_handler.active_cell_iterators()) + for (auto &cell : dof_handler.active_cell_iterators()) if (cell->is_locally_owned()) cell->set_active_fe_index(cell->subdomain_id()); @@ -73,7 +73,7 @@ test() << std::endl; // verify that the information has been communicated between processors - for (auto cell : dof_handler.active_cell_iterators()) + for (auto &cell : dof_handler.active_cell_iterators()) { if (cell->is_locally_owned()) Assert(cell->active_fe_index() == cell->subdomain_id(), diff --git a/tests/sharedtria/hp_no_cells_01.cc b/tests/sharedtria/hp_no_cells_01.cc index 199de46012..0836a469f5 100644 --- a/tests/sharedtria/hp_no_cells_01.cc +++ b/tests/sharedtria/hp_no_cells_01.cc @@ -59,7 +59,7 @@ test() parallel::shared::Triangulation::partition_custom_signal); triangulation.signals.post_refinement.connect([&triangulation]() { // partition the triangulation by hand - for (auto cell : triangulation.active_cell_iterators()) + for (auto &cell : triangulation.active_cell_iterators()) cell->set_subdomain_id(cell->active_cell_index() % Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD)); }); diff --git a/tests/sharedtria/no_cells_01.cc b/tests/sharedtria/no_cells_01.cc index df65463892..f91c2dc9ca 100644 --- a/tests/sharedtria/no_cells_01.cc +++ b/tests/sharedtria/no_cells_01.cc @@ -55,7 +55,7 @@ test() parallel::shared::Triangulation::partition_custom_signal); triangulation.signals.post_refinement.connect([&triangulation]() { // partition the triangulation by hand - for (auto cell : triangulation.active_cell_iterators()) + for (auto &cell : triangulation.active_cell_iterators()) cell->set_subdomain_id(cell->active_cell_index() % Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD)); }); diff --git a/tests/trilinos/solver_control_06.cc b/tests/trilinos/solver_control_06.cc index 09ae45f960..566ec3a7d6 100644 --- a/tests/trilinos/solver_control_06.cc +++ b/tests/trilinos/solver_control_06.cc @@ -247,7 +247,7 @@ Test_Solver_Output::assemble_system() std::vector local_dof_indices(dofs_per_cell); - for (auto cell : dof_handler.active_cell_iterators()) + for (auto &cell : dof_handler.active_cell_iterators()) { if (cell->is_locally_owned()) { diff --git a/tests/vector_tools/integrate_difference_04_hp_02.cc b/tests/vector_tools/integrate_difference_04_hp_02.cc index 1602b5ca77..7da0be3f97 100644 --- a/tests/vector_tools/integrate_difference_04_hp_02.cc +++ b/tests/vector_tools/integrate_difference_04_hp_02.cc @@ -96,7 +96,7 @@ test(VectorTools::NormType norm, double value, double exp = 2.0) hp::DoFHandler dofh(tria); // assign FEs mostly randomly to each cell - for (auto cell : dofh.active_cell_iterators()) + for (auto &cell : dofh.active_cell_iterators()) if (cell->is_locally_owned()) cell->set_active_fe_index(cell->active_cell_index() % fe.size()); dofh.distribute_dofs(fe);