From bfc0dcdac980b1b75f33f52729bff3f7fa06471c Mon Sep 17 00:00:00 2001 From: young Date: Tue, 31 Mar 2009 13:14:12 +0000 Subject: [PATCH] Upgraded: PETSc matrix base to migrate to PETSc 3.0.0 git-svn-id: https://svn.dealii.org/trunk@18535 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/petsc_matrix_base.h | 5 +++-- deal.II/lac/source/petsc_matrix_base.cc | 24 +++++++++++++++++---- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/deal.II/lac/include/lac/petsc_matrix_base.h b/deal.II/lac/include/lac/petsc_matrix_base.h index 79fae04e69..9f04b43399 100644 --- a/deal.II/lac/include/lac/petsc_matrix_base.h +++ b/deal.II/lac/include/lac/petsc_matrix_base.h @@ -1092,9 +1092,10 @@ namespace PETScWrappers /** * Test whether a matrix is Hermitian, * i.e. it is the complex conjugate - * of its transpose. + * of its transpose. Default tolerance + * is zero. */ - PetscTruth is_hermitian (); + PetscTruth is_hermitian (const double tol = 0.0); /* * Abstract PETSc object that helps view diff --git a/deal.II/lac/source/petsc_matrix_base.cc b/deal.II/lac/source/petsc_matrix_base.cc index 91c046ec9d..9de9116a0f 100644 --- a/deal.II/lac/source/petsc_matrix_base.cc +++ b/deal.II/lac/source/petsc_matrix_base.cc @@ -526,10 +526,16 @@ namespace PETScWrappers } void - MatrixBase::transpose () + MatrixBase::transpose () { int ierr; + +#if (PETSC_VERSION_MAJOR <= 2) ierr = MatTranspose(matrix, PETSC_NULL); +#else + ierr = MatTranspose(matrix, MAT_REUSE_MATRIX, &matrix); +#endif + AssertThrow (ierr == 0, ExcPETScError(ierr)); } @@ -544,12 +550,17 @@ namespace PETScWrappers } PetscTruth - MatrixBase::is_hermitian () + MatrixBase::is_hermitian (const double tolerance) { PetscTruth truth; // First flush PETSc caches compress (); + +#if (PETSC_VERSION_MAJOR <= 2) MatIsHermitian (matrix, &truth); +#else + MatIsHermitian (matrix, tolerance, &truth); +#endif return truth; } @@ -559,10 +570,15 @@ namespace PETScWrappers // First flush PETSc caches compress (); - // Write to screen + // Set options +#if (PETSC_VERSION_MAJOR <= 2) PetscViewerSetFormat (PETSC_VIEWER_STDOUT_WORLD, PETSC_VIEWER_ASCII_DEFAULT); - +#else + PetscViewerSetFormat (PETSC_VIEWER_STDOUT_WORLD, + PETSC_VIEWER_DEFAULT); +#endif + // Write to screen MatView (matrix,PETSC_VIEWER_STDOUT_WORLD); } -- 2.39.5