bool
in_local_range(const size_type index) const;
+ /**
+ * Return the local number of columns stored on the present MPI process.
+ *
+ * To figure out which elements exactly are stored locally, use
+ * local_domain().
+ */
+ size_type
+ local_domain_size() const;
+
+ /**
+ * Return a pair of indices indicating which columns of this matrix are
+ * stored locally. The first number is the index of the first column stored,
+ * the second the index of the one past the last one that is stored
+ * locally.
+ */
+ std::pair<size_type, size_type>
+ local_domain() const;
+
/**
* Return a reference to the MPI communicator object in use with this
* matrix.
MatrixBase::size_type
MatrixBase::local_size() const
{
- PetscInt n_rows, n_cols;
+ PetscInt n_rows;
- const PetscErrorCode ierr = MatGetLocalSize(matrix, &n_rows, &n_cols);
+ const PetscErrorCode ierr = MatGetLocalSize(matrix, &n_rows, nullptr);
AssertThrow(ierr == 0, ExcPETScError(ierr));
return n_rows;
+ MatrixBase::size_type
+ MatrixBase::local_domain_size() const
+ {
+ PetscInt n_cols;
+
+ const PetscErrorCode ierr = MatGetLocalSize(matrix, nullptr, &n_cols);
+ AssertThrow(ierr == 0, ExcPETScError(ierr));
+
+ return n_cols;
+ }
+
+
+
+ std::pair<MatrixBase::size_type, MatrixBase::size_type>
+ MatrixBase::local_domain() const
+ {
+ PetscInt begin, end;
+
+ const PetscErrorCode ierr =
+ MatGetOwnershipRangeColumn(static_cast<const Mat &>(matrix),
+ &begin,
+ &end);
+ AssertThrow(ierr == 0, ExcPETScError(ierr));
+
+ return std::make_pair(begin, end);
+ }
+
+
+
std::uint64_t
MatrixBase::n_nonzero_elements() const
{