]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Shorten another matrix-free test 15520/head
authorMartin Kronbichler <martin.kronbichler@uni-a.de>
Thu, 29 Jun 2023 18:23:21 +0000 (20:23 +0200)
committerMartin Kronbichler <martin.kronbichler@uni-a.de>
Fri, 30 Jun 2023 05:57:36 +0000 (07:57 +0200)
tests/matrix_free/matrix_vector_hp_parallel_01.cc

index 1221396a3b7b214226e07597206425b8888c2b7a..49760e44fe2de8cfa5f91b66db72efa588dfcfb4 100644 (file)
@@ -64,36 +64,7 @@ public:
               const LinearAlgebra::distributed::Vector<Number> &src,
               const std::pair<unsigned int, unsigned int> &cell_range) const
   {
-    // ask MatrixFree for cell_range for different orders
-    std::pair<unsigned int, unsigned int> subrange_deg =
-      data.create_cell_subrange_hp(cell_range, 1);
-    if (subrange_deg.second > subrange_deg.first)
-      helmholtz_operator<dim, 1, LinearAlgebra::distributed::Vector<Number>, 2>(
-        data, dst, src, subrange_deg);
-    subrange_deg = data.create_cell_subrange_hp(cell_range, 2);
-    if (subrange_deg.second > subrange_deg.first)
-      helmholtz_operator<dim, 2, LinearAlgebra::distributed::Vector<Number>, 3>(
-        data, dst, src, subrange_deg);
-    subrange_deg = data.create_cell_subrange_hp(cell_range, 3);
-    if (subrange_deg.second > subrange_deg.first)
-      helmholtz_operator<dim, 3, LinearAlgebra::distributed::Vector<Number>, 4>(
-        data, dst, src, subrange_deg);
-    subrange_deg = data.create_cell_subrange_hp(cell_range, 4);
-    if (subrange_deg.second > subrange_deg.first)
-      helmholtz_operator<dim, 4, LinearAlgebra::distributed::Vector<Number>, 5>(
-        data, dst, src, subrange_deg);
-    subrange_deg = data.create_cell_subrange_hp(cell_range, 5);
-    if (subrange_deg.second > subrange_deg.first)
-      helmholtz_operator<dim, 5, LinearAlgebra::distributed::Vector<Number>, 6>(
-        data, dst, src, subrange_deg);
-    subrange_deg = data.create_cell_subrange_hp(cell_range, 6);
-    if (subrange_deg.second > subrange_deg.first)
-      helmholtz_operator<dim, 6, LinearAlgebra::distributed::Vector<Number>, 7>(
-        data, dst, src, subrange_deg);
-    subrange_deg = data.create_cell_subrange_hp(cell_range, 7);
-    if (subrange_deg.second > subrange_deg.first)
-      helmholtz_operator<dim, 7, LinearAlgebra::distributed::Vector<Number>, 8>(
-        data, dst, src, subrange_deg);
+    helmholtz_operator_no_template<dim>(data, dst, src, cell_range);
   }
 
   void
@@ -121,9 +92,7 @@ test()
   const SphericalManifold<dim>              manifold;
   parallel::distributed::Triangulation<dim> tria(MPI_COMM_WORLD);
   GridGenerator::hyper_ball(tria);
-  typename Triangulation<dim>::active_cell_iterator cell = tria.begin_active(),
-                                                    endc = tria.end();
-  for (; cell != endc; ++cell)
+  for (const auto &cell : tria.active_cell_iterators())
     for (const unsigned int f : GeometryInfo<dim>::face_indices())
       if (cell->at_boundary(f))
         cell->face(f)->set_all_manifold_ids(0);
@@ -133,12 +102,9 @@ test()
   // refine a few cells
   for (unsigned int i = 0; i < 11 - 3 * dim; ++i)
     {
-      typename Triangulation<dim>::active_cell_iterator cell =
-                                                          tria.begin_active(),
-                                                        endc = tria.end();
-      unsigned int counter                                   = 0;
-      for (; cell != endc; ++cell, ++counter)
-        if (cell->is_locally_owned() && (counter % (7 - i) == 0))
+      unsigned int counter = 0;
+      for (const auto &cell : tria.active_cell_iterators())
+        if (cell->is_locally_owned() && ((counter++) % (7 - i) == 0))
           cell->set_refine_flag();
       tria.execute_coarsening_and_refinement();
     }
@@ -159,9 +125,7 @@ test()
   DoFHandler<dim> dof(tria);
   // set the active FE index in a random order
   {
-    typename DoFHandler<dim>::active_cell_iterator cell = dof.begin_active(),
-                                                   endc = dof.end();
-    for (; cell != endc; ++cell)
+    for (const auto &cell : dof.active_cell_iterators())
       {
         if (cell->is_locally_owned() == false)
           continue;
@@ -212,9 +176,7 @@ test()
     FullMatrix<double>                   cell_matrix;
     std::vector<types::global_dof_index> local_dof_indices;
 
-    typename DoFHandler<dim>::active_cell_iterator cell = dof.begin_active(),
-                                                   endc = dof.end();
-    for (; cell != endc; ++cell)
+    for (const auto &cell : dof.active_cell_iterators())
       {
         if (cell->is_locally_owned() == false)
           continue;

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.