*/
typedef dealii::types::global_dof_index size_type;
+ /**
+ * Exception
+ */
+ DeclException1(ExcAccessToNonlocalRow,
+ std::size_t,
+ << "You tried to access row " << arg1
+ << " of a non-contiguous locally owned row set."
+ << " The row " << arg1
+ << " is not stored locally and can't be accessed.");
+
/**
* A structure that describes some of the traits of this class in terms of
* its run-time behavior. Some other classes (such as the block matrix
// Try to copy all the rows of the matrix one by one. In case of error
// (i.e., the column indices are different), we need to abort and blow
// away the matrix.
- for (size_type row = local_range.first; row < local_range.second; ++row)
+ for (const auto &row : locally_owned_range_indices())
{
const int row_local = matrix->RowMap().LID(
static_cast<TrilinosWrappers::types::int_type>(row));
+ Assert((row_local >= 0), ExcAccessToNonlocalRow(row));
int n_entries, rhs_n_entries;
TrilinosScalar *value_ptr, *rhs_value_ptr;
int ncols = -1;
int local_row =
matrix->LRID(static_cast<TrilinosWrappers::types::int_type>(row));
+ Assert((local_row >= 0), ExcAccessToNonlocalRow(row));
// on the processor who owns this
// row, we'll have a non-negative
AssertThrow(ierr == 0, ExcTrilinosError(ierr));
}
- return ncols;
+ return static_cast<unsigned int>(ncols);
}
const std::pair<size_type, size_type> local_range = rhs.local_range();
const bool same_col_map = matrix->ColMap().SameAs(rhs.matrix->ColMap());
- for (size_type row = local_range.first; row < local_range.second; ++row)
+ for (const auto &row : locally_owned_range_indices())
{
const int row_local = matrix->RowMap().LID(
static_cast<TrilinosWrappers::types::int_type>(row));
+ Assert((row_local >= 0), ExcAccessToNonlocalRow(row));
// First get a view to the matrix columns of both matrices. Note that
// the data is in local index spaces so we need to be careful not only