From d86f2e33bb7614a5b4679a694fe164bd4bc3b827 Mon Sep 17 00:00:00 2001 From: young Date: Thu, 14 Mar 2013 09:10:53 +0000 Subject: [PATCH] Remove most instances of PETSC_USE_64BIT_INDICES. PetscInt is always right. git-svn-id: https://svn.dealii.org/trunk@28899 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/source/lac/petsc_matrix_base.cc | 40 +++++-------------- .../lac/petsc_parallel_sparse_matrix.cc | 36 +++-------------- deal.II/source/lac/petsc_parallel_vector.cc | 8 +--- deal.II/source/lac/petsc_solver.cc | 8 ---- deal.II/source/lac/petsc_vector_base.cc | 30 ++------------ deal.II/source/lac/slepc_solver.cc | 4 -- 6 files changed, 19 insertions(+), 107 deletions(-) diff --git a/deal.II/source/lac/petsc_matrix_base.cc b/deal.II/source/lac/petsc_matrix_base.cc index 12820212a3..036addb339 100644 --- a/deal.II/source/lac/petsc_matrix_base.cc +++ b/deal.II/source/lac/petsc_matrix_base.cc @@ -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 MatrixBase::local_range () const { -#ifdef PETSC_USE_64BIT_INDICES - PetscInt -#else - int -#endif - begin, end; + PetscInt begin, end; + const int ierr = MatGetOwnershipRange (static_cast(matrix), &begin, &end); AssertThrow (ierr == 0, ExcPETScError(ierr)); diff --git a/deal.II/source/lac/petsc_parallel_sparse_matrix.cc b/deal.II/source/lac/petsc_parallel_sparse_matrix.cc index 2120531cbd..a734506e54 100644 --- a/deal.II/source/lac/petsc_parallel_sparse_matrix.cc +++ b/deal.II/source/lac/petsc_parallel_sparse_matrix.cc @@ -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 int_row_lengths (row_lengths.begin(), row_lengths.end()); -#else - const std::vector 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 -#else - std::vector -#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 -#else - std::vector -#endif + row_entries; std::vector row_values; for (unsigned int i=0; i -#else - std::vector -#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 VectorBase::local_range () const { -#ifdef PETSC_USE_64BIT_INDICES - PetscInt -#else - int -#endif - begin, end; + PetscInt begin, end; const int ierr = VecGetOwnershipRange (static_cast(vector), &begin, &end); AssertThrow (ierr == 0, ExcPETScError(ierr)); diff --git a/deal.II/source/lac/slepc_solver.cc b/deal.II/source/lac/slepc_solver.cc index 7e2682ad2d..af34b63a14 100644 --- a/deal.II/source/lac/slepc_solver.cc +++ b/deal.II/source/lac/slepc_solver.cc @@ -167,11 +167,7 @@ namespace SLEPcWrappers // get number of converged eigenstates ierr = EPSGetConverged (solver_data->eps, -#ifdef PETSC_USE_64BIT_INDICES reinterpret_cast(n_converged) -#else - reinterpret_cast(n_converged) -#endif ); AssertThrow (ierr == 0, ExcSLEPcError(ierr)); -- 2.39.5