Debian Codegraph @

dune/istl/eigenvalue/test/cond2test.cc

raw
1 // SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
2 // SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3
4 #include <iostream>
5
6 #include <dune/common/fmatrix.hh>
7 #include <dune/common/fvector.hh>
8 #include <dune/common/timer.hh>
9 #include <dune/istl/bvector.hh>
10
11 #include "../../test/laplacian.hh"
12 #include "matrixinfo.hh"
13
14
15 int main (int argc, char** argv)
16 {
17 try
18 {
19 typedef double FIELD_TYPE;
20
21 static const int BS = 1;
22 std::size_t N = 60;
23
24 if (argc > 1)
25 N = atoi(argv[1]);
26 std::cout << "testing for N = " << N << ", BS = " << BS << std::endl;
27
28 typedef Dune::FieldMatrix<FIELD_TYPE,BS,BS> MatrixBlock;
29 typedef Dune::BCRSMatrix<MatrixBlock> BCRSMat;
30
31 BCRSMat mat;
32 setupLaplacian(mat,N);
33
34 Dune::Timer watch;
35
36 const bool verbose = true;
37 const unsigned int arppp_a_verbosity_level = 2;
38 const unsigned int pia_verbosity_level = 1;
39 MatrixInfo<BCRSMat> matrixInfo
40 (mat,verbose,arppp_a_verbosity_level,pia_verbosity_level);
41
42 watch.reset();
43 matrixInfo.getCond2(true);
44 std::cout << "computation of condition number took " << watch.elapsed()
45 <<" seconds" << std::endl;
46
47 watch.reset();
48 matrixInfo.getCond2(false);
49 std::cout << "computation of condition number took " << watch.elapsed()
50 <<" seconds" << std::endl;
51
52 return 0;
53 }
54 catch (std::exception& e)
55 {
56 std::cout << "ERROR: " << e.what() << std::endl;
57 return 1;
58 }
59 catch (...)
60 {
61 std::cerr << "Unknown exception thrown!" << std::endl;
62 return 1;
63 }
64 }