GEOS
HyprePreconditioner.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_HYPREPRECONDITIONER_HPP_
21 #define GEOS_LINEARALGEBRA_INTERFACES_HYPREPRECONDITIONER_HPP_
22 
23 #include "common/PreconditionerBase.hpp"
26 
27 #include <memory>
28 
29 namespace geos
30 {
31 
33 struct HyprePrecWrapper;
34 
36 struct HypreMGRData;
37 
39 struct HypreNullSpace;
40 
44 class HyprePreconditioner final : public PreconditionerBase< HypreInterface >
45 {
46 public:
47 
50 
52  using Base::setup;
53 
59 
66  arrayView1d< HypreVector > const & nearNullKernel );
67 
71  virtual ~HyprePreconditioner() override;
72 
77  virtual void setup( Matrix const & mat ) override;
78 
86  virtual void apply( Vector const & src, Vector & dst ) const override;
87 
88  virtual void clear() override;
89 
96  HyprePrecWrapper const & unwrapped() const;
97 
98 private:
99 
104  void create( DofManager const * const dofManager );
105 
111  HypreMatrix const & setupPreconditioningMatrix( HypreMatrix const & mat );
112 
114  LinearSolverParameters m_params;
115 
117  HypreMatrix m_precondMatrix;
118 
120  std::unique_ptr< HyprePrecWrapper > m_precond;
121 
123  std::unique_ptr< HypreMGRData > m_mgrData;
124 
126  std::unique_ptr< HypreNullSpace > m_nullSpace;
127 };
128 
129 }
130 
131 #endif //GEOS_LINEARALGEBRA_INTERFACES_HYPREPRECONDITIONER_HPP_
The DoFManager is responsible for allocating global dofs, constructing sparsity patterns,...
Definition: DofManager.hpp:44
Wrapper class for hypre's ParCSRMatrix.
Definition: HypreMatrix.hpp:56
Wrapper around hypre-based preconditioners.
virtual ~HyprePreconditioner() override
Destructor.
virtual void clear() override
Clean up the preconditioner setup.
HyprePrecWrapper const & unwrapped() const
Access the underlying implementation.
HyprePreconditioner(LinearSolverParameters params)
Constructor.
HyprePreconditioner(LinearSolverParameters params, arrayView1d< HypreVector > const &nearNullKernel)
Constructor.
virtual void apply(Vector const &src, Vector &dst) const override
Apply operator to a vector.
virtual void setup(Matrix const &mat) override
Compute the preconditioner from a matrix.
LAI::ParallelVector Vector
Alias for template parameter.
Common interface for preconditioning operators.
virtual void setup(Matrix const &mat)
Compute the preconditioner from a matrix.
typename LAI::ParallelMatrix Matrix
Alias for matrix type.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:180
Container for hypre preconditioner function pointers.
Definition: HypreUtils.hpp:54
Set of parameters for a linear solver or preconditioner.