MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
diagonal_preconditioner.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_ELASTICITY_DIAGONAL_PC_HPP
13#define MFEM_ELASTICITY_DIAGONAL_PC_HPP
14
15#include "../operators/elasticity_gradient_operator.hpp"
16
17namespace mfem
18{
19/**
20 * @brief ElasticityDiagonalPreconditioner acts as a matrix-free preconditioner
21 * for ElasticityOperator.
22 *
23 * @note There are two types to choose from
24 * - Diagonal: A classic Jacobi type preconditioner
25 * - BlockDiagonal: A Jacobi type preconditioner which calculates the diagonal
26 * contribution of ElasticityOperator on each diagonal element and applies
27 * its inverted submatrix.
28 */
30{
31 static constexpr int dim = 3;
32
33public:
35
37 : Solver(), type_(type) {}
38
39 void SetOperator(const Operator &op) override;
40
41 void Mult(const Vector &x, Vector &y) const override;
42
43private:
44 const ElasticityGradientOperator *gradient_operator_;
45 int num_submats_, submat_height_;
46 Vector Ke_diag_, K_diag_local_, K_diag_;
47 Type type_;
48};
49
50} // namespace mfem
51
52#endif
ElasticityDiagonalPreconditioner acts as a matrix-free preconditioner for ElasticityOperator.
ElasticityDiagonalPreconditioner(Type type=Type::Diagonal)
void SetOperator(const Operator &op) override
Set/update the solver for the given operator.
void Mult(const Vector &x, Vector &y) const override
Operator application: y=A(x).
ElasticityGradientOperator is a wrapper class to pass ElasticityOperator::AssembleGradientDiagonal an...
Abstract operator.
Definition: operator.hpp:25
Base class for solvers.
Definition: operator.hpp:683
Vector data type.
Definition: vector.hpp:80