From e4a549bae1e40cf31fc7e0498cd649c5926ccce3 Mon Sep 17 00:00:00 2001 From: kanschat Date: Mon, 2 Oct 2006 15:10:13 +0000 Subject: [PATCH] apply a fix in non-LAPACK mode 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 | 7 +- deal.II/lac/source/lapack_full_matrix.cc | 74 ++++++++++++++++++++ 2 files changed, 77 insertions(+), 4 deletions(-) diff --git a/deal.II/lac/include/lac/lapack_full_matrix.h b/deal.II/lac/include/lac/lapack_full_matrix.h index 6f00e2b46e..19826dad7e 100644 --- a/deal.II/lac/include/lac/lapack_full_matrix.h +++ b/deal.II/lac/include/lac/lapack_full_matrix.h @@ -27,7 +27,6 @@ template class Vector; template class BlockVector; template class FullMatrix; -template class VectorMemory; /** @@ -405,7 +404,7 @@ class LAPACKFullMatrix : public TransposeTable * @author Guido Kanschat, 2006 */ template -class LUPrecondition +class PreconditionLU : public Subscriptor { @@ -420,8 +419,8 @@ class LUPrecondition void Tvmult(BlockVector&, const BlockVector&) const; private: -// SmartPointer > matrix; -// SmartPointer > mem; + SmartPointer > matrix; + SmartPointer > > mem; }; diff --git a/deal.II/lac/source/lapack_full_matrix.cc b/deal.II/lac/source/lapack_full_matrix.cc index e65f1440cb..1c1abbb359 100644 --- a/deal.II/lac/source/lapack_full_matrix.cc +++ b/deal.II/lac/source/lapack_full_matrix.cc @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -275,6 +276,7 @@ LAPACKFullMatrix::compute_eigenvalues( #else template +void LAPACKFullMatrix::compute_lu_factorization() { Assert(false, ExcNeedsLAPACK()); @@ -283,6 +285,7 @@ Assert(false, ExcNeedsLAPACK()); template +void LAPACKFullMatrix::apply_lu_factorization(Vector&, bool) { Assert(false, ExcNeedsLAPACK()); @@ -380,6 +383,74 @@ LAPACKFullMatrix::print_formatted ( } +//----------------------------------------------------------------------// + +template +void +PreconditionLU::initialize(const LAPACKFullMatrix& M) +{ + matrix = &M; + mem = 0; +} + + +template +void +PreconditionLU::initialize(const LAPACKFullMatrix& M, + VectorMemory >& V) +{ + matrix = &M; + mem = &V; +} + + +template +void +PreconditionLU::vmult(Vector& dst, + const Vector& src) const +{ + dst = src; + matrix->apply_lu_factorization(dst, false); +} + + +template +void +PreconditionLU::Tvmult(Vector& dst, + const Vector& src) const +{ + dst = src; + matrix->apply_lu_factorization(dst, true); +} + + +template +void +PreconditionLU::vmult(BlockVector& dst, + const BlockVector& src) const +{ + Assert(mem != 0, ExcNotInitialized()); + Vector* aux = mem->alloc(); + *aux = src; + matrix->apply_lu_factorization(*aux, false); + dst = *aux; +} + + +template +void +PreconditionLU::Tvmult(BlockVector& dst, + const BlockVector& src) const +{ + Assert(mem != 0, ExcNotInitialized()); + Vector* aux = mem->alloc(); + *aux = src; + matrix->apply_lu_factorization(*aux, true); + dst = *aux; +} + + + template class LAPACKFullMatrix; template LAPACKFullMatrix & LAPACKFullMatrix::operator = (const FullMatrix& M); @@ -391,3 +462,6 @@ template LAPACKFullMatrix & LAPACKFullMatrix::operator = (const FullMatrix& M); template LAPACKFullMatrix & LAPACKFullMatrix::operator = (const FullMatrix& M); + +template class PreconditionLU; +template class PreconditionLU; -- 2.39.5