GEOS
SeparateComponentPreconditioner.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_SOLVERS_SEPARATECOMPONENTPRECONDITIONER_HPP_
21 #define GEOS_LINEARALGEBRA_SOLVERS_SEPARATECOMPONENTPRECONDITIONER_HPP_
22 
23 #include "linearAlgebra/common/PreconditionerBase.hpp"
24 
25 #include <memory>
26 
27 namespace geos
28 {
29 
34 template< typename LAI >
36 {
37 public:
38 
41 
43  using Vector = typename Base::Vector;
44 
46  using Matrix = typename Base::Matrix;
47 
54  std::unique_ptr< PreconditionerBase< LAI > > precond );
55 
60 
61  virtual void setup( Matrix const & mat ) override;
62 
70  virtual void apply( Vector const & src, Vector & dst ) const override;
71 
72  virtual void clear() override;
73 
74  virtual bool hasPreconditionerMatrix() const override
75  {
76  return m_precond->hasPreconditionerMatrix();
77  }
78 
79  virtual Matrix const & preconditionerMatrix() const override
80  {
81  return m_precond->preconditionerMatrix();
82  }
83 
88  {
90  return m_matSC;
91  }
92 
98  {
99  return *m_precond;
100  }
101 
102 private:
103 
105  localIndex m_numComp;
106 
108  Matrix m_matSC;
109 
111  std::unique_ptr< PreconditionerBase< LAI > > m_precond;
112 };
113 
114 }
115 
116 #endif //GEOS_LINEARALGEBRA_SOLVERS_SEPARATECOMPONENTPRECONDITIONER_HPP_
Abstract base class for linear operators.
Common interface for preconditioning operators.
bool ready() const
Chech if preconditioner is ready to use.
typename Base::Vector Vector
Alias for vector type.
typename LAI::ParallelMatrix Matrix
Alias for matrix type.
Separate component filter implemented as a compound preconditioner.
virtual Matrix const & preconditionerMatrix() const override
Access the preconditioner in matrix form (whenever available). It must be overridden by the specific ...
SeparateComponentPreconditioner(localIndex const numComp, std::unique_ptr< PreconditionerBase< LAI > > precond)
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.
virtual bool hasPreconditionerMatrix() const override
Check whether the preconditioner is available in matrix (explicit) form.
virtual void setup(Matrix const &mat) override
Compute the preconditioner from a matrix.
virtual ~SeparateComponentPreconditioner() override
Destructor.
PreconditionerBase< LAI > const & innerPrecond() const
Access to the nested preconditioner.
#define GEOS_LAI_ASSERT(expr)
Definition: common.hpp:35
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:85