MFEM  v3.3.2
Finite element discretization library
sparsesmoothers.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010, Lawrence Livermore National Security, LLC. Produced at
2 // the Lawrence Livermore National Laboratory. LLNL-CODE-443211. All Rights
3 // reserved. See file COPYRIGHT for details.
4 //
5 // This file is part of the MFEM library. For more information and source code
6 // availability see http://mfem.org.
7 //
8 // MFEM is free software; you can redistribute it and/or modify it under the
9 // terms of the GNU Lesser General Public License (as published by the Free
10 // Software Foundation) version 2.1 dated February 1999.
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:58
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:38
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.
DSmoother(int t=0, double s=1., int it=1)
Create Jacobi smoother.
SparseSmoother(const SparseMatrix &a)
Vector data type.
Definition: vector.hpp:41
Abstract operator.
Definition: operator.hpp:21
const SparseMatrix * oper