]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Update tests with respect to locally_owned_dofs_per_processor
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Fri, 31 May 2019 21:07:15 +0000 (23:07 +0200)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Fri, 7 Jun 2019 09:42:34 +0000 (11:42 +0200)
24 files changed:
tests/matrix_free/dg_pbc_01.cc
tests/mpi/dof_handler_number_cache.cc
tests/mpi/mg_02.cc
tests/mpi/p4est_2d_dofhandler_01.cc
tests/mpi/p4est_2d_dofhandler_02.cc
tests/mpi/p4est_2d_dofhandler_03.cc
tests/mpi/p4est_2d_dofhandler_04.cc
tests/mpi/p4est_2d_renumber_02.cc
tests/mpi/p4est_data_out_01.cc
tests/mpi/p4est_get_subdomain_association.cc
tests/mpi/periodicity_04.cc
tests/mpi/periodicity_07.cc
tests/mpi/renumber_cuthill_mckee.cc
tests/mpi/renumber_cuthill_mckee_02.cc
tests/mpi/step-40_cuthill_mckee_MPI-subset.cc
tests/sharedtria/dof_01.cc
tests/sharedtria/dof_02.cc
tests/sharedtria/dof_03.cc
tests/sharedtria/dof_04.cc
tests/sharedtria/hp_dof_01.cc
tests/sharedtria/hp_dof_02.cc
tests/sharedtria/hp_dof_03.cc
tests/sharedtria/hp_dof_04.cc
tests/sharedtria/hp_no_cells_01.cc

index 699d1798ae45ebb012440e13076e5e8d9d9362f5..e8d5a5c865d9406189b8cfeef32486dfcb4a58be 100644 (file)
@@ -95,6 +95,9 @@ test()
   SolverControl control(1000, 1e-12 * std::sqrt(rhs.size()));
   SolverCG<LinearAlgebra::distributed::Vector<double>> solver(control);
   solver.solve(mf, sol, rhs, PreconditionIdentity());
+
+  const std::vector<IndexSet> 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());
     }
index 26fed229748232b09e195847dbbf7d48cb8e082a..59a8feb496aa70923036c88f7d6b8bc2eb3154a3 100644 (file)
@@ -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<types::global_dof_index>
+        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<IndexSet> 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);
index b6828134295337f8d624ac46fb2c3d7d0b17a1b7..690aa78effa691445dbbe567ff9abd572947128b 100644 (file)
@@ -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<types::global_dof_index>
+      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<IndexSet> &vec =
+        const std::vector<IndexSet> vec =
           dofh.locally_owned_mg_dofs_per_processor(lvl);
 
         for (unsigned int i = 0; i < vec.size(); ++i)
index 2d13e6cafda9eed657e2def86cc06eb65c767d47..d7eeb1cf43d1b241264751cdf1992ac798571212 100644 (file)
@@ -55,9 +55,12 @@ test()
   static const FE_Q<dim> fe(2);
   dofh.distribute_dofs(fe);
 
+  const std::vector<types::global_dof_index>
+    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;
index 008058d62e4293ec62be547aa614ddb64aa254ad..04d80677e7d91709f57a9ac8a8df317fa814408e 100644 (file)
@@ -89,10 +89,12 @@ test()
       static const FE_Q<dim> fe(2);
       dofh.distribute_dofs(fe);
 
+      std::vector<types::global_dof_index> 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;
         }
index b9ffb6b3209265f94b8080a31bce80cfb3e29562..f4c89a6a0f9d97219b365f9ae82f6a9f474729e5 100644 (file)
@@ -90,10 +90,12 @@ test()
       static const FE_Q<dim> fe(2);
       dofh.distribute_dofs(fe);
 
+      std::vector<types::global_dof_index> 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;
         }
index f883a67c5e31dda8683f8e99a51403ac7f12ba30..bdb913dc637282ff5ef0051adb215d43225ab7df 100644 (file)
@@ -90,10 +90,12 @@ test()
       static const FE_Q<dim> fe(2);
       dofh.distribute_dofs(fe);
 
+      std::vector<types::global_dof_index> 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;
         }
index 7c45a562731498499a554ebf0e4106f318659d57..7202db7f8ab7a8cd1eaad2a5ba058cf0068585c5 100644 (file)
@@ -80,6 +80,8 @@ test()
     IndexSet dof_set;
     DoFTools::extract_locally_active_dofs(dofh, dof_set);
 
+    const std::vector<IndexSet> 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;
           }
       }
index d3d529fae696edc944cc4426ccef3db435fb31c5..2261db64d0b92befb52426f81188ec6f403d641c 100644 (file)
@@ -74,12 +74,13 @@ test()
   data_out.add_data_vector(x, "x");
   data_out.build_patches();
 
+  std::vector<types::global_dof_index> 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());
     }
 }
