]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Work around an incompatibility of MatrixBlockArray with linear_operator()
authorMatthias Maier <tamiko@43-1.org>
Thu, 13 Jul 2017 19:19:12 +0000 (14:19 -0500)
committerMatthias Maier <tamiko@43-1.org>
Thu, 13 Jul 2017 19:43:05 +0000 (14:43 -0500)
include/deal.II/multigrid/mg_block_smoother.h

index 1a9c1ceb569f6b59fe47d98f1f9734e6f375e531..e6ba850c2a16d83a7f0c0d13e18b786293872a33 100644 (file)
@@ -194,8 +194,29 @@ MGSmootherBlock<MatrixType, RelaxationType, number>::initialize (const MGMatrixT
 
   for (unsigned int i=min; i<=max; ++i)
     {
-      matrices[i] = linear_operator<BlockVector<number> >(m[i]);
-      smoothers[i] = linear_operator<BlockVector<number> >(s[i]);
+      // Workaround: The matrix objects supplied to this class do not
+      // expose information how to reinitialize a vector. Therefore,
+      // populate vmult and Tvmult by hand...
+
+      matrices[i] = LinearOperator<BlockVector<number>>();
+      matrices[i].vmult = [&m, i](BlockVector<number> &v,
+                                  const BlockVector<number> &u) {
+        m[i].vmult(v, u);
+      };
+      matrices[i].Tvmult = [&m, i](BlockVector<number> &v,
+                                   const BlockVector<number> &u) {
+        m[i].Tvmult(v, u);
+      };
+
+      smoothers[i] = LinearOperator<BlockVector<number>>();
+      smoothers[i].vmult = [&s, i](BlockVector<number> &v,
+                                   const BlockVector<number> &u) {
+        s[i].vmult(v, u);
+      };
+      smoothers[i].Tvmult = [&s, i](BlockVector<number> &v,
+                                    const BlockVector<number> &u) {
+        s[i].Tvmult(v, u);
+      };
     }
 }
 

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.