]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Replace MGTransferMG usages in tests/matrix_free 15784/head
authorPeter Munch <peterrmuench@gmail.com>
Sun, 23 Jul 2023 08:22:24 +0000 (10:22 +0200)
committerPeter Munch <peterrmuench@gmail.com>
Sun, 23 Jul 2023 08:26:39 +0000 (10:26 +0200)
15 files changed:
tests/matrix_free/multigrid_dg_periodic.cc
tests/matrix_free/multigrid_dg_sip_01.cc
tests/matrix_free/multigrid_dg_sip_02.cc
tests/matrix_free/parallel_multigrid.cc
tests/matrix_free/parallel_multigrid_adaptive_01.cc
tests/matrix_free/parallel_multigrid_adaptive_02.cc
tests/matrix_free/parallel_multigrid_adaptive_03.cc
tests/matrix_free/parallel_multigrid_adaptive_04.cc
tests/matrix_free/parallel_multigrid_adaptive_05.cc
tests/matrix_free/parallel_multigrid_adaptive_06ref.cc
tests/matrix_free/parallel_multigrid_fullydistributed.cc
tests/matrix_free/parallel_multigrid_interleave.cc
tests/matrix_free/parallel_multigrid_interleave_renumber.cc
tests/matrix_free/parallel_multigrid_mf.cc
tests/performance/timing_step_37.cc

index 2d3e3c2e3939628c3b073bc1db7132eb2429b804..028ca25bd6e972aa3651aced0c03d0cd3de2cd70 100644 (file)
@@ -46,7 +46,7 @@
 #include <deal.II/multigrid/mg_matrix.h>
 #include <deal.II/multigrid/mg_smoother.h>
 #include <deal.II/multigrid/mg_tools.h>
-#include <deal.II/multigrid/mg_transfer.h>
+#include <deal.II/multigrid/mg_transfer_matrix_free.h>
 #include <deal.II/multigrid/multigrid.h>
 
 #include <deal.II/numerics/vector_tools.h>
@@ -165,6 +165,12 @@ public:
     return inverse_diagonal_entries;
   }
 
+  const std::shared_ptr<const Utilities::MPI::Partitioner> &
+  get_vector_partitioner() const
+  {
+    return data.get_vector_partitioner();
+  }
+
 
 private:
   void
@@ -493,38 +499,6 @@ public:
 
 
 
-template <typename LAPLACEOPERATOR>
-class MGTransferMF
-  : public MGTransferPrebuilt<
-      LinearAlgebra::distributed::Vector<typename LAPLACEOPERATOR::value_type>>
-{
-public:
-  MGTransferMF(const MGLevelObject<LAPLACEOPERATOR> &laplace)
-    : laplace_operator(laplace){};
-
-  /**
-   * Overload copy_to_mg from MGTransferPrebuilt
-   */
-  template <int dim, class InVector, int spacedim>
-  void
-  copy_to_mg(const DoFHandler<dim, spacedim> &         mg_dof,
-             MGLevelObject<LinearAlgebra::distributed::Vector<
-               typename LAPLACEOPERATOR::value_type>> &dst,
-             const InVector &                          src) const
-  {
-    for (unsigned int level = dst.min_level(); level <= dst.max_level();
-         ++level)
-      laplace_operator[level].initialize_dof_vector(dst[level]);
-    MGTransferPrebuilt<LinearAlgebra::distributed::Vector<
-      typename LAPLACEOPERATOR::value_type>>::copy_to_mg(mg_dof, dst, src);
-  }
-
-private:
-  const MGLevelObject<LAPLACEOPERATOR> &laplace_operator;
-};
-
-
-
 template <int dim, typename number>
 void
 do_test(const DoFHandler<dim> &dof, const unsigned int n_q_points_1d)
@@ -581,8 +555,14 @@ do_test(const DoFHandler<dim> &dof, const unsigned int n_q_points_1d)
     }
   mg_smoother.initialize(mg_matrices, smoother_data);
 
-  MGTransferMF<LevelMatrixType> mg_transfer(mg_matrices);
-  mg_transfer.build(dof);
+  std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>> partitioners;
+  for (unsigned int level = mg_matrices.min_level();
+       level <= mg_matrices.max_level();
+       ++level)
+    partitioners.push_back(mg_matrices[level].get_vector_partitioner());
+
+  MGTransferMatrixFree<dim, double> mg_transfer;
+  mg_transfer.build(dof, partitioners);
 
   mg::Matrix<LinearAlgebra::distributed::Vector<double>> mg_matrix(mg_matrices);
 
@@ -590,7 +570,7 @@ do_test(const DoFHandler<dim> &dof, const unsigned int n_q_points_1d)
     mg_matrix, mg_coarse, mg_transfer, mg_smoother, mg_smoother);
   PreconditionMG<dim,
                  LinearAlgebra::distributed::Vector<double>,
-                 MGTransferMF<LevelMatrixType>>
+                 MGTransferMatrixFree<dim, double>>
     preconditioner(dof, mg, mg_transfer);
 
   {
index bcb67a23429cdbafed47b8e41686e237f751e1e4..f2dad019e6aceced8bdf722885619ffb8345dcb1 100644 (file)
@@ -500,40 +500,6 @@ public:
 
 
 
-template <int dim, typename LAPLACEOPERATOR>
-class MGTransferMF
-  : public MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>
-{
-public:
-  MGTransferMF(const MGLevelObject<LAPLACEOPERATOR> &laplace,
-               const MGConstrainedDoFs &             mg_constrained_dofs)
-    : MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>(
-        mg_constrained_dofs)
-    , laplace_operator(laplace){};
-
-  /**
-   * Overload copy_to_mg from MGTransferPrebuilt
-   */
-  template <class InVector, int spacedim>
-  void
-  copy_to_mg(const DoFHandler<dim, spacedim> &         mg_dof_handler,
-             MGLevelObject<LinearAlgebra::distributed::Vector<
-               typename LAPLACEOPERATOR::value_type>> &dst,
-             const InVector &                          src) const
-  {
-    for (unsigned int level = dst.min_level(); level <= dst.max_level();
-         ++level)
-      laplace_operator[level].initialize_dof_vector(dst[level]);
-    MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>::copy_to_mg(
-      mg_dof_handler, dst, src);
-  }
-
-private:
-  const MGLevelObject<LAPLACEOPERATOR> &laplace_operator;
-};
-
-
-
 template <int dim, typename number>
 void
 do_test(const DoFHandler<dim> &dof, const unsigned n_q_points_1d)
index fb5ac5cc66b1436b890819566ba1002321b4e6df..2accd6dcff311b6a7d95fd22f0551e3cbb7f7836 100644 (file)
@@ -177,6 +177,12 @@ public:
     return inverse_diagonal_entries;
   }
 
