]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
apply a fix in non-LAPACK mode
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 2 Oct 2006 15:10:13 +0000 (15:10 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 2 Oct 2006 15:10:13 +0000 (15:10 +0000)
add PreconditionLU

git-svn-id: https://svn.dealii.org/trunk@13976 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/lapack_full_matrix.h
deal.II/lac/source/lapack_full_matrix.cc

index 6f00e2b46e0937fbadb09aea7f6eb0519f844858..19826dad7e1e57ebf5f60e7afdd535d63d444831 100644 (file)
@@ -27,7 +27,6 @@
 template<typename number> class Vector;
 template<typename number> class BlockVector;
 template<typename number> class FullMatrix;
-template<class VECTOR> class VectorMemory;
 
 
 /**
@@ -405,7 +404,7 @@ class LAPACKFullMatrix : public TransposeTable<number>
  * @author Guido Kanschat, 2006
  */
 template <typename number>
-class LUPrecondition
+class PreconditionLU
   :
   public Subscriptor
 {
@@ -420,8 +419,8 @@ class LUPrecondition
     void Tvmult(BlockVector<number>&,
                const BlockVector<number>&) const;
   private:
-//    SmartPointer<const LAPACKFullMatrix<number> > matrix;
-//    SmartPointer<VectorMemory<Vector<number> > mem;
+    SmartPointer<const LAPACKFullMatrix<number> > matrix;
+    SmartPointer<VectorMemory<Vector<number> > > mem;
 };
 
 
index e65f1440cb8479387f5b8dee704ce4e68d0807c0..1c1abbb359eeac47bcbf0d91628ae096e8130da2 100644 (file)
@@ -16,6 +16,7 @@
 #include <lac/lapack_support.h>
 #include <lac/full_matrix.h>
 #include <lac/vector.h>
+#include <lac/block_vector.h>
 
 #include <iostream>
 #include <iomanip>
@@ -275,6 +276,7 @@ LAPACKFullMatrix<number>::compute_eigenvalues(
 #else
 
 template <typename number>
+void
 LAPACKFullMatrix<number>::compute_lu_factorization()
 {
 Assert(false, ExcNeedsLAPACK());
@@ -283,6 +285,7 @@ Assert(false, ExcNeedsLAPACK());
 
 
 template <typename number>
+void
 LAPACKFullMatrix<number>::apply_lu_factorization(Vector<number>&, bool)
 {
   Assert(false, ExcNeedsLAPACK());
@@ -380,6 +383,74 @@ LAPACKFullMatrix<number>::print_formatted (
 }
 
 
+//----------------------------------------------------------------------//
+
+template <typename number>
+void
+PreconditionLU<number>::initialize(const LAPACKFullMatrix<number>& M)
+{
+  matrix = &M;
+  mem = 0;
+}
+
+
+template <typename number>
+void
+PreconditionLU<number>::initialize(const LAPACKFullMatrix<number>& M,
+                                   VectorMemory<Vector<number> >& V)
+{
+  matrix = &M;
+  mem = &V;
+}
+
+
+template <typename number>
+void
+PreconditionLU<number>::vmult(Vector<number>& dst,
+                              const Vector<number>& src) const
+{
+  dst = src;
+  matrix->apply_lu_factorization(dst, false);
+}
+
+
+template <typename number>
+void
+PreconditionLU<number>::Tvmult(Vector<number>& dst,
+                               const Vector<number>& src) const
+{
+  dst = src;
+  matrix->apply_lu_factorization(dst, true);
+}
+
+
+template <typename number>
+void
+PreconditionLU<number>::vmult(BlockVector<number>& dst,
+                              const BlockVector<number>& src) const
+{
+  Assert(mem != 0, ExcNotInitialized());
+  Vector<number>* aux = mem->alloc();
+  *aux = src;
+  matrix->apply_lu_factorization(*aux, false);
+  dst = *aux;
+}
+
+
+template <typename number>
+void
+PreconditionLU<number>::Tvmult(BlockVector<number>& dst,
+                               const BlockVector<number>& src) const
+{
+  Assert(mem != 0, ExcNotInitialized());
+  Vector<number>* aux = mem->alloc();
+  *aux = src;
+  matrix->apply_lu_factorization(*aux, true);
+  dst = *aux;
+}
+
+
+
 template class LAPACKFullMatrix<double>;
 template LAPACKFullMatrix<double> &
 LAPACKFullMatrix<double>::operator = (const FullMatrix<double>& M);
@@ -391,3 +462,6 @@ template LAPACKFullMatrix<float> &
 LAPACKFullMatrix<float>::operator = (const FullMatrix<double>& M);
 template LAPACKFullMatrix<float> &
 LAPACKFullMatrix<float>::operator = (const FullMatrix<float>& M);
+
+template class PreconditionLU<double>;
+template class PreconditionLU<float>;

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.