19#ifdef DEAL_II_WITH_PETSC
112 const std::vector<IndexSet> & cols,
123 std::vector<types::global_dof_index>
row_sizes;
124 for (
unsigned int r = 0; r <
bdsp.n_block_rows(); ++r)
128 std::vector<types::global_dof_index>
col_sizes;
129 for (
unsigned int c = 0; c <
bdsp.n_block_cols(); ++c)
136 Assert(rows[r].size() ==
bdsp.block(r, c).n_rows(),
138 Assert(cols[c].size() ==
bdsp.block(r, c).n_cols(),
198 "When passing empty sub-blocks of a block matrix, you need to make "
199 "sure that at least one block in each block row and block column is "
200 "non-empty. However, block row " +
202 " is completely empty "
203 "and so it is not possible to determine how many rows it should have."));
207 "When passing empty sub-blocks of a block matrix, you need to make "
208 "sure that at least one block in each block row and block column is "
209 "non-empty. However, block column " +
211 " is completely empty "
212 "and so it is not possible to determine how many columns it should have."));
251 for (
unsigned int r = 0; r <
m; r++)
252 for (
unsigned int c = 0; c <
n; c++)
276 std::vector<IndexSet>
282 index_sets.push_back(
this->block(0, i).locally_owned_domain_indices());
289 std::vector<IndexSet>
295 index_sets.push_back(
this->block(i, 0).locally_owned_range_indices());
321 BlockSparseMatrix::operator
const Mat &()
const
323 return petsc_nest_matrix;
340 PetscInt
nr = 1,
nc = 1;
347 std::vector<Mat>
mats;
353 for (PetscInt i = 0; i <
nr; ++i)
355 for (PetscInt
j = 0;
j <
nc; ++
j)
375 for (PetscInt i = 0; i <
nr; ++i)
377 for (PetscInt
j = 0;
j <
nc; ++
j)
389 if (need_empty_matrices || !
isnest)
value_type * data() const noexcept
void reinit(const unsigned int n_blocks, const size_type n_elements_per_block)
BlockIndices column_block_indices
unsigned int n_block_rows() const
void compress(VectorOperation::values operation)
Table< 2, SmartPointer< BlockType, BlockMatrixBase< SparseMatrix > > > sub_objects
unsigned int n_block_cols() const
BlockIndices row_block_indices
BlockType & block(const unsigned int row, const unsigned int column)
size_type n_block_rows() 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 &)
MPI_Comm get_mpi_communicator() const
void create_empty_matrices_if_needed()
std::uint64_t n_nonzero_elements() const
BaseClass::BlockType BlockType
std::vector< IndexSet > locally_owned_domain_indices() const
std::vector< IndexSet > locally_owned_range_indices() const
void compress(VectorOperation::values operation)
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)
void petsc_increment_state_counter(Vec v)