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
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));
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));
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));
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));
// 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
// 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)
// 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)
}
compress ();
-
#else
// first set up the column number
// 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;
{
// 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)
{
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]],
#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);
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)
}
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)
// 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));
// 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));
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));
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));
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));
// 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));