From a1983b6b8ea60a41c83c5cff79ac83928b7e8c69 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 30 Dec 2019 11:24:06 -0700 Subject: [PATCH] Simplify the code a bit. In earlier versions of deal.II, the SparseDirectUMFPACK could deal with block matrices but not block vectors, and so we needed to do some copying around. This is no longer necessary. --- tests/umfpack/umfpack_09.cc | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/umfpack/umfpack_09.cc b/tests/umfpack/umfpack_09.cc index a161190fe2..5ed20f4040 100644 --- a/tests/umfpack/umfpack_09.cc +++ b/tests/umfpack/umfpack_09.cc @@ -129,21 +129,26 @@ test() solution.block(2).reinit(dof_handler.n_dofs() - 2 * (dof_handler.n_dofs() / 3)); solution.collect_sizes(); + + // Pick a solution vector + for (unsigned int j = 0; j < dof_handler.n_dofs(); ++j) + solution(j) = j + j * (i + 1) * (i + 1); + + // Then choose as rhs for the linear system the vector + // b = B*solution + // so that later the solution of the linear system Bx=b + // is again + // x = solution BlockVector x; x.reinit(solution); BlockVector b; b.reinit(solution); - for (unsigned int j = 0; j < dof_handler.n_dofs(); ++j) - solution(j) = j + j * (i + 1) * (i + 1); - B.vmult(b, solution); x = b; - Vector tmp(solution.size()); - tmp = x; - SparseDirectUMFPACK().solve(B, tmp); - x = tmp; + SparseDirectUMFPACK().solve(B, x); + // Check that we really got what we expected x -= solution; deallog << "relative norm distance = " << x.l2_norm() / solution.l2_norm() << std::endl; -- 2.39.5