MFEM  v4.3.0 Finite element discretization library
sparsesmoothers.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2021, Lawrence Livermore National Security, LLC. Produced
2 // at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3 // LICENSE and NOTICE for details. LLNL-CODE-806117.
4 //
5 // This file is part of the MFEM library. For more information and source code
6 // availability visit https://mfem.org.
7 //
8 // MFEM is free software; you can redistribute it and/or modify it under the
9 // terms of the BSD-3 license. We welcome feedback and contributions, see file
10 // CONTRIBUTING.md for details.
11
12 #ifndef MFEM_SPARSEMATSMOOTHERS
13 #define MFEM_SPARSEMATSMOOTHERS
14
15 #include "../config/config.hpp"
16 #include "sparsemat.hpp"
17
18 namespace mfem
19 {
20
22 {
23 protected:
25
26 public:
27  SparseSmoother() { oper = NULL; }
28
30  : MatrixInverse(a) { oper = &a; }
31
32  virtual void SetOperator(const Operator &a);
33 };
34
35 /// Data type for Gauss-Seidel smoother of sparse matrix
36 class GSSmoother : public SparseSmoother
37 {
38 protected:
39  int type; // 0, 1, 2 - symmetric, forward, backward
41
42 public:
43  /// Create GSSmoother.
44  GSSmoother(int t = 0, int it = 1) { type = t; iterations = it; }
45
46  /// Create GSSmoother.
47  GSSmoother(const SparseMatrix &a, int t = 0, int it = 1)
48  : SparseSmoother(a) { type = t; iterations = it; }
49
50  /// Matrix vector multiplication with GS Smoother.
51  virtual void Mult(const Vector &x, Vector &y) const;
52 };
53
54 /// Data type for scaled Jacobi-type smoother of sparse matrix
55 class DSmoother : public SparseSmoother
56 {
57 protected:
58  int type; // 0, 1, 2 - scaled Jacobi, scaled l1-Jacobi, scaled lumped-Jacobi
59  double scale;
61
62  mutable Vector z;
63
64 public:
65  /// Create Jacobi smoother.
66  DSmoother(int t = 0, double s = 1., int it = 1)
67  { type = t; scale = s; iterations = it; }
68
69  /// Create Jacobi smoother.
70  DSmoother(const SparseMatrix &a, int t = 0, double s = 1., int it = 1);
71
72  /// Matrix vector multiplication with Jacobi smoother.
73  virtual void Mult(const Vector &x, Vector &y) const;
74 };
75
76 }
77
78 #endif
GSSmoother(const SparseMatrix &a, int t=0, int it=1)
Create GSSmoother.
Data type for scaled Jacobi-type smoother of sparse matrix.
virtual void SetOperator(const Operator &a)
Set/update the solver for the given operator.
Abstract data type for matrix inverse.
Definition: matrix.hpp:62
Data type for Gauss-Seidel smoother of sparse matrix.
GSSmoother(int t=0, int it=1)
Create GSSmoother.
Data type sparse matrix.
Definition: sparsemat.hpp:41
virtual void Mult(const Vector &x, Vector &y) const
Matrix vector multiplication with Jacobi smoother.
virtual void Mult(const Vector &x, Vector &y) const
Matrix vector multiplication with GS Smoother.
double a
Definition: lissajous.cpp:41
DSmoother(int t=0, double s=1., int it=1)
Create Jacobi smoother.
RefCoord t[3]
SparseSmoother(const SparseMatrix &a)
Vector data type.
Definition: vector.hpp:60
RefCoord s[3]
Abstract operator.
Definition: operator.hpp:24
const SparseMatrix * oper