GEOS
TrilinosPreconditioner.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_TRILINOSPRECONDITIONER_HPP_
21 #define GEOS_LINEARALGEBRA_INTERFACES_TRILINOSPRECONDITIONER_HPP_
22 
23 #include "common/PreconditionerBase.hpp"
26 
27 #include <memory>
28 
29 class Epetra_Operator;
30 
31 namespace geos
32 {
33 
37 class TrilinosPreconditioner final : public PreconditionerBase< TrilinosInterface >
38 {
39 public:
40 
43 
45  using Vector = typename Base::Vector;
46 
48  using Matrix = typename Base::Matrix;
49 
55 
62  array1d< Vector > const & nearNullKernel );
63 
67  virtual ~TrilinosPreconditioner() override;
68 
73  virtual void setup( Matrix const & mat ) override;
74 
82  virtual void apply( Vector const & src, Vector & dst ) const override;
83 
84  virtual void clear() override;
85 
90  Epetra_Operator const & unwrapped() const;
91 
95  Epetra_Operator & unwrapped();
96 
97 private:
98 
104  EpetraMatrix const & setupPreconditioningMatrix( EpetraMatrix const & mat );
105 
107  LinearSolverParameters m_params;
108 
111  EpetraMatrix m_precondMatrix;
112 
114  std::unique_ptr< Epetra_Operator > m_precond;
115 
117  array2d< real64 > m_nullSpacePointer;
118 };
119 
120 }
121 
122 #endif //GEOS_LINEARALGEBRA_INTERFACES_TRILINOSPRECONDITIONER_HPP_
Wrapper class for Epetra's CrsMatrix.
Common interface for preconditioning operators.
typename Base::Vector Vector
Alias for vector type.
typename LAI::ParallelMatrix Matrix
Alias for matrix type.
Wrapper around Trilinos-based preconditioners.
TrilinosPreconditioner(LinearSolverParameters params, array1d< Vector > const &nearNullKernel)
Constructor.
typename Base::Matrix Matrix
Alias for matrix type.
virtual void clear() override
Clean up the preconditioner setup.
virtual void apply(Vector const &src, Vector &dst) const override
Apply operator to a vector.
Epetra_Operator & unwrapped()
Access the underlying Epetra preconditioning operator.
virtual ~TrilinosPreconditioner() override
Destructor.
virtual void setup(Matrix const &mat) override
Compute the preconditioner from a matrix.
typename Base::Vector Vector
Alias for vector type.
TrilinosPreconditioner(LinearSolverParameters params)
Constructor.
Epetra_Operator const & unwrapped() const
Access the underlying Epetra preconditioning operator.
Array< T, 2, PERMUTATION > array2d
Alias for 2D array.
Definition: DataTypes.hpp:192
Array< T, 1 > array1d
Alias for 1D array.
Definition: DataTypes.hpp:176
Set of parameters for a linear solver or preconditioner.