From 517eb7e4ab84ffe49525eaa04004911c0dcbe514 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 27 Aug 2021 11:33:40 -0600 Subject: [PATCH] Also use std::next for ++object.begin(x). --- tests/bits/chunk_sparse_matrix_iterator_11.cc | 2 ++ tests/bits/chunk_sparse_matrix_iterator_12.cc | 2 ++ tests/bits/periodicity_01.cc | 7 ++++--- tests/bits/periodicity_02.cc | 7 ++++--- tests/bits/periodicity_03.cc | 7 ++++--- tests/bits/periodicity_04.cc | 9 ++++---- tests/bits/periodicity_08.cc | 7 ++++--- tests/bits/periodicity_09.cc | 21 ++++++++++--------- tests/bits/sparse_matrix_iterator_11.cc | 2 ++ tests/bits/sparse_matrix_iterator_12.cc | 2 ++ tests/dofs/dof_tools_01a.cc | 5 +++-- tests/dofs/dof_tools_01a_constraints_false.cc | 5 +++-- tests/dofs/dof_tools_01a_constraints_true.cc | 5 +++-- tests/dofs/dof_tools_01a_subdomain.cc | 5 +++-- tests/dofs/dof_tools_02a.cc | 5 +++-- tests/dofs/dof_tools_02a_constraints_false.cc | 5 +++-- tests/dofs/dof_tools_02a_constraints_true.cc | 5 +++-- tests/dofs/dof_tools_02a_subdomain.cc | 5 +++-- tests/dofs/dof_tools_15a.cc | 5 +++-- tests/dofs/dof_tools_16a.cc | 5 +++-- tests/dofs/dof_tools_17a.cc | 5 +++-- tests/dofs/dof_tools_18a.cc | 5 +++-- tests/dofs/dof_tools_18a_1d.cc | 5 +++-- tests/dofs/dof_tools_21_b_x.cc | 2 +- tests/dofs/dof_tools_21_b_x_q3.cc | 2 +- tests/dofs/dof_tools_21_b_y.cc | 2 +- tests/dofs/sparsity_pattern_02.cc | 2 +- tests/dofs/sparsity_pattern_03.cc | 2 +- tests/dofs/sparsity_pattern_04.cc | 2 +- 29 files changed, 85 insertions(+), 58 deletions(-) diff --git a/tests/bits/chunk_sparse_matrix_iterator_11.cc b/tests/bits/chunk_sparse_matrix_iterator_11.cc index 0a9062a16e..e61143efed 100644 --- a/tests/bits/chunk_sparse_matrix_iterator_11.cc +++ b/tests/bits/chunk_sparse_matrix_iterator_11.cc @@ -20,6 +20,8 @@ #include +#include + #include "../tests.h" diff --git a/tests/bits/chunk_sparse_matrix_iterator_12.cc b/tests/bits/chunk_sparse_matrix_iterator_12.cc index c72f7a9ab0..2ca738e491 100644 --- a/tests/bits/chunk_sparse_matrix_iterator_12.cc +++ b/tests/bits/chunk_sparse_matrix_iterator_12.cc @@ -19,6 +19,8 @@ #include +#include + #include "../tests.h" diff --git a/tests/bits/periodicity_01.cc b/tests/bits/periodicity_01.cc index 98195bf5e7..657c0558e6 100644 --- a/tests/bits/periodicity_01.cc +++ b/tests/bits/periodicity_01.cc @@ -55,9 +55,10 @@ test() dof_handler.distribute_dofs(fe); AffineConstraints cm; - DoFTools::make_periodicity_constraints(dof_handler.begin(0)->face(0), - (++dof_handler.begin(0))->face(1), - cm); + DoFTools::make_periodicity_constraints( + dof_handler.begin(0)->face(0), + (std::next(dof_handler.begin(0)))->face(1), + cm); deallog << "dim " << std::to_string(dim) << ":" << std::endl; cm.print(deallog.get_file_stream()); diff --git a/tests/bits/periodicity_02.cc b/tests/bits/periodicity_02.cc index 068f84193e..2d5d2f07aa 100644 --- a/tests/bits/periodicity_02.cc +++ b/tests/bits/periodicity_02.cc @@ -59,9 +59,10 @@ test() dof_handler.distribute_dofs(fe); AffineConstraints cm; - DoFTools::make_periodicity_constraints(dof_handler.begin(0)->face(0), - (++dof_handler.begin(0))->face(1), - cm); + DoFTools::make_periodicity_constraints( + dof_handler.begin(0)->face(0), + (std::next(dof_handler.begin(0)))->face(1), + cm); cm.print(deallog.get_file_stream()); } diff --git a/tests/bits/periodicity_03.cc b/tests/bits/periodicity_03.cc index e1e2f03e12..5f7191aedb 100644 --- a/tests/bits/periodicity_03.cc +++ b/tests/bits/periodicity_03.cc @@ -61,9 +61,10 @@ test() dof_handler.distribute_dofs(fe); AffineConstraints cm; - DoFTools::make_periodicity_constraints(dof_handler.begin(0)->face(0), - (++dof_handler.begin(0))->face(1), - cm); + DoFTools::make_periodicity_constraints( + dof_handler.begin(0)->face(0), + (std::next(dof_handler.begin(0)))->face(1), + cm); cm.print(deallog.get_file_stream()); } diff --git a/tests/bits/periodicity_04.cc b/tests/bits/periodicity_04.cc index 0c1cb986fe..17f57245c7 100644 --- a/tests/bits/periodicity_04.cc +++ b/tests/bits/periodicity_04.cc @@ -68,10 +68,11 @@ test() std::vector mask(2, true); mask[1] = false; AffineConstraints cm; - DoFTools::make_periodicity_constraints(dof_handler.begin(0)->face(0), - (++dof_handler.begin(0))->face(1), - cm, - mask); + DoFTools::make_periodicity_constraints( + dof_handler.begin(0)->face(0), + (std::next(dof_handler.begin(0)))->face(1), + cm, + mask); cm.print(deallog.get_file_stream()); } diff --git a/tests/bits/periodicity_08.cc b/tests/bits/periodicity_08.cc index 0101fed219..e076c0d280 100644 --- a/tests/bits/periodicity_08.cc +++ b/tests/bits/periodicity_08.cc @@ -55,9 +55,10 @@ test() dof_handler.distribute_dofs(fe); AffineConstraints> cm; - DoFTools::make_periodicity_constraints(dof_handler.begin(0)->face(0), - (++dof_handler.begin(0))->face(1), - cm); + DoFTools::make_periodicity_constraints( + dof_handler.begin(0)->face(0), + (std::next(dof_handler.begin(0)))->face(1), + cm); cm.print(deallog.get_file_stream()); } diff --git a/tests/bits/periodicity_09.cc b/tests/bits/periodicity_09.cc index ad1bb49cf2..728f5c60bb 100644 --- a/tests/bits/periodicity_09.cc +++ b/tests/bits/periodicity_09.cc @@ -68,16 +68,17 @@ test() deallog << dim << " 1/periodicity_factor: " << 1. / periodicity_factor << std::endl; - DoFTools::make_periodicity_constraints(dof_handler.begin(0)->face(0), - (++dof_handler.begin(0))->face(1), - cm, - ComponentMask(), - true, - false, - false, - FullMatrix(), - std::vector(), - periodicity_factor); + DoFTools::make_periodicity_constraints( + dof_handler.begin(0)->face(0), + (std::next(dof_handler.begin(0)))->face(1), + cm, + ComponentMask(), + true, + false, + false, + FullMatrix(), + std::vector(), + periodicity_factor); cm.print(deallog.get_file_stream()); } diff --git a/tests/bits/sparse_matrix_iterator_11.cc b/tests/bits/sparse_matrix_iterator_11.cc index 23bdfaac74..6f4da75e5c 100644 --- a/tests/bits/sparse_matrix_iterator_11.cc +++ b/tests/bits/sparse_matrix_iterator_11.cc @@ -20,6 +20,8 @@ #include #include +#include + #include "../tests.h" diff --git a/tests/bits/sparse_matrix_iterator_12.cc b/tests/bits/sparse_matrix_iterator_12.cc index eac35f607c..13650baebe 100644 --- a/tests/bits/sparse_matrix_iterator_12.cc +++ b/tests/bits/sparse_matrix_iterator_12.cc @@ -20,6 +20,8 @@ #include #include +#include + #include "../tests.h" diff --git a/tests/dofs/dof_tools_01a.cc b/tests/dofs/dof_tools_01a.cc index 1c90687ad7..16614ed1ea 100644 --- a/tests/dofs/dof_tools_01a.cc +++ b/tests/dofs/dof_tools_01a.cc @@ -57,7 +57,8 @@ check_this(const DoFHandler &dof_handler) unsigned int hash = 0; for (unsigned int l = 0; l < sp.n_rows(); ++l) hash += - l * (sp.row_length(l) + (sp.begin(l) - sp.begin()) + - (sp.row_length(l) > 1 ? ++sp.begin(l) : sp.begin(l))->column()); + l * + (sp.row_length(l) + (sp.begin(l) - sp.begin()) + + (sp.row_length(l) > 1 ? std::next(sp.begin(l)) : sp.begin(l))->column()); deallog << hash << std::endl; } diff --git a/tests/dofs/dof_tools_01a_constraints_false.cc b/tests/dofs/dof_tools_01a_constraints_false.cc index 1a732fdb8f..857004ef6d 100644 --- a/tests/dofs/dof_tools_01a_constraints_false.cc +++ b/tests/dofs/dof_tools_01a_constraints_false.cc @@ -63,7 +63,8 @@ check_this(const DoFHandler &dof_handler) unsigned int hash = 0; for (unsigned int l = 0; l < sp.n_rows(); ++l) hash += - l * (sp.row_length(l) + (sp.begin(l) - sp.begin()) + - (sp.row_length(l) > 1 ? ++sp.begin(l) : sp.begin(l))->column()); + l * + (sp.row_length(l) + (sp.begin(l) - sp.begin()) + + (sp.row_length(l) > 1 ? std::next(sp.begin(l)) : sp.begin(l))->column()); deallog << hash << std::endl; } diff --git a/tests/dofs/dof_tools_01a_constraints_true.cc b/tests/dofs/dof_tools_01a_constraints_true.cc index c2d37854e4..e93dc88bd8 100644 --- a/tests/dofs/dof_tools_01a_constraints_true.cc +++ b/tests/dofs/dof_tools_01a_constraints_true.cc @@ -63,7 +63,8 @@ check_this(const DoFHandler &dof_handler) unsigned int hash = 0; for (unsigned int l = 0; l < sp.n_rows(); ++l) hash += - l * (sp.row_length(l) + (sp.begin(l) - sp.begin()) + - (sp.row_length(l) > 1 ? ++sp.begin(l) : sp.begin(l))->column()); + l * + (sp.row_length(l) + (sp.begin(l) - sp.begin()) + + (sp.row_length(l) > 1 ? std::next(sp.begin(l)) : sp.begin(l))->column()); deallog << hash << std::endl; } diff --git a/tests/dofs/dof_tools_01a_subdomain.cc b/tests/dofs/dof_tools_01a_subdomain.cc index b3e4e6c680..6dc1feb302 100644 --- a/tests/dofs/dof_tools_01a_subdomain.cc +++ b/tests/dofs/dof_tools_01a_subdomain.cc @@ -63,7 +63,8 @@ check_this(const DoFHandler &dof_handler) unsigned int hash = 0; for (unsigned int l = 0; l < sp.n_rows(); ++l) hash += - l * (sp.row_length(l) + (sp.begin(l) - sp.begin()) + - (sp.row_length(l) > 1 ? ++sp.begin(l) : sp.begin(l))->column()); + l * + (sp.row_length(l) + (sp.begin(l) - sp.begin()) + + (sp.row_length(l) > 1 ? std::next(sp.begin(l)) : sp.begin(l))->column()); deallog << hash << std::endl; } diff --git a/tests/dofs/dof_tools_02a.cc b/tests/dofs/dof_tools_02a.cc index 57b5bc46e2..e2a08acd77 100644 --- a/tests/dofs/dof_tools_02a.cc +++ b/tests/dofs/dof_tools_02a.cc @@ -67,7 +67,8 @@ check_this(const DoFHandler &dof_handler) unsigned int hash = 0; for (unsigned int l = 0; l < sp.n_rows(); ++l) hash += - l * (sp.row_length(l) + (sp.begin(l) - sp.begin()) + - (sp.row_length(l) > 1 ? ++sp.begin(l) : sp.begin(l))->column()); + l * + (sp.row_length(l) + (sp.begin(l) - sp.begin()) + + (sp.row_length(l) > 1 ? std::next(sp.begin(l)) : sp.begin(l))->column()); deallog << hash << std::endl; } diff --git a/tests/dofs/dof_tools_02a_constraints_false.cc b/tests/dofs/dof_tools_02a_constraints_false.cc index 035bb4c68c..ab66069690 100644 --- a/tests/dofs/dof_tools_02a_constraints_false.cc +++ b/tests/dofs/dof_tools_02a_constraints_false.cc @@ -73,7 +73,8 @@ check_this(const DoFHandler &dof_handler) unsigned int hash = 0; for (unsigned int l = 0; l < sp.n_rows(); ++l) hash += - l * (sp.row_length(l) + (sp.begin(l) - sp.begin()) + - (sp.row_length(l) > 1 ? ++sp.begin(l) : sp.begin(l))->column()); + l * + (sp.row_length(l) + (sp.begin(l) - sp.begin()) + + (sp.row_length(l) > 1 ? std::next(sp.begin(l)) : sp.begin(l))->column()); deallog << hash << std::endl; } diff --git a/tests/dofs/dof_tools_02a_constraints_true.cc b/tests/dofs/dof_tools_02a_constraints_true.cc index 07b2fdbca3..ce60161bc2 100644 --- a/tests/dofs/dof_tools_02a_constraints_true.cc +++ b/tests/dofs/dof_tools_02a_constraints_true.cc @@ -73,7 +73,8 @@ check_this(const DoFHandler &dof_handler) unsigned int hash = 0; for (unsigned int l = 0; l < sp.n_rows(); ++l) hash += - l * (sp.row_length(l) + (sp.begin(l) - sp.begin()) + - (sp.row_length(l) > 1 ? ++sp.begin(l) : sp.begin(l))->column()); + l * + (sp.row_length(l) + (sp.begin(l) - sp.begin()) + + (sp.row_length(l) > 1 ? std::next(sp.begin(l)) : sp.begin(l))->column()); deallog << hash << std::endl; } diff --git a/tests/dofs/dof_tools_02a_subdomain.cc b/tests/dofs/dof_tools_02a_subdomain.cc index b29cd90c18..1b229e30d5 100644 --- a/tests/dofs/dof_tools_02a_subdomain.cc +++ b/tests/dofs/dof_tools_02a_subdomain.cc @@ -74,7 +74,8 @@ check_this(const DoFHandler &dof_handler) unsigned int hash = 0; for (unsigned int l = 0; l < sp.n_rows(); ++l) hash += - l * (sp.row_length(l) + (sp.begin(l) - sp.begin()) + - (sp.row_length(l) > 1 ? ++sp.begin(l) : sp.begin(l))->column()); + l * + (sp.row_length(l) + (sp.begin(l) - sp.begin()) + + (sp.row_length(l) > 1 ? std::next(sp.begin(l)) : sp.begin(l))->column()); deallog << hash << std::endl; } diff --git a/tests/dofs/dof_tools_15a.cc b/tests/dofs/dof_tools_15a.cc index d2a335a6ec..aba0ebe1f0 100644 --- a/tests/dofs/dof_tools_15a.cc +++ b/tests/dofs/dof_tools_15a.cc @@ -66,7 +66,8 @@ check_this(const DoFHandler &dof_handler) unsigned int hash = 0; for (unsigned int l = 0; l < sp.n_rows(); ++l) hash += - l * (sp.row_length(l) + (sp.begin(l) - sp.begin()) + - (sp.row_length(l) > 1 ? ++sp.begin(l) : sp.begin(l))->column()); + l * + (sp.row_length(l) + (sp.begin(l) - sp.begin()) + + (sp.row_length(l) > 1 ? std::next(sp.begin(l)) : sp.begin(l))->column()); deallog << hash << std::endl; } diff --git a/tests/dofs/dof_tools_16a.cc b/tests/dofs/dof_tools_16a.cc index ec3bae12d6..2ba9c03f4f 100644 --- a/tests/dofs/dof_tools_16a.cc +++ b/tests/dofs/dof_tools_16a.cc @@ -72,7 +72,8 @@ check_this(const DoFHandler &dof_handler) unsigned int hash = 0; for (unsigned int l = 0; l < sp.n_rows(); ++l) hash += - l * (sp.row_length(l) + (sp.begin(l) - sp.begin()) + - (sp.row_length(l) > 1 ? ++sp.begin(l) : sp.begin(l))->column()); + l * + (sp.row_length(l) + (sp.begin(l) - sp.begin()) + + (sp.row_length(l) > 1 ? std::next(sp.begin(l)) : sp.begin(l))->column()); deallog << hash << std::endl; } diff --git a/tests/dofs/dof_tools_17a.cc b/tests/dofs/dof_tools_17a.cc index 8c2e45e035..6dccceb50c 100644 --- a/tests/dofs/dof_tools_17a.cc +++ b/tests/dofs/dof_tools_17a.cc @@ -57,7 +57,8 @@ check_this(const DoFHandler &dof_handler) unsigned int hash = 0; for (unsigned int l = 0; l < sp.n_rows(); ++l) hash += - l * (sp.row_length(l) + (sp.begin(l) - sp.begin()) + - (sp.row_length(l) > 1 ? ++sp.begin(l) : sp.begin(l))->column()); + l * + (sp.row_length(l) + (sp.begin(l) - sp.begin()) + + (sp.row_length(l) > 1 ? std::next(sp.begin(l)) : sp.begin(l))->column()); deallog << hash << std::endl; } diff --git a/tests/dofs/dof_tools_18a.cc b/tests/dofs/dof_tools_18a.cc index d8d5deef50..22e96c2df6 100644 --- a/tests/dofs/dof_tools_18a.cc +++ b/tests/dofs/dof_tools_18a.cc @@ -78,7 +78,8 @@ check_this(const DoFHandler &dof_handler) unsigned int hash = 0; for (unsigned int l = 0; l < sp.n_rows(); ++l) hash += - l * (sp.row_length(l) + (sp.begin(l) - sp.begin()) + - (sp.row_length(l) > 1 ? ++sp.begin(l) : sp.begin(l))->column()); + l * + (sp.row_length(l) + (sp.begin(l) - sp.begin()) + + (sp.row_length(l) > 1 ? std::next(sp.begin(l)) : sp.begin(l))->column()); deallog << hash << std::endl; } diff --git a/tests/dofs/dof_tools_18a_1d.cc b/tests/dofs/dof_tools_18a_1d.cc index 5c672b29db..5c60786732 100644 --- a/tests/dofs/dof_tools_18a_1d.cc +++ b/tests/dofs/dof_tools_18a_1d.cc @@ -83,8 +83,9 @@ check_this(const DoFHandler &dof_handler) unsigned int hash = 0; for (unsigned int l = 0; l < sp.n_rows(); ++l) hash += - l * (sp.row_length(l) + (sp.begin(l) - sp.begin()) + - (sp.row_length(l) > 1 ? ++sp.begin(l) : sp.begin(l))->column()); + l * + (sp.row_length(l) + (sp.begin(l) - sp.begin()) + + (sp.row_length(l) > 1 ? std::next(sp.begin(l)) : sp.begin(l))->column()); deallog << hash << std::endl; } diff --git a/tests/dofs/dof_tools_21_b_x.cc b/tests/dofs/dof_tools_21_b_x.cc index b8b622831e..b133c877e8 100644 --- a/tests/dofs/dof_tools_21_b_x.cc +++ b/tests/dofs/dof_tools_21_b_x.cc @@ -179,7 +179,7 @@ print_matching(DoFHandler &dof_handler) // Look for the two outermost faces: typename DoFHandler::face_iterator face_1 = - (++dof_handler.begin(0))->face(2); + (std::next(dof_handler.begin(0)))->face(2); typename DoFHandler::face_iterator face_2 = dof_handler.begin(0)->face(2); diff --git a/tests/dofs/dof_tools_21_b_x_q3.cc b/tests/dofs/dof_tools_21_b_x_q3.cc index e3a14c4823..934093a6aa 100644 --- a/tests/dofs/dof_tools_21_b_x_q3.cc +++ b/tests/dofs/dof_tools_21_b_x_q3.cc @@ -213,7 +213,7 @@ print_matching(DoFHandler &dof_handler) // Look for the two outermost faces: typename DoFHandler::face_iterator face_1 = - (++dof_handler.begin(0))->face(2); + (std::next(dof_handler.begin(0)))->face(2); typename DoFHandler::face_iterator face_2 = dof_handler.begin(0)->face(2); diff --git a/tests/dofs/dof_tools_21_b_y.cc b/tests/dofs/dof_tools_21_b_y.cc index a2ba6417d5..edfef95cd6 100644 --- a/tests/dofs/dof_tools_21_b_y.cc +++ b/tests/dofs/dof_tools_21_b_y.cc @@ -179,7 +179,7 @@ print_matching(DoFHandler &dof_handler) // Look for the two outermost faces: typename DoFHandler::face_iterator face_1 = - (++dof_handler.begin(0))->face(2); + (std::next(dof_handler.begin(0)))->face(2); typename DoFHandler::face_iterator face_2 = dof_handler.begin(0)->face(2); diff --git a/tests/dofs/sparsity_pattern_02.cc b/tests/dofs/sparsity_pattern_02.cc index 449c2e8414..f3c28e43fe 100644 --- a/tests/dofs/sparsity_pattern_02.cc +++ b/tests/dofs/sparsity_pattern_02.cc @@ -67,7 +67,7 @@ check() triangulation_2.refine_global(1); (std::next(triangulation_2.begin_active()))->set_refine_flag(); triangulation_2.execute_coarsening_and_refinement(); - (++triangulation_2.begin_active(2))->set_refine_flag(); + (std::next(triangulation_2.begin_active(2)))->set_refine_flag(); triangulation_2.execute_coarsening_and_refinement(); if (dim == 1) triangulation_2.refine_global(2); diff --git a/tests/dofs/sparsity_pattern_03.cc b/tests/dofs/sparsity_pattern_03.cc index 7221450af8..7c71656ad9 100644 --- a/tests/dofs/sparsity_pattern_03.cc +++ b/tests/dofs/sparsity_pattern_03.cc @@ -70,7 +70,7 @@ check() triangulation_2.refine_global(1); (std::next(triangulation_2.begin_active()))->set_refine_flag(); triangulation_2.execute_coarsening_and_refinement(); - (++triangulation_2.begin_active(2))->set_refine_flag(); + (std::next(triangulation_2.begin_active(2)))->set_refine_flag(); triangulation_2.execute_coarsening_and_refinement(); if (dim == 1) triangulation_2.refine_global(2); diff --git a/tests/dofs/sparsity_pattern_04.cc b/tests/dofs/sparsity_pattern_04.cc index 508548eaea..6fef2d7daf 100644 --- a/tests/dofs/sparsity_pattern_04.cc +++ b/tests/dofs/sparsity_pattern_04.cc @@ -71,7 +71,7 @@ check() triangulation_2.refine_global(1); (std::next(triangulation_2.begin_active()))->set_refine_flag(); triangulation_2.execute_coarsening_and_refinement(); - (++triangulation_2.begin_active(2))->set_refine_flag(); + (std::next(triangulation_2.begin_active(2)))->set_refine_flag(); triangulation_2.execute_coarsening_and_refinement(); if (dim == 1) triangulation_2.refine_global(2); -- 2.39.5