]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
add RelaxationBlockJacobi class
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 20 May 2011 01:58:20 +0000 (01:58 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 20 May 2011 01:58:20 +0000 (01:58 +0000)
git-svn-id: https://svn.dealii.org/trunk@23726 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/lac/relaxation_block.h
deal.II/include/deal.II/lac/relaxation_block.templates.h
deal.II/source/lac/relaxation_block.inst.in

index fd963897cfb29ab8df61e43c0a211917921013b9..d89f38d1007d799740ffc8166ac4c763d2e0f199 100644 (file)
@@ -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 MATRIX, typename inverse_type = typename MATRIX::value_type>
+class RelaxationBlockJacobi : public virtual Subscriptor,
+                            protected RelaxationBlock<MATRIX, inverse_type>
+{
+  public:
+                                    /**
+                                     * Default constructor.
+                                     */
+//    RelaxationBlockJacobi();
+
+                                    /**
+                                     * Define number type of matrix.
+                                     */
+    typedef typename MATRIX::value_type number;
+
+                                    /**
+                                     * Make type publicly available.
+                                     */
+    using RelaxationBlock<MATRIX,inverse_type>::AdditionalData;
+
+                                    /**
+                                     * Make initialization function
+                                     * publicly available.
+                                     */
+    using RelaxationBlock<MATRIX, inverse_type>::initialize;
+
+                                    /**
+                                     * Make function of base class public again.
+                                     */
+    using RelaxationBlock<MATRIX, inverse_type>::clear;
+
+                                    /**
+                                     * Make function of base class public again.
+                                     */
+    using RelaxationBlock<MATRIX, inverse_type>::empty;
+                                    /**
+                                     * Make function of base class public again.
+                                     */
+    using RelaxationBlock<MATRIX, inverse_type>::size;
+                                    /**
+                                     * Make function of base class public again.
+                                     */
+    using RelaxationBlock<MATRIX, inverse_type>::inverse;
+                                    /**
+                                     * Make function of base class public again.
+                                     */
+    using RelaxationBlock<MATRIX, inverse_type>::inverse_householder;
+                                    /**
+                                     * Make function of base class public again.
+                                     */
+    using RelaxationBlock<MATRIX, inverse_type>::inverse_svd;
+                                    /**
+                                     * Perform one step of the Jacobi
+                                     * iteration.
+                                     */
+    template <typename number2>
+    void step (Vector<number2>& dst, const Vector<number2>& rhs) const;
+
+                                    /**
+                                     * Perform one step of the
+                                     * Jacobi iteration.
+                                     */
+    template <typename number2>
+    void Tstep (Vector<number2>& dst, const Vector<number2>& rhs) const;
+};
+
+
 /**
  * Block Gauss-Seidel method with possibly overlapping blocks.
  *
index 767cd08496eacdb9a8a3fa09e068c6df392c67fa..135953a0edb93aa3608bcd54323804563b471f9d 100644 (file)
@@ -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 <deal.II/lac/relaxation_block.h>
 #include <deal.II/lac/full_matrix.h>
+#include <lac/vector_memory.h>
 
 DEAL_II_NAMESPACE_OPEN
 
@@ -189,6 +190,36 @@ RelaxationBlock<MATRIX,inverse_type>::do_step (
 }
 
 
+//----------------------------------------------------------------------//
+
+template <class MATRIX, typename inverse_type>
+template <typename number2>
+void RelaxationBlockJacobi<MATRIX,inverse_type>::step (
+  Vector<number2>       &dst,
+  const Vector<number2> &src) const
+{
+  GrowingVectorMemory<Vector<number2> > mem;
+  typename VectorMemory<Vector<number2> >::Pointer aux = mem;
+  aux->reinit(dst, false);
+  *aux = dst;
+  this->do_step(dst, *aux, src, false);
+}
+
+
+template <class MATRIX, typename inverse_type>
+template <typename number2>
+void RelaxationBlockJacobi<MATRIX,inverse_type>::Tstep (
+  Vector<number2>       &dst,
+  const Vector<number2> &src) const
+{
+  GrowingVectorMemory<Vector<number2> > mem;
+  typename VectorMemory<Vector<number2> >::Pointer aux = mem;
+  aux->reinit(dst, false);
+  *aux = dst;
+  this->do_step(dst, *aux, src, true);
+}
+
+
 //----------------------------------------------------------------------//
 
 template <class MATRIX, typename inverse_type>
@@ -211,6 +242,8 @@ void RelaxationBlockSOR<MATRIX,inverse_type>::Tstep (
 }
 
 
+//----------------------------------------------------------------------//
+
 template <class MATRIX, typename inverse_type>
 template <typename number2>
 void RelaxationBlockSSOR<MATRIX,inverse_type>::step (
index 5e09c1050ced64d69b75e4ce38514673990031ee..aea5d8324f6fedbb31ab14349773409f9f41a365 100644 (file)
@@ -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<SparseMatrix<S1>, S2>;
+    template class RelaxationBlockJacobi<SparseMatrix<S1>, S2>;
     template class RelaxationBlockSOR<SparseMatrix<S1>, S2>;
     template class RelaxationBlockSSOR<SparseMatrix<S1>, S2>;
   }
@@ -21,6 +22,14 @@ for (S1, S2 : REAL_SCALARS)
 
 for (S1, S2, S3 : REAL_SCALARS)
   {
+// ------------ RelaxationBlockJacobi -----------------
+    template
+      void RelaxationBlockJacobi<SparseMatrix<S1>, S2>::step<S3>
+      (Vector<S3> &, const Vector<S3> &) const;
+    template
+      void RelaxationBlockJacobi<SparseMatrix<S1>, S2>::Tstep<S3>
+      (Vector<S3> &, const Vector<S3> &) const;
+
 // ------------ RelaxationBlockSOR -----------------
     template
       void RelaxationBlockSOR<SparseMatrix<S1>, S2>::step<S3>

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.