+  const std::shared_ptr<const Utilities::MPI::Partitioner> &
+  get_vector_partitioner() const
+  {
+    return data.get_vector_partitioner();
+  }
+
 
 private:
   void
@@ -408,40 +414,6 @@ public:
 
 
 
-template <int dim, typename LAPLACEOPERATOR>
-class MGTransferMF
-  : public MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>
-{
-public:
-  MGTransferMF(const MGLevelObject<LAPLACEOPERATOR> &laplace,
-               const MGConstrainedDoFs &             mg_constrained_dofs)
-    : MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>(
-        mg_constrained_dofs)
-    , laplace_operator(laplace){};
-
-  /**
-   * Overload copy_to_mg from MGTransferPrebuilt
-   */
-  template <class InVector, int spacedim>
-  void
-  copy_to_mg(const DoFHandler<dim, spacedim> &         mg_dof_handler,
-             MGLevelObject<LinearAlgebra::distributed::Vector<
-               typename LAPLACEOPERATOR::value_type>> &dst,
-             const InVector &                          src) const
-  {
-    for (unsigned int level = dst.min_level(); level <= dst.max_level();
-         ++level)
-      laplace_operator[level].initialize_dof_vector(dst[level]);
-    MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>::copy_to_mg(
-      mg_dof_handler, dst, src);
-  }
-
-private:
-  const MGLevelObject<LAPLACEOPERATOR> &laplace_operator;
-};
-
-
-
 template <int dim, typename number>
 void
 do_test(const DoFHandler<dim> &dof, const unsigned int n_q_points_1d)
@@ -503,9 +475,14 @@ do_test(const DoFHandler<dim> &dof, const unsigned int n_q_points_1d)
   mg_constrained_dofs.initialize(dof);
   mg_constrained_dofs.make_zero_boundary_constraints(dof, {0});
 
-  MGTransferMF<dim, LevelMatrixType> mg_transfer(mg_matrices,
-                                                 mg_constrained_dofs);
-  mg_transfer.build(dof);
+  std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>> partitioners;
+  for (unsigned int level = mg_matrices.min_level();
+       level <= mg_matrices.max_level();
+       ++level)
+    partitioners.push_back(mg_matrices[level].get_vector_partitioner());
+
+  MGTransferMatrixFree<dim, double> mg_transfer(mg_constrained_dofs);
+  mg_transfer.build(dof, partitioners);
 
   mg::Matrix<LinearAlgebra::distributed::Vector<double>> mg_matrix(mg_matrices);
 
@@ -513,7 +490,7 @@ do_test(const DoFHandler<dim> &dof, const unsigned int n_q_points_1d)
     mg_matrix, mg_coarse, mg_transfer, mg_smoother, mg_smoother);
   PreconditionMG<dim,
                  LinearAlgebra::distributed::Vector<double>,
-                 MGTransferMF<dim, LevelMatrixType>>
+                 MGTransferMatrixFree<dim, double>>
     preconditioner(dof, mg, mg_transfer);
 
   {
index bcc1b56df81c06b142d27132e95795b4e0e5bafc..fb94f0ec169f62fec045b6f455093b2bf2214fd7 100644 (file)
@@ -42,7 +42,7 @@
 #include <deal.II/multigrid/mg_matrix.h>
 #include <deal.II/multigrid/mg_smoother.h>
 #include <deal.II/multigrid/mg_tools.h>
-#include <deal.II/multigrid/mg_transfer.h>
+#include <deal.II/multigrid/mg_transfer_matrix_free.h>
 #include <deal.II/multigrid/multigrid.h>
 
 #include <deal.II/numerics/vector_tools.h>
@@ -196,6 +196,12 @@ public:
     return inverse_diagonal_entries;
   }
 
+  const std::shared_ptr<const Utilities::MPI::Partitioner> &
+  get_vector_partitioner() const
+  {
+    return data.get_vector_partitioner();
+  }
+
 
 private:
   void
@@ -274,37 +280,6 @@ private:
 
 
 
-template <typename MatrixType>
-class MGTransferPrebuiltMF
-  : public MGTransferPrebuilt<LinearAlgebra::distributed::Vector<double>>
-{
-public:
-  MGTransferPrebuiltMF(const MGLevelObject<MatrixType> &laplace)
-    : laplace_operator(laplace){};
-
-  /**
-   * Overload copy_to_mg from MGTransferPrebuilt to get the vectors compatible
-   * with MatrixFree and bypass the crude initialization in MGTransferPrebuilt
-   */
-  template <int dim, class InVector, int spacedim>
-  void
-  copy_to_mg(const DoFHandler<dim, spacedim> &                          mg_dof,
-             MGLevelObject<LinearAlgebra::distributed::Vector<double>> &dst,
-             const InVector &src) const
-  {
-    for (unsigned int level = dst.min_level(); level <= dst.max_level();
-         ++level)
-      laplace_operator[level].initialize_dof_vector(dst[level]);
-    MGTransferPrebuilt<LinearAlgebra::distributed::Vector<double>>::copy_to_mg(
-      mg_dof, dst, src);
-  }
-
-private:
-  const MGLevelObject<MatrixType> &laplace_operator;
-};
-
-
-
 template <typename MatrixType, typename Number>
 class MGCoarseIterative
   : public MGCoarseGridBase<LinearAlgebra::distributed::Vector<Number>>
@@ -375,8 +350,14 @@ do_test(const DoFHandler<dim> &dof)
       mg_matrices[level].initialize(mapping, dof, dirichlet_boundaries, level);
     }
 
