PetscScalar matrix_scalar_product (const Vector &u,
const Vector &v) const;
+ /**
+ * Return the partitioning of the domain space of this matrix, i.e., the
+ * partitioning of the vectors this matrix has to be multiplied with.
+ */
+ IndexSet locally_owned_domain_indices() const;
+
+ /**
+ * Return the partitioning of the range space of this matrix, i.e., the
+ * partitioning of the vectors that are result from matrix-vector
+ * products.
+ */
+ IndexSet locally_owned_range_indices() const;
+
private:
/**
return u*tmp;
}
+ IndexSet
+ SparseMatrix::locally_owned_domain_indices () const
+ {
+ PetscInt n_rows, n_cols, min, max;
+ PetscErrorCode ierr;
+ IS* rows = nullptr;
+ IS* cols = nullptr;
+
+ ierr = MatGetSize (matrix, &n_rows, &n_cols);
+ ierr = MatGetOwnershipIS(matrix, rows, cols);
+ ierr = ISGetMinMax(*rows, &min, &max);
+
+ IndexSet locally_owned_domain_indices(n_rows);
+ locally_owned_domain_indices.add_range(min, max);
+
+ return locally_owned_domain_indices;
+ }
+
+ IndexSet
+ SparseMatrix::locally_owned_range_indices () const
+ {
+ PetscInt n_rows, n_cols, min, max;
+ PetscErrorCode ierr;
+ IS* rows = nullptr;
+ IS* cols = nullptr;
+
+ ierr = MatGetSize (matrix, &n_rows, &n_cols);
+ ierr = MatGetOwnershipIS(matrix, rows, cols);
+ ierr = ISGetMinMax(*cols, &min, &max);
+
+ IndexSet locally_owned_range_indices(n_cols);
+ locally_owned_range_indices.add_range(min, max);
+
+ return locally_owned_range_indices;
+ }
+
}
}