From a13e5216ae7271cf95f15b6149df28d9c8fbfc6a Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth <bangerth@math.tamu.edu> Date: Sun, 25 Jan 2015 13:04:58 -0600 Subject: [PATCH] Remove deprecated classes PreconditionedMatrix and PreconditionLACSolver. --- doc/news/changes.h | 1 + include/deal.II/lac/precondition.h | 243 ----------------------------- 2 files changed, 1 insertion(+), 243 deletions(-) diff --git a/doc/news/changes.h b/doc/news/changes.h index ea390d237d..caccbe2d22 100644 --- a/doc/news/changes.h +++ b/doc/news/changes.h @@ -209,6 +209,7 @@ inconvenience this causes. - Class MGMatrix. - Multigrid::vmult and friends. - Classes FEEvaluationDGP, FEEvaluationGeneral and FEEvaluationGL. + - Classes PreconditionedMatrix and PreconditionLACSolver. <br> This release also removes the deprecated class MGDoFHandler. The functionality of this class had previously been incorporated into diff --git a/include/deal.II/lac/precondition.h b/include/deal.II/lac/precondition.h index 9f665aa88c..d3c2af77db 100644 --- a/include/deal.II/lac/precondition.h +++ b/include/deal.II/lac/precondition.h @@ -646,153 +646,6 @@ private: -/** - * @deprecated This class has been superseded by IterativeInverse, which is - * more flexible and easier to use. - * - * Preconditioner using an iterative solver. This preconditioner uses a fully - * initialized LAC iterative solver for the approximate inverse of the matrix. - * Naturally, this solver needs another preconditionig method. - * - * Usually, the use of ReductionControl is preferred over the use of the basic - * SolverControl in defining this solver. - * - * Krylov space methods like SolverCG or SolverBicgstab become inefficient if - * soution 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<double> A; - * Vector<double> x; - * Vector<double> b; - * GrowingVectorMemory<Vector<double> > mem; - * - * ReductionControl inner_control (10, 1.e-30, 1.e-2) - * SolverCG<Vector<double> > inner_iteration (inner_control, mem); - * PreconditionSSOR <SparseMatrix<double> > inner_precondition; - * inner_precondition.initialize (A, 1.2); - * - * PreconditionLACSolver precondition; - * precondition.initialize (inner_iteration, A, inner_precondition); - * - * SolverControl outer_control(100, 1.e-16); - * SolverRichardson<Vector<double> > outer_iteration; - * - * outer_iteration.solve (A, x, b, precondition); - * @endcode - * - * Each time we call the inner loop, reduction of the residual by a factor - * <tt>1.e-2</tt> 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. - * - * @author Guido Kanschat, 1999 - */ -template<class SOLVER, class MATRIX = SparseMatrix<double>, class PRECONDITION = PreconditionIdentity> -class PreconditionLACSolver : public Subscriptor -{ -public: - /** - * Constructor. All work is done in initialize. - */ - PreconditionLACSolver (); - - /** - * Initialization function. Provide a solver object, a matrix, and another - * preconditioner for this. - */ - void initialize (SOLVER &, - const MATRIX &, - const PRECONDITION &); - - /** - * Execute preconditioning. - */ - template<class VECTOR> - void vmult (VECTOR &, const VECTOR &) const; - -private: - /** - * The solver object to use. - */ - SmartPointer<SOLVER,PreconditionLACSolver<SOLVER,MATRIX,PRECONDITION> > solver; - - /** - * The matrix in use. - */ - SmartPointer<const MATRIX,PreconditionLACSolver<SOLVER,MATRIX,PRECONDITION> > matrix; - - /** - * The preconditioner to use. - */ - SmartPointer<const PRECONDITION,PreconditionLACSolver<SOLVER,MATRIX,PRECONDITION> > precondition; -} DEAL_II_DEPRECATED; - - - -/** - * @deprecated Use ProductMatrix instead. - * - * Matrix with preconditioner. Given a matrix $A$ and a preconditioner $P$, - * this class implements a new matrix with the matrix-vector product $PA$. It - * needs an auxiliary vector for that. - * - * By this time, this is considered a temporary object to be plugged into - * eigenvalue solvers. Therefore, no SmartPointer is used for <tt>A</tt> and - * <tt>P</tt>. - * - * @author Guido Kanschat, 2000 - */ -template<class MATRIX, class PRECOND, class VECTOR> -class PreconditionedMatrix : public Subscriptor -{ -public: - /** - * Constructor. Provide matrix, preconditioner and a memory pool to obtain - * the auxiliary vector. - */ - PreconditionedMatrix (const MATRIX &A, - const PRECOND &P, - VectorMemory<VECTOR> &mem); - - /** - * Preconditioned matrix-vector-product. - */ - void vmult (VECTOR &dst, const VECTOR &src) const; - - /** - * Transposed preconditioned matrix-vector-product. - */ - void Tvmult (VECTOR &dst, const VECTOR &src) const; - - /** - * Residual $b-PAx$. - */ - double residual (VECTOR &dst, const VECTOR &src, const VECTOR &rhs) const; - -private: - /** - * Storage for the matrix. - */ - const MATRIX &A; - /** - * Storage for preconditioner. - */ - const PRECOND &P; - /** - * Memory pool for vectors. - */ - VectorMemory<VECTOR> &mem; -} DEAL_II_DEPRECATED; - - - /** * Preconditioning with a Chebyshev polynomial for symmetric positive definite * matrices. This preconditioner is similar to a Jacobi preconditioner if the @@ -1344,102 +1197,6 @@ AdditionalData (const double relaxation) -////////////////////////////////////////////////////////////////////// - -template<class SOLVER, class MATRIX, class PRECONDITION> -PreconditionLACSolver<SOLVER,MATRIX,PRECONDITION> -::PreconditionLACSolver () - : - solver(0), matrix(0), precondition(0) -{} - - -template<class SOLVER, class MATRIX, class PRECONDITION> -void -PreconditionLACSolver<SOLVER,MATRIX,PRECONDITION> -::initialize (SOLVER &s, - const MATRIX &m, - const PRECONDITION &p) -{ - solver = &s; - matrix = &m; - precondition = &p; -} - - -template<class SOLVER, class MATRIX, class PRECONDITION> -template<class VECTOR> -void -PreconditionLACSolver<SOLVER,MATRIX,PRECONDITION>::vmult (VECTOR &dst, - const VECTOR &src) const -{ - Assert (solver !=0 && matrix != 0 && precondition != 0, - ExcNotInitialized()); - - solver->solve(*matrix, dst, src, *precondition); -} - -////////////////////////////////////////////////////////////////////// - - -template<class MATRIX, class PRECOND, class VECTOR> -inline -PreconditionedMatrix<MATRIX, PRECOND, VECTOR> -::PreconditionedMatrix (const MATRIX &A, - const PRECOND &P, - VectorMemory<VECTOR> &mem): - A(A), P(P), mem(mem) -{} - - -template<class MATRIX, class PRECOND, class VECTOR> -inline void -PreconditionedMatrix<MATRIX, PRECOND, VECTOR> -::vmult (VECTOR &dst, - const VECTOR &src) const -{ - VECTOR *h = mem.alloc(); - h->reinit(src); - A.vmult(*h, src); - P.vmult(dst, *h); - mem.free(h); -} - - - -template<class MATRIX, class PRECOND, class VECTOR> -inline void -PreconditionedMatrix<MATRIX, PRECOND, VECTOR> -::Tvmult (VECTOR &dst, - const VECTOR &src) const -{ - VECTOR *h = mem.alloc(); - h->reinit(src); - A.Tvmult(*h, src); - P.Tvmult(dst, *h); - mem.free(h); -} - - - -template<class MATRIX, class PRECOND, class VECTOR> -inline double -PreconditionedMatrix<MATRIX, PRECOND, VECTOR> -::residual (VECTOR &dst, - const VECTOR &src, - const VECTOR &rhs) const -{ - VECTOR *h = mem.alloc(); - h->reinit(src); - A.vmult(*h, src); - P.vmult(dst, *h); - mem.free(h); - dst.sadd(-1.,1.,rhs); - return dst.l2_norm (); -} - - - //--------------------------------------------------------------------------- namespace internal -- 2.39.5