-  MGTransferPrebuiltMF<LevelMatrixType> mg_transfer(mg_matrices);
-  mg_transfer.build(dof);
+  std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>> partitioners;
+  for (unsigned int level = mg_matrices.min_level();
+       level <= mg_matrices.max_level();
+       ++level)
+    partitioners.push_back(mg_matrices[level].get_vector_partitioner());
+
+  MGTransferMatrixFree<dim, double> mg_transfer;
+  mg_transfer.build(dof, partitioners);
 
   MGCoarseIterative<LevelMatrixType, number> mg_coarse;
   mg_coarse.initialize(mg_matrices[0]);
@@ -411,7 +392,7 @@ do_test(const DoFHandler<dim> &dof)
     mg_matrix, mg_coarse, mg_transfer, mg_smoother, mg_smoother);
   PreconditionMG<dim,
                  LinearAlgebra::distributed::Vector<double>,
-                 MGTransferPrebuiltMF<LevelMatrixType>>
+                 MGTransferMatrixFree<dim, double>>
     preconditioner(dof, mg, mg_transfer);
 
   {
index ce5cfd3e165929bb4739d3fb7d123d25e452ee85..b58785c16a0d1e2702c3cc91658f68b3129904e0 100644 (file)
@@ -42,7 +42,7 @@
 #include <deal.II/multigrid/mg_matrix.h>
 #include <deal.II/multigrid/mg_smoother.h>
 #include <deal.II/multigrid/mg_tools.h>
-#include <deal.II/multigrid/mg_transfer.h>
+#include <deal.II/multigrid/mg_transfer_matrix_free.h>
 #include <deal.II/multigrid/multigrid.h>
 
 #include <deal.II/numerics/vector_tools.h>
@@ -304,6 +304,12 @@ public:
     return inverse_diagonal_entries;
   }
 
+  const std::shared_ptr<const Utilities::MPI::Partitioner> &
+  get_vector_partitioner() const
+  {
+    return data.get_vector_partitioner();
+  }
+
 
 private:
   void
@@ -426,42 +432,6 @@ private:
 
 
 
-template <typename LAPLACEOPERATOR>
-class MGTransferMF
-  : public MGTransferPrebuilt<LinearAlgebra::distributed::Vector<double>>
-{
-public:
-  MGTransferMF(const MGLevelObject<LAPLACEOPERATOR> &laplace,
-               const MGConstrainedDoFs &             mg_constrained_dofs)
-    : MGTransferPrebuilt<LinearAlgebra::distributed::Vector<double>>(
-        mg_constrained_dofs)
-    , laplace_operator(laplace)
-  {}
-
-  /**
-   * Overload copy_to_mg from MGTransferPrebuilt to get the vectors compatible
-   * with MatrixFree and bypass the crude vector initialization in
-   * MGTransferPrebuilt
-   */
-  template <int dim, class InVector, int spacedim>
-  void
-  copy_to_mg(const DoFHandler<dim, spacedim> &mg_dof_handler,
-             MGLevelObject<LinearAlgebra::distributed::Vector<double>> &dst,
-             const InVector &src) const
-  {
-    for (unsigned int level = dst.min_level(); level <= dst.max_level();
-         ++level)
-      laplace_operator[level].initialize_dof_vector(dst[level]);
-    MGTransferPrebuilt<LinearAlgebra::distributed::Vector<double>>::copy_to_mg(
-      mg_dof_handler, dst, src);
-  }
-
-private:
-  const MGLevelObject<LAPLACEOPERATOR> &laplace_operator;
-};
-
-
-
 template <typename MatrixType, typename Number>
 class MGCoarseIterative
   : public MGCoarseGridBase<LinearAlgebra::distributed::Vector<Number>>
@@ -560,8 +530,14 @@ do_test(const DoFHandler<dim> &dof)
        ++level)
     mg_interface_matrices[level].initialize(mg_matrices[level]);
 
-  MGTransferMF<LevelMatrixType> mg_transfer(mg_matrices, mg_constrained_dofs);
-  mg_transfer.build(dof);
+  std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>> partitioners;
+  for (unsigned int level = mg_matrices.min_level();
+       level <= mg_matrices.max_level();
+       ++level)
+    partitioners.push_back(mg_matrices[level].get_vector_partitioner());
+
+  MGTransferMatrixFree<dim, double> mg_transfer(mg_constrained_dofs);
+  mg_transfer.build(dof, partitioners);
 
   MGCoarseIterative<LevelMatrixType, number> mg_coarse;
   mg_coarse.initialize(mg_matrices[0]);
@@ -599,7 +575,7 @@ do_test(const DoFHandler<dim> &dof)
   mg.set_edge_matrices(mg_interface, mg_interface);
   PreconditionMG<dim,
                  LinearAlgebra::distributed::Vector<double>,
-                 MGTransferMF<LevelMatrixType>>
+                 MGTransferMatrixFree<dim, double>>
     preconditioner(dof, mg, mg_transfer);
 
   {
index 08513666741bf7aeaa35c05f54039633a9826064..3ae1c09498cb22223212fc10ae500530b387031a 100644 (file)
 
 using namespace dealii::MatrixFreeOperators;
 
-template <int dim, typename LAPLACEOPERATOR>
-class MGTransferMF
-  : public MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>
-{
-public:
-  MGTransferMF(const MGLevelObject<LAPLACEOPERATOR> &laplace,
-               const MGConstrainedDoFs &             mg_constrained_dofs)
-    : MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>(
-        mg_constrained_dofs)
-    , laplace_operator(laplace)
-  {}
-
-  /**
-   * Overload copy_to_mg from MGTransferPrebuilt to get the vectors compatible
-   * with MatrixFree and bypass the crude vector initialization in
-   * MGTransferPrebuilt
-   */
-  template <class InVector, int spacedim>
-  void
-  copy_to_mg(const DoFHandler<dim, spacedim> &         mg_dof_handler,
-             MGLevelObject<LinearAlgebra::distributed::Vector<
-               typename LAPLACEOPERATOR::value_type>> &dst,
-             const InVector &                          src) const
-  {
-    for (unsigned int level = dst.min_level(); level <= dst.max_level();
-         ++level)
-      laplace_operator[level].initialize_dof_vector(dst[level]);
-    MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>::copy_to_mg(
-      mg_dof_handler, dst, src);
-  }
-
-private:
-  const MGLevelObject<LAPLACEOPERATOR> &laplace_operator;
-};
-
-
-
 template <typename MatrixType, typename Number>
 class MGCoarseIterative
   : public MGCoarseGridBase<LinearAlgebra::distributed::Vector<Number>>
@@ -249,9 +212,14 @@ do_test(const DoFHandler<dim> &dof)
        ++level)
     mg_interface_matrices[level].initialize(mg_matrices[level]);
 
