* reinit(BlockSparsityPattern). The number of blocks per row and column
* are then determined by that function.
*/
- BlockSparseMatrix() = default;
+ BlockSparseMatrix();
/**
* Create a BlockSparseMatrix with a PETSc Mat that describes the entire
* a "nested" matrix using PETSc's MATNEST object whose individual
* blocks are the blocks of this matrix.
*/
- Mat petsc_nest_matrix = nullptr;
+ Mat petsc_nest_matrix;
/**
* Utility to setup the MATNEST object
/** @} */
// ------------- inline and template functions -----------------
+ inline BlockSparseMatrix::BlockSparseMatrix()
+ : BaseClass()
+ , petsc_nest_matrix(nullptr)
+ {}
+
+
inline BlockSparseMatrix::BlockSparseMatrix(const Mat &A)
: BlockSparseMatrix()
this->reinit(A);
}
+
+
template <size_t block_rows, size_t block_columns>
inline BlockSparseMatrix::BlockSparseMatrix(
const std::array<std::array<Mat, block_columns>, block_rows> &arrayA)
+ : BlockSparseMatrix()
{
this->reinit(block_rows, block_columns);
this->sub_objects.reinit(block_rows, block_columns);
this->collect_sizes();
}
+
+
inline BlockSparseMatrix &
BlockSparseMatrix::operator=(const double d)
{
ierr = MatCreateNest(
comm, m, nullptr, n, nullptr, psub_objects.data(), &petsc_nest_matrix);
AssertThrow(ierr == 0, ExcPETScError(ierr));
+
+ ierr = MatNestSetVecType(petsc_nest_matrix, VECNEST);
+ AssertThrow(ierr == 0, ExcPETScError(ierr));
}
Assert(tmp2.n_block_cols() == pbsm.n_block_cols(), ExcInternalError());
Assert(tmp2.m() == pbsm.m(), ExcInternalError());
Assert(tmp2.n() == pbsm.n(), ExcInternalError());
+ Assert(tmp2.petsc_matrix() == pbsm.petsc_matrix(), ExcInternalError());
for (unsigned int blr = 0; blr < 2; ++blr)
{
for (unsigned int blc = 0; blc < 2; ++blc)