From: young Date: Sat, 16 Jun 2012 19:19:12 +0000 (+0000) Subject: After testing, fix compilation for petsc-3.3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b947dc5590ebd2261ec1e1c559cb07223d79861f;p=dealii-svn.git After testing, fix compilation for petsc-3.3 git-svn-id: https://svn.dealii.org/trunk@25628 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/source/lac/petsc_parallel_sparse_matrix.cc b/deal.II/source/lac/petsc_parallel_sparse_matrix.cc index fa3b203060..ef7b6c3450 100644 --- a/deal.II/source/lac/petsc_parallel_sparse_matrix.cc +++ b/deal.II/source/lac/petsc_parallel_sparse_matrix.cc @@ -195,7 +195,14 @@ namespace PETScWrappers // for all rows globally int ierr; -#ifdef DEAL_II_USE_PETSC_DEV +#if DEAL_II_PETSC_VERSION_LT(3,3,0) + ierr + = MatCreateMPIAIJ (communicator, + local_rows, local_columns, + m, n, + n_nonzero_per_row, 0, 0, 0, + &matrix); +#else ierr = MatCreateAIJ (communicator, local_rows, local_columns, @@ -205,13 +212,6 @@ namespace PETScWrappers AssertThrow (ierr == 0, ExcPETScError(ierr)); ierr = MatSetOption (matrix, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE); -#else - ierr - = MatCreateMPIAIJ (communicator, - local_rows, local_columns, - m, n, - n_nonzero_per_row, 0, 0, 0, - &matrix); #endif AssertThrow (ierr == 0, ExcPETScError(ierr)); @@ -275,7 +275,14 @@ namespace PETScWrappers int ierr; -#ifdef DEAL_II_USE_PETSC_DEV +#if DEAL_II_PETSC_VERSION_LT(3,3,0) + ierr + = MatCreateMPIAIJ (communicator, + local_rows, local_columns, + m, n, + 0, &int_row_lengths[0], 0, 0, + &matrix); +#else ierr = MatCreateAIJ (communicator, local_rows, local_columns, @@ -287,13 +294,6 @@ namespace PETScWrappers //TODO: Sometimes the actual number of nonzero entries allocated is greater than the number of nonzero entries, which petsc will complain about unless explicitly disabled with MatSetOption. There is probably a way to prevent a different number nonzero elements being allocated in the first place. (See also previous TODO). ierr = MatSetOption (matrix, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE); -#else - ierr - = MatCreateMPIAIJ (communicator, - local_rows, local_columns, - m, n, - 0, &int_row_lengths[0], 0, 0, - &matrix); #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 7b927e5be3..03245ad41f 100644 --- a/deal.II/source/lac/petsc_solver.cc +++ b/deal.II/source/lac/petsc_solver.cc @@ -285,7 +285,12 @@ namespace PETScWrappers // 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 AssertThrow (ierr == 0, ExcPETScError(ierr)); // in the deal.II solvers, we always