-  MGTransferMF<dim, LevelMatrixType> mg_transfer(mg_matrices,
-                                                 mg_constrained_dofs);
-  mg_transfer.build(dof);
+  std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>> partitioners;
+  for (unsigned int level = mg_matrices.min_level();
+       level <= mg_matrices.max_level();
+       ++level)
+    partitioners.push_back(mg_level_data[level].get_vector_partitioner());
+
+  MGTransferMatrixFree<dim, double> mg_transfer(mg_constrained_dofs);
+  mg_transfer.build(dof, partitioners);
 
   MGCoarseIterative<LevelMatrixType, number> mg_coarse;
   mg_coarse.initialize(mg_matrices[0]);
@@ -287,7 +255,7 @@ do_test(const DoFHandler<dim> &dof)
   mg.set_edge_matrices(mg_interface, mg_interface);
   PreconditionMG<dim,
                  LinearAlgebra::distributed::Vector<double>,
-                 MGTransferMF<dim, LevelMatrixType>>
+                 MGTransferMatrixFree<dim, double>>
     preconditioner(dof, mg, mg_transfer);
 
   {
index d932c4211c0989d157e8fe0da01da4cb25a5224f..3bef0b0a02403e719cc5e088d72b6744615b2e39 100644 (file)
@@ -311,6 +311,12 @@ public:
     return inverse_diagonal_entries;
   }
 
+  const std::shared_ptr<const Utilities::MPI::Partitioner> &
+  get_vector_partitioner() const
+  {
+    return data.get_vector_partitioner();
+  }
+
 
 private:
   void
@@ -438,45 +444,6 @@ private:
 
 
 
-template <int dim, typename LAPLACEOPERATOR>
-class MGTransferMF
-  : public MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>
-{
-public:
-  MGTransferMF(const MGLevelObject<LAPLACEOPERATOR> &laplace,
-               const MGConstrainedDoFs &             mg_constrained_dofs)
-    : MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>(
-        mg_constrained_dofs)
-    , laplace_operator(laplace)
-  {}
-
-  /**
-   * Overload copy_to_mg from MGTransferPrebuilt to get the vectors compatible
-   * with MatrixFree and bypass the crude vector initialization in
-   * MGTransferPrebuilt
-   */
-  template <class InVector, int spacedim>
-  void
-  copy_to_mg(const DoFHandler<dim, spacedim> &         mg_dof_handler,
-             MGLevelObject<LinearAlgebra::distributed::Vector<
-               typename LAPLACEOPERATOR::value_type>> &dst,
-             const InVector &                          src) const
-  {
-    for (unsigned int level = dst.min_level(); level <= dst.max_level();
-         ++level)
-      laplace_operator[level].initialize_dof_vector(dst[level]);
-    MGLevelGlobalTransfer<LinearAlgebra::distributed::Vector<
-      typename LAPLACEOPERATOR::value_type>>::copy_to_mg(mg_dof_handler,
-                                                         dst,
-                                                         src);
-  }
-
-private:
-  const MGLevelObject<LAPLACEOPERATOR> &laplace_operator;
-};
-
-
-
 template <typename MatrixType, typename Number>
 class MGCoarseIterative
   : public MGCoarseGridBase<LinearAlgebra::distributed::Vector<Number>>
@@ -569,9 +536,14 @@ do_test(const DoFHandler<dim> &dof, const bool threaded)
        ++level)
     mg_interface_matrices[level].initialize(mg_matrices[level]);
 
-  MGTransferMF<dim, LevelMatrixType> mg_transfer(mg_matrices,
-                                                 mg_constrained_dofs);
-  mg_transfer.build(dof);
+  std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>> partitioners;
+  for (unsigned int level = mg_matrices.min_level();
+       level <= mg_matrices.max_level();
+       ++level)
+    partitioners.push_back(mg_matrices[level].get_vector_partitioner());
+
+  MGTransferMatrixFree<dim, number> mg_transfer(mg_constrained_dofs);
+  mg_transfer.build(dof, partitioners);
 
   MGCoarseIterative<LevelMatrixType, number> mg_coarse;
   mg_coarse.initialize(mg_matrices[0]);
@@ -610,7 +582,7 @@ do_test(const DoFHandler<dim> &dof, const bool threaded)
   mg.set_edge_matrices(mg_interface, mg_interface);
   PreconditionMG<dim,
                  LinearAlgebra::distributed::Vector<number>,
-                 MGTransferMF<dim, LevelMatrixType>>
+                 MGTransferMatrixFree<dim, number>>
     preconditioner(dof, mg, mg_transfer);
 
   {
index fe43ae0af285c0f626da8fde96364889ad49e530..b275ce1ab566c301515dff02c53bb256ed958b9e 100644 (file)
 
 using namespace dealii::MatrixFreeOperators;
 
-template <int dim, typename LAPLACEOPERATOR>
-class MGTransferMF
-  : public MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>
-{
-public:
-  MGTransferMF(const MGLevelObject<LAPLACEOPERATOR> &laplace,
-               const MGConstrainedDoFs &             mg_constrained_dofs)
-    : MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>(
-        mg_constrained_dofs)
-    , laplace_operator(laplace)
-  {}
-
-  /**
-   * Overload copy_to_mg from MGTransferPrebuilt to get the vectors compatible
-   * with MatrixFree and bypass the crude vector initialization in
-   * MGTransferPrebuilt
-   */
-  template <class InVector, int spacedim>
-  void
-  copy_to_mg(const DoFHandler<dim, spacedim> &         mg_dof_handler,
-             MGLevelObject<LinearAlgebra::distributed::Vector<
-               typename LAPLACEOPERATOR::value_type>> &dst,
-             const InVector &                          src) const
-  {
-    for (unsigned int level = dst.min_level(); level <= dst.max_level();
-         ++level)
-      laplace_operator[level].initialize_dof_vector(dst[level]);
-    MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>::copy_to_mg(
-      mg_dof_handler, dst, src);
-  }
-
-private:
-  const MGLevelObject<LAPLACEOPERATOR> &laplace_operator;
-};
-
-
-
 template <typename MatrixType, typename Number>
 class MGCoarseIterative
   : public MGCoarseGridBase<LinearAlgebra::distributed::Vector<Number>>
@@ -249,9 +212,14 @@ do_test(const DoFHandler<dim> &dof)
        ++level)
     mg_interface_matrices[level].initialize(mg_matrices[level]);
 
