From: Wolfgang Bangerth Date: Fri, 27 Aug 2021 17:30:16 +0000 (-0600) Subject: Also use std::next for ++object.begin_active(). X-Git-Tag: v9.4.0-rc1~1007^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=71b672a667de943c80864491ae9f1683a65e0330;p=dealii.git Also use std::next for ++object.begin_active(). --- diff --git a/tests/distributed_grids/tria_settings_01.cc b/tests/distributed_grids/tria_settings_01.cc index 7056a4ff55..7e5f06aa2e 100644 --- a/tests/distributed_grids/tria_settings_01.cc +++ b/tests/distributed_grids/tria_settings_01.cc @@ -43,7 +43,7 @@ testit(parallel::distributed::Triangulation &tr) GridGenerator::hyper_cube(tr); tr.refine_global(1); - (++tr.begin_active())->set_refine_flag(); + (std::next(tr.begin_active()))->set_refine_flag(); tr.execute_coarsening_and_refinement(); tr.begin_active()->set_refine_flag(); diff --git a/tests/dofs/sparsity_pattern_02.cc b/tests/dofs/sparsity_pattern_02.cc index 87d10d34fe..449c2e8414 100644 --- a/tests/dofs/sparsity_pattern_02.cc +++ b/tests/dofs/sparsity_pattern_02.cc @@ -65,7 +65,7 @@ check() else GridGenerator::hyper_cube(triangulation_2, -1, 1); triangulation_2.refine_global(1); - (++triangulation_2.begin_active())->set_refine_flag(); + (std::next(triangulation_2.begin_active()))->set_refine_flag(); triangulation_2.execute_coarsening_and_refinement(); (++triangulation_2.begin_active(2))->set_refine_flag(); triangulation_2.execute_coarsening_and_refinement(); diff --git a/tests/dofs/sparsity_pattern_03.cc b/tests/dofs/sparsity_pattern_03.cc index d8e74dbe9b..7221450af8 100644 --- a/tests/dofs/sparsity_pattern_03.cc +++ b/tests/dofs/sparsity_pattern_03.cc @@ -68,7 +68,7 @@ check() else GridGenerator::hyper_cube(triangulation_2, -1, 1); triangulation_2.refine_global(1); - (++triangulation_2.begin_active())->set_refine_flag(); + (std::next(triangulation_2.begin_active()))->set_refine_flag(); triangulation_2.execute_coarsening_and_refinement(); (++triangulation_2.begin_active(2))->set_refine_flag(); triangulation_2.execute_coarsening_and_refinement(); diff --git a/tests/dofs/sparsity_pattern_04.cc b/tests/dofs/sparsity_pattern_04.cc index 4f3939bb7e..508548eaea 100644 --- a/tests/dofs/sparsity_pattern_04.cc +++ b/tests/dofs/sparsity_pattern_04.cc @@ -69,7 +69,7 @@ check() else GridGenerator::hyper_cube(triangulation_2, -1, 1); triangulation_2.refine_global(1); - (++triangulation_2.begin_active())->set_refine_flag(); + (std::next(triangulation_2.begin_active()))->set_refine_flag(); triangulation_2.execute_coarsening_and_refinement(); (++triangulation_2.begin_active(2))->set_refine_flag(); triangulation_2.execute_coarsening_and_refinement(); diff --git a/tests/fe/nedelec_crash_hp.cc b/tests/fe/nedelec_crash_hp.cc index 593bf88be3..2470c5f698 100644 --- a/tests/fe/nedelec_crash_hp.cc +++ b/tests/fe/nedelec_crash_hp.cc @@ -68,7 +68,7 @@ test() Point(), (dim == 3 ? Point(2, 1, 1) : Point(2, 1))); - (++triangulation.begin_active())->set_refine_flag(); + (std::next(triangulation.begin_active()))->set_refine_flag(); triangulation.execute_coarsening_and_refinement(); hp::FECollection fe; diff --git a/tests/fe/nedelec_face_interpolation.cc b/tests/fe/nedelec_face_interpolation.cc index 04a1250e5f..23c4c83fff 100644 --- a/tests/fe/nedelec_face_interpolation.cc +++ b/tests/fe/nedelec_face_interpolation.cc @@ -52,7 +52,7 @@ test(unsigned p1, unsigned p2) Point(), (dim == 3 ? Point(2, 1, 1) : Point(2, 1))); - (++triangulation.begin_active())->set_refine_flag(); + (std::next(triangulation.begin_active()))->set_refine_flag(); triangulation.execute_coarsening_and_refinement(); hp::FECollection fe; diff --git a/tests/grid/grid_generator_07.cc b/tests/grid/grid_generator_07.cc index c0fec6fa3f..b0fa62f4f5 100644 --- a/tests/grid/grid_generator_07.cc +++ b/tests/grid/grid_generator_07.cc @@ -42,7 +42,7 @@ test(std::ostream &out) // makes a bunch of vertices unused std::set::active_cell_iterator> cells_to_remove; for (typename Triangulation::active_cell_iterator cell = - ++triangulation.begin_active(); + std::next(triangulation.begin_active()); cell != triangulation.end(); ++cell) cells_to_remove.insert(cell); diff --git a/tests/grid/mesh_3d_12.cc b/tests/grid/mesh_3d_12.cc index dd0b4fbc02..fb49f71bb9 100644 --- a/tests/grid/mesh_3d_12.cc +++ b/tests/grid/mesh_3d_12.cc @@ -73,7 +73,7 @@ check_this(Triangulation<3> &tria) void check(Triangulation<3> &tria) { - (++tria.begin_active())->set_refine_flag(); + (std::next(tria.begin_active()))->set_refine_flag(); tria.execute_coarsening_and_refinement(); deallog << "Initial check" << std::endl; diff --git a/tests/grid/mesh_3d_13.cc b/tests/grid/mesh_3d_13.cc index eaa7be7dd9..bd0abeedb4 100644 --- a/tests/grid/mesh_3d_13.cc +++ b/tests/grid/mesh_3d_13.cc @@ -83,7 +83,7 @@ check_this(Triangulation<3> &tria) void check(Triangulation<3> &tria) { - (++tria.begin_active())->set_refine_flag(); + (std::next(tria.begin_active()))->set_refine_flag(); tria.execute_coarsening_and_refinement(); deallog << "Initial check" << std::endl; diff --git a/tests/grid/mesh_3d_14.cc b/tests/grid/mesh_3d_14.cc index ad96418864..99e4511765 100644 --- a/tests/grid/mesh_3d_14.cc +++ b/tests/grid/mesh_3d_14.cc @@ -103,7 +103,7 @@ check_this(Triangulation<3> &tria) void check(Triangulation<3> &tria) { - (++tria.begin_active())->set_refine_flag(); + (std::next(tria.begin_active()))->set_refine_flag(); tria.execute_coarsening_and_refinement(); deallog << "Initial check" << std::endl; diff --git a/tests/grid/mesh_3d_15.cc b/tests/grid/mesh_3d_15.cc index 8332683801..058f9c2bb2 100644 --- a/tests/grid/mesh_3d_15.cc +++ b/tests/grid/mesh_3d_15.cc @@ -96,7 +96,7 @@ check_this(Triangulation<3> &tria) void check(Triangulation<3> &tria) { - (++tria.begin_active())->set_refine_flag(); + (std::next(tria.begin_active()))->set_refine_flag(); tria.execute_coarsening_and_refinement(); deallog << "Initial check" << std::endl; diff --git a/tests/grid/mesh_3d_17.cc b/tests/grid/mesh_3d_17.cc index 551cc1dc74..41ec5da22a 100644 --- a/tests/grid/mesh_3d_17.cc +++ b/tests/grid/mesh_3d_17.cc @@ -44,7 +44,7 @@ check(Triangulation<3> &tria) deallog << "Coarse cell 1 vertices:" << std::endl; for (unsigned int i = 0; i < 8; ++i) - deallog << ' ' << (++tria.begin_active())->vertex_index(i); + deallog << ' ' << (std::next(tria.begin_active()))->vertex_index(i); deallog << std::endl; diff --git a/tests/grid/mesh_3d_2.cc b/tests/grid/mesh_3d_2.cc index ce848bee07..7926c8c919 100644 --- a/tests/grid/mesh_3d_2.cc +++ b/tests/grid/mesh_3d_2.cc @@ -66,6 +66,6 @@ main() // we know that from the second // cell, the common face must have // wrong orientation. check this - Assert((++coarse_grid.begin_active())->face_orientation(5) == false, + Assert((std::next(coarse_grid.begin_active()))->face_orientation(5) == false, ExcInternalError()); } diff --git a/tests/grid/mesh_3d_21.cc b/tests/grid/mesh_3d_21.cc index 4469a2b818..e6fea6e141 100644 --- a/tests/grid/mesh_3d_21.cc +++ b/tests/grid/mesh_3d_21.cc @@ -104,7 +104,7 @@ check_this(Triangulation<3> &tria) void check(Triangulation<3> &tria) { - (++tria.begin_active())->set_refine_flag(); + (std::next(tria.begin_active()))->set_refine_flag(); tria.execute_coarsening_and_refinement(); deallog << "Initial check" << std::endl; diff --git a/tests/grid/mesh_3d_3.cc b/tests/grid/mesh_3d_3.cc index b594dab630..d19555f67f 100644 --- a/tests/grid/mesh_3d_3.cc +++ b/tests/grid/mesh_3d_3.cc @@ -42,7 +42,7 @@ main() create_two_cubes(coarse_grid); const Triangulation<3>::active_cell_iterator cells[2] = { - coarse_grid.begin_active(), ++coarse_grid.begin_active()}; + coarse_grid.begin_active(), std::next(coarse_grid.begin_active())}; // output all vertices for (unsigned int c = 0; c < 2; ++c) diff --git a/tests/grid/n_faces_01.cc b/tests/grid/n_faces_01.cc index 6a52e66659..cd026369a0 100644 --- a/tests/grid/n_faces_01.cc +++ b/tests/grid/n_faces_01.cc @@ -34,7 +34,7 @@ test() GridGenerator::hyper_cube(tria); tria.refine_global(2); tria.begin_active()->set_coarsen_flag(); - (++(tria.begin_active()))->set_coarsen_flag(); + (std::next((tria.begin_active())))->set_coarsen_flag(); tria.execute_coarsening_and_refinement(); std::map::face_iterator, unsigned int> diff --git a/tests/grid/union_triangulation.cc b/tests/grid/union_triangulation.cc index 1b994ff710..7679101b63 100644 --- a/tests/grid/union_triangulation.cc +++ b/tests/grid/union_triangulation.cc @@ -47,7 +47,7 @@ test() // similar for second grid, but // different cell tria_2.refine_global(1); - (++tria_2.begin_active())->set_refine_flag(); + (std::next(tria_2.begin_active()))->set_refine_flag(); tria_2.execute_coarsening_and_refinement(); GridGenerator::create_union_triangulation(tria_1, tria_2, tria_3); diff --git a/tests/hp/crash_07.cc b/tests/hp/crash_07.cc index b2d5df0586..7c62caa374 100644 --- a/tests/hp/crash_07.cc +++ b/tests/hp/crash_07.cc @@ -104,7 +104,7 @@ main() cell != dof_handler.end(); ++cell, ++cell_no) cell->set_active_fe_index(0); - (++dof_handler.begin_active())->set_active_fe_index(1); + (std::next(dof_handler.begin_active()))->set_active_fe_index(1); dof_handler.distribute_dofs(fe); deallog << "n_dofs=" << dof_handler.n_dofs() << std::endl; diff --git a/tests/hp/crash_12.cc b/tests/hp/crash_12.cc index 2f9d3f0fba..af3cf90197 100644 --- a/tests/hp/crash_12.cc +++ b/tests/hp/crash_12.cc @@ -73,7 +73,7 @@ test() Point(), (dim == 3 ? Point(2, 1, 1) : Point(2, 1))); - (++triangulation.begin_active())->set_refine_flag(); + (std::next(triangulation.begin_active()))->set_refine_flag(); triangulation.execute_coarsening_and_refinement(); hp::FECollection fe; diff --git a/tests/hp/error_prediction_02.cc b/tests/hp/error_prediction_02.cc index eb180b07ce..002b2475d9 100644 --- a/tests/hp/error_prediction_02.cc +++ b/tests/hp/error_prediction_02.cc @@ -46,7 +46,7 @@ test() TestGrids::hyper_line(tria, 4); tria.begin_active()->set_refine_flag(); - (++tria.begin_active())->set_refine_flag(); + (std::next(tria.begin_active()))->set_refine_flag(); tria.execute_coarsening_and_refinement(); hp::FECollection fes; diff --git a/tests/hp/face_domination_01.cc b/tests/hp/face_domination_01.cc index d253650635..db9452c9e4 100644 --- a/tests/hp/face_domination_01.cc +++ b/tests/hp/face_domination_01.cc @@ -80,7 +80,7 @@ main() dof_handler.distribute_dofs(fe_collection); print_dofs(dof_handler.begin_active()); - print_dofs(++dof_handler.begin_active()); + print_dofs(std::next(dof_handler.begin_active())); AffineConstraints constraints; constraints.clear(); diff --git a/tests/hp/face_domination_02.cc b/tests/hp/face_domination_02.cc index 0922a13202..799f52409b 100644 --- a/tests/hp/face_domination_02.cc +++ b/tests/hp/face_domination_02.cc @@ -82,7 +82,7 @@ main() dof_handler.distribute_dofs(fe_collection); print_dofs(dof_handler.begin_active()); - print_dofs(++dof_handler.begin_active()); + print_dofs(std::next(dof_handler.begin_active())); AffineConstraints constraints; constraints.clear(); diff --git a/tests/hp/face_domination_04.cc b/tests/hp/face_domination_04.cc index e6443f0eb0..ad5d33e8d1 100644 --- a/tests/hp/face_domination_04.cc +++ b/tests/hp/face_domination_04.cc @@ -89,7 +89,7 @@ main() deallog << "RTNodal of degree " << i << std::endl; print_dofs(dof_handler.begin_active()); - print_dofs(++dof_handler.begin_active()); + print_dofs(std::next(dof_handler.begin_active())); AffineConstraints constraints; constraints.clear(); diff --git a/tests/hp/fe_nothing_dominates.h b/tests/hp/fe_nothing_dominates.h index 1836c0bac3..96f30ee00a 100644 --- a/tests/hp/fe_nothing_dominates.h +++ b/tests/hp/fe_nothing_dominates.h @@ -60,7 +60,7 @@ project(const hp::FECollection &fe_collection, TestGrids::hyper_line(tria, 2); DoFHandler dofh(tria); - (++(dofh.begin_active()))->set_active_fe_index(1); + (std::next((dofh.begin_active())))->set_active_fe_index(1); dofh.distribute_dofs(fe_collection); // make constraints diff --git a/tests/hp/hp_constraints_common.h b/tests/hp/hp_constraints_common.h index 336d360c57..be8da58b11 100644 --- a/tests/hp/hp_constraints_common.h +++ b/tests/hp/hp_constraints_common.h @@ -304,10 +304,10 @@ test_with_2d_deformed_refined_mesh(const hp::FECollection &fe) triangulation.begin_active()->set_refine_flag(); break; case 1: - (++(triangulation.begin_active()))->set_refine_flag(); + (std::next((triangulation.begin_active())))->set_refine_flag(); break; case 2: - (++(++(triangulation.begin_active())))->set_refine_flag(); + (std::next((++(triangulation.begin_active()))))->set_refine_flag(); break; default: Assert(false, ExcNotImplemented()); @@ -349,7 +349,7 @@ test_interpolation_base(const hp::FECollection & fe, if (do_refine) { - (++triangulation.begin_active())->set_refine_flag(); + (std::next(triangulation.begin_active()))->set_refine_flag(); triangulation.execute_coarsening_and_refinement(); } diff --git a/tests/hp/hp_constraints_common_no_support.h b/tests/hp/hp_constraints_common_no_support.h index d92cc8c998..7766de0c75 100644 --- a/tests/hp/hp_constraints_common_no_support.h +++ b/tests/hp/hp_constraints_common_no_support.h @@ -305,10 +305,10 @@ test_with_2d_deformed_refined_mesh(const hp::FECollection &fe) triangulation.begin_active()->set_refine_flag(); break; case 1: - (++(triangulation.begin_active()))->set_refine_flag(); + (std::next((triangulation.begin_active())))->set_refine_flag(); break; case 2: - (++(++(triangulation.begin_active())))->set_refine_flag(); + (std::next((++(triangulation.begin_active()))))->set_refine_flag(); break; default: Assert(false, ExcNotImplemented()); @@ -350,7 +350,7 @@ test_interpolation_base(const hp::FECollection & fe, if (do_refine) { - (++triangulation.begin_active())->set_refine_flag(); + (std::next(triangulation.begin_active()))->set_refine_flag(); triangulation.execute_coarsening_and_refinement(); } diff --git a/tests/hp/hp_fe_values_copy.cc b/tests/hp/hp_fe_values_copy.cc index 764fb9b398..c45712e972 100644 --- a/tests/hp/hp_fe_values_copy.cc +++ b/tests/hp/hp_fe_values_copy.cc @@ -73,7 +73,7 @@ test() hp_fe_values1.reinit(cell1); // Now make a copy of the object and initialize it for the second cell - const auto cell2 = ++dof_handler.begin_active(); + const auto cell2 = std::next(dof_handler.begin_active()); hp::FEValues hp_fe_values2(hp_fe_values1); hp_fe_values2.reinit(cell2); diff --git a/tests/integrators/laplacian_02.cc b/tests/integrators/laplacian_02.cc index 08d90f80b4..da05905504 100644 --- a/tests/integrators/laplacian_02.cc +++ b/tests/integrators/laplacian_02.cc @@ -104,7 +104,8 @@ test_face(const FiniteElement &fe, bool diff = false) std::vector indices2(fe.dofs_per_cell); typename DoFHandler::active_cell_iterator cell1 = dof.begin_active(); - typename DoFHandler::active_cell_iterator cell2 = ++dof.begin_active(); + typename DoFHandler::active_cell_iterator cell2 = + std::next(dof.begin_active()); cell1->get_dof_indices(indices1); cell2->get_dof_indices(indices2); diff --git a/tests/lac/constraints.cc b/tests/lac/constraints.cc index 96b801d6d2..3baf5100e7 100644 --- a/tests/lac/constraints.cc +++ b/tests/lac/constraints.cc @@ -231,11 +231,11 @@ make_tria(Triangulation<3> &tria, int step) case 7: tria.begin_active()->set_refine_flag(); - (++tria.begin_active())->set_refine_flag(); + (std::next(tria.begin_active()))->set_refine_flag(); break; case 8: tria.begin_active()->set_refine_flag(); - (++(++(++tria.begin_active())))->set_refine_flag(); + (std::next((++(++tria.begin_active()))))->set_refine_flag(); break; }; diff --git a/tests/manifold/transfinite_manifold_11.cc b/tests/manifold/transfinite_manifold_11.cc index eb217d85e6..70d4d6938e 100644 --- a/tests/manifold/transfinite_manifold_11.cc +++ b/tests/manifold/transfinite_manifold_11.cc @@ -101,7 +101,7 @@ main() { triangulation.set_all_manifold_ids(3); - const auto center_cell = ++triangulation.begin_active(); + const auto center_cell = std::next(triangulation.begin_active()); const auto lower_radial = center_cell->face(2); const auto upper_radial = center_cell->face(3); lower_radial->set_manifold_id(1); diff --git a/tests/mpi/codim_01.cc b/tests/mpi/codim_01.cc index 4b9752b24f..65b8e95962 100644 --- a/tests/mpi/codim_01.cc +++ b/tests/mpi/codim_01.cc @@ -69,7 +69,7 @@ test(std::ostream & /*out*/) tr.refine_global(); tr.begin_active()->set_refine_flag(); - (++(tr.begin_active()))->set_refine_flag(); + (std::next((tr.begin_active())))->set_refine_flag(); tr.execute_coarsening_and_refinement(); diff --git a/tests/mpi/hp_unify_dof_indices_01.cc b/tests/mpi/hp_unify_dof_indices_01.cc index 60a0c6ab80..8f47d8e298 100644 --- a/tests/mpi/hp_unify_dof_indices_01.cc +++ b/tests/mpi/hp_unify_dof_indices_01.cc @@ -61,8 +61,8 @@ test() DoFHandler dof_handler(triangulation); if (dof_handler.begin_active()->is_locally_owned()) dof_handler.begin_active()->set_active_fe_index(0); - if ((++dof_handler.begin_active())->is_locally_owned()) - (++dof_handler.begin_active())->set_active_fe_index(1); + if ((std::next(dof_handler.begin_active()))->is_locally_owned()) + (std::next(dof_handler.begin_active()))->set_active_fe_index(1); dof_handler.distribute_dofs(fe); log_dof_diagnostics(dof_handler); diff --git a/tests/mpi/hp_unify_dof_indices_07.cc b/tests/mpi/hp_unify_dof_indices_07.cc index febfc6c9ff..b0190ef4e7 100644 --- a/tests/mpi/hp_unify_dof_indices_07.cc +++ b/tests/mpi/hp_unify_dof_indices_07.cc @@ -67,8 +67,8 @@ test() DoFHandler dof_handler(triangulation); if (dof_handler.begin_active()->is_locally_owned()) dof_handler.begin_active()->set_active_fe_index(0); - if ((++dof_handler.begin_active())->is_locally_owned()) - (++dof_handler.begin_active())->set_active_fe_index(1); + if ((std::next(dof_handler.begin_active()))->is_locally_owned()) + (std::next(dof_handler.begin_active()))->set_active_fe_index(1); dof_handler.distribute_dofs(fe); AffineConstraints constraints; diff --git a/tests/numerics/project_common.h b/tests/numerics/project_common.h index 301a9265de..9063d483b7 100644 --- a/tests/numerics/project_common.h +++ b/tests/numerics/project_common.h @@ -328,10 +328,10 @@ test_with_2d_deformed_refined_mesh(const FiniteElement &fe, triangulation.begin_active()->set_refine_flag(); break; case 1: - (++(triangulation.begin_active()))->set_refine_flag(); + (std::next((triangulation.begin_active())))->set_refine_flag(); break; case 2: - (++(++(triangulation.begin_active())))->set_refine_flag(); + (std::next((++(triangulation.begin_active()))))->set_refine_flag(); break; default: Assert(false, ExcNotImplemented()); diff --git a/tests/numerics/project_parallel_common.h b/tests/numerics/project_parallel_common.h index f1909ab84a..8f7a7a87cc 100644 --- a/tests/numerics/project_parallel_common.h +++ b/tests/numerics/project_parallel_common.h @@ -341,10 +341,10 @@ test_with_2d_deformed_refined_mesh(const FiniteElement &fe, triangulation.begin_active()->set_refine_flag(); break; case 1: - (++(triangulation.begin_active()))->set_refine_flag(); + (std::next((triangulation.begin_active())))->set_refine_flag(); break; case 2: - (++(++(triangulation.begin_active())))->set_refine_flag(); + (std::next((++(triangulation.begin_active()))))->set_refine_flag(); break; default: Assert(false, ExcNotImplemented()); diff --git a/tests/serialization/hp_dof_handler_01.cc b/tests/serialization/hp_dof_handler_01.cc index e0bba589bf..90a3b4b25f 100644 --- a/tests/serialization/hp_dof_handler_01.cc +++ b/tests/serialization/hp_dof_handler_01.cc @@ -193,8 +193,8 @@ test() dof_1.begin_active()->set_future_fe_index(0); dof_2.begin_active()->set_future_fe_index(0); - (++dof_1.begin_active())->set_future_fe_index(1); - (++dof_2.begin_active())->set_future_fe_index(1); + (std::next(dof_1.begin_active()))->set_future_fe_index(1); + (std::next(dof_2.begin_active()))->set_future_fe_index(1); // right now, both hp::DoFHandlers are the same. Renumber one of them DoFRenumbering::random(dof_1);