19 #ifdef DEAL_II_WITH_PETSC
58 this->
sub_objects.reinit(n_block_rows, n_block_columns);
76 const std::vector<IndexSet> & cols,
87 std::vector<types::global_dof_index> row_sizes;
92 std::vector<types::global_dof_index> col_sizes;
106 p->
reinit(rows[r], cols[c], bdsp.
block(r, c), com);
116 const MPI_Comm & com)
118 reinit(sizes, sizes, bdsp, com);
133 std::vector<Mat> psub_objects(
m *
n);
134 for (
unsigned int r = 0; r <
m; r++)
135 for (
unsigned int c = 0; c <
n; c++)
149 std::vector<IndexSet>
152 std::vector<IndexSet> index_sets;
155 index_sets.push_back(this->block(0, i).locally_owned_domain_indices());
162 std::vector<IndexSet>
165 std::vector<IndexSet> index_sets;
168 index_sets.push_back(this->block(i, 0).locally_owned_range_indices());
178 std::uint64_t n_nonzero = 0;
191 static MPI_Comm
comm = PETSC_COMM_SELF;
194 if (pcomm != MPI_COMM_NULL)
199 BlockSparseMatrix::operator
const Mat &()
const
201 return petsc_nest_matrix;
218 PetscInt nr = 1, nc = 1;
220 PetscErrorCode ierr =
221 PetscObjectTypeCompare(
reinterpret_cast<PetscObject
>(
A),
225 std::vector<Mat> mats;
228 ierr = MatNestGetSize(
A, &nr, &nc);
230 for (PetscInt i = 0; i < nr; ++i)
232 for (PetscInt j = 0; j < nc; ++j)
235 ierr = MatNestGetSubMat(
A, i, j, &sA);
245 std::vector<size_type> r_block_sizes(nr, 0);
246 std::vector<size_type> c_block_sizes(nc, 0);
250 for (PetscInt i = 0; i < nr; ++i)
252 for (PetscInt j = 0; j < nc; ++j)
void reinit(const unsigned int n_blocks, const size_type n_elements_per_block)
BlockIndices column_block_indices
BlockType & block(const unsigned int row, const unsigned int column)
unsigned int n_block_rows() const
Table< 2, SmartPointer< BlockType, BlockMatrixBase< SparseMatrix > > > sub_objects
unsigned int n_block_cols() const
BlockIndices row_block_indices
size_type n_block_rows() const
SparsityPatternType & block(const size_type row, const size_type column)
size_type n_block_cols() const
~BlockSparseMatrix() override
BaseClass::size_type size_type
void reinit(const size_type n_block_rows, const size_type n_block_columns)
BlockSparseMatrix & operator=(const BlockSparseMatrix &)
std::uint64_t n_nonzero_elements() const
BaseClass::BlockType BlockType
std::vector< IndexSet > locally_owned_domain_indices() const
const MPI_Comm & get_mpi_communicator() const
std::vector< IndexSet > locally_owned_range_indices() const
std::size_t n_nonzero_elements() const
virtual void reinit(const SparsityPattern &sparsity)
Subscriptor & operator=(const Subscriptor &)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
#define AssertNothrow(cond, exc)
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
types::global_dof_index size_type
PetscErrorCode destroy_matrix(Mat &matrix)