// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root // SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- // vi: set et ts=4 sw=2 sts=2: #include #include #include #include #include #include #include #include "laplacian.hh" int main(int argc, char** argv) { const int BS=1; int N=100; if(argc>1) N = atoi(argv[1]); std::cout << "testing for N=" << N << " BS=" << BS << std::endl; typedef Dune::FieldMatrix MatrixBlock; typedef Dune::BCRSMatrix BCRSMat; typedef Dune::FieldVector VectorBlock; typedef Dune::BlockVector BVector; typedef Dune::MatrixAdapter Operator; BCRSMat mat; Operator fop(mat); BVector b(N*N), x(N*N); setupLaplacian(mat,N); b=0; x=100; Dune::InverseOperatorResult res, res1; x=1; mat.mv(x, b); x=0; Dune::SeqJac prec0(mat, 1,1.0); Dune::LoopSolver solver0(fop, prec0, 1e-3,10,0); Dune::InverseOperator2Preconditioner> prec(solver0); Dune::LoopSolver solver(fop, prec, 1e-8,10,2); solver.apply(x,b,res); x=1; mat.mv(x, b); x=0; std::cout<<"solver1"< solver1(fop, prec0, 1e-8,100,2); solver1.apply(x,b,res1); if(res1.iterations!=res.iterations*10) { std::cerr<<"Convergence rates do not match!"<