Assert(local_rows.is_contiguous() && local_columns.is_contiguous(),
ExcMessage("PETSc only supports contiguous row/column ranges"));
-
+#ifdef DEBUG
+ {
+ // check indexsets
+ types::global_dof_index row_owners = Utilities::MPI::sum(local_rows.n_elements(), communicator);
+ types::global_dof_index col_owners = Utilities::MPI::sum(local_columns.n_elements(), communicator);
+ Assert(row_owners == sparsity_pattern.n_rows(),
+ ExcMessage(std::string("Each row has to be owned by exactly one owner (n_rows()=")
+ + Utilities::to_string(sparsity_pattern.n_rows())
+ + " but sum(local_rows.n_elements())="
+ + Utilities::to_string(row_owners)
+ + ")"));
+ Assert(col_owners == sparsity_pattern.n_cols(),
+ ExcMessage(std::string("Each column has to be owned by exactly one owner (n_cols()=")
+ + Utilities::to_string(sparsity_pattern.n_cols())
+ + " but sum(local_columns.n_elements())="
+ + Utilities::to_string(col_owners)
+ + ")"));
+ }
+#endif
// create the matrix. We do not set row length but set the