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 Total, S.A
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 GEOSX_LINEARALGEBRA_SOLVERS_SEPARATECOMPONENTPRECONDITIONER_HPP_
20 #define GEOSX_LINEARALGEBRA_SOLVERS_SEPARATECOMPONENTPRECONDITIONER_HPP_
21 
22 #include "PreconditionerBase.hpp"
23 
24 #include <memory>
25 
26 namespace geosx
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 
58  virtual ~SeparateComponentPreconditioner() override;
59 
61 
62  virtual void compute( Matrix const & mat, DofManager const & dofManager ) override;
63 
71  virtual void apply( Vector const & src, Vector & dst ) const override;
72 
73  virtual void clear() override;
74 
79  Matrix const & getPrecondMatrix() const
80  {
81  return m_matSC;
82  }
83 
89  {
90  return *m_precond;
91  }
92 
93 private:
94 
96  localIndex m_numComp;
97 
99  Matrix m_matSC;
100 
102  std::unique_ptr< PreconditionerBase< LAI > > m_precond;
103 };
104 
105 }
106 
107 #endif //GEOSX_LINEARALGEBRA_SOLVERS_SEPARATECOMPONENTPRECONDITIONER_HPP_
Common interface for preconditioning operators.
virtual void compute(Matrix const &mat, DofManager const &dofManager) override
Compute the preconditioner from a matrix.
virtual ~SeparateComponentPreconditioner() override
Destructor.
Separate component filter implemented as a compound preconditioner.
SeparateComponentPreconditioner(localIndex const numComp, std::unique_ptr< PreconditionerBase< LAI > > precond)
Constructor.
The DoFManager is responsible for allocating global dofs, constructing sparsity patterns, and generally simplifying the interaction between PhysicsSolvers and linear algebra operations.
Definition: DofManager.hpp:42
typename LAI::ParallelMatrix Matrix
Alias for matrix type.
virtual void apply(Vector const &src, Vector &dst) const override
Apply operator to a vector.
PreconditionerBase< LAI > const & getNestedPrecond() const
Access to the nested preconditioner.
std::ptrdiff_t localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:125
virtual void clear() override
Clean up the preconditioner setup.
Matrix const & getPrecondMatrix() const
Access the preconditioning matrix.
Abstract base class for linear operators.
typename Base::Vector Vector
Alias for vector type.