MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
sparsesmoothers.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2024, 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
18namespace mfem
19{
20
22{
23protected:
25
26public:
27 SparseSmoother() { oper = NULL; }
28
31
32 virtual void SetOperator(const Operator &a);
33};
34
35/// Data type for Gauss-Seidel smoother of sparse matrix
37{
38protected:
39 int type; // 0, 1, 2 - symmetric, forward, backward
41
42public:
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
56{
57protected:
58 int type; // 0, 1, 2 - scaled Jacobi, scaled l1-Jacobi, scaled lumped-Jacobi
61 /// Uses abs values of the diagonal entries. Relevant only when type = 0.
62 bool use_abs_diag = false;
63
64 mutable Vector z;
65
66public:
67 /// Create Jacobi smoother.
68 DSmoother(int t = 0, real_t s = 1., int it = 1)
69 { type = t; scale = s; iterations = it; }
70
71 /// Create Jacobi smoother.
72 DSmoother(const SparseMatrix &a, int t = 0, real_t s = 1., int it = 1);
73
74 /// Replace diag entries with their abs values. Relevant only when type = 0.
75 void SetPositiveDiagonal(bool pos_diag = true) { use_abs_diag = pos_diag; }
76
77 /// Matrix vector multiplication with Jacobi smoother.
78 virtual void Mult(const Vector &x, Vector &y) const;
79};
80
81}
82
83#endif
Data type for scaled Jacobi-type smoother of sparse matrix.
DSmoother(int t=0, real_t s=1., int it=1)
Create Jacobi smoother.
bool use_abs_diag
Uses abs values of the diagonal entries. Relevant only when type = 0.
void SetPositiveDiagonal(bool pos_diag=true)
Replace diag entries with their abs values. Relevant only when type = 0.
virtual void Mult(const Vector &x, Vector &y) const
Matrix vector multiplication with Jacobi smoother.
Data type for Gauss-Seidel smoother of sparse matrix.
GSSmoother(const SparseMatrix &a, int t=0, int it=1)
Create GSSmoother.
GSSmoother(int t=0, int it=1)
Create GSSmoother.
virtual void Mult(const Vector &x, Vector &y) const
Matrix vector multiplication with GS Smoother.
Abstract data type for matrix inverse.
Definition matrix.hpp:63
Abstract operator.
Definition operator.hpp:25
Data type sparse matrix.
Definition sparsemat.hpp:51
virtual void SetOperator(const Operator &a)
Set/update the solver for the given operator.
SparseSmoother(const SparseMatrix &a)
const SparseMatrix * oper
Vector data type.
Definition vector.hpp:80
real_t a
Definition lissajous.cpp:41
float real_t
Definition config.hpp:43
RefCoord t[3]
RefCoord s[3]