]> https://gitweb.dealii.org/ - dealii.git/commitdiff
MatrixFreeTools::compute_diagonal(): do not initialize vector 13316/head
authorPeter Munch <peterrmuench@gmail.com>
Tue, 1 Feb 2022 09:19:42 +0000 (10:19 +0100)
committerPeter Munch <peterrmuench@gmail.com>
Tue, 1 Feb 2022 09:19:42 +0000 (10:19 +0100)
doc/news/changes/incompatibilities/20220201SchreterMunch [new file with mode: 0644]
include/deal.II/matrix_free/tools.h
tests/matrix_free/compute_diagonal_util.h

diff --git a/doc/news/changes/incompatibilities/20220201SchreterMunch b/doc/news/changes/incompatibilities/20220201SchreterMunch
new file mode 100644 (file)
index 0000000..1069f24
--- /dev/null
@@ -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.
+<br>
+(Magdalena Schreter, Peter Munch, 2022/02/01)
index ef1a1c5e1afc36cdf0bbcaac81a9cacec2de95b7..b8e608b08355fbababf4b741d9f9a05d8ceae6c8 100644 (file)
@@ -795,9 +795,6 @@ namespace MatrixFreeTools
   {
     using VectorType = LinearAlgebra::distributed::Vector<Number>;
 
-    // initialize vector
-    matrix_free.initialize_dof_vector(diagonal_global, dof_no);
-
     int dummy = 0;
 
     matrix_free.template cell_loop<VectorType, int>(
index 9f64e13871b4e2ff51d72c3f773d843a904f688d..e0da7eb7938f25034785ca5e8787b48e65a6d830 100644 (file)
@@ -101,6 +101,7 @@ public:
     double error_local_1, error_local_2, error_global;
 
     {
+      matrix_free.initialize_dof_vector(diagonal_global);
       MatrixFreeTools::compute_diagonal<dim,
                                         fe_degree,
                                         n_points,
@@ -118,6 +119,7 @@ public:
 
     {
       VectorType diagonal_global;
+      matrix_free.initialize_dof_vector(diagonal_global);
       MatrixFreeTools::compute_diagonal(matrix_free,
                                         diagonal_global,
                                         &Test::cell_function,

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.