From 32c6af9f3ec067eb8ea969b1778044592658db2b Mon Sep 17 00:00:00 2001 From: oliver Date: Tue, 27 Jul 2004 14:08:49 +0000 Subject: [PATCH] Added some of the probably more important parameters to the class PreconditionLU. git-svn-id: https://svn.dealii.org/trunk@9521 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/petsc_precondition.h | 36 ++++++++++++++++++-- deal.II/lac/source/petsc_precondition.cc | 18 +++++++++- 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/deal.II/lac/include/lac/petsc_precondition.h b/deal.II/lac/include/lac/petsc_precondition.h index 510fad9603..24a41a32db 100644 --- a/deal.II/lac/include/lac/petsc_precondition.h +++ b/deal.II/lac/include/lac/petsc_precondition.h @@ -533,9 +533,38 @@ namespace PETScWrappers struct AdditionalData { /** - * Constructor. + * Constructor. (Default values + * taken from function PCCreate_LU + * of the PetSC lib.) */ - AdditionalData (); + AdditionalData (const double pivoting = 1.e-6, + const double zero_pivot = 1.e-12, + const double damping = 0.0); + + /** + * Determines, when Pivoting is + * done during LU decomposition. + * 0.0 indicates no pivoting, + * and 1.0 complete pivoting. + * Confer PetSC manual for more + * details. + */ + double pivoting; + + /** + * Size at which smaller pivots + * are declared to be zero. + * Confer PetSC manual for more + * details. + */ + double zero_pivot; + + /** + * This quantity is added to the + * diagonal of the matrix during + * factorisation. + */ + double damping; }; /** @@ -550,7 +579,8 @@ namespace PETScWrappers * generates a compiler fault. */ PreconditionLU (const MatrixBase &matrix, - const AdditionalData &additional_data = AdditionalData()); + const AdditionalData &additional_data = + AdditionalData(1.e-6, 1.e-12, 0.0)); protected: /** diff --git a/deal.II/lac/source/petsc_precondition.cc b/deal.II/lac/source/petsc_precondition.cc index 836d439622..542257393b 100644 --- a/deal.II/lac/source/petsc_precondition.cc +++ b/deal.II/lac/source/petsc_precondition.cc @@ -259,7 +259,13 @@ namespace PETScWrappers /* ----------------- PreconditionLU -------------------- */ PreconditionLU::AdditionalData:: - AdditionalData () + AdditionalData (const double pivoting, + const double zero_pivot, + const double damping) + : + pivoting (pivoting), + zero_pivot (zero_pivot), + damping (damping) {} @@ -279,6 +285,16 @@ namespace PETScWrappers // preconditioner int ierr; ierr = PCSetType (pc, const_cast(PCLU)); + AssertThrow (ierr == 0, ExcPETScError(ierr)); + + // set flags as given + ierr = PCLUSetPivoting (pc, additional_data.pivoting); + AssertThrow (ierr == 0, ExcPETScError(ierr)); + + ierr = PCLUSetZeroPivot (pc, additional_data.zero_pivot); + AssertThrow (ierr == 0, ExcPETScError(ierr)); + + ierr = PCLUSetDamping (pc, additional_data.damping); AssertThrow (ierr == 0, ExcPETScError(ierr)); } -- 2.39.5