CSRMatrixUmfpackSolver.hpp
Go to the documentation of this file.
1 /*===========================================================================
2 //
3 // File: CSRMatrixUmfpackSolver.hpp
4 //
5 // Created: 2011-10-03 17:27:26+0200
6 //
7 // Authors: Ingeborg S. Ligaarden <Ingeborg.Ligaarden@sintef.no>
8 // Jostein R. Natvig <Jostein.R.Natvig@sintef.no>
9 // Halvor M. Nilsen <HalvorMoll.Nilsen@sintef.no>
10 // Atgeirr F. Rasmussen <atgeirr@sintef.no>
11 // Bård Skaflestad <Bard.Skaflestad@sintef.no>
12 //
13 //==========================================================================*/
14 
15 
16 /*
17  Copyright 2011 SINTEF ICT, Applied Mathematics.
18  Copyright 2011 Statoil ASA.
19 
20  This file is part of the Open Porous Media Project (OPM).
21 
22  OPM is free software: you can redistribute it and/or modify
23  it under the terms of the GNU General Public License as published by
24  the Free Software Foundation, either version 3 of the License, or
25  (at your option) any later version.
26 
27  OPM is distributed in the hope that it will be useful,
28  but WITHOUT ANY WARRANTY; without even the implied warranty of
29  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  GNU General Public License for more details.
31 
32  You should have received a copy of the GNU General Public License
33  along with OPM. If not, see <http://www.gnu.org/licenses/>.
34 */
35 
36 #ifndef OPM_CSRMATRIXUMFPACKSOLVER_HPP_HEADER
37 #define OPM_CSRMATRIXUMFPACKSOLVER_HPP_HEADER
38 
40 #include <opm/common/ErrorMacros.hpp>
41 
42 namespace Opm
43 {
44  namespace ImplicitTransportLinAlgSupport
45  {
46 
48  {
49  public:
50 
51 
52  template <class Vector>
53  void
54  solve(const struct CSRMatrix* A,
55  const Vector b,
56  Vector x)
57  {
58 #if HAVE_SUITESPARSE_UMFPACK_H
59  call_UMFPACK(const_cast<CSRMatrix*>(A), b, x);
60 #else
61  OPM_THROW(std::runtime_error, "Cannot use implicit transport solver without UMFPACK. "
62  "Reconfigure opm-core with SuiteSparse/UMFPACK support and recompile.");
63 #endif
64  }
65 
66 
67  template <class Vector>
68  void
69  solve(const struct CSRMatrix& A,
70  const Vector& b,
71  Vector& x)
72  {
73 #if HAVE_SUITESPARSE_UMFPACK_H
74  call_UMFPACK(const_cast<CSRMatrix*>(&A), &b[0], &x[0]);
75 #else
76  OPM_THROW(std::runtime_error, "Cannot use implicit transport solver without UMFPACK. "
77  "Reconfigure opm-core with SuiteSparse/UMFPACK support and recompile.");
78 #endif
79  }
80 
81 
82  }; // class CSRMatrixUmfpackSolver
83 
84  } // namespace ImplicitTransportLinAlgSupport
85 } // namespace Opm
86 
87 #endif /* OPM_CSRMATRIXUMFPACKSOLVER_HPP_HEADER */
Definition: sparse_sys.h:38
void call_UMFPACK(struct CSRMatrix *A, const double *b, double *x)
Definition: CSRMatrixUmfpackSolver.hpp:47
Definition: AnisotropicEikonal.hpp:43
void solve(const struct CSRMatrix *A, const Vector b, Vector x)
Definition: CSRMatrixUmfpackSolver.hpp:54
void solve(const struct CSRMatrix &A, const Vector &b, Vector &x)
Definition: CSRMatrixUmfpackSolver.hpp:69