From 189833be81a44fe05aee1fe38d10153970084f66 Mon Sep 17 00:00:00 2001 From: young Date: Mon, 20 Aug 2012 11:39:46 +0000 Subject: [PATCH] Third PETSc bundle removing support for PETSc < 3.x.x git-svn-id: https://svn.dealii.org/trunk@26028 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/deal.II/lac/petsc_matrix_base.h | 4 +- deal.II/include/deal.II/lac/petsc_solver.h | 6 -- deal.II/source/lac/petsc_matrix_base.cc | 66 +------------------ .../lac/petsc_parallel_block_sparse_matrix.cc | 2 - deal.II/source/lac/petsc_solver.cc | 19 +----- 5 files changed, 5 insertions(+), 92 deletions(-) diff --git a/deal.II/include/deal.II/lac/petsc_matrix_base.h b/deal.II/include/deal.II/lac/petsc_matrix_base.h index e8b352e46f..f9b426ee96 100644 --- a/deal.II/include/deal.II/lac/petsc_matrix_base.h +++ b/deal.II/include/deal.II/lac/petsc_matrix_base.h @@ -1054,7 +1054,6 @@ namespace PETScWrappers #endif is_symmetric (const double tolerance = 1.e-12); -#if DEAL_II_PETSC_VERSION_GTE(2,3,0) /** * Test whether a matrix is * Hermitian, i.e. it is the @@ -1070,9 +1069,8 @@ namespace PETScWrappers PetscBool #endif is_hermitian (const double tolerance = 1.e-12); -#endif - /* + /** * Abstract PETSc object that helps view * in ASCII other PETSc objects. Currently * this function simply writes non-zero diff --git a/deal.II/include/deal.II/lac/petsc_solver.h b/deal.II/include/deal.II/lac/petsc_solver.h index eb0008e2f2..984ea7b6b5 100644 --- a/deal.II/include/deal.II/lac/petsc_solver.h +++ b/deal.II/include/deal.II/lac/petsc_solver.h @@ -270,12 +270,6 @@ namespace PETScWrappers */ ~SolverData (); -#if (PETSC_VERSION_MAJOR == 2) && (PETSC_VERSION_MINOR < 2) - /** - * A PETSc solver object. - */ - SLES sles; -#endif /** * Objects for Krylov subspace * solvers and preconditioners. diff --git a/deal.II/source/lac/petsc_matrix_base.cc b/deal.II/source/lac/petsc_matrix_base.cc index 605aecf2b0..271c4f90b9 100644 --- a/deal.II/source/lac/petsc_matrix_base.cc +++ b/deal.II/source/lac/petsc_matrix_base.cc @@ -48,15 +48,9 @@ namespace PETScWrappers // get a representation of the present // row -#if DEAL_II_PETSC_VERSION_LT(2,2,1) - int ncols; - int *colnums; - PetscScalar *values; -#else PetscInt ncols; const PetscInt *colnums; const PetscScalar *values; -#endif int ierr; ierr = MatGetRow(*matrix, this->a_row, &ncols, &colnums, &values); @@ -147,11 +141,7 @@ namespace PETScWrappers // now set all the entries of this row to // zero -#if DEAL_II_PETSC_VERSION_LT(2,2,1) - const int petsc_row = row; -#else const PetscInt petsc_row = row; -#endif IS index_set; #if DEAL_II_PETSC_VERSION_LT(3,2,0) @@ -160,11 +150,6 @@ namespace PETScWrappers ISCreateGeneral (get_mpi_communicator(), 1, &petsc_row, PETSC_COPY_VALUES, &index_set); #endif - -#if DEAL_II_PETSC_VERSION_LT(2,3,0) - const int ierr - = MatZeroRows(matrix, index_set, &new_diag_value); -#else #if DEAL_II_PETSC_VERSION_LT(3,2,0) const int ierr = MatZeroRowsIS(matrix, index_set, new_diag_value); @@ -172,8 +157,6 @@ namespace PETScWrappers const int ierr = MatZeroRowsIS(matrix, index_set, new_diag_value, PETSC_NULL, PETSC_NULL); #endif -#endif - AssertThrow (ierr == 0, ExcPETScError(ierr)); #if DEAL_II_PETSC_VERSION_LT(3,2,0) @@ -195,11 +178,7 @@ namespace PETScWrappers // now set all the entries of these rows // to zero -#if DEAL_II_PETSC_VERSION_LT(2,2,1) - const std::vector petsc_rows (rows.begin(), rows.end()); -#else const std::vector petsc_rows (rows.begin(), rows.end()); -#endif // call the functions. note that we have // to call them even if #rows is empty, @@ -214,10 +193,6 @@ namespace PETScWrappers &petsc_rows[0], PETSC_COPY_VALUES, &index_set); #endif -#if DEAL_II_PETSC_VERSION_LT(2,3,0) - const int ierr - = MatZeroRows(matrix, index_set, &new_diag_value); -#else #if DEAL_II_PETSC_VERSION_LT(3,2,0) const int ierr = MatZeroRowsIS(matrix, index_set, new_diag_value); @@ -225,8 +200,6 @@ namespace PETScWrappers const int ierr = MatZeroRowsIS(matrix, index_set, new_diag_value, PETSC_NULL, PETSC_NULL); #endif -#endif - AssertThrow (ierr == 0, ExcPETScError(ierr)); #if DEAL_II_PETSC_VERSION_LT(3,2,0) @@ -386,15 +359,9 @@ namespace PETScWrappers // get a representation of the present // row -#if DEAL_II_PETSC_VERSION_LT(2,2,1) - int ncols; - int *colnums; - PetscScalar *values; -#else PetscInt ncols; const PetscInt *colnums; const PetscScalar *values; -#endif //TODO: this is probably horribly inefficient; we should lobby for a way to //query this information from PETSc @@ -473,11 +440,7 @@ namespace PETScWrappers MatrixBase & MatrixBase::operator *= (const PetscScalar a) { -#if DEAL_II_PETSC_VERSION_LT(2,3,0) - const int ierr = MatScale (&a, matrix); -#else const int ierr = MatScale (matrix, a); -#endif AssertThrow (ierr == 0, ExcPETScError(ierr)); return *this; @@ -489,12 +452,7 @@ namespace PETScWrappers MatrixBase::operator /= (const PetscScalar a) { const PetscScalar factor = 1./a; - -#if DEAL_II_PETSC_VERSION_LT(2,3,0) - const int ierr = MatScale (&factor, matrix); -#else const int ierr = MatScale (matrix, factor); -#endif AssertThrow (ierr == 0, ExcPETScError(ierr)); @@ -574,14 +532,7 @@ namespace PETScWrappers void MatrixBase::transpose () { - int ierr; - -#if DEAL_II_PETSC_VERSION_LT(3,0,0) - ierr = MatTranspose(matrix, PETSC_NULL); -#else - ierr = MatTranspose(matrix, MAT_REUSE_MATRIX, &matrix); -#endif - + int ierr = MatTranspose(matrix, MAT_REUSE_MATRIX, &matrix); AssertThrow (ierr == 0, ExcPETScError(ierr)); } @@ -620,15 +571,8 @@ namespace PETScWrappers // First flush PETSc caches compress (); - -#if DEAL_II_PETSC_VERSION_LT(3,0,0) - // avoid warning about unused variables - (void) tolerance; - - MatIsHermitian (matrix, &truth); -#else MatIsHermitian (matrix, tolerance, &truth); -#endif + return truth; } @@ -639,13 +583,9 @@ namespace PETScWrappers compress (); // Set options -#if DEAL_II_PETSC_VERSION_LT(3,0,0) - 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); } diff --git a/deal.II/source/lac/petsc_parallel_block_sparse_matrix.cc b/deal.II/source/lac/petsc_parallel_block_sparse_matrix.cc index 6f949bee07..2760ae5527 100644 --- a/deal.II/source/lac/petsc_parallel_block_sparse_matrix.cc +++ b/deal.II/source/lac/petsc_parallel_block_sparse_matrix.cc @@ -27,12 +27,10 @@ namespace PETScWrappers {} - BlockSparseMatrix::~BlockSparseMatrix () {} - BlockSparseMatrix & BlockSparseMatrix::operator = (const BlockSparseMatrix &m) { diff --git a/deal.II/source/lac/petsc_solver.cc b/deal.II/source/lac/petsc_solver.cc index 9c07b9b38f..3aaef627b9 100644 --- a/deal.II/source/lac/petsc_solver.cc +++ b/deal.II/source/lac/petsc_solver.cc @@ -94,15 +94,9 @@ namespace PETScWrappers // checks with the solver_control // object we have in this object for // convergence -#if DEAL_II_PETSC_VERSION_LT(3,0,0) - KSPSetConvergenceTest (solver_data->ksp, &convergence_test, - reinterpret_cast(&solver_control)); -#else KSPSetConvergenceTest (solver_data->ksp, &convergence_test, reinterpret_cast(&solver_control), PETSC_NULL); -#endif - } // set the command line option prefix name @@ -274,13 +268,7 @@ namespace PETScWrappers // problem in PETSc 2.1.6, where it asks // for a char*, even though KSPXXXX is of // type const char* - int ierr; - -#if DEAL_II_PETSC_VERSION_LT(3,3,0) - ierr = KSPSetType (ksp, const_cast(KSPCHEBYCHEV)); -#else - ierr = KSPSetType (ksp, const_cast(KSPCHEBYSHEV)); -#endif + int ierr = KSPSetType (ksp, const_cast(KSPCHEBYSHEV)); AssertThrow (ierr == 0, ExcPETScError(ierr)); // in the deal.II solvers, we always @@ -792,14 +780,9 @@ namespace PETScWrappers * that checks with the solver_control * object for convergence */ -#if DEAL_II_PETSC_VERSION_LT(3,0,0) - KSPSetConvergenceTest (solver_data->ksp, &convergence_test, - reinterpret_cast(&solver_control)); -#else KSPSetConvergenceTest (solver_data->ksp, &convergence_test, reinterpret_cast(&solver_control), PETSC_NULL); -#endif /** * set the software that is to be -- 2.39.5