-  MGTransferMF<dim, LevelMatrixType> mg_transfer(mg_matrices,
-                                                 mg_constrained_dofs);
-  mg_transfer.build(dof);
+  std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>> partitioners;
+  for (unsigned int level = mg_matrices.min_level();
+       level <= mg_matrices.max_level();
+       ++level)
+    partitioners.push_back(mg_level_data[level].get_vector_partitioner());
+
+  MGTransferMatrixFree<dim, double> mg_transfer(mg_constrained_dofs);
+  mg_transfer.build(dof, partitioners);
 
   MGCoarseIterative<LevelMatrixType, number> mg_coarse;
   mg_coarse.initialize(mg_matrices[0]);
@@ -285,7 +253,7 @@ do_test(const DoFHandler<dim> &dof)
   mg.set_edge_matrices(mg_interface, mg_interface);
   PreconditionMG<dim,
                  LinearAlgebra::distributed::Vector<double>,
-                 MGTransferMF<dim, LevelMatrixType>>
+                 MGTransferMatrixFree<dim, double>>
     preconditioner(dof, mg, mg_transfer);
 
   {
index 96b5394ad996a5d2ad3b402ad121877f26d3bb83..86dcbaa8f6c7d4b5c9d8e41324ba1b0b9fb6381e 100644 (file)
@@ -308,6 +308,12 @@ public:
     return inverse_diagonal_entries;
   }
 
+  const std::shared_ptr<const Utilities::MPI::Partitioner> &
+  get_vector_partitioner() const
+  {
+    return data.get_vector_partitioner();
+  }
+
 
 private:
   void
@@ -435,45 +441,6 @@ private:
 
 
 
-template <int dim, typename LAPLACEOPERATOR>
-class MGTransferMF
-  : public MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>
-{
-public:
-  MGTransferMF(const MGLevelObject<LAPLACEOPERATOR> &laplace,
-               const MGConstrainedDoFs &             mg_constrained_dofs)
-    : MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>(
-        mg_constrained_dofs)
-    , laplace_operator(laplace)
-  {}
-
-  /**
-   * Overload copy_to_mg from MGTransferPrebuilt to get the vectors compatible
-   * with MatrixFree and bypass the crude vector initialization in
-   * MGTransferPrebuilt
-   */
-  template <class InVector, int spacedim>
-  void
-  copy_to_mg(const DoFHandler<dim, spacedim> &         mg_dof_handler,
-             MGLevelObject<LinearAlgebra::distributed::Vector<
-               typename LAPLACEOPERATOR::value_type>> &dst,
-             const InVector &                          src) const
-  {
-    for (unsigned int level = dst.min_level(); level <= dst.max_level();
-         ++level)
-      laplace_operator[level].initialize_dof_vector(dst[level]);
-    MGLevelGlobalTransfer<LinearAlgebra::distributed::Vector<
-      typename LAPLACEOPERATOR::value_type>>::copy_to_mg(mg_dof_handler,
-                                                         dst,
-                                                         src);
-  }
-
-private:
-  const MGLevelObject<LAPLACEOPERATOR> &laplace_operator;
-};
-
-
-
 template <typename MatrixType, typename Number>
 class MGCoarseIterative
   : public MGCoarseGridBase<LinearAlgebra::distributed::Vector<Number>>
@@ -566,9 +533,14 @@ do_test(const DoFHandler<dim> &dof, const bool threaded)
        ++level)
     mg_interface_matrices[level].initialize(mg_matrices[level]);
 
-  MGTransferMF<dim, LevelMatrixType> mg_transfer(mg_matrices,
-                                                 mg_constrained_dofs);
-  mg_transfer.build(dof);
+  std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>> partitioners;
+  for (unsigned int level = mg_matrices.min_level();
+       level <= mg_matrices.max_level();
+       ++level)
+    partitioners.push_back(mg_matrices[level].get_vector_partitioner());
+
+  MGTransferMatrixFree<dim, double> mg_transfer(mg_constrained_dofs);
+  mg_transfer.build(dof, partitioners);
 
   MGCoarseIterative<LevelMatrixType, number> mg_coarse;
   mg_coarse.initialize(mg_matrices[0]);
@@ -607,7 +579,7 @@ do_test(const DoFHandler<dim> &dof, const bool threaded)
   mg.set_edge_matrices(mg_interface, mg_interface);
   PreconditionMG<dim,
                  LinearAlgebra::distributed::Vector<number>,
-                 MGTransferMF<dim, LevelMatrixType>>
+                 MGTransferMatrixFree<dim, double>>
     preconditioner(dof, mg, mg_transfer);
 
   {
index ee2379323767369612803b106120cbc0f296e28e..8915d65f94a25e22ce2a8c9d53501d8f98cad455 100644 (file)
 
 using namespace dealii::MatrixFreeOperators;
 
-template <int dim, typename LAPLACEOPERATOR>
-class MGTransferMF
-  : public MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>
-{
-public:
-  MGTransferMF(const MGLevelObject<LAPLACEOPERATOR> &laplace,
-               const MGConstrainedDoFs &             mg_constrained_dofs)
-    : MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>(
-        mg_constrained_dofs)
-    , laplace_operator(laplace)
-  {}
-
-  /**
-   * Overload copy_to_mg from MGTransferPrebuilt to get the vectors compatible
-   * with MatrixFree and bypass the crude vector initialization in
-   * MGTransferPrebuilt
-   */
-  template <class InVector, int spacedim>
-  void
-  copy_to_mg(const DoFHandler<dim, spacedim> &         mg_dof_handler,
-             MGLevelObject<LinearAlgebra::distributed::Vector<
-               typename LAPLACEOPERATOR::value_type>> &dst,
-             const InVector &                          src) const
-  {
-    for (unsigned int level = dst.min_level(); level <= dst.max_level();
-         ++level)
-      laplace_operator[level].initialize_dof_vector(dst[level]);
-    MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>::copy_to_mg(
-      mg_dof_handler, dst, src);
-  }
-
-private:
-  const MGLevelObject<LAPLACEOPERATOR> &laplace_operator;
-};
-
-
-
 template <typename MatrixType, typename Number>
 class MGCoarseIterative
   : public MGCoarseGridBase<LinearAlgebra::distributed::Vector<Number>>
@@ -250,9 +213,14 @@ do_test(const DoFHandler<dim> &dof)
        ++level)
     mg_interface_matrices[level].initialize(mg_matrices[level]);
 
