]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
support mixed accuracy preconditioning
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 18 Mar 2013 14:56:11 +0000 (14:56 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 18 Mar 2013 14:56:11 +0000 (14:56 +0000)
git-svn-id: https://svn.dealii.org/trunk@28930 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/lac/iterative_inverse.h

index 9d0d38e8da0adfb272ec71ba01edb2e81a064aa4..a93dd3369d3ea3fa8daf90cf9c76c6ab660179de 100644 (file)
@@ -77,7 +77,7 @@ public:
   /**
    * Initialization
    * function. Provide a matrix and
-   * preconditioner for th solve in
+   * preconditioner for the solve in
    * vmult().
    */
   template <class MATRIX, class PRECONDITION>
@@ -94,6 +94,14 @@ public:
    */
   void vmult (VECTOR &dst, const VECTOR &src) const;
 
+  /**
+   * Solve for right hand side <tt>src</tt>, but allow for the fact
+   * that the vectors given to this function have different type from
+   * the vectors used by the inner solver.
+   */
+  template <class VECTOR2>
+  void vmult (VECTOR2 &dst, const VECTOR2 &src) const;
+
   /**
    * The solver, which allows
    * selection of the actual solver
@@ -144,10 +152,28 @@ IterativeInverse<VECTOR>::vmult (VECTOR &dst, const VECTOR &src) const
 {
   Assert(matrix.get() != 0, ExcNotInitialized());
   Assert(preconditioner.get() != 0, ExcNotInitialized());
+  dst = 0.;
   solver.solve(*matrix, dst, src, *preconditioner);
 }
 
 
+template <class VECTOR>
+template <class VECTOR2>
+inline void
+IterativeInverse<VECTOR>::vmult (VECTOR2 &dst, const VECTOR2 &src) const
+{
+  Assert(matrix.get() != 0, ExcNotInitialized());
+  Assert(preconditioner.get() != 0, ExcNotInitialized());
+  GrowingVectorMemory<VECTOR> mem;
+  typename VectorMemory<VECTOR>::Pointer sol(mem);
+  typename VectorMemory<VECTOR>::Pointer rhs(mem);
+  sol->reinit(dst);
+  *rhs = src;
+  solver.solve(*matrix, *sol, *rhs, *preconditioner);
+  dst = *sol;
+}
+
+
 
 DEAL_II_NAMESPACE_CLOSE
 

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.