GEOS
coreComponents
linearAlgebra
multiscale
MultiscalePreconditioner.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_MULTISCALEPRECONDITIONER_HPP_
20
#define GEOS_LINEARALGEBRA_MULTISCALE_MULTISCALEPRECONDITIONER_HPP_
21
22
#include "linearAlgebra/common/PreconditionerBase.hpp"
23
#include "
linearAlgebra/utilities/LinearSolverParameters.hpp
"
24
#include "mesh/MeshLevel.hpp"
25
26
#include <memory>
27
28
namespace
geos
29
{
30
31
namespace
multiscale
32
{
33
template
<
typename
LAI >
34
class
LevelBuilderBase;
35
}
36
41
template
<
typename
LAI >
42
class
MultiscalePreconditioner
:
public
PreconditionerBase
< LAI >
43
{
44
public
:
45
47
using
Base
=
PreconditionerBase< LAI >
;
48
50
using
Vector
=
typename
Base::Vector
;
51
53
using
Matrix
=
typename
Base::Matrix
;
54
56
using
Operator
=
LinearOperator< Vector >
;
57
63
MultiscalePreconditioner
(
LinearSolverParameters
params,
DomainPartition
& domain );
64
65
~
MultiscalePreconditioner
();
66
67
virtual
void
setup
(
Matrix
const
& mat )
override
;
68
76
virtual
void
apply
(
Vector
const
& src,
Vector
& dst )
const override
;
77
78
virtual
void
clear
()
override
;
79
80
private
:
81
82
void
createLevels(
Matrix
const
& mat );
83
84
void
computeLevel(
integer
const
level )
const
;
85
86
void
printLevelInfo()
const
;
87
88
void
logMessage(
integer
const
minLevel,
string
const
& msg )
const
;
89
90
struct
LevelData
91
{
92
std::unique_ptr< multiscale::LevelBuilderBase< LAI > > builder;
93
Matrix
const
*
matrix
;
94
mutable
Vector
rhs;
95
mutable
Vector
sol;
96
mutable
Vector
tmp;
97
};
98
99
LinearSolverParameters
m_params;
100
101
DomainPartition
& m_domain;
102
103
std::vector< LevelData > m_levels;
104
105
std::unique_ptr< PreconditionerBase< LAI > > m_coarse_solver;
106
107
bool
m_initialized{
false
};
108
};
109
110
}
// namespace geos
111
112
#endif
//GEOS_LINEARALGEBRA_MULTISCALE_MULTISCALEPRECONDITIONER_HPP_
geos::DomainPartition
Partition of the decomposed physical domain. It also manages the connexion information to its neighbo...
Definition:
DomainPartition.hpp:53
geos::LinearOperator
Abstract base class for linear operators.
Definition:
LinearOperator.hpp:35
geos::MultiscalePreconditioner
Multiscale preconditioner for near-elliptic and coupled problems.
Definition:
MultiscalePreconditioner.hpp:43
geos::MultiscalePreconditioner::apply
virtual void apply(Vector const &src, Vector &dst) const override
Apply operator to a vector, dst = this(src).
geos::MultiscalePreconditioner::setup
virtual void setup(Matrix const &mat) override
Compute the preconditioner from a matrix.
geos::MultiscalePreconditioner::clear
virtual void clear() override
Clean up the preconditioner setup.
geos::MultiscalePreconditioner::MultiscalePreconditioner
MultiscalePreconditioner(LinearSolverParameters params, DomainPartition &domain)
Constructor.
geos::PreconditionerBase
Common interface for preconditioning operators.
Definition:
PreconditionerBase.hpp:33
geos::PreconditionerBase::matrix
Matrix const & matrix() const
Access the matrix the preconditioner was computed from.
Definition:
PreconditionerBase.hpp:135
geos::PreconditionerBase::Vector
typename Base::Vector Vector
Alias for vector type.
Definition:
PreconditionerBase.hpp:42
geos::PreconditionerBase::Matrix
typename LAI::ParallelMatrix Matrix
Alias for matrix type.
Definition:
PreconditionerBase.hpp:45
LinearSolverParameters.hpp
geos
Definition:
DataLayouts.hpp:29
geos::integer
int integer
Signed integer type.
Definition:
DataTypes.hpp:81
geos::LinearSolverParameters
Set of parameters for a linear solver or preconditioner.
Definition:
LinearSolverParameters.hpp:36
Generated by
1.9.1