-  MGTransferMF<dim, LevelMatrixType> mg_transfer(mg_matrices,
-                                                 mg_constrained_dofs);
-  mg_transfer.build(dof);
+  std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>> partitioners;
+  for (unsigned int level = mg_matrices.min_level();
+       level <= mg_matrices.max_level();
+       ++level)
+    partitioners.push_back(mg_level_data[level].get_vector_partitioner());
+
+  MGTransferMatrixFree<dim, double> mg_transfer(mg_constrained_dofs);
+  mg_transfer.build(dof, partitioners);
 
   MGCoarseIterative<LevelMatrixType, number> mg_coarse;
   mg_coarse.initialize(mg_matrices[0]);
@@ -274,7 +242,7 @@ do_test(const DoFHandler<dim> &dof)
   mg.set_edge_matrices(mg_interface, mg_interface);
   PreconditionMG<dim,
                  LinearAlgebra::distributed::Vector<double>,
-                 MGTransferMF<dim, LevelMatrixType>>
+                 MGTransferMatrixFree<dim, double>>
     preconditioner(dof, mg, mg_transfer);
 
   {
index fdb129600e12f4567214a9bf442af3dc3b611ecd..c9f48979fe228e5a156e2ff0039567c00cf03d0d 100644 (file)
@@ -201,6 +201,12 @@ public:
     return inverse_diagonal_entries;
   }
 
+  const std::shared_ptr<const Utilities::MPI::Partitioner> &
+  get_vector_partitioner() const
+  {
+    return data.get_vector_partitioner();
+  }
+
 
 private:
   void
@@ -279,42 +285,6 @@ private:
 
 
 
-template <int dim, typename MatrixType>
-class MGTransferPrebuiltMF
-  : public MGTransferMatrixFree<dim, typename MatrixType::value_type>
-{
-public:
-  MGTransferPrebuiltMF(const MGLevelObject<MatrixType> &laplace,
-                       const MGConstrainedDoFs &        mg_constrained_dofs)
-    : MGTransferMatrixFree<dim, typename MatrixType::value_type>(
-        mg_constrained_dofs)
-    , laplace_operator(laplace){};
-
-  /**
-   * Overload copy_to_mg from MGTransferPrebuilt to get the vectors compatible
-   * with MatrixFree and bypass the crude initialization in MGTransferPrebuilt
-   */
-  template <class InVector, int spacedim>
-  void
-  copy_to_mg(
-    const DoFHandler<dim, spacedim> &mg_dof,
-    MGLevelObject<
-      LinearAlgebra::distributed::Vector<typename MatrixType::value_type>> &dst,
-    const InVector &src) const
-  {
-    for (unsigned int level = dst.min_level(); level <= dst.max_level();
-         ++level)
-      laplace_operator[level].initialize_dof_vector(dst[level]);
-    MGLevelGlobalTransfer<LinearAlgebra::distributed::Vector<
-      typename MatrixType::value_type>>::copy_to_mg(mg_dof, dst, src);
-  }
-
-private:
-  const MGLevelObject<MatrixType> &laplace_operator;
-};
-
-
-
 template <typename MatrixType, typename Number>
 class MGCoarseIterative
   : public MGCoarseGridBase<LinearAlgebra::distributed::Vector<Number>>
@@ -382,9 +352,14 @@ do_test(const DoFHandler<dim> &dof)
   mg_constrained_dofs.initialize(dof);
   mg_constrained_dofs.make_zero_boundary_constraints(dof, {0});
 
-  MGTransferPrebuiltMF<dim, LevelMatrixType> mg_transfer(mg_matrices,
-                                                         mg_constrained_dofs);
-  mg_transfer.build(dof);
+  std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>> partitioners;
+  for (unsigned int level = mg_matrices.min_level();
+       level <= mg_matrices.max_level();
+       ++level)
+    partitioners.push_back(mg_matrices[level].get_vector_partitioner());
+
+  MGTransferMatrixFree<dim, number> mg_transfer(mg_constrained_dofs);
+  mg_transfer.build(dof, partitioners);
 
   MGCoarseIterative<LevelMatrixType, number> mg_coarse;
   mg_coarse.initialize(mg_matrices[0]);
@@ -422,7 +397,7 @@ do_test(const DoFHandler<dim> &dof)
     mg_matrix, mg_coarse, mg_transfer, mg_smoother, mg_smoother);
   PreconditionMG<dim,
                  LinearAlgebra::distributed::Vector<number>,
-                 MGTransferPrebuiltMF<dim, LevelMatrixType>>
+                 MGTransferMatrixFree<dim, number>>
     preconditioner(dof, mg, mg_transfer);
 
   {
index 8e85f40c4ab90538d0ca0678154540f09548c8d4..b8de2d3c4f889cd3c97ea4e3833cf67e6ec84544 100644 (file)
@@ -220,6 +220,12 @@ public:
     return inverse_diagonal_entries;
   }
 
+  const std::shared_ptr<const Utilities::MPI::Partitioner> &
+  get_vector_partitioner() const
+  {
+    return data.get_vector_partitioner();
+  }
+
 
 private:
   void
@@ -300,42 +306,6 @@ private:
 
 
 
