GEOS
HypreSolver.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 Total, S.A
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
20 #ifndef GEOS_LINEARALGEBRA_INTERFACES_HYPRESOLVER_HPP_
21 #define GEOS_LINEARALGEBRA_INTERFACES_HYPRESOLVER_HPP_
22 
26 
27 namespace geos
28 {
29 
30 class DofManager;
31 
33 struct HypreSolverWrapper;
34 
38 class HypreSolver final : public LinearSolverBase< HypreInterface >
39 {
40 public:
41 
44 
50 
54  virtual ~HypreSolver() override;
55 
59  virtual void setup( HypreMatrix const & mat ) override;
60 
64  virtual void apply( HypreVector const & src,
65  HypreVector & dst ) const override;
66 
70  virtual void solve( HypreVector const & rhs,
71  HypreVector & sol ) const override;
72 
76  virtual void clear() override;
77 
78 private:
79 
86  int doSolve( HypreVector const & rhs, HypreVector & sol ) const;
87 
88  using Base::m_params;
89  using Base::m_result;
90 
92  HyprePreconditioner m_precond;
93 
95  std::unique_ptr< HypreSolverWrapper > m_solver;
96 };
97 
98 } // end geos namespace
99 
100 #endif /* HYPRESOLVER_HPP_ */
Wrapper class for hypre's ParCSRMatrix.
Definition: HypreMatrix.hpp:56
Wrapper around hypre-based preconditioners.
This class creates and provides basic support for Hypre solvers.
Definition: HypreSolver.hpp:39
virtual ~HypreSolver() override
Destructor.
HypreSolver(LinearSolverParameters parameters)
Solver constructor, with parameter list reference.
virtual void solve(HypreVector const &rhs, HypreVector &sol) const override
Solve preconditioned system.
virtual void setup(HypreMatrix const &mat) override
Compute the preconditioner from a matrix.
virtual void clear() override
Clean up the preconditioner setup.
virtual void apply(HypreVector const &src, HypreVector &dst) const override
Apply operator to a vector, dst = this(src).
Wrapper class for hypre's ParVector.
Definition: HypreVector.hpp:51
Simple interface for linear solvers that allows to extract solution results.
LinearSolverResult m_result
Result of most recent solve (status, timings)
LinearSolverParameters m_params
Parameters for the solver.
LinearSolverParameters const & parameters() const
Set of parameters for a linear solver or preconditioner.