// ------------------------------------------------------------------------ // // SPDX-License-Identifier: LGPL-2.1-or-later // Copyright (C) 2002 - 2023 by the deal.II authors // // This file is part of the deal.II library. // // Part of the source code is dual licensed under Apache-2.0 WITH // LLVM-exception OR LGPL-2.1-or-later. Detailed license information // governing the source code and code contributions can be found in // LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II. // // ------------------------------------------------------------------------ #ifndef dealii_sparse_mic_h #define dealii_sparse_mic_h #include #include #include DEAL_II_NAMESPACE_OPEN /** * @addtogroup Preconditioners * @{ */ /** * Implementation of the Modified Incomplete Cholesky (MIC(0)) preconditioner * for symmetric matrices. This class conforms to the state and usage * specification in SparseLUDecomposition. * * *

The decomposition

* * Let a symmetric, positive-definite, sparse matrix $A$ be in the form $A = D * - L - L^T$, where $D$ is the diagonal part of $A$ and $-L$ is a strictly * lower triangular matrix. The MIC(0) decomposition of the matrix $A$ is * defined by $B = (X-L)X^{-1}(X-L^T)$, where $X$ is a diagonal matrix defined * by the condition $\text{rowsum}(A) = \text{rowsum}(B)$. */ template class SparseMIC : public SparseLUDecomposition { public: /** * Declare type for container size. */ using size_type = types::global_dof_index; /** * Constructor. Does nothing, so you have to call @p decompose sometimes * afterwards. */ SparseMIC() = default; /** * Destructor. */ virtual ~SparseMIC() override; /** * Deletes all member variables. Leaves the class in the state that it had * directly after calling the constructor */ virtual void clear() override; /** * Make the @p AdditionalData type in the base class accessible to this * class as well. */ using AdditionalData = typename SparseLUDecomposition::AdditionalData; /** * Perform the incomplete LU factorization of the given matrix. * * This function needs to be called before an object of this class is used * as preconditioner. * * For more details about possible parameters, see the class documentation * of SparseLUDecomposition and the documentation of the @p * SparseLUDecomposition::AdditionalData class. * * According to the @p parameters, this function creates a new * SparsityPattern or keeps the previous sparsity or takes the sparsity * given by the user to @p data. Then, this function performs the MIC * decomposition. * * After this function is called the preconditioner is ready to be used. */ template void initialize(const SparseMatrix &matrix, const AdditionalData ¶meters = AdditionalData()); /** * Apply the incomplete decomposition, i.e. do one forward-backward step * $dst=(LU)^{-1}src$. * * Call @p initialize before calling this function. */ template void vmult(Vector &dst, const Vector &src) const; /** * Apply the transpose of the incomplete decomposition, i.e. do one * forward-backward step $dst=(LU)^{-1}src$. * * Call @p initialize before calling this function. * * @note This function has not yet been implemented */ template void Tvmult(Vector &dst, const Vector &src) const; /** * Determine an estimate for the memory consumption (in bytes) of this * object. */ std::size_t memory_consumption() const override; /** * @addtogroup Exceptions * @{ */ /** * Exception */ DeclException0(ExcStrengthenDiagonalTooSmall); /** * Exception */ DeclException1(ExcInvalidStrengthening, double, << "The strengthening parameter " << arg1 << " is not greater or equal than zero!"); /** * Exception */ DeclException2(ExcDecompositionNotStable, int, double, << "The diagonal element (" << arg1 << ',' << arg1 << ") is " << arg2 << ", but must be positive"); /** @} */ private: /** * Values of the computed diagonal. */ std::vector diag; /** * Inverses of the diagonal: precomputed for faster vmult. */ std::vector inv_diag; /** * Values of the computed "inner sums", i.e. per-row sums of the elements * laying on the right side of the diagonal. */ std::vector inner_sums; /** * Compute the row-th "inner sum". */ number get_rowsum(const size_type row) const; }; /** @} */ DEAL_II_NAMESPACE_CLOSE #endif // dealii_