* Return a reference to the underlying PETSc type. It can be used to
* modify the underlying data, so use it only when you know what you
* are doing.
+ *
+ * The PETSc Mat object returned here describes the *entire* matrix,
+ * not just one of its blocks. Internally, this is done by creating
+ * a "nested" matrix using Petsc's MatCreateNest object whose individual
+ * blocks are the blocks of this matrix.
*/
Mat &
petsc_matrix();
private:
+ /**
+ * A PETSc Mat object that describes the entire block matrix.
+ * Internally, this is done by creating
+ * a "nested" matrix using Petsc's MatCreateNest object whose individual
+ * blocks are the blocks of this matrix.
+ */
Mat petsc_nest_matrix = nullptr;
};
return *this;
}
+
+
BlockSparseMatrix::~BlockSparseMatrix()
{
PetscErrorCode ierr = destroy_matrix(petsc_nest_matrix);
AssertNothrow(ierr == 0, ExcPETScError(ierr));
}
+
+
# ifndef DOXYGEN
void
BlockSparseMatrix::reinit(const size_type n_block_rows,
}
# endif
+
+
void
BlockSparseMatrix::reinit(const std::vector<IndexSet> & rows,
const std::vector<IndexSet> & cols,
AssertThrow(ierr == 0, ExcPETScError(ierr));
}
+
+
std::vector<IndexSet>
BlockSparseMatrix::locally_owned_domain_indices() const
{
return index_sets;
}
+
+
std::vector<IndexSet>
BlockSparseMatrix::locally_owned_range_indices() const
{
return index_sets;
}
+
+
std::uint64_t
BlockSparseMatrix::n_nonzero_elements() const
{
return n_nonzero;
}
+
+
const MPI_Comm &
BlockSparseMatrix::get_mpi_communicator() const
{
return petsc_nest_matrix;
}
+
+
Mat &
BlockSparseMatrix::petsc_matrix()
{