MFEM  v3.2
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
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 
36 class GSSmoother : public SparseSmoother
37 {
38 protected:
39  int type; // 0, 1, 2 - symmetric, forward, backward
41 
42 public:
44  GSSmoother(int t = 0, int it = 1) { type = t; iterations = it; }
45 
47  GSSmoother(const SparseMatrix &a, int t = 0, int it = 1)
48  : SparseSmoother(a) { type = t; iterations = it; }
49 
51  virtual void Mult(const Vector &x, Vector &y) const;
52 };
53 
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:
66  DSmoother(int t = 0, double s = 1., int it = 1)
67  { type = t; scale = s; iterations = it; }
68 
70  DSmoother(const SparseMatrix &a, int t = 0, double s = 1., int it = 1);
71 
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:33
Abstract operator.
Definition: operator.hpp:21
const SparseMatrix * oper