]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Third PETSc bundle removing support for PETSc < 3.x.x
authoryoung <young@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 20 Aug 2012 11:39:46 +0000 (11:39 +0000)
committeryoung <young@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 20 Aug 2012 11:39:46 +0000 (11:39 +0000)
git-svn-id: https://svn.dealii.org/trunk@26028 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/lac/petsc_matrix_base.h
deal.II/include/deal.II/lac/petsc_solver.h
deal.II/source/lac/petsc_matrix_base.cc
deal.II/source/lac/petsc_parallel_block_sparse_matrix.cc
deal.II/source/lac/petsc_solver.cc

index e8b352e46f3fafad04e5b94a8f473860961904b4..f9b426ee9603e28815ca38159d049954f04efcc7 100644 (file)
@@ -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
index eb0008e2f23a3988c9447c40762197fc9cf85b29..984ea7b6b5ebd18c7e2818a4bf38671d9144b326 100644 (file)
@@ -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.
index 605aecf2b0ac67756efc315d531fcb721001743c..271c4f90b97c587f7be9ff744b024fef87178440 100644 (file)
@@ -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<int>      petsc_rows (rows.begin(), rows.end());
-#else
     const std::vector<PetscInt> 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);
   }
index 6f949bee070bbdfd9e069f5c6858210b1fb22eda..2760ae552700da18f9e84c04d277f1507baa9079 100644 (file)
@@ -27,12 +27,10 @@ namespace PETScWrappers
     {}
 
 
-
     BlockSparseMatrix::~BlockSparseMatrix ()
     {}
 
 
-
     BlockSparseMatrix &
     BlockSparseMatrix::operator = (const BlockSparseMatrix &m)
     {
index 9c07b9b38fcebad4a76370f272e75dafde0848e6..3aaef627b98f88b493c5521cb081a76ffbaad005 100644 (file)
@@ -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<void *>(&solver_control));
-#else
         KSPSetConvergenceTest (solver_data->ksp, &convergence_test,
                                reinterpret_cast<void *>(&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<char *>(KSPCHEBYCHEV));
-#else
-    ierr = KSPSetType (ksp, const_cast<char *>(KSPCHEBYSHEV));
-#endif
+    int ierr = KSPSetType (ksp, const_cast<char *>(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<void *>(&solver_control));
-#else
       KSPSetConvergenceTest (solver_data->ksp, &convergence_test,
                             reinterpret_cast<void *>(&solver_control),
                             PETSC_NULL);
-#endif
 
                                /**
                                 * set the software that is to be

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.