]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Remove most instances of PETSC_USE_64BIT_INDICES. PetscInt is always right.
authoryoung <young@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 14 Mar 2013 09:10:53 +0000 (09:10 +0000)
committeryoung <young@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 14 Mar 2013 09:10:53 +0000 (09:10 +0000)
git-svn-id: https://svn.dealii.org/trunk@28899 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/lac/petsc_matrix_base.cc
deal.II/source/lac/petsc_parallel_sparse_matrix.cc
deal.II/source/lac/petsc_parallel_vector.cc
deal.II/source/lac/petsc_solver.cc
deal.II/source/lac/petsc_vector_base.cc
deal.II/source/lac/slepc_solver.cc

index 12820212a3cbc1694a2927646dbbce71db5a3caa..036addb3394f3fd99bebd16715d9635b585130e6 100644 (file)
@@ -217,12 +217,8 @@ namespace PETScWrappers
   MatrixBase::el (const unsigned int i,
                   const unsigned int j) const
   {
-#ifdef PETSC_USE_64BIT_INDICES
-    PetscInt
-#else
-    int
-#endif
-    petsc_i = i, petsc_j = j;
+    PetscInt petsc_i = i, petsc_j = j;
+
     PetscScalar value;
 
     const int ierr
@@ -274,12 +270,8 @@ namespace PETScWrappers
   unsigned int
   MatrixBase::m () const
   {
-#ifdef PETSC_USE_64BIT_INDICES
-    PetscInt
-#else
-    int
-#endif
-    n_rows, n_cols;
+    PetscInt n_rows, n_cols;
+
     int ierr = MatGetSize (matrix, &n_rows, &n_cols);
     AssertThrow (ierr == 0, ExcPETScError(ierr));
 
@@ -291,12 +283,8 @@ namespace PETScWrappers
   unsigned int
   MatrixBase::n () const
   {
-#ifdef PETSC_USE_64BIT_INDICES
-    PetscInt
-#else
-    int
-#endif
-    n_rows, n_cols;
+    PetscInt n_rows, n_cols;
+
     int ierr = MatGetSize (matrix, &n_rows, &n_cols);
     AssertThrow (ierr == 0, ExcPETScError(ierr));
 
@@ -308,12 +296,8 @@ namespace PETScWrappers
   unsigned int
   MatrixBase::local_size () const
   {
-#ifdef PETSC_USE_64BIT_INDICES
-    PetscInt
-#else
-    int
-#endif
-    n_rows, n_cols;
+    PetscInt n_rows, n_cols;
+
     int ierr = MatGetLocalSize (matrix, &n_rows, &n_cols);
     AssertThrow (ierr == 0, ExcPETScError(ierr));
 
@@ -325,12 +309,8 @@ namespace PETScWrappers
   std::pair<unsigned int, unsigned int>
   MatrixBase::local_range () const
   {
-#ifdef PETSC_USE_64BIT_INDICES
-    PetscInt
-#else
-    int
-#endif
-    begin, end;
+    PetscInt begin, end;
+
     const int ierr = MatGetOwnershipRange (static_cast<const Mat &>(matrix),
                                            &begin, &end);
     AssertThrow (ierr == 0, ExcPETScError(ierr));
index 2120531cbdb69bd5090535f7758667d534a02c0c..a734506e54477360286ee043a548d93a0f6fc923 100644 (file)
@@ -263,13 +263,8 @@ namespace PETScWrappers
       // signed integers. so we have to
       // convert, unless we want to play dirty
       // tricks with conversions of pointers
-#ifdef PETSC_USE_64BIT_INDICES
       const std::vector<PetscInt> int_row_lengths (row_lengths.begin(),
                                                    row_lengths.end());
-#else
-      const std::vector<signed int> int_row_lengths (row_lengths.begin(),
-                                                     row_lengths.end());
-#endif
 
 //TODO: There must be a significantly better way to provide information about the off-diagonal blocks of the matrix. this way, petsc keeps allocating tiny chunks of memory, and gets completely hung up over this
 
@@ -356,11 +351,8 @@ namespace PETScWrappers
 
       // then count the elements in- and
       // out-of-window for the rows we own
-#ifdef PETSC_USE_64BIT_INDICES
       std::vector<PetscInt>
-#else
-      std::vector<int>
-#endif
+
       row_lengths_in_window (local_row_end - local_row_start),
                             row_lengths_out_of_window (local_row_end - local_row_start);
       for (unsigned int row = local_row_start; row<local_row_end; ++row)
@@ -439,12 +431,8 @@ namespace PETScWrappers
           // have to somehow clumsily work around
           // the whole thing:
 #if DEAL_II_PETSC_VERSION_LT(2,2,1)
-
-#ifdef PETSC_USE_64BIT_INDICES
           std::vector<PetscInt>
-#else
-          std::vector<int>
-#endif
+
           row_entries;
           std::vector<PetscScalar> row_values;
           for (unsigned int i=0; i<sparsity_pattern.n_rows(); ++i)
@@ -461,7 +449,6 @@ namespace PETScWrappers
             }
 
           compress ();
-
 #else
 
           // first set up the column number
@@ -470,11 +457,8 @@ namespace PETScWrappers
           // dummy entry at the end to make
           // sure petsc doesn't read past the
           // end
-#ifdef PETSC_USE_64BIT_INDICES
           std::vector<PetscInt>
-#else
-          std::vector<int>
-#endif
+
           rowstart_in_window (local_row_end - local_row_start + 1, 0),
                              colnums_in_window;
           {
@@ -492,12 +476,7 @@ namespace PETScWrappers
           // now copy over the information
           // from the sparsity pattern.
           {
-#ifdef PETSC_USE_64BIT_INDICES
-            PetscInt
-#else
-            int
-#endif
-            * ptr = & colnums_in_window[0];
+            PetscInt* ptr = & colnums_in_window[0];
 
             for (unsigned int i=local_row_start; i<local_row_end; ++i)
               {
@@ -546,12 +525,7 @@ namespace PETScWrappers
 
             for (unsigned int i=local_row_start; i<local_row_end; ++i)
               {
-#ifdef PETSC_USE_64BIT_INDICES
-                PetscInt
-#else
-                int
-#endif
-                petsc_i = i;
+                PetscInt petsc_i = i;
                 MatSetValues (matrix, 1, &petsc_i,
                               sparsity_pattern.row_length(i),
                               &colnums_in_window[rowstart_in_window[i-local_row_start]],
index cf3bd0c4e72aaca4bfde7b15fdf1ff2dd11a8191..9d36ee63047bc0db652e4d115a44f5e6dd2ad774 100644 (file)
@@ -269,13 +269,7 @@ namespace PETScWrappers
 
 #if DEBUG
       // test ghost allocation in debug mode
-
-#ifdef PETSC_USE_64BIT_INDICES
-      PetscInt
-#else
-      int
-#endif
-      begin, end;
+      PetscInt begin, end;
 
       ierr = VecGetOwnershipRange (vector, &begin, &end);
 
index 67d38bf5efdbce9094f9d32742ce9f68f95bb08d..3b58933f75e1f6024c58a3032799185bc5275936 100644 (file)
@@ -160,11 +160,7 @@ namespace PETScWrappers
 
   int
   SolverBase::convergence_test (KSP                 /*ksp*/,
-#ifdef PETSC_USE_64BIT_INDICES
                                 const PetscInt      iteration,
-#else
-                                const int           iteration,
-#endif
                                 const PetscReal     residual_norm,
                                 KSPConvergedReason *reason,
                                 void               *solver_control_x)
@@ -853,11 +849,7 @@ namespace PETScWrappers
   }
 
   int SparseDirectMUMPS::convergence_test (KSP            /*ksp*/,
-#ifdef PETSC_USE_64BIT_INDICES
                                            const PetscInt       iteration,
-#else
-                                           const int            iteration,
-#endif
                                            const PetscReal      residual_norm,
                                            KSPConvergedReason   *reason,
                                            void                 *solver_control_x)
index 439a6bfcaba59a75006e34209508019b0c556dc6..8de2a942bb505ddad984aed1a01fa36a4f2c123b 100644 (file)
@@ -68,11 +68,7 @@ namespace PETScWrappers
           // an index set
           if (vector.ghosted)
             {
-#ifdef PETSC_USE_64BIT_INDICES
               PetscInt begin, end;
-#else
-              int begin, end;
-#endif
               ierr = VecGetOwnershipRange (vector.vector, &begin, &end);
               AssertThrow (ierr == 0, ExcPETScError(ierr));
 
@@ -119,12 +115,7 @@ namespace PETScWrappers
           // first verify that the requested
           // element is actually locally
           // available
-
-#ifdef PETSC_USE_64BIT_INDICES
           PetscInt begin, end;
-#else
-          int begin, end;
-#endif
 
           ierr = VecGetOwnershipRange (vector.vector, &begin, &end);
           AssertThrow (ierr == 0, ExcPETScError(ierr));
@@ -266,12 +257,7 @@ namespace PETScWrappers
   unsigned int
   VectorBase::size () const
   {
-#ifdef PETSC_USE_64BIT_INDICES
-    PetscInt
-#else
-    int
-#endif
-    sz;
+    PetscInt sz;
     const int ierr = VecGetSize (vector, &sz);
     AssertThrow (ierr == 0, ExcPETScError(ierr));
 
@@ -283,12 +269,7 @@ namespace PETScWrappers
   unsigned int
   VectorBase::local_size () const
   {
-#ifdef PETSC_USE_64BIT_INDICES
-    PetscInt
-#else
-    int
-#endif
-    sz;
+    PetscInt sz;
     const int ierr = VecGetLocalSize (vector, &sz);
     AssertThrow (ierr == 0, ExcPETScError(ierr));
 
@@ -300,12 +281,7 @@ namespace PETScWrappers
   std::pair<unsigned int, unsigned int>
   VectorBase::local_range () const
   {
-#ifdef PETSC_USE_64BIT_INDICES
-    PetscInt
-#else
-    int
-#endif
-    begin, end;
+    PetscInt begin, end;
     const int ierr = VecGetOwnershipRange (static_cast<const Vec &>(vector),
                                            &begin, &end);
     AssertThrow (ierr == 0, ExcPETScError(ierr));
index 7e2682ad2d8c18c2aa8098c84d6b581f4d77634c..af34b63a14ee33054815385d04b7d36bd98bcc8a 100644 (file)
@@ -167,11 +167,7 @@ namespace SLEPcWrappers
 
     // get number of converged eigenstates
     ierr = EPSGetConverged (solver_data->eps,
-#ifdef PETSC_USE_64BIT_INDICES
                             reinterpret_cast<PetscInt *>(n_converged)
-#else
-                            reinterpret_cast<int *>(n_converged)
-#endif
                            );
     AssertThrow (ierr == 0, ExcSLEPcError(ierr));
 

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.