index b229282ffe6fc4780bc252603775832fc7ffda60..59c4592f000b74ebeb6d272e0496ae7a2d7682cb 100644 (file)
@@ -59,9 +59,12 @@ test()
   static const FE_Q<dim> fe(2);
   dofh.distribute_dofs(fe);
 
+  const std::vector<types::global_dof_index>
+    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;
index cc5aea0f8fa4e193b9786752a91b8e11550ad1a8..bf5530f6946122f4c8f7b17026e6280cde8c89c3 100644 (file)
@@ -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<IndexSet> &locally_owned_dofs_vector =
+  const std::vector<IndexSet> 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);
index 726faf990771128d5f7ff8ad913597da3897da84..59ec485f07881a2f876804b4fe5932902caa79c8 100644 (file)
@@ -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<IndexSet> &locally_owned_dofs =
+  const std::vector<IndexSet> locally_owned_dofs =
     dof_handler.locally_owned_dofs_per_processor();
 
   std::map<types::global_dof_index, Point<dim>> supportPoints;
index 98eb00c366b38cd5aad74c3cf576ee2ff21f10c1..2abff36a13551ccc2501f063c9e755f4b1a7e033 100644 (file)
@@ -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<IndexSet> 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)
index 7b11b0ddf01541a0c0b1a033776d9006eb26baae..3763ffb7c178c91ddf3884b8c94c4d0238b2503c 100644 (file)
@@ -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<IndexSet> 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)
index 55791689c10b4afd820011fbc588817e70f14ac5..a45c9dd935782c75ffb174389fc602f8162abd37 100644 (file)
@@ -388,10 +388,13 @@ namespace Step40
         pcout << "   Number of degrees of freedom: " << dof_handler.n_dofs()
               << std::endl
               << "      ";
+        const std::vector<types::global_dof_index>
+          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();
index 41adee92e05245f3e1cf575e6deae39208888d06..23ffe7e3b611bc42874d57658af5f480a03acc17 100644 (file)
@@ -114,9 +114,12 @@ test()
       //        }
       //      deallog << " sum: " << sum << std::endl;
 
+      const std::vector<types::global_dof_index>
+        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<IndexSet> 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());
index 8b04dbbdff7ccfef34088f6b9668b73fbd8cd365..44841b373689882a4ab3edfa780db2b8730bbc5f 100644 (file)
@@ -114,9 +114,12 @@ test()
       //        }
       //      deallog << " sum: " << sum << std::endl;
 
+      const std::vector<types::global_dof_index>
+        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<IndexSet> 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());
     }
index edd75940c0d993808fdc052b8f3352132b0df585..775366e5d48790385b448b5428d7a317f153fda6 100644 (file)
@@ -112,9 +112,12 @@ test()
       //        }
       //      deallog << " sum: " << sum << std::endl;
 
+      const std::vector<types::global_dof_index>
+        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<IndexSet> 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());
index 3c5d67052586cf24ac9a844cd2a710035f426489..fb5386ea777020da1d416b531bc5b23f5294d7b8 100644 (file)
@@ -114,9 +114,12 @@ test()
       //        }
       //      deallog << " sum: " << sum << std::endl;
 
+      const std::vector<types::global_dof_index>
+        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<IndexSet> 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());
index 6b3ea4ffbf7ae3d42823d9293b2d86a0b8dfba3a..1c255bad18edc43367e0576b2120003d78f75a1c 100644 (file)
@@ -119,9 +119,12 @@ test()
       //        }
       //      deallog << " sum: " << sum << std::endl;
 
+      const std::vector<types::global_dof_index>
+        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<IndexSet> 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());
index 6cd2b15c608e3b277b496c46b830924d0496db9e..4a614908202e9f8884fac00cfe8e3a1030f5c0a5 100644 (file)
@@ -120,9 +120,12 @@ test()
       //        }
       //      deallog << " sum: " << sum << std::endl;
 
+      const std::vector<types::global_dof_index>
+        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<IndexSet> 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());
     }
index dc6382e075b7f220478c8549d75246431d3d7e57..87bf7379b831d4c018c310726a2edd2a93670927 100644 (file)
@@ -117,9 +117,12 @@ test()
       //        }
       //      deallog << " sum: " << sum << std::endl;
 
+      const std::vector<types::global_dof_index>
+        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<IndexSet> 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());
index 5886615132c04e96cef604bb56174b290a339b09..e37e13d7eff1c700d1e3149df3122fef1b3dc278 100644 (file)
@@ -120,9 +120,12 @@ test()
       //        }
       //      deallog << " sum: " << sum << std::endl;
 
+      const std::vector<types::global_dof_index>
+        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<IndexSet> 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());
index 21264675799a0204f1d4c7e6f26ef68992327085..5eee549c6d6756615e74cb8d3cb0179967a7c156 100644 (file)
@@ -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<IndexSet> 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());

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.