From eeeb2cb99e353b37b5c4599c4e3d5937bf709084 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 17 Feb 2006 00:00:54 +0000 Subject: [PATCH] a test that presently fails because minres is not equipped to deal with block systems git-svn-id: https://svn.dealii.org/trunk@12392 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/lac/Makefile | 4 +- tests/lac/block_minres.cc | 84 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 tests/lac/block_minres.cc diff --git a/tests/lac/Makefile b/tests/lac/Makefile index 3cae089c98..de44341992 100644 --- a/tests/lac/Makefile +++ b/tests/lac/Makefile @@ -1,6 +1,6 @@ ############################################################ # $Id$ -# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors +# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors ############################################################ ############################################################ @@ -26,7 +26,7 @@ tests_x = vector-vector \ block_vector block_vector_iterator block_matrices \ matrix_lib matrix_out \ solver eigen \ - sparse_ilu sparse_ilu_t lapack + sparse_ilu sparse_ilu_t lapack block_minres # from above list of regular expressions, generate the real set of diff --git a/tests/lac/block_minres.cc b/tests/lac/block_minres.cc new file mode 100644 index 0000000000..ea0f9eafde --- /dev/null +++ b/tests/lac/block_minres.cc @@ -0,0 +1,84 @@ +//---------------------------- block_matrices.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2006 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------- block_matrices.cc --------------------------- + +// MinRes can't deal with block systems at the time of writing this test + + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +int main() +{ + std::ofstream logfile("block_minres/output"); + logfile.precision(2); + deallog.attach(logfile); + + + // assemble a 2x2 block identity + // matrix + BlockSparsityPattern block_structure(2,2); + block_structure.block(0,0).reinit (2,2,1); + block_structure.block(0,1).reinit (2,2,1); + block_structure.block(1,0).reinit (2,2,1); + block_structure.block(1,1).reinit (2,2,1); + block_structure.collect_sizes (); + + block_structure.add (0,0); + block_structure.add (1,1); + block_structure.add (2,2); + block_structure.add (3,3); + block_structure.compress(); + + BlockSparseMatrix block_A(block_structure); + block_A.add(0,0,1); + block_A.add(1,1,1); + block_A.add(2,2,1); + block_A.add(3,3,1); + + // block vector with 2 blocks of 2 + // components each + BlockVector a (2,2); + a(0) = 2; + a(1) = 3; + a(2) = 4; + a(3) = 5; + + // this should work (check that + // sizes of objects are all + // correct) + BlockVector b (2,2); + block_A.vmult (b,a); + + // and while at it also check + // whether the result was correct + Assert (b(0) == 2, ExcInternalError()); + Assert (b(1) == 3, ExcInternalError()); + Assert (b(2) == 4, ExcInternalError()); + Assert (b(3) == 5, ExcInternalError()); + + // now solve with MinRes. This + // didn't work at one point + SolverControl solver_control (1000, 1e-12); + SolverMinRes > minres (solver_control); + + minres.solve (block_A, b, a, PreconditionIdentity()); +} -- 2.39.5