OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
Amesos2BottomSolver.h
Go to the documentation of this file.
1 //
2 // Class Amesos2BottomSolver
3 // Interface to Amesos2 solvers of the Trilinos package.
4 //
5 // Copyright (c) 2017 - 2020, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
6 // All rights reserved
7 //
8 // Implemented as part of the PhD thesis
9 // "Precise Simulations of Multibunches in High Intensity Cyclotrons"
10 //
11 // This file is part of OPAL.
12 //
13 // OPAL is free software: you can redistribute it and/or modify
14 // it under the terms of the GNU General Public License as published by
15 // the Free Software Foundation, either version 3 of the License, or
16 // (at your option) any later version.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with OPAL. If not, see <https://www.gnu.org/licenses/>.
20 //
21 #ifndef AMESOS2_SOLVER_H
22 #define AMESOS2_SOLVER_H
23 
24 #include "BottomSolver.h"
25 
26 #include <Amesos2.hpp>
27 
28 #include <string>
29 
30 extern Inform* gmsg;
31 
32 template <class Level>
33 class Amesos2BottomSolver : public BottomSolver<Teuchos::RCP<amr::matrix_t>,
34  Teuchos::RCP<amr::multivector_t>,
35  Level>
36 {
37 public:
40 
41  typedef Amesos2::Solver<matrix_t, mv_t> solver_t;
42 
43 public:
44 
49  Amesos2BottomSolver(std::string solvertype = "klu2");
50 
51  void solve(const Teuchos::RCP<mv_t>& x,
52  const Teuchos::RCP<mv_t>& b);
53 
54  void setOperator(const Teuchos::RCP<matrix_t>& A,
55  Level* level_p = nullptr);
56 
57  std::size_t getNumIters();
58 
59 private:
60 
61  std::string solvertype_m;
62 
63  Teuchos::RCP<solver_t> solver_mp;
64 };
65 
66 #include "Amesos2BottomSolver.hpp"
67 
68 #endif
Inform * gmsg
Definition: Main.cpp:62
Tpetra::MultiVector< scalar_t, local_ordinal_t, global_ordinal_t, node_t > multivector_t
Tpetra::CrsMatrix< scalar_t, local_ordinal_t, global_ordinal_t, node_t > matrix_t
Amesos2::Solver< matrix_t, mv_t > solver_t
amr::multivector_t mv_t
void setOperator(const Teuchos::RCP< matrix_t > &A, Level *level_p=nullptr)
void solve(const Teuchos::RCP< mv_t > &x, const Teuchos::RCP< mv_t > &b)
std::string solvertype_m
kind of solver
Amesos2BottomSolver(std::string solvertype="klu2")
Teuchos::RCP< solver_t > solver_mp
solver instance
Definition: Inform.h:42