All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
LinearSolverPetsc.hpp
1 /*
2  Copyright 2014 SINTEF ICT, Applied Mathematics.
3  Copyright 2014 STATOIL ASA.
4 
5  This file is part of the Open Porous Media project (OPM).
6 
7  OPM is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  OPM is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with OPM. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef OPM_LINEARSOLVERPETSC_HEADER_INCLUDED
22 #define OPM_LINEARSOLVERPETSC_HEADER_INCLUDED
23 #include <opm/core/linalg/LinearSolverInterface.hpp>
24 #include <opm/core/utility/parameters/ParameterGroup.hpp>
25 #include <string>
26 
27 namespace Opm
28 {
29 
30 
33  {
34  public:
41 
45  LinearSolverPetsc(const ParameterGroup& param);
46 
48  virtual ~LinearSolverPetsc();
49 
51 
61  virtual LinearSolverReport solve(const int size,
62  const int nonzeros,
63  const int* ia,
64  const int* ja,
65  const double* sa,
66  const double* rhs,
67  double* solution,
68  const boost::any&) const;
69 
72  virtual void setTolerance(const double tol);
73 
76  virtual double getTolerance() const;
77  private:
78  std::string ksp_type_;
79  std::string pc_type_;
80  int ksp_view_;
81  double rtol_;
82  double atol_;
83  double dtol_;
84  int maxits_;
85  };
86 
87 
88 } // namespace Opm
89 
90 
91 
92 #endif // OPM_LINEARSOLVERPETSC_HEADER_INCLUDED
Struct for reporting data about the solution process back to the caller.
Definition: LinearSolverInterface.hpp:41
LinearSolverPetsc()
Default constructor.
Abstract interface for linear solvers.
Definition: LinearSolverInterface.hpp:32
virtual double getTolerance() const
Get tolerance ofthe linear solver.
Definition: LinearSolverPetsc.cpp:283
virtual ~LinearSolverPetsc()
Destructor.
Definition: LinearSolverPetsc.cpp:246
virtual LinearSolverReport solve(const int size, const int nonzeros, const int *ia, const int *ja, const double *sa, const double *rhs, double *solution, const boost::any &) const
Solve a linear system, with a matrix given in compressed sparse row format.
Definition: LinearSolverPetsc.cpp:253
LinearSolverReport solve(const CSRMatrix *A, const double *rhs, double *solution) const
Solve a linear system, with a matrix given in compressed sparse row format.
Definition: LinearSolverInterface.cpp:37
virtual void setTolerance(const double tol)
Set tolerance for the residual in dune istl linear solver.
Definition: LinearSolverPetsc.cpp:279
ParameterGroup is a class that is used to provide run-time parameters.
Definition: ParameterGroup.hpp:81
Concrete class encapsulating some Petsc linear solvers.
Definition: LinearSolverPetsc.hpp:32