]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use simpler initialization of partitioner 17851/head
authorMartin Kronbichler <martin.kronbichler@rub.de>
Fri, 8 Nov 2024 11:51:24 +0000 (12:51 +0100)
committerMartin Kronbichler <martin.kronbichler@rub.de>
Fri, 8 Nov 2024 12:56:33 +0000 (13:56 +0100)
examples/step-59/step-59.cc

index adb743c2c3ef6f5b73592e4c4c5ec15e23d19075..3132433e92aa6c08a0e635c99c4f5def925d31dd 100644 (file)
@@ -178,6 +178,9 @@ namespace Step59
 
     std::shared_ptr<const MatrixFree<dim, number>> get_matrix_free() const;
 
+    std::shared_ptr<const Utilities::MPI::Partitioner>
+    get_vector_partitioner() const;
+
     void vmult(LinearAlgebra::distributed::Vector<number>       &dst,
                const LinearAlgebra::distributed::Vector<number> &src) const;
 
@@ -282,6 +285,15 @@ namespace Step59
 
 
 
+  template <int dim, int fe_degree, typename number>
+  std::shared_ptr<const Utilities::MPI::Partitioner>
+  LaplaceOperator<dim, fe_degree, number>::get_vector_partitioner() const
+  {
+    return data->get_dof_info().vector_partitioner;
+  }
+
+
+
   template <int dim, int fe_degree, typename number>
   void LaplaceOperator<dim, fe_degree, number>::initialize_dof_vector(
     LinearAlgebra::distributed::Vector<number> &vec) const
@@ -1165,11 +1177,8 @@ namespace Step59
     std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>>
       partitioners(dof_handler.get_triangulation().n_global_levels());
     for (unsigned int level = 0; level < partitioners.size(); ++level)
-      {
-        LinearAlgebra::distributed::Vector<float> vec;
-        mg_matrices[level].initialize_dof_vector(vec);
-        partitioners[level] = vec.get_partitioner();
-      }
+      partitioners[level] = mg_matrices[level].get_vector_partitioner();
+
     mg_transfer.build(dof_handler, partitioners);
     setup_time += time.wall_time();
     time_details << "MG build transfer time        " << time.wall_time()

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.