From b3145931a4387adc54b0e40f3ed70fbb588140b8 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Tue, 1 Feb 2022 10:19:42 +0100 Subject: [PATCH] MatrixFreeTools::compute_diagonal(): do not initialize vector --- doc/news/changes/incompatibilities/20220201SchreterMunch | 7 +++++++ include/deal.II/matrix_free/tools.h | 3 --- tests/matrix_free/compute_diagonal_util.h | 2 ++ 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 doc/news/changes/incompatibilities/20220201SchreterMunch diff --git a/doc/news/changes/incompatibilities/20220201SchreterMunch b/doc/news/changes/incompatibilities/20220201SchreterMunch new file mode 100644 index 0000000000..1069f242a8 --- /dev/null +++ b/doc/news/changes/incompatibilities/20220201SchreterMunch @@ -0,0 +1,7 @@ +Changed: The function MatrixFreeTools::compute_diagonal() +does not initialize the output vector anymore. Users +need to call MatrixFree:initialize_dof_vector() themselves. +This change is required to be able to also support block +vectors. +
+(Magdalena Schreter, Peter Munch, 2022/02/01) diff --git a/include/deal.II/matrix_free/tools.h b/include/deal.II/matrix_free/tools.h index ef1a1c5e1a..b8e608b083 100644 --- a/include/deal.II/matrix_free/tools.h +++ b/include/deal.II/matrix_free/tools.h @@ -795,9 +795,6 @@ namespace MatrixFreeTools { using VectorType = LinearAlgebra::distributed::Vector; - // initialize vector - matrix_free.initialize_dof_vector(diagonal_global, dof_no); - int dummy = 0; matrix_free.template cell_loop( diff --git a/tests/matrix_free/compute_diagonal_util.h b/tests/matrix_free/compute_diagonal_util.h index 9f64e13871..e0da7eb793 100644 --- a/tests/matrix_free/compute_diagonal_util.h +++ b/tests/matrix_free/compute_diagonal_util.h @@ -101,6 +101,7 @@ public: double error_local_1, error_local_2, error_global; { + matrix_free.initialize_dof_vector(diagonal_global); MatrixFreeTools::compute_diagonal