From 0a07e72237be7725ff5b0b6b327e2cc355fd2943 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Fri, 8 Nov 2024 12:51:24 +0100 Subject: [PATCH] Use simpler initialization of partitioner --- examples/step-59/step-59.cc | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/examples/step-59/step-59.cc b/examples/step-59/step-59.cc index adb743c2c3..3132433e92 100644 --- a/examples/step-59/step-59.cc +++ b/examples/step-59/step-59.cc @@ -178,6 +178,9 @@ namespace Step59 std::shared_ptr> get_matrix_free() const; + std::shared_ptr + get_vector_partitioner() const; + void vmult(LinearAlgebra::distributed::Vector &dst, const LinearAlgebra::distributed::Vector &src) const; @@ -282,6 +285,15 @@ namespace Step59 + template + std::shared_ptr + LaplaceOperator::get_vector_partitioner() const + { + return data->get_dof_info().vector_partitioner; + } + + + template void LaplaceOperator::initialize_dof_vector( LinearAlgebra::distributed::Vector &vec) const @@ -1165,11 +1177,8 @@ namespace Step59 std::vector> partitioners(dof_handler.get_triangulation().n_global_levels()); for (unsigned int level = 0; level < partitioners.size(); ++level) - { - LinearAlgebra::distributed::Vector 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() -- 2.39.5