GEOS
MsrsbLevelBuilderBase.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2018-2019 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2019 The Board of Trustees of the Leland Stanford Junior University
7  * Copyright (c) 2018-2019 Total, S.A
8  * Copyright (c) 2019- GEOS/GEOSX Contributors
9  * All right reserved
10  *
11  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
12  * ------------------------------------------------------------------------------------------------------------
13  */
14 
19 #ifndef GEOS_LINEARALGEBRA_MULTISCALE_MSRSBLEVELBUILDERBASE_HPP
20 #define GEOS_LINEARALGEBRA_MULTISCALE_MSRSBLEVELBUILDERBASE_HPP
21 
22 #include "linearAlgebra/common/PreconditionerBase.hpp"
26 
27 namespace geos
28 {
29 namespace multiscale
30 {
31 
36 template< typename LAI >
38 {
39 public:
40 
43 
45  using Vector = typename Base::Vector;
46 
48  using Matrix = typename Base::Matrix;
49 
51  using Operator = typename Base::Operator;
52 
58  explicit MsrsbLevelBuilderBase( string name, LinearSolverParameters params );
59 
60  virtual Matrix const & prolongation() const override
61  {
62  return m_prolongation;
63  }
64 
65  virtual Operator const & restriction() const override
66  {
67  return *m_restriction;
68  }
69 
70  virtual Matrix const & matrix() const override
71  {
72  return m_matrix;
73  }
74 
75  virtual PreconditionerBase< LAI > const * presmoother() const override
76  {
77  return m_preSmoother.get();
78  }
79 
84  {
85  return m_preSmoother.get();
86  }
87 
88  virtual PreconditionerBase< LAI > const * postsmoother() const override
89  {
90  return m_postSmoother.get();
91  }
92 
97  {
98  return m_postSmoother.get();
99  }
100 
105 
109  multiscale::DofManager const & dofManager() const { return m_dofManager; }
110 
111  virtual void compute( Matrix const & fineMatrix ) override;
112 
118  virtual bool updateProlongation( Matrix const & fineMatrix ) = 0;
119 
120 protected:
121 
122  using Base::m_params;
123  using Base::m_name;
124 
127 
130 
132  std::unique_ptr< Operator > m_restriction;
133 
136 
139 
141  std::unique_ptr< PreconditionerBase< LAI > > m_preSmoother;
142 
144  std::unique_ptr< PreconditionerBase< LAI > > m_postSmoother;
145 };
146 
147 } // multiscale
148 } // geos
149 
150 #endif //GEOS_LINEARALGEBRA_MULTISCALE_MSRSBLEVELBUILDERBASE_HPP
Common interface for preconditioning operators.
Degree-of-freedom manager that works with multiscale mesh levels.
Definition: DofManager.hpp:37
Base class for level builder implementations.
typename LAI::ParallelVector Vector
Alias for vector type.
typename LAI::ParallelMatrix Matrix
Alias for matrix type.
LinearSolverParameters m_params
Linear solver top-level parameters.
LinearOperator< Vector > Operator
Alias for operator type.
Base class for MsRSB level builders.
virtual void compute(Matrix const &fineMatrix) override
Compute the current level.
virtual PreconditionerBase< LAI > const * presmoother() const override
virtual PreconditionerBase< LAI > const * postsmoother() const override
virtual bool updateProlongation(Matrix const &fineMatrix)=0
Update current level's prolongation using a new previous level matrix.
multiscale::DofManager m_dofManager
DofManager for the matrix.
multiscale::DofManager const & dofManager() const
MsrsbLevelBuilderBase(string name, LinearSolverParameters params)
Constructor.
std::unique_ptr< Operator > m_restriction
Restriction (kept as abstract operator to allow for memory efficiency, e.g. when R = P^T)
virtual Matrix const & matrix() const override
typename Base::Operator Operator
Alias for operator type.
PreconditionerBase< LAI > * postsmoother()
virtual Matrix const & prolongation() const override
MsrsbLevelBuilderBase const * m_fineLevel
Pointer to the fine level.
std::unique_ptr< PreconditionerBase< LAI > > m_postSmoother
Post-smoothing operator.
virtual Operator const & restriction() const override
std::unique_ptr< PreconditionerBase< LAI > > m_preSmoother
Pre-smoothing operator.
Set of parameters for a linear solver or preconditioner.