From: bangerth Date: Fri, 18 Jan 2013 04:25:34 +0000 (+0000) Subject: New test. Like the ILU, the test -- surprisingly -- doesn't actually show that the... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b07883f447c241e8b68f3586e2868cc068410e3;p=dealii-svn.git New test. Like the ILU, the test -- surprisingly -- doesn't actually show that the decomposition we compute is exact, even if we take into account *all* entries of the matrix. That appears to be a pre-existing problem, though, and one I won't investigate today. git-svn-id: https://svn.dealii.org/trunk@28115 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/lac/sparse_mic.cc b/tests/lac/sparse_mic.cc new file mode 100644 index 0000000000..b7ce0edbe4 --- /dev/null +++ b/tests/lac/sparse_mic.cc @@ -0,0 +1,125 @@ +//---------------------------- sparse_ilu.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2008, 2013 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. +// +//---------------------------- sparse_ilu.cc --------------------------- + + +// make sure that the SparseMIC applied with infinite fill-in +// generates the exact inverse matrix + +#include "../tests.h" +#include +#include +#include +#include +#include +#include "testmatrix.h" +#include +#include +#include +#include + +//TODO:[WB] find test that is less sensitive to floating point accuracy + +int main() +{ + std::ofstream logfile("sparse_mic/output"); + deallog << std::fixed; + deallog << std::setprecision(3); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + + for (unsigned int size=4; size <= 16; size *= 2) + { + unsigned int dim = (size-1)*(size-1); + + deallog << "Size " << size << " Unknowns " << dim << std::endl; + + // Make matrix + FDMatrix testproblem(size, size); + SparsityPattern structure(dim, dim, dim); + // testproblem.five_point_structure(structure); + for (unsigned int i=0; i A(structure); + testproblem.five_point(A); + + + for (unsigned int test=0; test<2; ++test) + { + deallog << "Test " << test << std::endl; + + // generate sparse ILU. + // + // for test 1, test with + // full pattern. for test + // 2, test with same + // pattern as A + SparsityPattern mic_pattern (dim, dim, dim); + switch (test) + { + case 0: + for (unsigned int i=0; i mic (mic_pattern); + mic.decompose (A); + + // now for three test vectors v + // determine norm of + // (I-BA)v, where B is MIC of A. + // since matrix is symmetric, + // likewise test for right + // preconditioner + Vector v(dim); + Vector tmp1(dim), tmp2(dim); + for (unsigned int i=0; i<3; ++i) + { + for (unsigned int j=0; j