-template <int dim, typename MatrixType>
-class MGTransferPrebuiltMF
-  : public MGTransferMatrixFree<dim, typename MatrixType::value_type>
-{
-public:
-  MGTransferPrebuiltMF(const MGLevelObject<MatrixType> &laplace,
-                       const MGConstrainedDoFs &        mg_constrained_dofs)
-    : MGTransferMatrixFree<dim, typename MatrixType::value_type>(
-        mg_constrained_dofs)
-    , laplace_operator(laplace){};
-
-  /**
-   * Overload copy_to_mg from MGTransferPrebuilt to get the vectors compatible
-   * with MatrixFree and bypass the crude initialization in MGTransferPrebuilt
-   */
-  template <class InVector, int spacedim>
-  void
-  copy_to_mg(
-    const DoFHandler<dim, spacedim> &mg_dof,
-    MGLevelObject<
-      LinearAlgebra::distributed::Vector<typename MatrixType::value_type>> &dst,
-    const InVector &src) const
-  {
-    for (unsigned int level = dst.min_level(); level <= dst.max_level();
-         ++level)
-      laplace_operator[level].initialize_dof_vector(dst[level]);
-    MGLevelGlobalTransfer<LinearAlgebra::distributed::Vector<
-      typename MatrixType::value_type>>::copy_to_mg(mg_dof, dst, src);
-  }
-
-private:
-  const MGLevelObject<MatrixType> &laplace_operator;
-};
-
-
-
 template <int dim, typename number>
 void
 do_test(const DoFHandler<dim> &dof)
@@ -383,9 +353,14 @@ do_test(const DoFHandler<dim> &dof)
   mg_constrained_dofs.initialize(dof);
   mg_constrained_dofs.make_zero_boundary_constraints(dof, {0});
 
-  MGTransferPrebuiltMF<dim, LevelMatrixType> mg_transfer(mg_matrices,
-                                                         mg_constrained_dofs);
-  mg_transfer.build(dof);
+  std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>> partitioners;
+  for (unsigned int level = mg_matrices.min_level();
+       level <= mg_matrices.max_level();
+       ++level)
+    partitioners.push_back(mg_matrices[level].get_vector_partitioner());
+
+  MGTransferMatrixFree<dim, number> mg_transfer(mg_constrained_dofs);
+  mg_transfer.build(dof, partitioners);
 
   using SMOOTHER =
     PreconditionChebyshev<LevelMatrixType,
@@ -418,7 +393,7 @@ do_test(const DoFHandler<dim> &dof)
     mg_matrix, mg_coarse, mg_transfer, mg_smoother, mg_smoother);
   PreconditionMG<dim,
                  LinearAlgebra::distributed::Vector<number>,
-                 MGTransferPrebuiltMF<dim, LevelMatrixType>>
+                 MGTransferMatrixFree<dim, number>>
     preconditioner(dof, mg, mg_transfer);
 
   {
index 96c27dcfda745a229e6473c9922d037f024498d1..dbf5f7e1229181afb00094c5de435db3ad078a8d 100644 (file)
@@ -261,6 +261,12 @@ public:
     return inverse_diagonal_entries;
   }
 
+  const std::shared_ptr<const Utilities::MPI::Partitioner> &
+  get_vector_partitioner() const
+  {
+    return data.get_vector_partitioner();
+  }
+
 
 private:
   void
@@ -341,42 +347,6 @@ private:
 
 
 
-template <int dim, typename MatrixType>
-class MGTransferPrebuiltMF
-  : public MGTransferMatrixFree<dim, typename MatrixType::value_type>
-{
-public:
-  MGTransferPrebuiltMF(const MGLevelObject<MatrixType> &laplace,
-                       const MGConstrainedDoFs &        mg_constrained_dofs)
-    : MGTransferMatrixFree<dim, typename MatrixType::value_type>(
-        mg_constrained_dofs)
-    , laplace_operator(laplace){};
-
-  /**
-   * Overload copy_to_mg from MGTransferPrebuilt to get the vectors compatible
-   * with MatrixFree and bypass the crude initialization in MGTransferPrebuilt
-   */
-  template <class InVector, int spacedim>
-  void
-  copy_to_mg(
-    const DoFHandler<dim, spacedim> &mg_dof,
-    MGLevelObject<
-      LinearAlgebra::distributed::Vector<typename MatrixType::value_type>> &dst,
-    const InVector &src) const
-  {
-    for (unsigned int level = dst.min_level(); level <= dst.max_level();
-         ++level)
-      laplace_operator[level].initialize_dof_vector(dst[level]);
-    MGLevelGlobalTransfer<LinearAlgebra::distributed::Vector<
-      typename MatrixType::value_type>>::copy_to_mg(mg_dof, dst, src);
-  }
-
-private:
-  const MGLevelObject<MatrixType> &laplace_operator;
-};
-
-
-
 template <int dim, typename number>
 void
 do_test(DoFHandler<dim> &dof)
@@ -424,9 +394,14 @@ do_test(DoFHandler<dim> &dof)
   mg_constrained_dofs.initialize(dof);
   mg_constrained_dofs.make_zero_boundary_constraints(dof, {0});
 
-  MGTransferPrebuiltMF<dim, LevelMatrixType> mg_transfer(mg_matrices,
-                                                         mg_constrained_dofs);
-  mg_transfer.build(dof);
+  std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>> partitioners;
+  for (unsigned int level = mg_matrices.min_level();
+       level <= mg_matrices.max_level();
+       ++level)
+    partitioners.push_back(mg_matrices[level].get_vector_partitioner());
+
+  MGTransferMatrixFree<dim, number> mg_transfer(mg_constrained_dofs);
+  mg_transfer.build(dof, partitioners);
 
   using SMOOTHER =
     PreconditionChebyshev<LevelMatrixType,
@@ -459,7 +434,7 @@ do_test(DoFHandler<dim> &dof)
     mg_matrix, mg_coarse, mg_transfer, mg_smoother, mg_smoother);
   PreconditionMG<dim,
                  LinearAlgebra::distributed::Vector<number>,
-                 MGTransferPrebuiltMF<dim, LevelMatrixType>>
+                 MGTransferMatrixFree<dim, number>>
     preconditioner(dof, mg, mg_transfer);
 
   {
index ba94935293bb2e74403eb20bc56f6cb29b91fe23..f5aca044baab6f4e0c0f38b675cd4e0f21420ce1 100644 (file)
@@ -196,6 +196,12 @@ public:
     return inverse_diagonal_entries;
   }
 
