From: kanschat Date: Fri, 20 May 2011 01:58:20 +0000 (+0000) Subject: add RelaxationBlockJacobi class X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ba3341849e00dd330a51b0eea649769db9dbf87;p=dealii-svn.git add RelaxationBlockJacobi class git-svn-id: https://svn.dealii.org/trunk@23726 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/lac/relaxation_block.h b/deal.II/include/deal.II/lac/relaxation_block.h index fd963897cf..d89f38d100 100644 --- a/deal.II/include/deal.II/lac/relaxation_block.h +++ b/deal.II/include/deal.II/lac/relaxation_block.h @@ -233,6 +233,88 @@ class RelaxationBlock : }; +/** + * Block Jacobi (additive Schwarz) method with possibly overlapping blocks. + * + * This class implements the step() and Tstep() functions expected by + * SolverRelaxation and MGSmootherRelaxation. They perform an + * additive Schwarz method on the blocks provided in the + * BlockList of AdditionalData. Differing from PreconditionBlockJacobi, + * these blocks may be of varying size, non-contiguous, and + * overlapping. On the other hand, this class does not implement the + * preconditioner interface expected by Solver objects. + * + * @ingroup Preconditioners + * @author Guido Kanschat + * @date 2010 + */ +template +class RelaxationBlockJacobi : public virtual Subscriptor, + protected RelaxationBlock +{ + public: + /** + * Default constructor. + */ +// RelaxationBlockJacobi(); + + /** + * Define number type of matrix. + */ + typedef typename MATRIX::value_type number; + + /** + * Make type publicly available. + */ + using RelaxationBlock::AdditionalData; + + /** + * Make initialization function + * publicly available. + */ + using RelaxationBlock::initialize; + + /** + * Make function of base class public again. + */ + using RelaxationBlock::clear; + + /** + * Make function of base class public again. + */ + using RelaxationBlock::empty; + /** + * Make function of base class public again. + */ + using RelaxationBlock::size; + /** + * Make function of base class public again. + */ + using RelaxationBlock::inverse; + /** + * Make function of base class public again. + */ + using RelaxationBlock::inverse_householder; + /** + * Make function of base class public again. + */ + using RelaxationBlock::inverse_svd; + /** + * Perform one step of the Jacobi + * iteration. + */ + template + void step (Vector& dst, const Vector& rhs) const; + + /** + * Perform one step of the + * Jacobi iteration. + */ + template + void Tstep (Vector& dst, const Vector& rhs) const; +}; + + /** * Block Gauss-Seidel method with possibly overlapping blocks. * diff --git a/deal.II/include/deal.II/lac/relaxation_block.templates.h b/deal.II/include/deal.II/lac/relaxation_block.templates.h index 767cd08496..135953a0ed 100644 --- a/deal.II/include/deal.II/lac/relaxation_block.templates.h +++ b/deal.II/include/deal.II/lac/relaxation_block.templates.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 by the deal.II authors +// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -15,6 +15,7 @@ #include #include +#include DEAL_II_NAMESPACE_OPEN @@ -189,6 +190,36 @@ RelaxationBlock::do_step ( } +//----------------------------------------------------------------------// + +template +template +void RelaxationBlockJacobi::step ( + Vector &dst, + const Vector &src) const +{ + GrowingVectorMemory > mem; + typename VectorMemory >::Pointer aux = mem; + aux->reinit(dst, false); + *aux = dst; + this->do_step(dst, *aux, src, false); +} + + +template +template +void RelaxationBlockJacobi::Tstep ( + Vector &dst, + const Vector &src) const +{ + GrowingVectorMemory > mem; + typename VectorMemory >::Pointer aux = mem; + aux->reinit(dst, false); + *aux = dst; + this->do_step(dst, *aux, src, true); +} + + //----------------------------------------------------------------------// template @@ -211,6 +242,8 @@ void RelaxationBlockSOR::Tstep ( } +//----------------------------------------------------------------------// + template template void RelaxationBlockSSOR::step ( diff --git a/deal.II/source/lac/relaxation_block.inst.in b/deal.II/source/lac/relaxation_block.inst.in index 5e09c1050c..aea5d8324f 100644 --- a/deal.II/source/lac/relaxation_block.inst.in +++ b/deal.II/source/lac/relaxation_block.inst.in @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2009, 2010 by the deal.II authors +// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2009, 2010, 2011 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -14,6 +14,7 @@ for (S1, S2 : REAL_SCALARS) { template class RelaxationBlock, S2>; + template class RelaxationBlockJacobi, S2>; template class RelaxationBlockSOR, S2>; template class RelaxationBlockSSOR, S2>; } @@ -21,6 +22,14 @@ for (S1, S2 : REAL_SCALARS) for (S1, S2, S3 : REAL_SCALARS) { +// ------------ RelaxationBlockJacobi ----------------- + template + void RelaxationBlockJacobi, S2>::step + (Vector &, const Vector &) const; + template + void RelaxationBlockJacobi, S2>::Tstep + (Vector &, const Vector &) const; + // ------------ RelaxationBlockSOR ----------------- template void RelaxationBlockSOR, S2>::step