From 7fc322bef60ffd5539d72bb8b1dbe97dc7cf488a Mon Sep 17 00:00:00 2001 From: young Date: Tue, 13 Sep 2011 09:41:50 +0000 Subject: [PATCH] Update bundle to provide deal.II <-> PETSc-3.2 compatibility git-svn-id: https://svn.dealii.org/trunk@24320 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/deal.II/lac/petsc_matrix_base.h | 14 ++-- deal.II/include/deal.II/lac/petsc_vector.h | 12 +-- deal.II/source/lac/petsc_matrix_base.cc | 73 ++++++++++--------- .../lac/petsc_parallel_sparse_matrix.cc | 18 ++--- deal.II/source/lac/petsc_parallel_vector.cc | 7 +- deal.II/source/lac/petsc_precondition.cc | 6 +- deal.II/source/lac/petsc_solver.cc | 12 +-- deal.II/source/lac/petsc_sparse_matrix.cc | 18 ++--- deal.II/source/lac/petsc_vector.cc | 6 +- deal.II/source/lac/petsc_vector_base.cc | 18 ++--- 10 files changed, 93 insertions(+), 91 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 5939f5c5ac..11a97cefa4 100644 --- a/deal.II/include/deal.II/lac/petsc_matrix_base.h +++ b/deal.II/include/deal.II/lac/petsc_matrix_base.h @@ -1108,10 +1108,10 @@ namespace PETScWrappers * $1000\times32$-bit machine * precision. */ -#if DEAL_II_PETSC_VERSION_DEV() - PetscBool +#if DEAL_II_PETSC_VERSION_LT(3,2,0) + PetscTruth #else - PetscTruth + PetscBool #endif is_symmetric (const double tolerance = 1.e-12); @@ -1125,14 +1125,14 @@ namespace PETScWrappers * $1000\times32$-bit machine * precision. */ -#if DEAL_II_PETSC_VERSION_DEV() - PetscBool +#if DEAL_II_PETSC_VERSION_LT(3,2,0) + PetscTruth #else - PetscTruth + PetscBool #endif is_hermitian (const double tolerance = 1.e-12); #endif - + /* * Abstract PETSc object that helps view * in ASCII other PETSc objects. Currently diff --git a/deal.II/include/deal.II/lac/petsc_vector.h b/deal.II/include/deal.II/lac/petsc_vector.h index 98ca66313d..b088a7ff7b 100644 --- a/deal.II/include/deal.II/lac/petsc_vector.h +++ b/deal.II/include/deal.II/lac/petsc_vector.h @@ -283,10 +283,10 @@ namespace PETScWrappers // the petsc function we call wants to // generate the vector itself, so destroy // the old one first -#if DEAL_II_PETSC_VERSION_DEV() - ierr = VecDestroy (&vector); -#else +#if DEAL_II_PETSC_VERSION_LT(3,2,0) ierr = VecDestroy (vector); +#else + ierr = VecDestroy (&vector); #endif AssertThrow (ierr == 0, ExcPETScError(ierr)); } @@ -335,10 +335,10 @@ namespace PETScWrappers #endif AssertThrow (ierr == 0, ExcPETScError(ierr)); -#if DEAL_II_PETSC_VERSION_DEV() - ierr = VecScatterDestroy (&ctx); -#else +#if DEAL_II_PETSC_VERSION_LT(3,2,0) ierr = VecScatterDestroy (ctx); +#else + ierr = VecScatterDestroy (&ctx); #endif AssertThrow (ierr == 0, ExcPETScError(ierr)); #endif diff --git a/deal.II/source/lac/petsc_matrix_base.cc b/deal.II/source/lac/petsc_matrix_base.cc index ebabbdfd7a..002f5ba661 100644 --- a/deal.II/source/lac/petsc_matrix_base.cc +++ b/deal.II/source/lac/petsc_matrix_base.cc @@ -90,10 +90,10 @@ namespace PETScWrappers MatrixBase::~MatrixBase () { -#if DEAL_II_PETSC_VERSION_DEV() - const int ierr = MatDestroy (&matrix); -#else +#if DEAL_II_PETSC_VERSION_LT(3,2,0) const int ierr = MatDestroy (matrix); +#else + const int ierr = MatDestroy (&matrix); #endif AssertThrow (ierr == 0, ExcPETScError(ierr)); } @@ -104,10 +104,10 @@ namespace PETScWrappers MatrixBase::clear () { // destroy the matrix... -#if DEAL_II_PETSC_VERSION_DEV() - int ierr = MatDestroy (&matrix); -#else +#if DEAL_II_PETSC_VERSION_LT(3,2,0) int ierr = MatDestroy (matrix); +#else + int ierr = MatDestroy (&matrix); #endif AssertThrow (ierr == 0, ExcPETScError(ierr)); // ...and replace it by an empty @@ -154,10 +154,10 @@ namespace PETScWrappers #endif IS index_set; -#if DEAL_II_PETSC_VERSION_DEV() - ISCreateGeneral (get_mpi_communicator(), 1, &petsc_row, PETSC_COPY_VALUES, &index_set); -#else +#if DEAL_II_PETSC_VERSION_LT(3,2,0) ISCreateGeneral (get_mpi_communicator(), 1, &petsc_row, &index_set); +#else + ISCreateGeneral (get_mpi_communicator(), 1, &petsc_row, PETSC_COPY_VALUES, &index_set); #endif @@ -165,21 +165,21 @@ namespace PETScWrappers const int ierr = MatZeroRows(matrix, index_set, &new_diag_value); #else -#if DEAL_II_PETSC_VERSION_DEV() +#if DEAL_II_PETSC_VERSION_LT(3,2,0) const int ierr - = MatZeroRowsIS(matrix, index_set, new_diag_value, PETSC_NULL, PETSC_NULL); + = MatZeroRowsIS(matrix, index_set, new_diag_value); #else const int ierr - = MatZeroRowsIS(matrix, index_set, new_diag_value); + = MatZeroRowsIS(matrix, index_set, new_diag_value, PETSC_NULL, PETSC_NULL); #endif #endif AssertThrow (ierr == 0, ExcPETScError(ierr)); -#if DEAL_II_PETSC_VERSION_DEV() - ISDestroy (&index_set); -#else +#if DEAL_II_PETSC_VERSION_LT(3,2,0) ISDestroy (index_set); +#else + ISDestroy (&index_set); #endif compress (); @@ -205,33 +205,34 @@ namespace PETScWrappers // to call them even if #rows is empty, // since this is a collective operation IS index_set; -#if DEAL_II_PETSC_VERSION_DEV() + +#if DEAL_II_PETSC_VERSION_LT(3,2,0) ISCreateGeneral (get_mpi_communicator(), rows.size(), - &petsc_rows[0], PETSC_COPY_VALUES, &index_set); + &petsc_rows[0], &index_set); #else ISCreateGeneral (get_mpi_communicator(), rows.size(), - &petsc_rows[0], &index_set); + &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_DEV() +#if DEAL_II_PETSC_VERSION_LT(3,2,0) const int ierr - = MatZeroRowsIS(matrix, index_set, new_diag_value, PETSC_NULL, PETSC_NULL); + = MatZeroRowsIS(matrix, index_set, new_diag_value); #else const int ierr - = MatZeroRowsIS(matrix, index_set, new_diag_value); + = MatZeroRowsIS(matrix, index_set, new_diag_value, PETSC_NULL, PETSC_NULL); #endif #endif AssertThrow (ierr == 0, ExcPETScError(ierr)); -#if DEAL_II_PETSC_VERSION_DEV() - ISDestroy (&index_set); -#else +#if DEAL_II_PETSC_VERSION_LT(3,2,0) ISDestroy (index_set); +#else + ISDestroy (&index_set); #endif compress (); @@ -606,17 +607,17 @@ namespace PETScWrappers AssertThrow (ierr == 0, ExcPETScError(ierr)); } -#if DEAL_II_PETSC_VERSION_DEV() - PetscBool -#else +#if DEAL_II_PETSC_VERSION_LT(3,2,0) PetscTruth +#else + PetscBool #endif MatrixBase::is_symmetric (const double tolerance) { -#if DEAL_II_PETSC_VERSION_DEV() - PetscBool -#else +#if DEAL_II_PETSC_VERSION_LT(3,2,0) PetscTruth +#else + PetscBool #endif truth; // First flush PETSc caches @@ -625,17 +626,17 @@ namespace PETScWrappers return truth; } -#if DEAL_II_PETSC_VERSION_DEV() - PetscBool -#else +#if DEAL_II_PETSC_VERSION_LT(3,2,0) PetscTruth +#else + PetscBool #endif MatrixBase::is_hermitian (const double tolerance) { -#if DEAL_II_PETSC_VERSION_DEV() - PetscBool -#else +#if DEAL_II_PETSC_VERSION_LT(3,2,0) PetscTruth +#else + PetscBool #endif truth; diff --git a/deal.II/source/lac/petsc_parallel_sparse_matrix.cc b/deal.II/source/lac/petsc_parallel_sparse_matrix.cc index 81906c4e48..8c5838729c 100644 --- a/deal.II/source/lac/petsc_parallel_sparse_matrix.cc +++ b/deal.II/source/lac/petsc_parallel_sparse_matrix.cc @@ -114,10 +114,10 @@ namespace PETScWrappers // get rid of old matrix and generate a // new one -#if DEAL_II_PETSC_VERSION_DEV() - const int ierr = MatDestroy (&matrix); -#else +#if DEAL_II_PETSC_VERSION_LT(3,2,0) const int ierr = MatDestroy (matrix); +#else + const int ierr = MatDestroy (&matrix); #endif AssertThrow (ierr == 0, ExcPETScError(ierr)); @@ -140,10 +140,10 @@ namespace PETScWrappers // get rid of old matrix and generate a // new one -#if DEAL_II_PETSC_VERSION_DEV() - const int ierr = MatDestroy (&matrix); -#else +#if DEAL_II_PETSC_VERSION_LT(3,2,0) const int ierr = MatDestroy (matrix); +#else + const int ierr = MatDestroy (&matrix); #endif AssertThrow (ierr == 0, ExcPETScError(ierr)); @@ -166,10 +166,10 @@ namespace PETScWrappers // get rid of old matrix and generate a // new one -#if DEAL_II_PETSC_VERSION_DEV() - const int ierr = MatDestroy (&matrix); -#else +#if DEAL_II_PETSC_VERSION_LT(3,2,0) const int ierr = MatDestroy (matrix); +#else + const int ierr = MatDestroy (&matrix); #endif AssertThrow (ierr == 0, ExcPETScError(ierr)); diff --git a/deal.II/source/lac/petsc_parallel_vector.cc b/deal.II/source/lac/petsc_parallel_vector.cc index 04a6cb75b9..7596e96b9e 100644 --- a/deal.II/source/lac/petsc_parallel_vector.cc +++ b/deal.II/source/lac/petsc_parallel_vector.cc @@ -113,10 +113,11 @@ namespace PETScWrappers // so let's go the slow way: int ierr; -#if DEAL_II_PETSC_VERSION_DEV() - ierr = VecDestroy (&vector); -#else + +#if DEAL_II_PETSC_VERSION_LT(3,2,0) ierr = VecDestroy (vector); +#else + ierr = VecDestroy (&vector); #endif AssertThrow (ierr == 0, ExcPETScError(ierr)); diff --git a/deal.II/source/lac/petsc_precondition.cc b/deal.II/source/lac/petsc_precondition.cc index a01bae6732..7d4f70c1ed 100644 --- a/deal.II/source/lac/petsc_precondition.cc +++ b/deal.II/source/lac/petsc_precondition.cc @@ -37,10 +37,10 @@ namespace PETScWrappers { if (pc!=NULL) { -#if DEAL_II_PETSC_VERSION_DEV() - int ierr = PCDestroy(&pc); -#else +#if DEAL_II_PETSC_VERSION_LT(3,2,0) int ierr = PCDestroy(pc); +#else + int ierr = PCDestroy(&pc); #endif AssertThrow (ierr == 0, ExcPETScError(ierr)); } diff --git a/deal.II/source/lac/petsc_solver.cc b/deal.II/source/lac/petsc_solver.cc index 362967807f..c35282df56 100644 --- a/deal.II/source/lac/petsc_solver.cc +++ b/deal.II/source/lac/petsc_solver.cc @@ -34,10 +34,10 @@ namespace PETScWrappers SolverBase::SolverData::~SolverData () { // destroy the solver object -#if DEAL_II_PETSC_VERSION_DEV() - int ierr = KSPDestroy (&ksp); -#else +#if DEAL_II_PETSC_VERSION_LT(3,2,0) int ierr = KSPDestroy (ksp); +#else + int ierr = KSPDestroy (&ksp); #endif AssertThrow (ierr == 0, ExcPETScError(ierr)); @@ -402,10 +402,10 @@ namespace PETScWrappers // right if (additional_data.right_preconditioning) { -#if DEAL_II_PETSC_VERSION_DEV() - ierr = KSPSetPCSide(ksp, PC_RIGHT); -#else +#if DEAL_II_PETSC_VERSION_LT(3,2,0) ierr = KSPSetPreconditionerSide(ksp, PC_RIGHT); +#else + ierr = KSPSetPCSide(ksp, PC_RIGHT); #endif AssertThrow (ierr == 0, ExcPETScError(ierr)); diff --git a/deal.II/source/lac/petsc_sparse_matrix.cc b/deal.II/source/lac/petsc_sparse_matrix.cc index 0fb4b70d5d..01e6756326 100644 --- a/deal.II/source/lac/petsc_sparse_matrix.cc +++ b/deal.II/source/lac/petsc_sparse_matrix.cc @@ -83,10 +83,10 @@ namespace PETScWrappers { // get rid of old matrix and generate a // new one -#if DEAL_II_PETSC_VERSION_DEV() - const int ierr = MatDestroy (&matrix); -#else +#if DEAL_II_PETSC_VERSION_LT(3,2,0) const int ierr = MatDestroy (matrix); +#else + const int ierr = MatDestroy (&matrix); #endif AssertThrow (ierr == 0, ExcPETScError(ierr)); @@ -103,10 +103,10 @@ namespace PETScWrappers { // get rid of old matrix and generate a // new one -#if DEAL_II_PETSC_VERSION_DEV() - const int ierr = MatDestroy (&matrix); -#else +#if DEAL_II_PETSC_VERSION_LT(3,2,0) const int ierr = MatDestroy (matrix); +#else + const int ierr = MatDestroy (&matrix); #endif AssertThrow (ierr == 0, ExcPETScError(ierr)); @@ -123,10 +123,10 @@ namespace PETScWrappers { // get rid of old matrix and generate a // new one -#if DEAL_II_PETSC_VERSION_DEV() - const int ierr = MatDestroy (&matrix); -#else +#if DEAL_II_PETSC_VERSION_LT(3,2,0) const int ierr = MatDestroy (matrix); +#else + const int ierr = MatDestroy (&matrix); #endif AssertThrow (ierr == 0, ExcPETScError(ierr)); diff --git a/deal.II/source/lac/petsc_vector.cc b/deal.II/source/lac/petsc_vector.cc index 4ea59af9d4..ff52aa0a71 100644 --- a/deal.II/source/lac/petsc_vector.cc +++ b/deal.II/source/lac/petsc_vector.cc @@ -78,10 +78,10 @@ namespace PETScWrappers // so let's go the slow way: if (attained_ownership) { -#if DEAL_II_PETSC_VERSION_DEV() - int ierr = VecDestroy (&vector); -#else +#if DEAL_II_PETSC_VERSION_LT(3,2,0) int ierr = VecDestroy (vector); +#else + int ierr = VecDestroy (&vector); #endif AssertThrow (ierr == 0, ExcPETScError(ierr)); } diff --git a/deal.II/source/lac/petsc_vector_base.cc b/deal.II/source/lac/petsc_vector_base.cc index 130bb33b2f..34ffaeee27 100644 --- a/deal.II/source/lac/petsc_vector_base.cc +++ b/deal.II/source/lac/petsc_vector_base.cc @@ -215,10 +215,10 @@ namespace PETScWrappers { if (attained_ownership) { -#if DEAL_II_PETSC_VERSION_DEV() - const int ierr = VecDestroy (&vector); -#else +#if DEAL_II_PETSC_VERSION_LT(3,2,0) const int ierr = VecDestroy (vector); +#else + const int ierr = VecDestroy (&vector); #endif AssertThrow (ierr == 0, ExcPETScError(ierr)); } @@ -257,10 +257,10 @@ namespace PETScWrappers Assert (size() == v.size(), ExcDimensionMismatch(size(), v.size())); -#if DEAL_II_PETSC_VERSION_DEV() - PetscBool -#else +#if DEAL_II_PETSC_VERSION_LT(3,2,0) PetscTruth +#else + PetscBool #endif flag; @@ -278,10 +278,10 @@ namespace PETScWrappers Assert (size() == v.size(), ExcDimensionMismatch(size(), v.size())); -#if DEAL_II_PETSC_VERSION_DEV() - PetscBool -#else +#if DEAL_II_PETSC_VERSION_LT(3,2,0) PetscTruth +#else + PetscBool #endif flag; -- 2.39.5