+  const std::shared_ptr<const Utilities::MPI::Partitioner> &
+  get_vector_partitioner() const
+  {
+    return data.get_vector_partitioner();
+  }
+
 
 private:
   void
@@ -274,42 +280,6 @@ private:
 
 
 
-template <int dim, typename MatrixType>
-class MGTransferPrebuiltMF
-  : public MGTransferMatrixFree<dim, typename MatrixType::value_type>
-{
-public:
-  MGTransferPrebuiltMF(const MGLevelObject<MatrixType> &laplace,
-                       const MGConstrainedDoFs &        mg_constrained_dofs)
-    : MGTransferMatrixFree<dim, typename MatrixType::value_type>(
-        mg_constrained_dofs)
-    , laplace_operator(laplace){};
-
-  /**
-   * Overload copy_to_mg from MGTransferPrebuilt to get the vectors compatible
-   * with MatrixFree and bypass the crude initialization in MGTransferPrebuilt
-   */
-  template <class InVector, int spacedim>
-  void
-  copy_to_mg(
-    const DoFHandler<dim, spacedim> &mg_dof,
-    MGLevelObject<
-      LinearAlgebra::distributed::Vector<typename MatrixType::value_type>> &dst,
-    const InVector &src) const
-  {
-    for (unsigned int level = dst.min_level(); level <= dst.max_level();
-         ++level)
-      laplace_operator[level].initialize_dof_vector(dst[level]);
-    MGLevelGlobalTransfer<LinearAlgebra::distributed::Vector<
-      typename MatrixType::value_type>>::copy_to_mg(mg_dof, dst, src);
-  }
-
-private:
-  const MGLevelObject<MatrixType> &laplace_operator;
-};
-
-
-
 template <typename MatrixType, typename Number>
 class MGCoarseIterative
   : public MGCoarseGridBase<LinearAlgebra::distributed::Vector<Number>>
@@ -377,9 +347,14 @@ do_test(const DoFHandler<dim> &dof)
   mg_constrained_dofs.initialize(dof);
   mg_constrained_dofs.make_zero_boundary_constraints(dof, {0});
 
-  MGTransferPrebuiltMF<dim, LevelMatrixType> mg_transfer(mg_matrices,
-                                                         mg_constrained_dofs);
-  mg_transfer.build(dof);
+  std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>> partitioners;
+  for (unsigned int level = mg_matrices.min_level();
+       level <= mg_matrices.max_level();
+       ++level)
+    partitioners.push_back(mg_matrices[level].get_vector_partitioner());
+
+  MGTransferMatrixFree<dim, number> mg_transfer(mg_constrained_dofs);
+  mg_transfer.build(dof, partitioners);
 
   MGCoarseIterative<LevelMatrixType, number> mg_coarse;
   mg_coarse.initialize(mg_matrices[0]);
@@ -417,7 +392,7 @@ do_test(const DoFHandler<dim> &dof)
     mg_matrix, mg_coarse, mg_transfer, mg_smoother, mg_smoother);
   PreconditionMG<dim,
                  LinearAlgebra::distributed::Vector<number>,
-                 MGTransferPrebuiltMF<dim, LevelMatrixType>>
+                 MGTransferMatrixFree<dim, number>>
     preconditioner(dof, mg, mg_transfer);
 
   {
index ef03bb86397ef04b93f9a97e60e72e653dfbb2a0..bbfd99a1d312fff1deb3081b73ac3b34487d88c7 100644 (file)
@@ -265,41 +265,6 @@ LaplaceOperator<dim, fe_degree, number>::local_compute_diagonal(
 
 
 
-template <int dim, typename MatrixType>
-class MGTransferMF
-  : public MGTransferMatrixFree<dim, typename MatrixType::value_type>
-{
-public:
-  void
-  setup(const MGLevelObject<MatrixType> &laplace,
-        const MGConstrainedDoFs &        mg_constrained_dofs)
-  {
-    this->MGTransferMatrixFree<dim, typename MatrixType::value_type>::
-      initialize_constraints(mg_constrained_dofs);
-    laplace_operator = &laplace;
-  }
-
-  template <class InVector, int spacedim>
-  void
-  copy_to_mg(
-    const DoFHandler<dim, spacedim> &mg_dof,
-    MGLevelObject<
-      LinearAlgebra::distributed::Vector<typename MatrixType::value_type>> &dst,
-    const InVector &src) const
-  {
-    for (unsigned int level = dst.min_level(); level <= dst.max_level();
-         ++level)
-      (*laplace_operator)[level].initialize_dof_vector(dst[level]);
-    MGLevelGlobalTransfer<LinearAlgebra::distributed::Vector<
-      typename MatrixType::value_type>>::copy_to_mg(mg_dof, dst, src);
-  }
-
-private:
-  const MGLevelObject<MatrixType> *laplace_operator;
-};
-
-
-
 template <int dim>
 class LaplaceProblem
 {
@@ -343,7 +308,8 @@ private:
   LinearAlgebra::distributed::Vector<double> solution;
   LinearAlgebra::distributed::Vector<double> system_rhs;
 
-  MGTransferMF<dim, LevelMatrixType> mg_transfer;
+  MGTransferMatrixFree<dim, LinearAlgebra::distributed::Vector<float>>
+    mg_transfer;
 
   using SmootherType =
     PreconditionChebyshev<LevelMatrixType,
@@ -537,7 +503,7 @@ template <int dim>
 void
 LaplaceProblem<dim>::setup_transfer()
 {
-  mg_transfer.setup(mg_matrices, mg_constrained_dofs);
+  mg_transfer.initialize_constraints(mg_constrained_dofs);
   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)
@@ -601,9 +567,10 @@ LaplaceProblem<dim>::solve()
     mg_matrix, mg_coarse, mg_transfer, mg_smoother, mg_smoother);
   mg.set_edge_matrices(mg_interface, mg_interface);
 
-  PreconditionMG<dim,
-                 LinearAlgebra::distributed::Vector<float>,
-                 MGTransferMF<dim, LevelMatrixType>>
+  PreconditionMG<
+    dim,
+    LinearAlgebra::distributed::Vector<float>,
+    MGTransferMatrixFree<dim, LinearAlgebra::distributed::Vector<float>>>
     preconditioner(dof_handler, mg, mg_transfer);
 
 

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.