GEOSX
SeparateComponentPreconditioner.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_SOLVERS_SEPARATECOMPONENTPRECONDITIONER_HPP_
20 #define GEOS_LINEARALGEBRA_SOLVERS_SEPARATECOMPONENTPRECONDITIONER_HPP_
21 
22 #include "linearAlgebra/common/PreconditionerBase.hpp"
23 
24 #include <memory>
25 
26 namespace geos
27 {
28 
33 template< typename LAI >
35 {
36 public:
37 
40 
42  using Vector = typename Base::Vector;
43 
45  using Matrix = typename Base::Matrix;
46 
53  std::unique_ptr< PreconditionerBase< LAI > > precond );
54 
59 
60  virtual void setup( Matrix const & mat ) override;
61 
69  virtual void apply( Vector const & src, Vector & dst ) const override;
70 
71  virtual void clear() override;
72 
73  virtual bool hasPreconditionerMatrix() const override
74  {
75  return m_precond->hasPreconditionerMatrix();
76  }
77 
78  virtual Matrix const & preconditionerMatrix() const override
79  {
80  return m_precond->preconditionerMatrix();
81  }
82 
87  {
89  return m_matSC;
90  }
91 
97  {
98  return *m_precond;
99  }
100 
101 private:
102 
104  localIndex m_numComp;
105 
107  Matrix m_matSC;
108 
110  std::unique_ptr< PreconditionerBase< LAI > > m_precond;
111 };
112 
113 }
114 
115 #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:33
GEOSX_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:125