All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
LinearSolverFactory.hpp
1 /*
2  Copyright 2012 SINTEF ICT, Applied Mathematics.
3 
4  This file is part of the Open Porous Media project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef OPM_LINEARSOLVERFACTORY_HEADER_INCLUDED
21 #define OPM_LINEARSOLVERFACTORY_HEADER_INCLUDED
22 
23 
24 #include <opm/core/linalg/LinearSolverInterface.hpp>
25 #include <memory>
26 
27 namespace Opm
28 {
29 
30  class ParameterGroup;
31 
32 
38  {
39  public:
42 
58  LinearSolverFactory(const ParameterGroup& param);
59 
61  virtual ~LinearSolverFactory();
62 
64 
74  virtual LinearSolverReport solve(const int size,
75  const int nonzeros,
76  const int* ia,
77  const int* ja,
78  const double* sa,
79  const double* rhs,
80  double* solution,
81  const boost::any& add=boost::any()) const;
82 
86  virtual void setTolerance(const double tol);
87 
91  virtual double getTolerance() const;
92 
93  private:
94  std::shared_ptr<LinearSolverInterface> solver_;
95  };
96 
97 
98 } // namespace Opm
99 
100 
101 #endif // OPM_LINEARSOLVERFACTORY_HEADER_INCLUDED
Struct for reporting data about the solution process back to the caller.
Definition: LinearSolverInterface.hpp:41
Abstract interface for linear solvers.
Definition: LinearSolverInterface.hpp:32
virtual ~LinearSolverFactory()
Destructor.
Definition: LinearSolverFactory.cpp:108
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
LinearSolverFactory()
Default constructor.
Definition: LinearSolverFactory.cpp:46
virtual void setTolerance(const double tol)
Set tolerance for the linear solver.
Definition: LinearSolverFactory.cpp:128
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 &add=boost::any()) const
Solve a linear system, with a matrix given in compressed sparse row format.
Definition: LinearSolverFactory.cpp:116
virtual double getTolerance() const
Get tolerance for the linear solver.
Definition: LinearSolverFactory.cpp:133
ParameterGroup is a class that is used to provide run-time parameters.
Definition: ParameterGroup.hpp:81
Concrete class encapsulating any available linear solver.
Definition: LinearSolverFactory.hpp:37