PETSc typedefs PetscErrorCode to be int (so these are equivalent) but this makes
things a bit clearer.
// get a representation of the vector and copy it
PetscScalar *start_ptr;
- int ierr = VecGetArray (static_cast<const Vec &>(petsc_vec), &start_ptr);
+ PetscErrorCode ierr = VecGetArray (static_cast<const Vec &>(petsc_vec),
+ &start_ptr);
AssertThrow (ierr == 0, ExcPETScError(ierr));
const size_type vec_size = local_size();
#else
const PetscErrorCode ierr = PetscOptionsSetValue (NULL, name.c_str (), value.c_str ());
#endif
- (void)ierr;
- Assert (ierr == 0, ExcPETScError(ierr));
+ AssertThrow (ierr == 0, ExcPETScError(ierr));
}
const PetscBooleanType option_value = PETSC_FALSE)
{
#if DEAL_II_PETSC_VERSION_LT(3,0,0)
- const int ierr = MatSetOption (matrix, option_name);
+ const PetscErrorCode ierr = MatSetOption (matrix, option_name);
#else
- const int ierr = MatSetOption (matrix, option_name, option_value);
+ const PetscErrorCode ierr = MatSetOption (matrix, option_name, option_value);
#endif
AssertThrow (ierr == 0, ExcPETScError(ierr));
col_value_ptr = &column_values[0];
}
- const int ierr = MatSetValues (matrix, 1, &petsc_i, n_columns,
- col_index_ptr,
- col_value_ptr, INSERT_VALUES);
+ const PetscErrorCode ierr = MatSetValues (matrix, 1, &petsc_i, n_columns,
+ col_index_ptr,
+ col_value_ptr, INSERT_VALUES);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
col_value_ptr = &column_values[0];
}
- const int ierr = MatSetValues (matrix, 1, &petsc_i, n_columns,
- col_index_ptr, col_value_ptr, ADD_VALUES);
+ const PetscErrorCode ierr = MatSetValues (matrix, 1, &petsc_i, n_columns,
+ col_index_ptr, col_value_ptr,
+ ADD_VALUES);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
{
PetscInt begin, end;
- const int ierr = MatGetOwnershipRange (static_cast<const Mat &>(matrix),
- &begin, &end);
+ const PetscErrorCode ierr = MatGetOwnershipRange (static_cast<const Mat &>(matrix),
+ &begin, &end);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return ((index >= static_cast<size_type>(begin)) &&
// we skip the code below and create a simple serial vector of
// length 0
- int ierr;
#if DEAL_II_PETSC_VERSION_LT(3,2,0)
- ierr = VecDestroy (vector);
+ PetscErrorCode ierr = VecDestroy (vector);
#else
- ierr = VecDestroy (&vector);
+ PetscErrorCode ierr = VecDestroy (&vector);
#endif
AssertThrow (ierr == 0, ExcPETScError(ierr));
reinit (v.communicator, v.size(), v.local_size(), true);
}
- const int ierr = VecCopy (v.vector, vector);
+ PetscErrorCode ierr = VecCopy (v.vector, vector);
AssertThrow (ierr == 0, ExcPETScError(ierr));
if (has_ghost_elements())
{
- int ierr;
-
ierr = VecGhostUpdateBegin(vector, INSERT_VALUES, SCATTER_FORWARD);
AssertThrow (ierr == 0, ExcPETScError(ierr));
ierr = VecGhostUpdateEnd(vector, INSERT_VALUES, SCATTER_FORWARD);
if (size() != v.size())
reinit (v.size(), true);
- const int ierr = VecCopy (v.vector, vector);
+ const PetscErrorCode ierr = VecCopy (v.vector, vector);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return *this;
Vector &
Vector::operator = (const MPI::Vector &v)
{
- int ierr;
+ PetscErrorCode ierr;
if (attained_ownership)
{
// the petsc function we call wants to
const PetscInt petsc_i = index;
- const int ierr = VecSetValues (vector, 1, &petsc_i, &value, INSERT_VALUES);
+ const PetscErrorCode ierr = VecSetValues (vector, 1, &petsc_i, &value,
+ INSERT_VALUES);
AssertThrow (ierr == 0, ExcPETScError(ierr));
vector.last_action = VectorOperation::insert;
// use the PETSc function to add something
const PetscInt petsc_i = index;
- const int ierr = VecSetValues (vector, 1, &petsc_i, &value, ADD_VALUES);
+ const PetscErrorCode ierr = VecSetValues (vector, 1, &petsc_i, &value,
+ ADD_VALUES);
AssertThrow (ierr == 0, ExcPETScError(ierr));
// add something
const PetscInt petsc_i = index;
const PetscScalar subtractand = -value;
- const int ierr = VecSetValues (vector, 1, &petsc_i, &subtractand, ADD_VALUES);
+ const PetscErrorCode ierr = VecSetValues (vector, 1, &petsc_i, &subtractand,
+ ADD_VALUES);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return *this;
const PetscScalar new_value
= static_cast<PetscScalar>(*this) * value;
- const int ierr = VecSetValues (vector, 1, &petsc_i, &new_value, INSERT_VALUES);
+ const PetscErrorCode ierr = VecSetValues (vector, 1, &petsc_i, &new_value,
+ INSERT_VALUES);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return *this;
const PetscScalar new_value
= static_cast<PetscScalar>(*this) / value;
- const int ierr = VecSetValues (vector, 1, &petsc_i, &new_value, INSERT_VALUES);
+ const PetscErrorCode ierr = VecSetValues (vector, 1, &petsc_i, &new_value,
+ INSERT_VALUES);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return *this;
VectorBase::in_local_range (const size_type index) const
{
PetscInt begin, end;
- const int ierr = VecGetOwnershipRange (static_cast<const Vec &>(vector),
- &begin, &end);
+ const PetscErrorCode ierr = VecGetOwnershipRange (static_cast<const Vec &>(vector),
+ &begin, &end);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return ((index >= static_cast<size_type>(begin)) &&
// with a parallel vector
if (ghosted )
{
-
- int ierr;
-
// there is the possibility
// that the vector has
// ghost elements. in that
// position we can get from
// an index set
PetscInt begin, end;
- ierr = VecGetOwnershipRange (vector, &begin, &end);
+ PetscErrorCode ierr = VecGetOwnershipRange (vector, &begin, &end);
AssertThrow (ierr == 0, ExcPETScError(ierr));
Vec locally_stored_elements = PETSC_NULL;
// element we are interested in
else
{
- int ierr;
-
PetscInt begin, end;
- ierr = VecGetOwnershipRange (vector, &begin, &end);
+ PetscErrorCode ierr = VecGetOwnershipRange (vector, &begin, &end);
AssertThrow (ierr == 0, ExcPETScError(ierr));
PetscScalar *ptr;
// get a representation of the vector and copy it
PetscScalar *start_ptr;
- int ierr = VecGetArray (static_cast<const Vec &>(petsc_vec), &start_ptr);
+ PetscErrorCode ierr = VecGetArray (static_cast<const Vec &>(petsc_vec), &start_ptr);
AssertThrow (ierr == 0, ExcPETScError(ierr));
const size_type vec_size = petsc_vec.local_size();
void
SolverBase::set_initial_space(const std::vector<Vector> &this_initial_space)
{
- int ierr;
std::vector<Vec> vecs(this_initial_space.size());
for (unsigned int i = 0; i < this_initial_space.size(); i++)
// by taking a linear combination of them. (TODO: make function virtual?)
#if DEAL_II_PETSC_VERSION_LT(3,1,0)
- ierr = EPSSetInitialVector (eps, &vecs[0]);
+ const PetscErrorCode ierr = EPSSetInitialVector (eps, &vecs[0]);
#else
- ierr = EPSSetInitialSpace (eps, vecs.size(), &vecs[0]);
+ const PetscErrorCode ierr = EPSSetInitialSpace (eps, vecs.size(), &vecs[0]);
#endif
AssertThrow (ierr == 0, ExcSLEPcError(ierr));
}
// get a representation of the vector
// and copy it
PetscScalar *start_ptr;
- int ierr = VecGetArray (static_cast<const Vec &>(v), &start_ptr);
+ PetscErrorCode ierr = VecGetArray (static_cast<const Vec &>(v), &start_ptr);
AssertThrow (ierr == 0, ExcPETScError(ierr));
internal::copy (start_ptr, start_ptr+vec_size, begin());
// get a representation of the vector
// and copy it
PetscScalar *start_ptr;
- int ierr = VecGetArray (static_cast<const Vec &>(v), &start_ptr);
+ PetscErrorCode ierr = VecGetArray (static_cast<const Vec &>(v), &start_ptr);
AssertThrow (ierr == 0, ExcPETScError(ierr));
internal::copy (start_ptr, start_ptr+vec_size, begin());
// PetscErrorMessage changes the value in a pointer to refer to a
// statically allocated description of the current error message.
const char *petsc_message;
- const int ierr = PetscErrorMessage (error_code, &petsc_message, /*specific=*/NULL);
+ const PetscErrorCode ierr = PetscErrorMessage (error_code, &petsc_message,
+ /*specific=*/NULL);
if (ierr == 0 && petsc_message != NULL)
{
out << "The description of the error provided by PETSc is \""
{
// use the call sequence indicating only a maximal number of
// elements per row for all rows globally
- const int ierr = MatCreateSeqDense (PETSC_COMM_SELF, m, n, PETSC_NULL,
- &matrix);
+ const PetscErrorCode ierr = MatCreateSeqDense (PETSC_COMM_SELF, m, n,
+ PETSC_NULL, &matrix);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
const PetscInt *colnums;
const PetscScalar *values;
- int ierr;
- (void)ierr;
- ierr = MatGetRow(*matrix, this->a_row, &ncols, &colnums, &values);
+ PetscErrorCode ierr = MatGetRow(*matrix, this->a_row, &ncols, &colnums,
+ &values);
AssertThrow (ierr == 0, ExcPETScError(ierr));
// copy it into our caches if the line
// ...and replace it by an empty
// sequential matrix
const int m=0, n=0, n_nonzero_per_row=0;
- const int ierr = MatCreateSeqAIJ(PETSC_COMM_SELF, m, n, n_nonzero_per_row,
- 0, &matrix);
+ const PetscErrorCode ierr = MatCreateSeqAIJ(PETSC_COMM_SELF, m, n,
+ n_nonzero_per_row,
+ 0, &matrix);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
assert_is_compressed ();
- const int ierr = MatZeroEntries (matrix);
+ const PetscErrorCode ierr = MatZeroEntries (matrix);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return *this;
#endif
#if DEAL_II_PETSC_VERSION_LT(3,2,0)
- const int ierr = MatZeroRowsIS(matrix, index_set, new_diag_value);
+ const PetscErrorCode ierr = MatZeroRowsIS(matrix, index_set, new_diag_value);
#else
- const int ierr = MatZeroRowsIS(matrix, index_set, new_diag_value, PETSC_NULL,
- PETSC_NULL);
+ const PetscErrorCode ierr = MatZeroRowsIS(matrix, index_set, new_diag_value,
+ PETSC_NULL, PETSC_NULL);
#endif
AssertThrow (ierr == 0, ExcPETScError(ierr));
PetscScalar value;
- const int ierr = MatGetValues (matrix, 1, &petsc_i, 1, &petsc_j,
- &value);
+ const PetscErrorCode ierr = MatGetValues (matrix, 1, &petsc_i, 1, &petsc_j,
+ &value);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return value;
void
MatrixBase::compress (const VectorOperation::values operation)
{
- int ierr;
- (void)ierr;
+ {
#ifdef DEBUG
#ifdef DEAL_II_WITH_MPI
- // Check that all processors agree that last_action is the same (or none!)
+ // Check that all processors agree that last_action is the same (or none!)
- int my_int_last_action = last_action;
- int all_int_last_action;
+ int my_int_last_action = last_action;
+ int all_int_last_action;
- ierr = MPI_Allreduce(&my_int_last_action, &all_int_last_action, 1, MPI_INT,
- MPI_BOR, get_mpi_communicator());
- AssertThrowMPI(ierr);
+ const int ierr = MPI_Allreduce
+ (&my_int_last_action, &all_int_last_action, 1, MPI_INT, MPI_BOR,
+ get_mpi_communicator());
+ AssertThrowMPI(ierr);
- AssertThrow(all_int_last_action != (VectorOperation::add | VectorOperation::insert),
- ExcMessage("Error: not all processors agree on the last VectorOperation before this compress() call."));
+ AssertThrow(all_int_last_action != (VectorOperation::add | VectorOperation::insert),
+ ExcMessage("Error: not all processors agree on the last "
+ "VectorOperation before this compress() call."));
#endif
#endif
+ }
AssertThrow(last_action == VectorOperation::unknown
|| last_action == operation,
ExcMessage("Missing compress() or calling with wrong VectorOperation argument."));
// flush buffers
- ierr = MatAssemblyBegin (matrix,MAT_FINAL_ASSEMBLY);
+ PetscErrorCode ierr = MatAssemblyBegin (matrix,MAT_FINAL_ASSEMBLY);
AssertThrow (ierr == 0, ExcPETScError(ierr));
ierr = MatAssemblyEnd (matrix,MAT_FINAL_ASSEMBLY);
{
PetscInt n_rows, n_cols;
- const int ierr = MatGetSize (matrix, &n_rows, &n_cols);
+ const PetscErrorCode ierr = MatGetSize (matrix, &n_rows, &n_cols);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return n_rows;
{
PetscInt n_rows, n_cols;
- const int ierr = MatGetSize (matrix, &n_rows, &n_cols);
+ const PetscErrorCode ierr = MatGetSize (matrix, &n_rows, &n_cols);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return n_cols;
{
PetscInt n_rows, n_cols;
- const int ierr = MatGetLocalSize (matrix, &n_rows, &n_cols);
+ const PetscErrorCode ierr = MatGetLocalSize (matrix, &n_rows, &n_cols);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return n_rows;
{
PetscInt begin, end;
- const int ierr = MatGetOwnershipRange (static_cast<const Mat &>(matrix),
- &begin, &end);
+ const PetscErrorCode ierr = MatGetOwnershipRange (static_cast<const Mat &>(matrix),
+ &begin, &end);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return std::make_pair (begin, end);
MatrixBase::n_nonzero_elements () const
{
MatInfo mat_info;
- const int ierr = MatGetInfo (matrix, MAT_GLOBAL_SUM, &mat_info);
+ const PetscErrorCode ierr = MatGetInfo (matrix, MAT_GLOBAL_SUM, &mat_info);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return static_cast<size_type>(mat_info.nz_used);
//TODO: this is probably horribly inefficient; we should lobby for a way to
//query this information from PETSc
- int ierr = MatGetRow(*this, row, &ncols, &colnums, &values);
+ PetscErrorCode ierr = MatGetRow(*this, row, &ncols, &colnums, &values);
AssertThrow (ierr == 0, ExcPETScError(ierr));
// then restore the matrix and return the number of columns in this row as
{
PetscReal result;
- const int ierr = MatNorm (matrix, NORM_1, &result);
+ const PetscErrorCode ierr = MatNorm (matrix, NORM_1, &result);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return result;
{
PetscReal result;
- const int ierr = MatNorm (matrix, NORM_INFINITY, &result);
+ const PetscErrorCode ierr = MatNorm (matrix, NORM_INFINITY, &result);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return result;
{
PetscReal result;
- const int ierr = MatNorm (matrix, NORM_FROBENIUS, &result);
+ const PetscErrorCode ierr = MatNorm (matrix, NORM_FROBENIUS, &result);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return result;
{
PetscScalar result;
- const int ierr = MatGetTrace (matrix, &result);
+ const PetscErrorCode ierr = MatGetTrace (matrix, &result);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return result;
MatrixBase &
MatrixBase::operator *= (const PetscScalar a)
{
- const int ierr = MatScale (matrix, a);
+ const PetscErrorCode ierr = MatScale (matrix, a);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return *this;
MatrixBase::operator /= (const PetscScalar a)
{
const PetscScalar factor = 1./a;
- const int ierr = MatScale (matrix, factor);
+ const PetscErrorCode ierr = MatScale (matrix, factor);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return *this;
MatrixBase::add (const PetscScalar factor,
const MatrixBase &other)
{
- const int ierr = MatAXPY (matrix, factor,
- other, DIFFERENT_NONZERO_PATTERN);
+ const PetscErrorCode ierr = MatAXPY (matrix, factor,
+ other, DIFFERENT_NONZERO_PATTERN);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return *this;
{
Assert (&src != &dst, ExcSourceEqualsDestination());
- const int ierr = MatMult (matrix, src, dst);
+ const PetscErrorCode ierr = MatMult (matrix, src, dst);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
{
Assert (&src != &dst, ExcSourceEqualsDestination());
- const int ierr = MatMultTranspose (matrix, src, dst);
+ const PetscErrorCode ierr = MatMultTranspose (matrix, src, dst);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
{
Assert (&src != &dst, ExcSourceEqualsDestination());
- const int ierr = MatMultAdd (matrix, src, dst, dst);
- (void)ierr;
+ const PetscErrorCode ierr = MatMultAdd (matrix, src, dst, dst);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
{
Assert (&src != &dst, ExcSourceEqualsDestination());
- const int ierr = MatMultTransposeAdd (matrix, src, dst, dst);
+ const PetscErrorCode ierr = MatMultTransposeAdd (matrix, src, dst, dst);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
void
MatrixBase::transpose ()
{
- const int ierr = MatTranspose(matrix, MAT_REUSE_MATRIX, &matrix);
+ const PetscErrorCode ierr = MatTranspose(matrix, MAT_REUSE_MATRIX, &matrix);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
{
PetscBooleanType truth;
assert_is_compressed ();
- const int ierr = MatIsSymmetric (matrix, tolerance, &truth);
+ const PetscErrorCode ierr = MatIsSymmetric (matrix, tolerance, &truth);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return truth;
}
PetscBooleanType truth;
assert_is_compressed ();
- const int ierr = MatIsHermitian (matrix, tolerance, &truth);
+ const PetscErrorCode ierr = MatIsHermitian (matrix, tolerance, &truth);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return truth;
assert_is_compressed ();
// Set options
- int ierr = PetscViewerSetFormat (PETSC_VIEWER_STDOUT_WORLD,
- format);
+ PetscErrorCode ierr = PetscViewerSetFormat (PETSC_VIEWER_STDOUT_WORLD,
+ format);
AssertThrow (ierr == 0, ExcPETScError(ierr));
// Write to screen
MatrixBase::size_type row;
for (row = loc_range.first; row < loc_range.second; ++row)
{
- int ierr = MatGetRow(*this, row, &ncols, &colnums, &values);
+ PetscErrorCode ierr = MatGetRow(*this, row, &ncols, &colnums, &values);
AssertThrow (ierr == 0, ExcPETScError(ierr));
for (PetscInt col = 0; col < ncols; ++col)
MatrixBase::memory_consumption() const
{
MatInfo info;
- const int ierr = MatGetInfo(matrix, MAT_LOCAL, &info);
+ const PetscErrorCode ierr = MatGetInfo(matrix, MAT_LOCAL, &info);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return sizeof(*this) + static_cast<size_type>(info.memory);
// and reinit x and y with
// dealii::PETScWrappers::*::Vector:
const char *vec_type;
- int ierr = VecGetType (src, &vec_type);
+ PetscErrorCode ierr = VecGetType (src, &vec_type);
AssertThrow (ierr == 0, ExcPETScError(ierr));
PetscInt local_size;
// to the matrix-vector multiplication
// of this MatrixFree object,
void *this_object;
- const int ierr = MatShellGetContext (A, &this_object);
+ const PetscErrorCode ierr = MatShellGetContext (A, &this_object);
AssertThrow (ierr == 0, ExcPETScError(ierr));
// call vmult of this object:
Assert (local_rows <= m, ExcDimensionMismatch (local_rows, m));
Assert (local_columns <= n, ExcDimensionMismatch (local_columns, n));
- int ierr;
// create a PETSc MatShell matrix-type
// object of dimension m x n and local size
// local_rows x local_columns
- ierr = MatCreateShell(communicator, local_rows, local_columns, m, n, (void *)this, &matrix);
+ PetscErrorCode ierr = MatCreateShell(communicator, local_rows, local_columns,
+ m, n, (void *)this, &matrix);
AssertThrow (ierr == 0, ExcPETScError(ierr));
// register the MatrixFree::matrix_free_mult function
// as the matrix multiplication used by this matrix
// create an empty matrix, we can as
// well make it sequential
const int m=0, n=0, n_nonzero_per_row=0;
- const int ierr
+ const PetscErrorCode ierr
= MatCreateSeqAIJ(PETSC_COMM_SELF, m, n, n_nonzero_per_row,
0, &matrix);
AssertThrow (ierr == 0, ExcPETScError(ierr));
this->communicator = other.communicator;
- const int ierr = MatCopy(other.matrix, matrix, SAME_NONZERO_PATTERN);
+ const PetscErrorCode ierr = MatCopy(other.matrix, matrix,
+ SAME_NONZERO_PATTERN);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
// use the call sequence indicating only
// a maximal number of elements per row
// for all rows globally
- int ierr;
-
#if DEAL_II_PETSC_VERSION_LT(3,3,0)
- ierr = MatCreateMPIAIJ (communicator,
- local_rows, local_columns,
- m, n,
- n_nonzero_per_row, 0,
- n_offdiag_nonzero_per_row, 0,
- &matrix);
+ const PetscErrorCode ierr = MatCreateMPIAIJ
+ (communicator,
+ local_rows, local_columns,
+ m, n,
+ n_nonzero_per_row, 0,
+ n_offdiag_nonzero_per_row, 0,
+ &matrix);
#else
- ierr = MatCreateAIJ (communicator,
- local_rows, local_columns,
- m, n,
- n_nonzero_per_row, 0,
- n_offdiag_nonzero_per_row, 0,
- &matrix);
+ const PetscErrorCode ierr = MatCreateAIJ
+ (communicator,
+ local_rows, local_columns,
+ m, n,
+ n_nonzero_per_row, 0,
+ n_offdiag_nonzero_per_row, 0,
+ &matrix);
set_matrix_option (matrix, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE);
#endif
AssertThrow (ierr == 0, ExcPETScError(ierr));
offdiag_row_lengths.end());
//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
-
- int ierr;
-
#if DEAL_II_PETSC_VERSION_LT(3,3,0)
- ierr = MatCreateMPIAIJ (communicator,
- local_rows, local_columns,
- m, n,
- 0, &int_row_lengths[0],
- 0, offdiag_row_lengths.size() ? &int_offdiag_row_lengths[0] : 0,
- &matrix);
+ const PetscErrorCode ierr = MatCreateMPIAIJ
+ (communicator,
+ local_rows, local_columns,
+ m, n,
+ 0, &int_row_lengths[0],
+ 0, offdiag_row_lengths.size() ? &int_offdiag_row_lengths[0] : 0,
+ &matrix);
#else
- ierr = MatCreateAIJ (communicator,
- local_rows, local_columns,
- m, n,
- 0, &int_row_lengths[0],
- 0, offdiag_row_lengths.size() ? &int_offdiag_row_lengths[0] : 0,
- &matrix);
+ const PetscErrorCode ierr = MatCreateAIJ
+ (communicator,
+ local_rows, local_columns,
+ m, n,
+ 0, &int_row_lengths[0],
+ 0,
+ offdiag_row_lengths.size() ? &int_offdiag_row_lengths[0] : 0,
+ &matrix);
//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).
set_matrix_option (matrix, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE);
// create the matrix. We do not set row length but set the
// correct SparsityPattern later.
- int ierr;
-
- ierr = MatCreate(communicator,&matrix);
+ PetscErrorCode ierr = MatCreate(communicator,&matrix);
AssertThrow (ierr == 0, ExcPETScError(ierr));
ierr = MatSetSizes(matrix,
// the first _local_ row, i.e. it
// doesn't index into an array for
// _all_ rows.
- const int ierr = MatCreateMPIAIJ(communicator,
- local_rows_per_process[this_process],
- local_columns_per_process[this_process],
- sparsity_pattern.n_rows(),
- sparsity_pattern.n_cols(),
- 0, &row_lengths_in_window[0],
- 0, &row_lengths_out_of_window[0],
- &matrix);
+ const PetscErrorCode ierr = MatCreateMPIAIJ(communicator,
+ local_rows_per_process[this_process],
+ local_columns_per_process[this_process],
+ sparsity_pattern.n_rows(),
+ sparsity_pattern.n_cols(),
+ 0, &row_lengths_in_window[0],
+ 0, &row_lengths_out_of_window[0],
+ &matrix);
AssertThrow (ierr == 0, ExcPETScError(ierr));
#else //PETSC_VERSION>=2.3.3
// create the matrix. We
// do not set row length but set the
// correct SparsityPattern later.
- int ierr = MatCreate(communicator,&matrix);
+ PetscErrorCode ierr = MatCreate(communicator,&matrix);
AssertThrow (ierr == 0, ExcPETScError(ierr));
ierr = MatSetSizes(matrix,
// this is an invalid empty vector, so we can just as well create a
// sequential one to avoid all the overhead incurred by parallelism
const int n = 0;
- const int ierr
- = VecCreateSeq (PETSC_COMM_SELF, n, &vector);
+ const PetscErrorCode ierr = VecCreateSeq (PETSC_COMM_SELF, n, &vector);
AssertThrow (ierr == 0, ExcPETScError(ierr));
ghosted = false;
}
VectorBase::clear ();
const int n = 0;
- int ierr = VecCreateSeq (PETSC_COMM_SELF, n, &vector);
+ const PetscErrorCode ierr = VecCreateSeq (PETSC_COMM_SELF, n, &vector);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
// mismatch (may not be true for every proc)
int k_global, k = ((size() != n) || (local_size() != local_sz));
- int ierr = MPI_Allreduce (&k, &k_global, 1,
- MPI_INT, MPI_LOR, communicator);
- AssertThrowMPI(ierr);
+ {
+ const int ierr = MPI_Allreduce (&k, &k_global, 1,
+ MPI_INT, MPI_LOR, communicator);
+ AssertThrowMPI(ierr);
+ }
if (k_global || has_ghost_elements())
{
// but somehow it leads to odd errors
// somewhere down the line in some of
// the tests:
-// const int ierr = VecSetSizes (vector, n, n);
+// const PetscErrorCode ierr = VecSetSizes (vector, n, n);
// AssertThrow (ierr == 0, ExcPETScError(ierr));
// so let's go the slow way:
#if DEAL_II_PETSC_VERSION_LT(3,2,0)
- ierr = VecDestroy (vector);
+ const PetscErrorCode ierr = VecDestroy (vector);
#else
- ierr = VecDestroy (&vector);
+ const PetscErrorCode ierr = VecDestroy (&vector);
#endif
AssertThrow (ierr == 0, ExcPETScError(ierr));
reinit (v.locally_owned_elements(), v.ghost_indices, v.communicator);
if (!omit_zeroing_entries)
{
- const int ierr = VecSet(vector, 0.0);
+ const PetscErrorCode ierr = VecSet(vector, 0.0);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
}
const IndexSet &ghost,
const MPI_Comm &comm)
{
- int ierr;
#if DEAL_II_PETSC_VERSION_LT(3,2,0)
- ierr = VecDestroy (vector);
+ const PetscErrorCode ierr = VecDestroy (vector);
#else
- ierr = VecDestroy (&vector);
+ const PetscErrorCode ierr = VecDestroy (&vector);
#endif
AssertThrow (ierr == 0, ExcPETScError(ierr));
Vector::reinit (const IndexSet &local,
const MPI_Comm &comm)
{
- int ierr;
#if DEAL_II_PETSC_VERSION_LT(3,2,0)
- ierr = VecDestroy (vector);
+ const PetscErrorCode ierr = VecDestroy (vector);
#else
- ierr = VecDestroy (&vector);
+ const PetscErrorCode ierr = VecDestroy (&vector);
#endif
AssertThrow (ierr == 0, ExcPETScError(ierr));
//TODO [TH]: can not access v.last_action here. Implement is_compressed()?
//Assert(v.last_action==VectorOperation::unknown,
// ExcMessage("Call to compress() required before calling operator=."));
- int ierr;
// get a pointer to the local memory of
// this vector
PetscScalar *dest_array;
- ierr = VecGetArray (vector, &dest_array);
+ PetscErrorCode ierr = VecGetArray (vector, &dest_array);
AssertThrow (ierr == 0, ExcPETScError(ierr));
// then also a pointer to the source
Assert (local_size <= n, ExcIndexRange (local_size, 0, n));
ghosted = false;
- const int ierr = VecCreateMPI (communicator, local_size, PETSC_DETERMINE,
- &vector);
+ const PetscErrorCode ierr = VecCreateMPI (communicator, local_size, PETSC_DETERMINE,
+ &vector);
AssertThrow (ierr == 0, ExcPETScError(ierr));
Assert (size() == n,
:
0);
- int ierr = VecCreateGhost(communicator,
- local_size,
- PETSC_DETERMINE,
- ghostindices.size(),
- ptr,
- &vector);
+ PetscErrorCode ierr = VecCreateGhost(communicator,
+ local_size,
+ PETSC_DETERMINE,
+ ghostindices.size(),
+ ptr,
+ &vector);
AssertThrow (ierr == 0, ExcPETScError(ierr));
Assert (size() == n,
PetscScalar *val;
PetscInt nlocal, istart, iend;
- int ierr = VecGetArray (vector, &val);
+ PetscErrorCode ierr = VecGetArray (vector, &val);
AssertThrow (ierr == 0, ExcPETScError(ierr));
ierr = VecGetLocalSize (vector, &nlocal);
i++)
{
// This is slow, but most likely only used to debug.
- ierr = MPI_Barrier(communicator);
- AssertThrowMPI(ierr);
+ const int mpi_ierr = MPI_Barrier(communicator);
+ AssertThrowMPI(mpi_ierr);
if (i == Utilities::MPI::this_mpi_process(communicator))
{
if (across)
if (pc!=NULL)
{
#if DEAL_II_PETSC_VERSION_LT(3,2,0)
- int ierr = PCDestroy(pc);
+ PetscErrorCode ierr = PCDestroy(pc);
#else
- int ierr = PCDestroy(&pc);
+ PetscErrorCode ierr = PCDestroy(&pc);
#endif
pc = NULL;
AssertThrow (ierr == 0, ExcPETScError(ierr));
{
AssertThrow (pc != NULL, StandardExceptions::ExcInvalidState ());
- int ierr;
- ierr = PCApply(pc, src, dst);
+ const PetscErrorCode ierr = PCApply(pc, src, dst);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
AssertThrow (pc == NULL, StandardExceptions::ExcInvalidState ());
MPI_Comm comm;
- int ierr;
// this ugly cast is necessary because the
// type Mat and PETScObject are
// unrelated.
- ierr = PetscObjectGetComm(reinterpret_cast<PetscObject>(matrix), &comm);
+ PetscErrorCode ierr = PetscObjectGetComm(reinterpret_cast<PetscObject>(matrix),
+ &comm);
AssertThrow (ierr == 0, ExcPETScError(ierr));
ierr = PCCreate(comm, &pc);
{
additional_data = additional_data_;
- int ierr = PCCreate(comm, &pc);
+ PetscErrorCode ierr = PCCreate(comm, &pc);
AssertThrow (ierr == 0, ExcPETScError(ierr));
initialize();
{
AssertThrow (pc != NULL, StandardExceptions::ExcInvalidState ());
- int ierr;
- ierr = PCSetType (pc, const_cast<char *>(PCJACOBI));
+ PetscErrorCode ierr = PCSetType (pc, const_cast<char *>(PCJACOBI));
AssertThrow (ierr == 0, ExcPETScError(ierr));
ierr = PCSetFromOptions (pc);
create_pc();
initialize();
- int ierr = PCSetUp (pc);
+ PetscErrorCode ierr = PCSetUp (pc);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
{
additional_data = additional_data_;
- int ierr = PCCreate(comm, &pc);
+ PetscErrorCode ierr = PCCreate(comm, &pc);
AssertThrow (ierr == 0, ExcPETScError(ierr));
initialize();
void
PreconditionBlockJacobi::initialize()
{
- int ierr;
- ierr = PCSetType (pc, const_cast<char *>(PCBJACOBI));
+ PetscErrorCode ierr = PCSetType (pc, const_cast<char *>(PCBJACOBI));
AssertThrow (ierr == 0, ExcPETScError(ierr));
ierr = PCSetFromOptions (pc);
create_pc();
initialize();
- int ierr = PCSetUp (pc);
+ PetscErrorCode ierr = PCSetUp (pc);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
create_pc();
- int ierr;
- ierr = PCSetType (pc, const_cast<char *>(PCSOR));
+ PetscErrorCode ierr = PCSetType (pc, const_cast<char *>(PCSOR));
AssertThrow (ierr == 0, ExcPETScError(ierr));
// then set flags as given
create_pc();
- int ierr;
- ierr = PCSetType (pc, const_cast<char *>(PCSOR));
+ PetscErrorCode ierr = PCSetType (pc, const_cast<char *>(PCSOR));
AssertThrow (ierr == 0, ExcPETScError(ierr));
// then set flags as given
create_pc();
- int ierr;
- ierr = PCSetType (pc, const_cast<char *>(PCEISENSTAT));
+ PetscErrorCode ierr = PCSetType (pc, const_cast<char *>(PCEISENSTAT));
AssertThrow (ierr == 0, ExcPETScError(ierr));
// then set flags as given
create_pc();
- int ierr = PCSetType (pc, const_cast<char *>(PCICC));
+ PetscErrorCode ierr = PCSetType (pc, const_cast<char *>(PCICC));
AssertThrow (ierr == 0, ExcPETScError(ierr));
// then set flags
create_pc();
- int ierr;
- ierr = PCSetType (pc, const_cast<char *>(PCILU));
+ PetscErrorCode ierr = PCSetType (pc, const_cast<char *>(PCILU));
AssertThrow (ierr == 0, ExcPETScError(ierr));
// then set flags
{
additional_data = additional_data_;
- int ierr = PCCreate(comm, &pc);
+ PetscErrorCode ierr = PCCreate(comm, &pc);
AssertThrow (ierr == 0, ExcPETScError(ierr));
#ifdef PETSC_HAVE_HYPRE
PreconditionBoomerAMG::initialize ()
{
#ifdef PETSC_HAVE_HYPRE
- int ierr;
- ierr = PCSetType (pc, const_cast<char *>(PCHYPRE));
+ PetscErrorCode ierr = PCSetType (pc, const_cast<char *>(PCHYPRE));
AssertThrow (ierr == 0, ExcPETScError(ierr));
ierr = PCHYPRESetType(pc, "boomeramg");
create_pc();
initialize ();
- int ierr = PCSetUp (pc);
+ PetscErrorCode ierr = PCSetUp (pc);
AssertThrow (ierr == 0, ExcPETScError(ierr));
#else // PETSC_HAVE_HYPRE
#ifdef PETSC_HAVE_HYPRE
create_pc();
- int ierr;
- ierr = PCSetType (pc, const_cast<char *>(PCHYPRE));
+ PetscErrorCode ierr = PCSetType (pc, const_cast<char *>(PCHYPRE));
AssertThrow (ierr == 0, ExcPETScError(ierr));
ierr = PCHYPRESetType(pc, "parasails");
create_pc();
- int ierr;
- ierr = PCSetType (pc, const_cast<char *>(PCNONE));
+ PetscErrorCode ierr = PCSetType (pc, const_cast<char *>(PCNONE));
AssertThrow (ierr == 0, ExcPETScError(ierr));
ierr = PCSetFromOptions (pc);
create_pc();
- int ierr;
- ierr = PCSetType (pc, const_cast<char *>(PCLU));
+ PetscErrorCode ierr = PCSetType (pc, const_cast<char *>(PCLU));
AssertThrow (ierr == 0, ExcPETScError(ierr));
// set flags as given
const VectorBase &b,
const PreconditionerBase &preconditioner)
{
- int ierr;
-
/*
TODO: PETSc duplicates communicators, so this does not work (you put MPI_COMM_SELF in, but get something other out when you ask PETSc for the communicator. This mainly fails due to the MatrixFree classes, that can not ask PETSc for a communicator. //Timo Heister
Assert(A.get_mpi_communicator()==mpi_communicator, ExcMessage("PETSc Solver and Matrix need to use the same MPI_Comm."));
{
solver_data.reset (new SolverData());
- ierr = KSPCreate (mpi_communicator, &solver_data->ksp);
+ PetscErrorCode ierr = KSPCreate (mpi_communicator, &solver_data->ksp);
AssertThrow (ierr == 0, ExcPETScError(ierr));
// let derived classes set the solver
}
// set the command line option prefix name
- ierr = KSPSetOptionsPrefix(solver_data->ksp, prefix_name.c_str());
+ PetscErrorCode ierr = KSPSetOptionsPrefix(solver_data->ksp, prefix_name.c_str());
AssertThrow (ierr == 0, ExcPETScError(ierr));
// set the command line options provided
void
SolverBase::initialize(const PreconditionerBase &preconditioner)
{
- int ierr;
+ PetscErrorCode ierr;
solver_data.reset (new SolverData());
void
SolverRichardson::set_solver_type (KSP &ksp) const
{
- int ierr;
- ierr = KSPSetType (ksp, KSPRICHARDSON);
+ PetscErrorCode ierr = KSPSetType (ksp, KSPRICHARDSON);
AssertThrow (ierr == 0, ExcPETScError(ierr));
// set the damping factor from the data
// spelling Chebyshev between PETSc 3.2
// and 3.3...
#if DEAL_II_PETSC_VERSION_LT(3,3,0)
- int ierr = KSPSetType (ksp, KSPCHEBYCHEV);
+ PetscErrorCode ierr = KSPSetType (ksp, KSPCHEBYCHEV);
#else
- int ierr = KSPSetType (ksp, KSPCHEBYSHEV);
+ PetscErrorCode ierr = KSPSetType (ksp, KSPCHEBYSHEV);
#endif
AssertThrow (ierr == 0, ExcPETScError(ierr));
void
SolverCG::set_solver_type (KSP &ksp) const
{
- int ierr = KSPSetType (ksp, KSPCG);
+ PetscErrorCode ierr = KSPSetType (ksp, KSPCG);
AssertThrow (ierr == 0, ExcPETScError(ierr));
// in the deal.II solvers, we always
void
SolverBiCG::set_solver_type (KSP &ksp) const
{
- int ierr = KSPSetType (ksp, KSPBICG);
+ PetscErrorCode ierr = KSPSetType (ksp, KSPBICG);
AssertThrow (ierr == 0, ExcPETScError(ierr));
// in the deal.II solvers, we always
void
SolverGMRES::set_solver_type (KSP &ksp) const
{
- int ierr = KSPSetType (ksp, KSPGMRES);
+ PetscErrorCode ierr = KSPSetType (ksp, KSPGMRES);
AssertThrow (ierr == 0, ExcPETScError(ierr));
// set the restart parameter from the
void
SolverBicgstab::set_solver_type (KSP &ksp) const
{
- int ierr = KSPSetType (ksp, KSPBCGS);
+ PetscErrorCode ierr = KSPSetType (ksp, KSPBCGS);
AssertThrow (ierr == 0, ExcPETScError(ierr));
// in the deal.II solvers, we always
void
SolverCGS::set_solver_type (KSP &ksp) const
{
- int ierr = KSPSetType (ksp, KSPCGS);
+ PetscErrorCode ierr = KSPSetType (ksp, KSPCGS);
AssertThrow (ierr == 0, ExcPETScError(ierr));
// in the deal.II solvers, we always
void
SolverTFQMR::set_solver_type (KSP &ksp) const
{
- int ierr = KSPSetType (ksp, KSPTFQMR);
+ PetscErrorCode ierr = KSPSetType (ksp, KSPTFQMR);
AssertThrow (ierr == 0, ExcPETScError(ierr));
// in the deal.II solvers, we always
void
SolverTCQMR::set_solver_type (KSP &ksp) const
{
- int ierr = KSPSetType (ksp, KSPTCQMR);
+ PetscErrorCode ierr = KSPSetType (ksp, KSPTCQMR);
AssertThrow (ierr == 0, ExcPETScError(ierr));
// in the deal.II solvers, we always
void
SolverCR::set_solver_type (KSP &ksp) const
{
- int ierr = KSPSetType (ksp, KSPCR);
+ PetscErrorCode ierr = KSPSetType (ksp, KSPCR);
AssertThrow (ierr == 0, ExcPETScError(ierr));
// in the deal.II solvers, we always
void
SolverLSQR::set_solver_type (KSP &ksp) const
{
- int ierr = KSPSetType (ksp, KSPLSQR);
+ PetscErrorCode ierr = KSPSetType (ksp, KSPLSQR);
AssertThrow (ierr == 0, ExcPETScError(ierr));
// in the deal.II solvers, we always
void
SolverPreOnly::set_solver_type (KSP &ksp) const
{
- int ierr = KSPSetType (ksp, KSPPREONLY);
+ PetscErrorCode ierr = KSPSetType (ksp, KSPPREONLY);
AssertThrow (ierr == 0, ExcPETScError(ierr));
// The KSPPREONLY solver of
* preconditioner. Its use is due to SparseDirectMUMPS being a direct
* (rather than iterative) solver
*/
- int ierr = KSPSetType (ksp, KSPPREONLY);
+ PetscErrorCode ierr = KSPSetType (ksp, KSPPREONLY);
AssertThrow (ierr == 0, ExcPETScError(ierr));
/**
const VectorBase &b)
{
#ifdef PETSC_HAVE_MUMPS
- int ierr;
-
/**
* factorization matrix to be obtained from MUMPS
*/
* creates the default KSP context and puts it in the location
* solver_data->ksp
*/
- ierr = KSPCreate (mpi_communicator, &solver_data->ksp);
+ PetscErrorCode ierr = KSPCreate (mpi_communicator, &solver_data->ksp);
AssertThrow (ierr == 0, ExcPETScError(ierr));
/**
/**
* solve the linear system
*/
- ierr = KSPSolve (solver_data->ksp, b, x);
+ PetscErrorCode ierr = KSPSolve (solver_data->ksp, b, x);
AssertThrow (ierr == 0, ExcPETScError(ierr));
/**
SparseMatrix::SparseMatrix ()
{
const int m=0, n=0, n_nonzero_per_row=0;
- const int ierr = MatCreateSeqAIJ(PETSC_COMM_SELF, m, n, n_nonzero_per_row,
- 0, &matrix);
+ const PetscErrorCode ierr = MatCreateSeqAIJ(PETSC_COMM_SELF, m, n,
+ n_nonzero_per_row, 0, &matrix);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
SparseMatrix::get_mpi_communicator () const
{
static MPI_Comm comm;
- const int ierr = PetscObjectGetComm((PetscObject)matrix, &comm);
+ const PetscErrorCode ierr = PetscObjectGetComm((PetscObject)matrix, &comm);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return comm;
}
// use the call sequence indicating only
// a maximal number of elements per row
// for all rows globally
- const int ierr = MatCreateSeqAIJ(PETSC_COMM_SELF, m, n,
- n_nonzero_per_row,
- 0, &matrix);
+ const PetscErrorCode ierr = MatCreateSeqAIJ(PETSC_COMM_SELF, m, n,
+ n_nonzero_per_row,
+ 0, &matrix);
AssertThrow (ierr == 0, ExcPETScError(ierr));
// set symmetric flag, if so requested
const std::vector<PetscInt>
int_row_lengths (row_lengths.begin(), row_lengths.end());
- const int ierr = MatCreateSeqAIJ(PETSC_COMM_SELF, m, n, 0,
- &int_row_lengths[0], &matrix);
+ const PetscErrorCode ierr = MatCreateSeqAIJ(PETSC_COMM_SELF, m, n, 0,
+ &int_row_lengths[0], &matrix);
AssertThrow (ierr == 0, ExcPETScError(ierr));
// set symmetric flag, if so requested
row_entries[j] = sparsity_pattern.column_number (i,j);
const PetscInt int_row = i;
- const int ierr = MatSetValues (matrix, 1, &int_row,
- row_lengths[i], &row_entries[0],
- &row_values[0], INSERT_VALUES);
+ const PetscErrorCode ierr = MatSetValues (matrix, 1, &int_row,
+ row_lengths[i], &row_entries[0],
+ &row_values[0], INSERT_VALUES);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
compress (VectorOperation::insert);
// but somehow it leads to odd errors
// somewhere down the line in some of
// the tests:
-// const int ierr = VecSetSizes (vector, n, n);
+// const PetscErrorCode ierr = VecSetSizes (vector, n, n);
// AssertThrow (ierr == 0, ExcPETScError(ierr));
// so let's go the slow way:
if (attained_ownership)
{
#if DEAL_II_PETSC_VERSION_LT(3,2,0)
- int ierr = VecDestroy (vector);
+ PetscErrorCode ierr = VecDestroy (vector);
#else
- int ierr = VecDestroy (&vector);
+ PetscErrorCode ierr = VecDestroy (&vector);
#endif
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
void
Vector::create_vector (const size_type n)
{
- const int ierr
+ const PetscErrorCode ierr
= VecCreateSeq (PETSC_COMM_SELF, n, &vector);
AssertThrow (ierr == 0, ExcPETScError(ierr));
attained_ownership = true;
{
PetscInt idx = index;
PetscScalar value;
- int ierr = VecGetValues(vector.vector, 1, &idx, &value);
+ PetscErrorCode ierr = VecGetValues(vector.vector, 1, &idx, &value);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return value;
}
// with a parallel vector
else if (dynamic_cast<const PETScWrappers::MPI::Vector *>(&vector) != 0)
{
- int ierr;
-
// there is the possibility
// that the vector has
// ghost elements. in that
if (vector.ghosted)
{
PetscInt begin, end;
- ierr = VecGetOwnershipRange (vector.vector, &begin, &end);
+ PetscErrorCode ierr = VecGetOwnershipRange (vector.vector, &begin,
+ &end);
AssertThrow (ierr == 0, ExcPETScError(ierr));
Vec locally_stored_elements = PETSC_NULL;
// available
PetscInt begin, end;
- ierr = VecGetOwnershipRange (vector.vector, &begin, &end);
+ PetscErrorCode ierr = VecGetOwnershipRange (vector.vector, &begin, &end);
AssertThrow (ierr == 0, ExcPETScError(ierr));
ExcMessage("PETSc does not support multi-threaded access, set "
"the thread limit to 1 in MPI_InitFinalize()."));
- int ierr = VecDuplicate (v.vector, &vector);
+ PetscErrorCode ierr = VecDuplicate (v.vector, &vector);
AssertThrow (ierr == 0, ExcPETScError(ierr));
ierr = VecCopy (v.vector, vector);
if (attained_ownership)
{
#if DEAL_II_PETSC_VERSION_LT(3,2,0)
- const int ierr = VecDestroy (vector);
+ const PetscErrorCode ierr = VecDestroy (vector);
#else
- const int ierr = VecDestroy (&vector);
+ const PetscErrorCode ierr = VecDestroy (&vector);
#endif
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
if (attained_ownership)
{
#if DEAL_II_PETSC_VERSION_LT(3,2,0)
- const int ierr = VecDestroy (vector);
+ const PetscErrorCode ierr = VecDestroy (vector);
#else
- const int ierr = VecDestroy (&vector);
+ const PetscErrorCode ierr = VecDestroy (&vector);
#endif
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
//TODO[TH]: assert(is_compressed())
- int ierr = VecSet (vector, s);
+ PetscErrorCode ierr = VecSet (vector, s);
AssertThrow (ierr == 0, ExcPETScError(ierr));
if (has_ghost_elements())
ExcDimensionMismatch(size(), v.size()));
PetscBooleanType flag;
- const int ierr = VecEqual (vector, v.vector, &flag);
+ const PetscErrorCode ierr = VecEqual (vector, v.vector, &flag);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return (flag == PETSC_TRUE);
ExcDimensionMismatch(size(), v.size()));
PetscBooleanType flag;
- const int ierr = VecEqual (vector, v.vector, &flag);
+ const PetscErrorCode ierr = VecEqual (vector, v.vector, &flag);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return (flag == PETSC_FALSE);
VectorBase::size () const
{
PetscInt sz;
- const int ierr = VecGetSize (vector, &sz);
+ const PetscErrorCode ierr = VecGetSize (vector, &sz);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return sz;
VectorBase::local_size () const
{
PetscInt sz;
- const int ierr = VecGetLocalSize (vector, &sz);
+ const PetscErrorCode ierr = VecGetLocalSize (vector, &sz);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return sz;
VectorBase::local_range () const
{
PetscInt begin, end;
- const int ierr = VecGetOwnershipRange (static_cast<const Vec &>(vector),
- &begin, &end);
+ const PetscErrorCode ierr = VecGetOwnershipRange (static_cast<const Vec &>(vector),
+ &begin, &end);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return std::make_pair (begin, end);
// val = (x,y) = y^H x,
//where y^H denotes the conjugate transpose of y.
//Note that this corresponds to the usual "mathematicians" complex inner product where the SECOND argument gets the complex conjugate.
- const int ierr = VecDot (vec.vector, vector, &result);
+ const PetscErrorCode ierr = VecDot (vec.vector, vector, &result);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return result;
void
VectorBase::compress (const VectorOperation::values operation)
{
- int ierr;
- (void)ierr;
+ {
#ifdef DEBUG
#ifdef DEAL_II_WITH_MPI
- // Check that all processors agree that last_action is the same (or none!)
+ // Check that all processors agree that last_action is the same (or none!)
- int my_int_last_action = last_action;
- int all_int_last_action;
+ int my_int_last_action = last_action;
+ int all_int_last_action;
- ierr = MPI_Allreduce(&my_int_last_action, &all_int_last_action, 1, MPI_INT,
- MPI_BOR, get_mpi_communicator());
- AssertThrowMPI(ierr);
+ const int ierr = MPI_Allreduce
+ (&my_int_last_action, &all_int_last_action, 1, MPI_INT, MPI_BOR,
+ get_mpi_communicator());
+ AssertThrowMPI(ierr);
- AssertThrow(all_int_last_action != (::dealii::VectorOperation::add | ::dealii::VectorOperation::insert),
- ExcMessage("Error: not all processors agree on the last VectorOperation before this compress() call."));
+ AssertThrow(all_int_last_action !=
+ (::dealii::VectorOperation::add | ::dealii::VectorOperation::insert),
+ ExcMessage("Error: not all processors agree on the last "
+ "VectorOperation before this compress() call."));
#endif
#endif
+ }
AssertThrow(last_action == ::dealii::VectorOperation::unknown
|| last_action == operation,
// we still need to call
// VecAssemblyBegin/End on all
// processors.
- ierr = VecAssemblyBegin(vector);
+ PetscErrorCode ierr = VecAssemblyBegin(vector);
AssertThrow (ierr == 0, ExcPETScError(ierr));
ierr = VecAssemblyEnd(vector);
AssertThrow (ierr == 0, ExcPETScError(ierr));
PetscScalar
VectorBase::mean_value () const
{
- int ierr;
-
// We can only use our more efficient
// routine in the serial case.
if (dynamic_cast<const PETScWrappers::MPI::Vector *>(this) != 0)
{
PetscScalar sum;
- ierr = VecSum(vector, &sum);
+ const PetscErrorCode ierr = VecSum(vector, &sum);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return sum/static_cast<PetscReal>(size());
}
// get a representation of the vector and
// loop over all the elements
PetscScalar *start_ptr;
- ierr = VecGetArray (vector, &start_ptr);
+ PetscErrorCode ierr = VecGetArray (vector, &start_ptr);
AssertThrow (ierr == 0, ExcPETScError(ierr));
PetscScalar mean = 0;
{
real_type d;
- const int ierr = VecNorm (vector, NORM_1, &d);
+ const PetscErrorCode ierr = VecNorm (vector, NORM_1, &d);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return d;
{
real_type d;
- const int ierr = VecNorm (vector, NORM_2, &d);
+ const PetscErrorCode ierr = VecNorm (vector, NORM_2, &d);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return d;
// get a representation of the vector and
// loop over all the elements
PetscScalar *start_ptr;
- int ierr = VecGetArray (vector, &start_ptr);
+ PetscErrorCode ierr = VecGetArray (vector, &start_ptr);
AssertThrow (ierr == 0, ExcPETScError(ierr));
real_type norm = 0;
{
real_type d;
- const int ierr = VecNorm (vector, NORM_INFINITY, &d);
+ const PetscErrorCode ierr = VecNorm (vector, NORM_INFINITY, &d);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return d;
{
real_type d;
Assert (!has_ghost_elements(), ExcGhostsPresent());
- const int ierr = VecNormalize (vector, &d);
+ const PetscErrorCode ierr = VecNormalize (vector, &d);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return d;
PetscInt p;
real_type d;
- const int ierr = VecMin (vector, &p, &d);
+ const PetscErrorCode ierr = VecMin (vector, &p, &d);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return d;
PetscInt p;
real_type d;
- const int ierr = VecMax (vector, &p, &d);
+ const PetscErrorCode ierr = VecMax (vector, &p, &d);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return d;
{
Assert (!has_ghost_elements(), ExcGhostsPresent());
- const int ierr = VecAbs (vector);
+ const PetscErrorCode ierr = VecAbs (vector);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return *this;
{
Assert (!has_ghost_elements(), ExcGhostsPresent());
- const int ierr = VecConjugate (vector);
+ const PetscErrorCode ierr = VecConjugate (vector);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return *this;
{
Assert (!has_ghost_elements(), ExcGhostsPresent());
- const int ierr = VecPointwiseMult (vector,vector,vector);
+ const PetscErrorCode ierr = VecPointwiseMult (vector,vector,vector);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return *this;
VectorBase::mult (const VectorBase &v)
{
Assert (!has_ghost_elements(), ExcGhostsPresent());
- const int ierr = VecPointwiseMult (vector,vector,v);
+ const PetscErrorCode ierr = VecPointwiseMult (vector,vector,v);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return *this;
const VectorBase &v)
{
Assert (!has_ghost_elements(), ExcGhostsPresent());
- const int ierr = VecPointwiseMult (vector,u,v);
+ const PetscErrorCode ierr = VecPointwiseMult (vector,u,v);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return *this;
// get a representation of the vector and
// loop over all the elements
PetscScalar *start_ptr;
- int ierr = VecGetArray (vector, &start_ptr);
+ PetscErrorCode ierr = VecGetArray (vector, &start_ptr);
AssertThrow (ierr == 0, ExcPETScError(ierr));
const PetscScalar *ptr = start_ptr,
// get a representation of the vector and
// loop over all the elements
PetscScalar *start_ptr;
- int ierr = VecGetArray (vector, &start_ptr);
+ PetscErrorCode ierr = VecGetArray (vector, &start_ptr);
AssertThrow (ierr == 0, ExcPETScError(ierr));
const PetscScalar *ptr = start_ptr,
Assert (!has_ghost_elements(), ExcGhostsPresent());
AssertIsFinite(a);
- const int ierr = VecScale (vector, a);
+ const PetscErrorCode ierr = VecScale (vector, a);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return *this;
const PetscScalar factor = 1./a;
AssertIsFinite(factor);
- const int ierr = VecScale (vector, factor);
+ const PetscErrorCode ierr = VecScale (vector, factor);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return *this;
VectorBase::operator += (const VectorBase &v)
{
Assert (!has_ghost_elements(), ExcGhostsPresent());
- const int ierr = VecAXPY (vector, 1, v);
+ const PetscErrorCode ierr = VecAXPY (vector, 1, v);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return *this;
VectorBase::operator -= (const VectorBase &v)
{
Assert (!has_ghost_elements(), ExcGhostsPresent());
- const int ierr = VecAXPY (vector, -1, v);
+ const PetscErrorCode ierr = VecAXPY (vector, -1, v);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return *this;
Assert (!has_ghost_elements(), ExcGhostsPresent());
AssertIsFinite(s);
- const int ierr = VecShift (vector, s);
+ const PetscErrorCode ierr = VecShift (vector, s);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
Assert (!has_ghost_elements(), ExcGhostsPresent());
AssertIsFinite(a);
- const int ierr = VecAXPY (vector, a, v);
+ const PetscErrorCode ierr = VecAXPY (vector, a, v);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
const PetscScalar weights[2] = {a,b};
Vec addends[2] = {v.vector, w.vector};
- const int ierr = VecMAXPY (vector, 2, weights, addends);
+ const PetscErrorCode ierr = VecMAXPY (vector, 2, weights, addends);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
Assert (!has_ghost_elements(), ExcGhostsPresent());
AssertIsFinite(s);
- const int ierr = VecAYPX (vector, s, v);
+ const PetscErrorCode ierr = VecAYPX (vector, s, v);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
const PetscScalar weights[2] = {a,b};
Vec addends[2] = {v.vector,w.vector};
- const int ierr = VecMAXPY (vector, 2, weights, addends);
+ const PetscErrorCode ierr = VecMAXPY (vector, 2, weights, addends);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
const PetscScalar weights[3] = {a,b,c};
Vec addends[3] = {v.vector, w.vector, x.vector};
- const int ierr = VecMAXPY (vector, 3, weights, addends);
+ const PetscErrorCode ierr = VecMAXPY (vector, 3, weights, addends);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
VectorBase::scale (const VectorBase &factors)
{
Assert (!has_ghost_elements(), ExcGhostsPresent());
- const int ierr
+ const PetscErrorCode ierr
= VecPointwiseMult (vector, factors, vector);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
// there is no simple operation for this
// in PETSc. there are multiple ways to
// emulate it, we choose this one:
- const int ierr = VecCopy (v.vector, vector);
+ const PetscErrorCode ierr = VecCopy (v.vector, vector);
AssertThrow (ierr == 0, ExcPETScError(ierr));
*this *= a;
// there is no simple operation for this
// in PETSc. there are multiple ways to
// emulate it, we choose this one:
- const int ierr = VecCopy (v.vector, vector);
+ const PetscErrorCode ierr = VecCopy (v.vector, vector);
AssertThrow (ierr == 0, ExcPETScError(ierr));
sadd (a, b, w);
const VectorBase &b)
{
Assert (!has_ghost_elements(), ExcGhostsPresent());
- const int ierr = VecPointwiseDivide (vector, a, b);
+ const PetscErrorCode ierr = VecPointwiseDivide (vector, a, b);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
//TODO[TH]:assert(is_compressed())
// Set options
- int ierr = PetscViewerSetFormat (PETSC_VIEWER_STDOUT_WORLD,
- format);
+ PetscErrorCode ierr = PetscViewerSetFormat (PETSC_VIEWER_STDOUT_WORLD,
+ format);
AssertThrow (ierr == 0, ExcPETScError(ierr));
// Write to screen
// get a representation of the vector and
// loop over all the elements
PetscScalar *val;
- int ierr = VecGetArray (vector, &val);
+ PetscErrorCode ierr = VecGetArray (vector, &val);
AssertThrow (ierr == 0, ExcPETScError(ierr));
void
VectorBase::swap (VectorBase &v)
{
- const int ierr = VecSwap (vector, v.vector);
+ const PetscErrorCode ierr = VecSwap (vector, v.vector);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
#endif
const InsertMode mode = (add_values ? ADD_VALUES : INSERT_VALUES);
- const int ierr = VecSetValues (vector, n_elements, petsc_indices,
- values, mode);
+ const PetscErrorCode ierr = VecSetValues (vector, n_elements, petsc_indices,
+ values, mode);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
mpi_communicator (mpi_communicator)
{
// create eigensolver context
- int ierr = EPSCreate (mpi_communicator, &eps);
+ PetscErrorCode ierr = EPSCreate (mpi_communicator, &eps);
AssertThrow (ierr == 0, ExcSLEPcError(ierr));
// hand over the absolute tolerance and the maximum number of
{
// Destroy the solver object.
#if DEAL_II_PETSC_VERSION_LT(3,2,0)
- const int ierr = EPSDestroy (eps);
+ const PetscErrorCode ierr = EPSDestroy (eps);
#else
- const int ierr = EPSDestroy (&eps);
+ const PetscErrorCode ierr = EPSDestroy (&eps);
#endif
AssertThrow (ierr == 0, ExcSLEPcError(ierr));
}
SolverBase::set_matrices (const PETScWrappers::MatrixBase &A)
{
// standard eigenspectrum problem
- const int ierr = EPSSetOperators (eps, A, PETSC_NULL);
+ const PetscErrorCode ierr = EPSSetOperators (eps, A, PETSC_NULL);
AssertThrow (ierr == 0, ExcSLEPcError(ierr));
}
const PETScWrappers::MatrixBase &B)
{
// generalized eigenspectrum problem
- const int ierr = EPSSetOperators (eps, A, B);
+ const PetscErrorCode ierr = EPSSetOperators (eps, A, B);
AssertThrow (ierr == 0, ExcSLEPcError(ierr));
}
{
// set transformation type if any
// STSetShift is called inside
- const int ierr = EPSSetST(eps,transformation.st);
+ const PetscErrorCode ierr = EPSSetST(eps,transformation.st);
AssertThrow (ierr == 0, SolverBase::ExcSLEPcError(ierr));
}
Vec vec = this_initial_vector;
#if DEAL_II_PETSC_VERSION_LT(3,1,0)
- const int ierr = EPSSetInitialVector (eps, &vec);
+ const PetscErrorCode ierr = EPSSetInitialVector (eps, &vec);
#else
- const int ierr = EPSSetInitialSpace (eps, 1, &vec);
+ const PetscErrorCode ierr = EPSSetInitialSpace (eps, 1, &vec);
#endif
AssertThrow (ierr == 0, ExcSLEPcError(ierr));
}
// set target eigenvalues to solve for
// in all transformation except STSHIFT there is a direct connection between
// the target and the shift, read more on p41 of SLEPc manual.
- const int ierr = EPSSetTarget (eps, this_target );
+ const PetscErrorCode ierr = EPSSetTarget (eps, this_target );
AssertThrow (ierr == 0, ExcSLEPcError(ierr));
}
SolverBase::set_which_eigenpairs (const EPSWhich eps_which)
{
// set which portion of the eigenspectrum to solve for
- const int ierr = EPSSetWhichEigenpairs (eps, eps_which);
+ const PetscErrorCode ierr = EPSSetWhichEigenpairs (eps, eps_which);
AssertThrow (ierr == 0, ExcSLEPcError(ierr));
}
void
SolverBase::set_problem_type (const EPSProblemType eps_problem)
{
- const int ierr = EPSSetProblemType (eps, eps_problem);
+ const PetscErrorCode ierr = EPSSetProblemType (eps, eps_problem);
AssertThrow (ierr == 0, ExcSLEPcError(ierr));
}
unsigned int *n_converged)
{
// set number of eigenvectors to compute
- int ierr = EPSSetDimensions (eps, n_eigenpairs,
- PETSC_DECIDE, PETSC_DECIDE);
+ PetscErrorCode ierr = EPSSetDimensions (eps, n_eigenpairs,
+ PETSC_DECIDE, PETSC_DECIDE);
AssertThrow (ierr == 0, ExcSLEPcError(ierr));
// set the solve options to the eigenvalue problem solver context
PETScWrappers::VectorBase &eigenvectors)
{
// get converged eigenpair
- const int ierr = EPSGetEigenpair (eps, index,
- &eigenvalues, PETSC_NULL,
- eigenvectors, PETSC_NULL);
+ const PetscErrorCode ierr = EPSGetEigenpair (eps, index,
+ &eigenvalues, PETSC_NULL,
+ eigenvectors, PETSC_NULL);
AssertThrow (ierr == 0, ExcSLEPcError(ierr));
}
{
#ifndef PETSC_USE_COMPLEX
// get converged eigenpair
- const int ierr = EPSGetEigenpair (eps, index,
- &real_eigenvalues, &imag_eigenvalues,
- real_eigenvectors, imag_eigenvectors);
+ const PetscErrorCode ierr = EPSGetEigenpair (eps, index,
+ &real_eigenvalues,
+ &imag_eigenvalues,
+ real_eigenvectors,
+ imag_eigenvectors);
AssertThrow (ierr == 0, ExcSLEPcError(ierr));
#else
Assert ((false),
SolverBase (cn, mpi_communicator),
additional_data (data)
{
- const int ierr = EPSSetType (eps, const_cast<char *>(EPSKRYLOVSCHUR));
+ const PetscErrorCode ierr = EPSSetType (eps,
+ const_cast<char *>(EPSKRYLOVSCHUR));
AssertThrow (ierr == 0, ExcSLEPcError(ierr));
}
SolverBase (cn, mpi_communicator),
additional_data (data)
{
- int ierr = EPSSetType (eps, const_cast<char *>(EPSARNOLDI));
+ PetscErrorCode ierr = EPSSetType (eps, const_cast<char *>(EPSARNOLDI));
AssertThrow (ierr == 0, ExcSLEPcError(ierr));
// if requested, set delayed reorthogonalization in the Arnoldi
SolverBase (cn, mpi_communicator),
additional_data (data)
{
- int ierr = EPSSetType (eps, const_cast<char *>(EPSLANCZOS));
+ PetscErrorCode ierr = EPSSetType (eps, const_cast<char *>(EPSLANCZOS));
AssertThrow (ierr == 0, ExcSLEPcError(ierr));
ierr = EPSLanczosSetReorthog(eps,additional_data.reorthog);
SolverBase (cn, mpi_communicator),
additional_data (data)
{
- int ierr = EPSSetType (eps, const_cast<char *>(EPSPOWER));
+ PetscErrorCode ierr = EPSSetType (eps, const_cast<char *>(EPSPOWER));
AssertThrow (ierr == 0, ExcSLEPcError(ierr));
}
additional_data (data)
{
#if DEAL_II_PETSC_VERSION_GTE(3,1,0)
- int ierr = EPSSetType (eps, const_cast<char *>(EPSGD));
+ PetscErrorCode ierr = EPSSetType (eps, const_cast<char *>(EPSGD));
AssertThrow (ierr == 0, ExcSLEPcError(ierr));
if (additional_data.double_expansion)
additional_data (data)
{
#if DEAL_II_PETSC_VERSION_GTE(3,1,0)
- int ierr;
- ierr = EPSSetType (eps, const_cast<char *>(EPSJD));
+ const PetscErrorCode ierr = EPSSetType (eps, const_cast<char *>(EPSJD));
AssertThrow (ierr == 0, ExcSLEPcError(ierr));
#else
// PETSc/SLEPc version must be > 3.1.0.
// 'Tis overwhelmingly likely that PETSc/SLEPc *always* has
// BLAS/LAPACK, but let's be defensive.
#if PETSC_HAVE_BLASLAPACK
- int ierr;
- ierr = EPSSetType (eps, const_cast<char *>(EPSLAPACK));
+ const PetscErrorCode ierr = EPSSetType (eps, const_cast<char *>(EPSLAPACK));
AssertThrow (ierr == 0, ExcSLEPcError(ierr));
#else
Assert ((false),
{
TransformationBase::TransformationBase (const MPI_Comm &mpi_communicator)
{
- const int ierr = STCreate(mpi_communicator, &st);
+ const PetscErrorCode ierr = STCreate(mpi_communicator, &st);
AssertThrow (ierr == 0, SolverBase::ExcSLEPcError(ierr));
}
{
if (st!=NULL)
{
- const int ierr = STDestroy(&st);
+ const PetscErrorCode ierr = STDestroy(&st);
AssertThrow (ierr == 0, SolverBase::ExcSLEPcError(ierr));
}
}
void TransformationBase::set_matrix_mode(const STMatMode mode)
{
- const int ierr = STSetMatMode(st,mode);
+ const PetscErrorCode ierr = STSetMatMode(st,mode);
AssertThrow (ierr == 0, SolverBase::ExcSLEPcError(ierr));
}
void TransformationBase::set_solver(const PETScWrappers::SolverBase &solver)
{
- int ierr = STSetKSP(st,solver.solver_data->ksp);
+ PetscErrorCode ierr = STSetKSP(st,solver.solver_data->ksp);
AssertThrow (ierr == 0, SolverBase::ExcSLEPcError(ierr));
}
TransformationBase(mpi_communicator),
additional_data (data)
{
- int ierr;
- ierr = STSetType (st, const_cast<char *>(STSHIFT));
+ PetscErrorCode ierr = STSetType (st, const_cast<char *>(STSHIFT));
AssertThrow (ierr == 0, SolverBase::ExcSLEPcError(ierr));
ierr = STSetShift (st, additional_data.shift_parameter);
TransformationBase(mpi_communicator),
additional_data (data)
{
- int ierr;
#if DEAL_II_PETSC_VERSION_LT(3,1,0)
- ierr = STSetType (st, const_cast<char *>(STSINV));
+ PetscErrorCode ierr = STSetType (st, const_cast<char *>(STSINV));
#else
- ierr = STSetType (st, const_cast<char *>(STSINVERT));
+ PetscErrorCode ierr = STSetType (st, const_cast<char *>(STSINVERT));
#endif
AssertThrow (ierr == 0, SolverBase::ExcSLEPcError(ierr));
additional_data (data)
{
#if DEAL_II_PETSC_VERSION_LT(3,5,0)
- int ierr;
- ierr = STSetType (st, const_cast<char *>(STFOLD));
- (void)ierr;
+ PetscErrorCode ierr = STSetType (st, const_cast<char *>(STFOLD));
AssertThrow (ierr == 0, SolverBase::ExcSLEPcError(ierr));
ierr = STSetShift (st, additional_data.shift_parameter);
- (void)ierr;
AssertThrow (ierr == 0, SolverBase::ExcSLEPcError(ierr));
#else
// PETSc/SLEPc version must be < 3.5.0.
TransformationBase(mpi_communicator),
additional_data (data)
{
- int ierr = STSetType (st, const_cast<char *>(STCAYLEY));
+ PetscErrorCode ierr = STSetType (st, const_cast<char *>(STCAYLEY));
AssertThrow (ierr == 0, SolverBase::ExcSLEPcError(ierr));
ierr = STSetShift (st, additional_data.shift_parameter);