From: Matthias Maier Date: Wed, 28 Jun 2017 11:47:23 +0000 (-0500) Subject: lac: Remove deprecated IterativeInverse X-Git-Tag: v9.0.0-rc1~1447^2~11 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=524b8285a340835baa3f7b9efecae653efeab94d;p=dealii.git lac: Remove deprecated IterativeInverse This class is superseded by the LinearOperator framework. --- diff --git a/include/deal.II/lac/iterative_inverse.h b/include/deal.II/lac/iterative_inverse.h deleted file mode 100644 index 9c3dcd9231..0000000000 --- a/include/deal.II/lac/iterative_inverse.h +++ /dev/null @@ -1,177 +0,0 @@ -// --------------------------------------------------------------------- -// -// Copyright (C) 1999 - 2017 by the deal.II authors -// -// This file is part of the deal.II library. -// -// The deal.II library is free software; you can use it, redistribute -// it, and/or modify it under the terms of the GNU Lesser General -// Public License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// The full text of the license can be found in the file LICENSE at -// the top level of the deal.II distribution. -// -// --------------------------------------------------------------------- - -#ifndef dealii__iterative_inverse_h -#define dealii__iterative_inverse_h - -#include -#include -#include -#include -#include - -DEAL_II_NAMESPACE_OPEN - - -/** - * Implementation of the inverse of a matrix, using an iterative method. - * - * The function vmult() of this class starts an iterative solver in order to - * approximate the action of the inverse matrix. - * - * Krylov space methods like SolverCG or SolverBicgstab become inefficient if - * solution down to machine accuracy is needed. This is due to the fact, that - * round-off errors spoil the orthogonality of the vector sequences. - * Therefore, a nested iteration of two methods is proposed: The outer method - * is SolverRichardson, since it is robust with respect to round-of errors. - * The inner loop is an appropriate Krylov space method, since it is fast. - * - * @code - * // Declare related objects - * SparseMatrix A; - * Vector x; - * Vector b; - * GrowingVectorMemory > mem; - * - * ReductionControl inner_control (10, 1.e-30, 1.e-2); - * PreconditionSSOR > inner_precondition; - * inner_precondition.initialize (A, 1.2); - * - * IterativeInverse > precondition; - * precondition.initialize (A, inner_precondition); - * precondition.solver.select("cg"); - * precondition.solver.set_control(inner_control); - * - * SolverControl outer_control(100, 1.e-16); - * SolverRichardson > outer_iteration; - * - * outer_iteration.solve (A, x, b, precondition); - * @endcode - * - * Each time we call the inner loop, reduction of the residual by a factor - * 1.e-2 is attempted. Since the right hand side vector of the inner - * iteration is the residual of the outer loop, the relative errors are far - * from machine accuracy, even if the errors of the outer loop are in the - * range of machine accuracy. - * - * @deprecated Use the LinearOperator class instead. See the module on - * @ref LAOperators "linear operators" for further details. - * - * @ingroup Matrix2 - * @author Guido Kanschat - * @date 2010 - */ -template -class IterativeInverse : public Subscriptor -{ -public: - /** - * Initialization function. Provide a matrix and preconditioner for the - * solve in vmult(). - */ - template - void initialize (const MatrixType &, const PreconditionerType &); - - /** - * Delete the pointers to matrix and preconditioner. - */ - void clear(); - - /** - * Solve for right hand side src. - */ - void vmult (VectorType &dst, const VectorType &src) const; - - /** - * Solve for right hand side src, but allow for the fact that the - * vectors given to this function have different type from the vectors used - * by the inner solver. - */ - template - void vmult (OtherVectorType &dst, const OtherVectorType &src) const; - - /** - * The solver, which allows selection of the actual solver as well as - * adjustment of parameters. - */ - SolverSelector solver; - -private: - /** - * The matrix in use. - */ - std::shared_ptr > matrix; - - /** - * The preconditioner to use. - */ - std::shared_ptr > preconditioner; -}; - - -template -template -inline -void -IterativeInverse::initialize(const MatrixType &m, const PreconditionerType &p) -{ - VectorType v; - matrix = std::shared_ptr > (new_pointer_matrix_base(m, v)); - preconditioner = std::shared_ptr > (new_pointer_matrix_base(p, v)); -} - - -template -inline -void -IterativeInverse::clear() -{ - matrix = 0; - preconditioner = 0; -} - - -template -inline void -IterativeInverse::vmult (VectorType &dst, const VectorType &src) const -{ - Assert(matrix.get() != nullptr, ExcNotInitialized()); - Assert(preconditioner.get() != nullptr, ExcNotInitialized()); - dst = 0.; - solver.solve(*matrix, dst, src, *preconditioner); -} - - -template -template -inline void -IterativeInverse::vmult (OtherVectorType &dst, const OtherVectorType &src) const -{ - Assert(matrix.get() != 0, ExcNotInitialized()); - Assert(preconditioner.get() != 0, ExcNotInitialized()); - GrowingVectorMemory mem; - typename VectorMemory::Pointer sol(mem); - typename VectorMemory::Pointer rhs(mem); - sol->reinit(dst); - *rhs = src; - solver.solve(*matrix, *sol, *rhs, *preconditioner); - dst = *sol; -} - - - -DEAL_II_NAMESPACE_CLOSE - -#endif