GEOS
LevelBuilderBase.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_LEVELBUILDERBASE_HPP_
20 #define GEOS_LINEARALGEBRA_MULTISCALE_LEVELBUILDERBASE_HPP_
21 
22 #include "common/DataTypes.hpp"
25 #include "linearAlgebra/common/PreconditionerBase.hpp"
27 #include "mesh/MeshLevel.hpp"
28 
29 #include <memory>
30 
31 namespace geos
32 {
33 namespace multiscale
34 {
35 
40 template< typename LAI >
42 {
43 public:
44 
46  using Vector = typename LAI::ParallelVector;
47 
49  using Matrix = typename LAI::ParallelMatrix;
50 
53 
60  static std::unique_ptr< LevelBuilderBase< LAI > >
61  create( string name, LinearSolverParameters params );
62 
68  explicit LevelBuilderBase( string name, LinearSolverParameters params );
69 
73  virtual ~LevelBuilderBase() = default;
74 
78  virtual Operator const & prolongation() const = 0;
79 
83  virtual Operator const & restriction() const = 0;
84 
88  virtual Matrix const & matrix() const = 0;
89 
93  virtual Operator const * presmoother() const = 0;
94 
98  virtual Operator const * postsmoother() const = 0;
99 
106  virtual void initializeFineLevel( DomainPartition & domain,
107  geos::DofManager const & dofManager,
108  MPI_Comm const & comm ) = 0;
109 
116  Matrix const & fineMatrix ) = 0;
117 
122  virtual void compute( Matrix const & fineMatrix ) = 0;
123 
128  virtual std::unique_ptr< PreconditionerBase< LAI > > makeCoarseSolver() const = 0;
129 
130 protected:
131 
133  string m_name;
134 
137 };
138 
139 } // namespace multiscale
140 } // namespace geos
141 
142 #endif //GEOS_LINEARALGEBRA_MULTISCALE_LEVELBUILDERBASE_HPP_
The DoFManager is responsible for allocating global dofs, constructing sparsity patterns,...
Definition: DofManager.hpp:45
Partition of the decomposed physical domain. It also manages the connexion information to its neighbo...
Base class for level builder implementations.
typename LAI::ParallelVector Vector
Alias for vector type.
typename LAI::ParallelMatrix Matrix
Alias for matrix type.
virtual Operator const & restriction() const =0
virtual void initializeFineLevel(DomainPartition &domain, geos::DofManager const &dofManager, MPI_Comm const &comm)=0
Initialize the finest level (level 0).
LevelBuilderBase(string name, LinearSolverParameters params)
Constructor.
static std::unique_ptr< LevelBuilderBase< LAI > > create(string name, LinearSolverParameters params)
Factory interface to create level instances.
virtual void compute(Matrix const &fineMatrix)=0
Compute the current level.
virtual Matrix const & matrix() const =0
virtual std::unique_ptr< PreconditionerBase< LAI > > makeCoarseSolver() const =0
Instantiate coarsest level solver.
LinearSolverParameters m_params
Linear solver top-level parameters.
virtual Operator const * presmoother() const =0
virtual void initializeCoarseLevel(LevelBuilderBase< LAI > &fineLevel, Matrix const &fineMatrix)=0
Initialize a coarse level (levels 1 and above).
virtual Operator const * postsmoother() const =0
virtual ~LevelBuilderBase()=default
Destructor.
virtual Operator const & prolongation() const =0
LAInterface::ParallelMatrix ParallelMatrix
Alias for ParallelMatrix.
LAInterface::ParallelVector ParallelVector
Alias for ParallelVector.
Set of parameters for a linear solver or preconditioner.