From ded3f34e2fa1f3a7ef00a76b812d8213effe8f0e Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Fri, 31 May 2019 23:07:15 +0200 Subject: [PATCH] Update tests with respect to locally_owned_dofs_per_processor --- tests/matrix_free/dg_pbc_01.cc | 8 +++--- tests/mpi/dof_handler_number_cache.cc | 17 +++++++------ tests/mpi/mg_02.cc | 11 ++++---- tests/mpi/p4est_2d_dofhandler_01.cc | 5 +++- tests/mpi/p4est_2d_dofhandler_02.cc | 6 +++-- tests/mpi/p4est_2d_dofhandler_03.cc | 6 +++-- tests/mpi/p4est_2d_dofhandler_04.cc | 6 +++-- tests/mpi/p4est_2d_renumber_02.cc | 4 ++- tests/mpi/p4est_data_out_01.cc | 7 +++--- tests/mpi/p4est_get_subdomain_association.cc | 5 +++- tests/mpi/periodicity_04.cc | 2 +- tests/mpi/periodicity_07.cc | 2 +- tests/mpi/renumber_cuthill_mckee.cc | 8 +++--- tests/mpi/renumber_cuthill_mckee_02.cc | 8 +++--- tests/mpi/step-40_cuthill_mckee_MPI-subset.cc | 5 +++- tests/sharedtria/dof_01.cc | 25 ++++++++++--------- tests/sharedtria/dof_02.cc | 25 ++++++++++--------- tests/sharedtria/dof_03.cc | 25 ++++++++++--------- tests/sharedtria/dof_04.cc | 25 ++++++++++--------- tests/sharedtria/hp_dof_01.cc | 25 ++++++++++--------- tests/sharedtria/hp_dof_02.cc | 25 ++++++++++--------- tests/sharedtria/hp_dof_03.cc | 25 ++++++++++--------- tests/sharedtria/hp_dof_04.cc | 25 ++++++++++--------- tests/sharedtria/hp_no_cells_01.cc | 20 ++++++--------- 24 files changed, 175 insertions(+), 145 deletions(-) diff --git a/tests/matrix_free/dg_pbc_01.cc b/tests/matrix_free/dg_pbc_01.cc index 699d1798ae..e8d5a5c865 100644 --- a/tests/matrix_free/dg_pbc_01.cc +++ b/tests/matrix_free/dg_pbc_01.cc @@ -95,6 +95,9 @@ test() SolverControl control(1000, 1e-12 * std::sqrt(rhs.size())); SolverCG> solver(control); solver.solve(mf, sol, rhs, PreconditionIdentity()); + + const std::vector locally_owned_dofs_per_processor = + dof.locally_owned_dofs_per_processor(); // gather all data at root if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0) { @@ -107,14 +110,13 @@ test() ++i) { MPI_Recv(sol_gather_ptr, - dof.locally_owned_dofs_per_processor()[i].n_elements(), + locally_owned_dofs_per_processor[i].n_elements(), MPI_DOUBLE, i, i, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - sol_gather_ptr += - dof.locally_owned_dofs_per_processor()[i].n_elements(); + sol_gather_ptr += locally_owned_dofs_per_processor[i].n_elements(); } solution_gather0.print(deallog.get_file_stream()); } diff --git a/tests/mpi/dof_handler_number_cache.cc b/tests/mpi/dof_handler_number_cache.cc index 26fed22974..59a8feb496 100644 --- a/tests/mpi/dof_handler_number_cache.cc +++ b/tests/mpi/dof_handler_number_cache.cc @@ -111,19 +111,22 @@ test() ++i) AssertThrow(dof_handler.n_locally_owned_dofs_per_processor()[i] <= N, ExcInternalError()); - AssertThrow(std::accumulate( - dof_handler.n_locally_owned_dofs_per_processor().begin(), - dof_handler.n_locally_owned_dofs_per_processor().end(), - 0U) == N, + const std::vector + n_locally_owned_dofs_per_processor = + dof_handler.n_locally_owned_dofs_per_processor(); + AssertThrow(std::accumulate(n_locally_owned_dofs_per_processor.begin(), + n_locally_owned_dofs_per_processor.end(), + 0U) == N, ExcInternalError()); + const std::vector locally_owned_dofs_per_processor = + dof_handler.locally_owned_dofs_per_processor(); IndexSet all(N), really_all(N); // poor man's union operation - for (unsigned int i = 0; - i < dof_handler.n_locally_owned_dofs_per_processor().size(); + for (unsigned int i = 0; i < n_locally_owned_dofs_per_processor.size(); ++i) for (unsigned int j = 0; j < N; ++j) - if (dof_handler.locally_owned_dofs_per_processor()[i].is_element(j)) + if (locally_owned_dofs_per_processor[i].is_element(j)) { AssertThrow(all.is_element(j) == false, ExcInternalError()); all.add_index(j); diff --git a/tests/mpi/mg_02.cc b/tests/mpi/mg_02.cc index b682813429..690aa78eff 100644 --- a/tests/mpi/mg_02.cc +++ b/tests/mpi/mg_02.cc @@ -94,18 +94,19 @@ test() deallog << "Levels: " << tr.n_global_levels() << std::endl; std::cout << "Levels: " << tr.n_global_levels() << std::endl; + const std::vector + n_locally_owned_dofs_per_processor = + dofh.n_locally_owned_dofs_per_processor(); deallog << "n_locally_owned_dofs_per_processor:" << std::endl; - for (unsigned int i = 0; - i < dofh.n_locally_owned_dofs_per_processor().size(); - ++i) - deallog << dofh.n_locally_owned_dofs_per_processor()[i] << std::endl; + for (unsigned int i = 0; i < n_locally_owned_dofs_per_processor.size(); ++i) + deallog << n_locally_owned_dofs_per_processor[i] << std::endl; deallog << "locally_owned_mg_dofs_per_processor:" << std::endl; for (unsigned int lvl = 0; lvl < tr.n_global_levels(); ++lvl) { deallog << "level " << lvl << ":" << std::endl; - const std::vector &vec = + const std::vector vec = dofh.locally_owned_mg_dofs_per_processor(lvl); for (unsigned int i = 0; i < vec.size(); ++i) diff --git a/tests/mpi/p4est_2d_dofhandler_01.cc b/tests/mpi/p4est_2d_dofhandler_01.cc index 2d13e6cafd..d7eeb1cf43 100644 --- a/tests/mpi/p4est_2d_dofhandler_01.cc +++ b/tests/mpi/p4est_2d_dofhandler_01.cc @@ -55,9 +55,12 @@ test() static const FE_Q fe(2); dofh.distribute_dofs(fe); + const std::vector + n_locally_owned_dofs_per_processor = + dofh.n_locally_owned_dofs_per_processor(); if (myid == 0) { - deallog << "dofh.n_dofs() " << dofh.n_locally_owned_dofs_per_processor() + deallog << "dofh.n_dofs() " << n_locally_owned_dofs_per_processor << std::endl; deallog << "dofh.n_locally_owned_dofs() " << dofh.n_locally_owned_dofs() << std::endl; diff --git a/tests/mpi/p4est_2d_dofhandler_02.cc b/tests/mpi/p4est_2d_dofhandler_02.cc index 008058d62e..04d80677e7 100644 --- a/tests/mpi/p4est_2d_dofhandler_02.cc +++ b/tests/mpi/p4est_2d_dofhandler_02.cc @@ -89,10 +89,12 @@ test() static const FE_Q fe(2); dofh.distribute_dofs(fe); + std::vector n_locally_owned_dofs_per_processor = + dofh.n_locally_owned_dofs_per_processor(); if (myid == 0) { - deallog << "dofh.n_dofs() " - << dofh.n_locally_owned_dofs_per_processor() << std::endl; + deallog << "dofh.n_dofs() " << n_locally_owned_dofs_per_processor + << std::endl; deallog << "dofh.n_locally_owned_dofs() " << dofh.n_locally_owned_dofs() << std::endl; } diff --git a/tests/mpi/p4est_2d_dofhandler_03.cc b/tests/mpi/p4est_2d_dofhandler_03.cc index b9ffb6b320..f4c89a6a0f 100644 --- a/tests/mpi/p4est_2d_dofhandler_03.cc +++ b/tests/mpi/p4est_2d_dofhandler_03.cc @@ -90,10 +90,12 @@ test() static const FE_Q fe(2); dofh.distribute_dofs(fe); + std::vector n_locally_owned_dofs_per_processor = + dofh.n_locally_owned_dofs_per_processor(); if (myid == 0) { - deallog << "dofh.n_dofs() " - << dofh.n_locally_owned_dofs_per_processor() << std::endl; + deallog << "dofh.n_dofs() " << n_locally_owned_dofs_per_processor + << std::endl; deallog << "dofh.n_locally_owned_dofs() " << dofh.n_locally_owned_dofs() << std::endl; } diff --git a/tests/mpi/p4est_2d_dofhandler_04.cc b/tests/mpi/p4est_2d_dofhandler_04.cc index f883a67c5e..bdb913dc63 100644 --- a/tests/mpi/p4est_2d_dofhandler_04.cc +++ b/tests/mpi/p4est_2d_dofhandler_04.cc @@ -90,10 +90,12 @@ test() static const FE_Q fe(2); dofh.distribute_dofs(fe); + std::vector n_locally_owned_dofs_per_processor = + dofh.n_locally_owned_dofs_per_processor(); if (myid == 0) { - deallog << "dofh.n_dofs() " - << dofh.n_locally_owned_dofs_per_processor() << std::endl; + deallog << "dofh.n_dofs() " << n_locally_owned_dofs_per_processor + << std::endl; deallog << "dofh.n_locally_owned_dofs() " << dofh.n_locally_owned_dofs() << std::endl; } diff --git a/tests/mpi/p4est_2d_renumber_02.cc b/tests/mpi/p4est_2d_renumber_02.cc index 7c45a56273..7202db7f8a 100644 --- a/tests/mpi/p4est_2d_renumber_02.cc +++ b/tests/mpi/p4est_2d_renumber_02.cc @@ -80,6 +80,8 @@ test() IndexSet dof_set; DoFTools::extract_locally_active_dofs(dofh, dof_set); + const std::vector owned_dofs = + dofh.locally_owned_dofs_per_processor(); if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0) { dof_set.print(deallog); @@ -88,7 +90,7 @@ test() ++i) { deallog << "Dofs owned by processor " << i << ": "; - dofh.locally_owned_dofs_per_processor()[i].print(deallog); + owned_dofs[i].print(deallog); deallog << std::endl; } } diff --git a/tests/mpi/p4est_data_out_01.cc b/tests/mpi/p4est_data_out_01.cc index d3d529fae6..2261db64d0 100644 --- a/tests/mpi/p4est_data_out_01.cc +++ b/tests/mpi/p4est_data_out_01.cc @@ -74,12 +74,13 @@ test() data_out.add_data_vector(x, "x"); data_out.build_patches(); + std::vector n_locally_owned_dofs_per_processor = + dofh.n_locally_owned_dofs_per_processor(); if (myid == 0) { - for (unsigned int i = 0; - i < dofh.n_locally_owned_dofs_per_processor().size(); + for (unsigned int i = 0; i < n_locally_owned_dofs_per_processor.size(); ++i) - deallog << dofh.n_locally_owned_dofs_per_processor()[i] << std::endl; + deallog << n_locally_owned_dofs_per_processor[i] << std::endl; data_out.write_vtu(deallog.get_file_stream()); } } diff --git a/tests/mpi/p4est_get_subdomain_association.cc b/tests/mpi/p4est_get_subdomain_association.cc index b229282ffe..59c4592f00 100644 --- a/tests/mpi/p4est_get_subdomain_association.cc +++ b/tests/mpi/p4est_get_subdomain_association.cc @@ -59,9 +59,12 @@ test() static const FE_Q fe(2); dofh.distribute_dofs(fe); + const std::vector + n_locally_owned_dofs_per_processor = + dofh.n_locally_owned_dofs_per_processor(); if (myid == 1) { - deallog << "dofh.n_dofs() " << dofh.n_locally_owned_dofs_per_processor() + deallog << "dofh.n_dofs() " << n_locally_owned_dofs_per_processor << std::endl; deallog << "dofh.n_locally_owned_dofs() " << dofh.n_locally_owned_dofs() << std::endl; diff --git a/tests/mpi/periodicity_04.cc b/tests/mpi/periodicity_04.cc index cc5aea0f8f..bf5530f694 100644 --- a/tests/mpi/periodicity_04.cc +++ b/tests/mpi/periodicity_04.cc @@ -205,7 +205,7 @@ check(const unsigned int orientation, bool reverse) unsigned int myid = Utilities::MPI::this_mpi_process(MPI_COMM_WORLD); constraints.print(deallog.get_file_stream()); - const std::vector &locally_owned_dofs_vector = + const std::vector locally_owned_dofs_vector = dof_handler.locally_owned_dofs_per_processor(); IndexSet locally_active_dofs; DoFTools::extract_locally_active_dofs(dof_handler, locally_active_dofs); diff --git a/tests/mpi/periodicity_07.cc b/tests/mpi/periodicity_07.cc index 726faf9907..59ec485f07 100644 --- a/tests/mpi/periodicity_07.cc +++ b/tests/mpi/periodicity_07.cc @@ -138,7 +138,7 @@ test(const unsigned numRefinementLevels = 2) IndexSet locally_active_dofs; DoFTools::extract_locally_active_dofs(dof_handler, locally_active_dofs); - const std::vector &locally_owned_dofs = + const std::vector locally_owned_dofs = dof_handler.locally_owned_dofs_per_processor(); std::map> supportPoints; diff --git a/tests/mpi/renumber_cuthill_mckee.cc b/tests/mpi/renumber_cuthill_mckee.cc index 98eb00c366..2abff36a13 100644 --- a/tests/mpi/renumber_cuthill_mckee.cc +++ b/tests/mpi/renumber_cuthill_mckee.cc @@ -74,7 +74,9 @@ test() std::copy(renumbering.begin(), renumbering.end(), complete_renumbering.begin()); - unsigned int offset = renumbering.size(); + unsigned int offset = renumbering.size(); + const std::vector dofs_per_proc = + dofh.locally_owned_dofs_per_processor(); for (unsigned int i = 1; i < nprocs; ++i) { if (myid == i) @@ -87,14 +89,14 @@ test() MPI_COMM_WORLD); else if (myid == 0) MPI_Recv(&complete_renumbering[offset], - dofh.locally_owned_dofs_per_processor()[i].n_elements(), + dofs_per_proc[i].n_elements(), Utilities::MPI::internal::mpi_type_id( &complete_renumbering[0]), i, i, MPI_COMM_WORLD, MPI_STATUSES_IGNORE); - offset += dofh.locally_owned_dofs_per_processor()[i].n_elements(); + offset += dofs_per_proc[i].n_elements(); } if (myid == 0) diff --git a/tests/mpi/renumber_cuthill_mckee_02.cc b/tests/mpi/renumber_cuthill_mckee_02.cc index 7b11b0ddf0..3763ffb7c1 100644 --- a/tests/mpi/renumber_cuthill_mckee_02.cc +++ b/tests/mpi/renumber_cuthill_mckee_02.cc @@ -77,7 +77,9 @@ test() std::copy(renumbering.begin(), renumbering.end(), complete_renumbering.begin()); - unsigned int offset = renumbering.size(); + unsigned int offset = renumbering.size(); + const std::vector locally_owned_dofs_per_processor = + dofh.locally_owned_dofs_per_processor(); for (unsigned int i = 1; i < nprocs; ++i) { if (myid == i) @@ -90,14 +92,14 @@ test() MPI_COMM_WORLD); else if (myid == 0) MPI_Recv(&complete_renumbering[offset], - dofh.locally_owned_dofs_per_processor()[i].n_elements(), + locally_owned_dofs_per_processor[i].n_elements(), Utilities::MPI::internal::mpi_type_id( &complete_renumbering[0]), i, i, MPI_COMM_WORLD, MPI_STATUSES_IGNORE); - offset += dofh.locally_owned_dofs_per_processor()[i].n_elements(); + offset += locally_owned_dofs_per_processor[i].n_elements(); } if (myid == 0) diff --git a/tests/mpi/step-40_cuthill_mckee_MPI-subset.cc b/tests/mpi/step-40_cuthill_mckee_MPI-subset.cc index 55791689c1..a45c9dd935 100644 --- a/tests/mpi/step-40_cuthill_mckee_MPI-subset.cc +++ b/tests/mpi/step-40_cuthill_mckee_MPI-subset.cc @@ -388,10 +388,13 @@ namespace Step40 pcout << " Number of degrees of freedom: " << dof_handler.n_dofs() << std::endl << " "; + const std::vector + n_locally_owned_dofs_per_processor = + dof_handler.n_locally_owned_dofs_per_processor(); for (unsigned int i = 0; i < Utilities::MPI::n_mpi_processes(mpi_communicator); ++i) - pcout << dof_handler.n_locally_owned_dofs_per_processor()[i] << '+'; + pcout << n_locally_owned_dofs_per_processor[i] << '+'; pcout << std::endl; assemble_system(); diff --git a/tests/sharedtria/dof_01.cc b/tests/sharedtria/dof_01.cc index 41adee92e0..23ffe7e3b6 100644 --- a/tests/sharedtria/dof_01.cc +++ b/tests/sharedtria/dof_01.cc @@ -114,9 +114,12 @@ test() // } // deallog << " sum: " << sum << std::endl; + const std::vector + n_locally_owned_dofs_per_processor = + dof_handler.n_locally_owned_dofs_per_processor(); Assert(dof_handler.n_locally_owned_dofs() == - dof_handler.n_locally_owned_dofs_per_processor() - [triangulation.locally_owned_subdomain()], + n_locally_owned_dofs_per_processor[triangulation + .locally_owned_subdomain()], ExcInternalError()); Assert(dof_handler.n_locally_owned_dofs() == dof_handler.locally_owned_dofs().n_elements(), @@ -125,21 +128,19 @@ test() const unsigned int N = dof_handler.n_dofs(); Assert(dof_handler.n_locally_owned_dofs() <= N, ExcInternalError()); - Assert(std::accumulate( - dof_handler.n_locally_owned_dofs_per_processor().begin(), - dof_handler.n_locally_owned_dofs_per_processor().end(), - 0U) == N, + Assert(std::accumulate(n_locally_owned_dofs_per_processor.begin(), + n_locally_owned_dofs_per_processor.end(), + 0U) == N, ExcInternalError()); + const std::vector locally_owned_dofs_per_processor = + dof_handler.locally_owned_dofs_per_processor(); IndexSet all(N); - for (unsigned int i = 0; - i < dof_handler.locally_owned_dofs_per_processor().size(); - ++i) + for (unsigned int i = 0; i < locally_owned_dofs_per_processor.size(); ++i) { - IndexSet intersect = - all & dof_handler.locally_owned_dofs_per_processor()[i]; + IndexSet intersect = all & locally_owned_dofs_per_processor[i]; Assert(intersect.n_elements() == 0, ExcInternalError()); - all.add_indices(dof_handler.locally_owned_dofs_per_processor()[i]); + all.add_indices(locally_owned_dofs_per_processor[i]); } Assert(all == complete_index_set(N), ExcInternalError()); diff --git a/tests/sharedtria/dof_02.cc b/tests/sharedtria/dof_02.cc index 8b04dbbdff..44841b3736 100644 --- a/tests/sharedtria/dof_02.cc +++ b/tests/sharedtria/dof_02.cc @@ -114,9 +114,12 @@ test() // } // deallog << " sum: " << sum << std::endl; + const std::vector + n_locally_owned_dofs_per_processor = + dof_handler.n_locally_owned_dofs_per_processor(); Assert(dof_handler.n_locally_owned_dofs() == - dof_handler.n_locally_owned_dofs_per_processor() - [triangulation.locally_owned_subdomain()], + n_locally_owned_dofs_per_processor[triangulation + .locally_owned_subdomain()], ExcInternalError()); Assert(dof_handler.n_locally_owned_dofs() == dof_handler.locally_owned_dofs().n_elements(), @@ -125,21 +128,19 @@ test() const unsigned int N = dof_handler.n_dofs(); Assert(dof_handler.n_locally_owned_dofs() <= N, ExcInternalError()); - Assert(std::accumulate( - dof_handler.n_locally_owned_dofs_per_processor().begin(), - dof_handler.n_locally_owned_dofs_per_processor().end(), - 0U) == N, + Assert(std::accumulate(n_locally_owned_dofs_per_processor.begin(), + n_locally_owned_dofs_per_processor.end(), + 0U) == N, ExcInternalError()); + const std::vector locally_owned_dofs_per_processor = + dof_handler.locally_owned_dofs_per_processor(); IndexSet all(N); - for (unsigned int i = 0; - i < dof_handler.locally_owned_dofs_per_processor().size(); - ++i) + for (unsigned int i = 0; i < locally_owned_dofs_per_processor.size(); ++i) { - IndexSet intersect = - all & dof_handler.locally_owned_dofs_per_processor()[i]; + IndexSet intersect = all & locally_owned_dofs_per_processor[i]; Assert(intersect.n_elements() == 0, ExcInternalError()); - all.add_indices(dof_handler.locally_owned_dofs_per_processor()[i]); + all.add_indices(locally_owned_dofs_per_processor[i]); } Assert(all == complete_index_set(N), ExcInternalError()); } diff --git a/tests/sharedtria/dof_03.cc b/tests/sharedtria/dof_03.cc index edd75940c0..775366e5d4 100644 --- a/tests/sharedtria/dof_03.cc +++ b/tests/sharedtria/dof_03.cc @@ -112,9 +112,12 @@ test() // } // deallog << " sum: " << sum << std::endl; + const std::vector + n_locally_owned_dofs_per_processor = + dof_handler.n_locally_owned_dofs_per_processor(); Assert(dof_handler.n_locally_owned_dofs() == - dof_handler.n_locally_owned_dofs_per_processor() - [triangulation.locally_owned_subdomain()], + n_locally_owned_dofs_per_processor[triangulation + .locally_owned_subdomain()], ExcInternalError()); Assert(dof_handler.n_locally_owned_dofs() == dof_handler.locally_owned_dofs().n_elements(), @@ -123,21 +126,19 @@ test() const unsigned int N = dof_handler.n_dofs(); Assert(dof_handler.n_locally_owned_dofs() <= N, ExcInternalError()); - Assert(std::accumulate( - dof_handler.n_locally_owned_dofs_per_processor().begin(), - dof_handler.n_locally_owned_dofs_per_processor().end(), - 0U) == N, + Assert(std::accumulate(n_locally_owned_dofs_per_processor.begin(), + n_locally_owned_dofs_per_processor.end(), + 0U) == N, ExcInternalError()); + const std::vector locally_owned_dofs_per_processor = + dof_handler.locally_owned_dofs_per_processor(); IndexSet all(N); - for (unsigned int i = 0; - i < dof_handler.locally_owned_dofs_per_processor().size(); - ++i) + for (unsigned int i = 0; i < locally_owned_dofs_per_processor.size(); ++i) { - IndexSet intersect = - all & dof_handler.locally_owned_dofs_per_processor()[i]; + IndexSet intersect = all & locally_owned_dofs_per_processor[i]; Assert(intersect.n_elements() == 0, ExcInternalError()); - all.add_indices(dof_handler.locally_owned_dofs_per_processor()[i]); + all.add_indices(locally_owned_dofs_per_processor[i]); } Assert(all == complete_index_set(N), ExcInternalError()); diff --git a/tests/sharedtria/dof_04.cc b/tests/sharedtria/dof_04.cc index 3c5d670525..fb5386ea77 100644 --- a/tests/sharedtria/dof_04.cc +++ b/tests/sharedtria/dof_04.cc @@ -114,9 +114,12 @@ test() // } // deallog << " sum: " << sum << std::endl; + const std::vector + n_locally_owned_dofs_per_processor = + dof_handler.n_locally_owned_dofs_per_processor(); Assert(dof_handler.n_locally_owned_dofs() == - dof_handler.n_locally_owned_dofs_per_processor() - [triangulation.locally_owned_subdomain()], + n_locally_owned_dofs_per_processor[triangulation + .locally_owned_subdomain()], ExcInternalError()); Assert(dof_handler.n_locally_owned_dofs() == dof_handler.locally_owned_dofs().n_elements(), @@ -125,21 +128,19 @@ test() const unsigned int N = dof_handler.n_dofs(); Assert(dof_handler.n_locally_owned_dofs() <= N, ExcInternalError()); - Assert(std::accumulate( - dof_handler.n_locally_owned_dofs_per_processor().begin(), - dof_handler.n_locally_owned_dofs_per_processor().end(), - 0U) == N, + Assert(std::accumulate(n_locally_owned_dofs_per_processor.begin(), + n_locally_owned_dofs_per_processor.end(), + 0U) == N, ExcInternalError()); + const std::vector locally_owned_dofs_per_processor = + dof_handler.locally_owned_dofs_per_processor(); IndexSet all(N); - for (unsigned int i = 0; - i < dof_handler.locally_owned_dofs_per_processor().size(); - ++i) + for (unsigned int i = 0; i < locally_owned_dofs_per_processor.size(); ++i) { - IndexSet intersect = - all & dof_handler.locally_owned_dofs_per_processor()[i]; + IndexSet intersect = all & locally_owned_dofs_per_processor[i]; Assert(intersect.n_elements() == 0, ExcInternalError()); - all.add_indices(dof_handler.locally_owned_dofs_per_processor()[i]); + all.add_indices(locally_owned_dofs_per_processor[i]); } Assert(all == complete_index_set(N), ExcInternalError()); diff --git a/tests/sharedtria/hp_dof_01.cc b/tests/sharedtria/hp_dof_01.cc index 6b3ea4ffbf..1c255bad18 100644 --- a/tests/sharedtria/hp_dof_01.cc +++ b/tests/sharedtria/hp_dof_01.cc @@ -119,9 +119,12 @@ test() // } // deallog << " sum: " << sum << std::endl; + const std::vector + n_locally_owned_dofs_per_processor = + dof_handler.n_locally_owned_dofs_per_processor(); Assert(dof_handler.n_locally_owned_dofs() == - dof_handler.n_locally_owned_dofs_per_processor() - [triangulation.locally_owned_subdomain()], + n_locally_owned_dofs_per_processor[triangulation + .locally_owned_subdomain()], ExcInternalError()); Assert(dof_handler.n_locally_owned_dofs() == dof_handler.locally_owned_dofs().n_elements(), @@ -130,21 +133,19 @@ test() const unsigned int N = dof_handler.n_dofs(); Assert(dof_handler.n_locally_owned_dofs() <= N, ExcInternalError()); - Assert(std::accumulate( - dof_handler.n_locally_owned_dofs_per_processor().begin(), - dof_handler.n_locally_owned_dofs_per_processor().end(), - 0U) == N, + Assert(std::accumulate(n_locally_owned_dofs_per_processor.begin(), + n_locally_owned_dofs_per_processor.end(), + 0U) == N, ExcInternalError()); + const std::vector locally_owned_dofs_per_processor = + dof_handler.locally_owned_dofs_per_processor(); IndexSet all(N); - for (unsigned int i = 0; - i < dof_handler.locally_owned_dofs_per_processor().size(); - ++i) + for (unsigned int i = 0; i < locally_owned_dofs_per_processor.size(); ++i) { - IndexSet intersect = - all & dof_handler.locally_owned_dofs_per_processor()[i]; + IndexSet intersect = all & locally_owned_dofs_per_processor[i]; Assert(intersect.n_elements() == 0, ExcInternalError()); - all.add_indices(dof_handler.locally_owned_dofs_per_processor()[i]); + all.add_indices(locally_owned_dofs_per_processor[i]); } Assert(all == complete_index_set(N), ExcInternalError()); diff --git a/tests/sharedtria/hp_dof_02.cc b/tests/sharedtria/hp_dof_02.cc index 6cd2b15c60..4a61490820 100644 --- a/tests/sharedtria/hp_dof_02.cc +++ b/tests/sharedtria/hp_dof_02.cc @@ -120,9 +120,12 @@ test() // } // deallog << " sum: " << sum << std::endl; + const std::vector + n_locally_owned_dofs_per_processor = + dof_handler.n_locally_owned_dofs_per_processor(); Assert(dof_handler.n_locally_owned_dofs() == - dof_handler.n_locally_owned_dofs_per_processor() - [triangulation.locally_owned_subdomain()], + n_locally_owned_dofs_per_processor[triangulation + .locally_owned_subdomain()], ExcInternalError()); Assert(dof_handler.n_locally_owned_dofs() == dof_handler.locally_owned_dofs().n_elements(), @@ -131,21 +134,19 @@ test() const unsigned int N = dof_handler.n_dofs(); Assert(dof_handler.n_locally_owned_dofs() <= N, ExcInternalError()); - Assert(std::accumulate( - dof_handler.n_locally_owned_dofs_per_processor().begin(), - dof_handler.n_locally_owned_dofs_per_processor().end(), - 0U) == N, + Assert(std::accumulate(n_locally_owned_dofs_per_processor.begin(), + n_locally_owned_dofs_per_processor.end(), + 0U) == N, ExcInternalError()); + const std::vector locally_owned_dofs_per_processor = + dof_handler.locally_owned_dofs_per_processor(); IndexSet all(N); - for (unsigned int i = 0; - i < dof_handler.locally_owned_dofs_per_processor().size(); - ++i) + for (unsigned int i = 0; i < locally_owned_dofs_per_processor.size(); ++i) { - IndexSet intersect = - all & dof_handler.locally_owned_dofs_per_processor()[i]; + IndexSet intersect = all & locally_owned_dofs_per_processor[i]; Assert(intersect.n_elements() == 0, ExcInternalError()); - all.add_indices(dof_handler.locally_owned_dofs_per_processor()[i]); + all.add_indices(locally_owned_dofs_per_processor[i]); } Assert(all == complete_index_set(N), ExcInternalError()); } diff --git a/tests/sharedtria/hp_dof_03.cc b/tests/sharedtria/hp_dof_03.cc index dc6382e075..87bf7379b8 100644 --- a/tests/sharedtria/hp_dof_03.cc +++ b/tests/sharedtria/hp_dof_03.cc @@ -117,9 +117,12 @@ test() // } // deallog << " sum: " << sum << std::endl; + const std::vector + n_locally_owned_dofs_per_processor = + dof_handler.n_locally_owned_dofs_per_processor(); Assert(dof_handler.n_locally_owned_dofs() == - dof_handler.n_locally_owned_dofs_per_processor() - [triangulation.locally_owned_subdomain()], + n_locally_owned_dofs_per_processor[triangulation + .locally_owned_subdomain()], ExcInternalError()); Assert(dof_handler.n_locally_owned_dofs() == dof_handler.locally_owned_dofs().n_elements(), @@ -128,21 +131,19 @@ test() const unsigned int N = dof_handler.n_dofs(); Assert(dof_handler.n_locally_owned_dofs() <= N, ExcInternalError()); - Assert(std::accumulate( - dof_handler.n_locally_owned_dofs_per_processor().begin(), - dof_handler.n_locally_owned_dofs_per_processor().end(), - 0U) == N, + Assert(std::accumulate(n_locally_owned_dofs_per_processor.begin(), + n_locally_owned_dofs_per_processor.end(), + 0U) == N, ExcInternalError()); + const std::vector locally_owned_dofs_per_processor = + dof_handler.locally_owned_dofs_per_processor(); IndexSet all(N); - for (unsigned int i = 0; - i < dof_handler.locally_owned_dofs_per_processor().size(); - ++i) + for (unsigned int i = 0; i < locally_owned_dofs_per_processor.size(); ++i) { - IndexSet intersect = - all & dof_handler.locally_owned_dofs_per_processor()[i]; + IndexSet intersect = all & locally_owned_dofs_per_processor[i]; Assert(intersect.n_elements() == 0, ExcInternalError()); - all.add_indices(dof_handler.locally_owned_dofs_per_processor()[i]); + all.add_indices(locally_owned_dofs_per_processor[i]); } Assert(all == complete_index_set(N), ExcInternalError()); diff --git a/tests/sharedtria/hp_dof_04.cc b/tests/sharedtria/hp_dof_04.cc index 5886615132..e37e13d7ef 100644 --- a/tests/sharedtria/hp_dof_04.cc +++ b/tests/sharedtria/hp_dof_04.cc @@ -120,9 +120,12 @@ test() // } // deallog << " sum: " << sum << std::endl; + const std::vector + n_locally_owned_dofs_per_processor = + dof_handler.n_locally_owned_dofs_per_processor(); Assert(dof_handler.n_locally_owned_dofs() == - dof_handler.n_locally_owned_dofs_per_processor() - [triangulation.locally_owned_subdomain()], + n_locally_owned_dofs_per_processor[triangulation + .locally_owned_subdomain()], ExcInternalError()); Assert(dof_handler.n_locally_owned_dofs() == dof_handler.locally_owned_dofs().n_elements(), @@ -131,21 +134,19 @@ test() const unsigned int N = dof_handler.n_dofs(); Assert(dof_handler.n_locally_owned_dofs() <= N, ExcInternalError()); - Assert(std::accumulate( - dof_handler.n_locally_owned_dofs_per_processor().begin(), - dof_handler.n_locally_owned_dofs_per_processor().end(), - 0U) == N, + Assert(std::accumulate(n_locally_owned_dofs_per_processor.begin(), + n_locally_owned_dofs_per_processor.end(), + 0U) == N, ExcInternalError()); + const std::vector locally_owned_dofs_per_processor = + dof_handler.locally_owned_dofs_per_processor(); IndexSet all(N); - for (unsigned int i = 0; - i < dof_handler.locally_owned_dofs_per_processor().size(); - ++i) + for (unsigned int i = 0; i < locally_owned_dofs_per_processor.size(); ++i) { - IndexSet intersect = - all & dof_handler.locally_owned_dofs_per_processor()[i]; + IndexSet intersect = all & locally_owned_dofs_per_processor[i]; Assert(intersect.n_elements() == 0, ExcInternalError()); - all.add_indices(dof_handler.locally_owned_dofs_per_processor()[i]); + all.add_indices(locally_owned_dofs_per_processor[i]); } Assert(all == complete_index_set(N), ExcInternalError()); diff --git a/tests/sharedtria/hp_no_cells_01.cc b/tests/sharedtria/hp_no_cells_01.cc index 2126467579..5eee549c6d 100644 --- a/tests/sharedtria/hp_no_cells_01.cc +++ b/tests/sharedtria/hp_no_cells_01.cc @@ -93,8 +93,7 @@ test() deallog << std::endl; Assert(dof_handler.n_locally_owned_dofs() == - dof_handler.n_locally_owned_dofs_per_processor() - [triangulation.locally_owned_subdomain()], + v[triangulation.locally_owned_subdomain()], ExcInternalError()); Assert(dof_handler.n_locally_owned_dofs() == dof_handler.locally_owned_dofs().n_elements(), @@ -103,21 +102,16 @@ test() const unsigned int N = dof_handler.n_dofs(); Assert(dof_handler.n_locally_owned_dofs() <= N, ExcInternalError()); - Assert( - std::accumulate(dof_handler.n_locally_owned_dofs_per_processor().begin(), - dof_handler.n_locally_owned_dofs_per_processor().end(), - 0U) == N, - ExcInternalError()); + Assert(std::accumulate(v.begin(), v.end(), 0U) == N, ExcInternalError()); + std::vector locally_owned_dofs_per_processor = + dof_handler.locally_owned_dofs_per_processor(); IndexSet all(N); - for (unsigned int i = 0; - i < dof_handler.locally_owned_dofs_per_processor().size(); - ++i) + for (unsigned int i = 0; i < locally_owned_dofs_per_processor.size(); ++i) { - IndexSet intersect = - all & dof_handler.locally_owned_dofs_per_processor()[i]; + IndexSet intersect = all & locally_owned_dofs_per_processor[i]; Assert(intersect.n_elements() == 0, ExcInternalError()); - all.add_indices(dof_handler.locally_owned_dofs_per_processor()[i]); + all.add_indices(locally_owned_dofs_per_processor[i]); } Assert(all == complete_index_set(N), ExcInternalError()); -- 2.39.5