GEOSX
TrilinosPreconditioner.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
7  * Copyright (c) 2018-2020 TotalEnergies
8  * Copyright (c) 2019- GEOSX Contributors
9  * All rights reserved
10  *
11  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
12  * ------------------------------------------------------------------------------------------------------------
13  */
14 
19 #ifndef GEOS_LINEARALGEBRA_INTERFACES_TRILINOSPRECONDITIONER_HPP_
20 #define GEOS_LINEARALGEBRA_INTERFACES_TRILINOSPRECONDITIONER_HPP_
21 
22 #include "common/PreconditionerBase.hpp"
25 
26 #include <memory>
27 
28 class Epetra_Operator;
29 
30 namespace geos
31 {
32 
36 class TrilinosPreconditioner final : public PreconditionerBase< TrilinosInterface >
37 {
38 public:
39 
42 
44  using Vector = typename Base::Vector;
45 
47  using Matrix = typename Base::Matrix;
48 
54 
61  array1d< Vector > const & nearNullKernel );
62 
66  virtual ~TrilinosPreconditioner() override;
67 
72  virtual void setup( Matrix const & mat ) override;
73 
81  virtual void apply( Vector const & src, Vector & dst ) const override;
82 
83  virtual void clear() override;
84 
89  Epetra_Operator const & unwrapped() const;
90 
94  Epetra_Operator & unwrapped();
95 
96 private:
97 
103  EpetraMatrix const & setupPreconditioningMatrix( EpetraMatrix const & mat );
104 
106  LinearSolverParameters m_params;
107 
110  EpetraMatrix m_precondMatrix;
111 
113  std::unique_ptr< Epetra_Operator > m_precond;
114 
116  array2d< real64 > m_nullSpacePointer;
117 };
118 
119 }
120 
121 #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:232
Array< T, 1 > array1d
Alias for 1D array.
Definition: DataTypes.hpp:216
Set of parameters for a linear solver or preconditioner.