deal.II version GIT relicensing-2169-gec1b43f35b 2024-11-22 07:10:00+00:00
|
Functions | |
template<typename SparseMatrixType , typename SparsityPatternType , typename SparseMatrixType2 , typename SparsityPatternType2 > | |
void | restrict_to_serial_sparse_matrix (const SparseMatrixType &sparse_matrix_in, const SparsityPatternType &sparsity_pattern, const IndexSet &requested_is, SparseMatrixType2 &system_matrix_out, SparsityPatternType2 &sparsity_pattern_out) |
template<typename SparseMatrixType , typename SparsityPatternType , typename SparseMatrixType2 , typename SparsityPatternType2 > | |
void | restrict_to_serial_sparse_matrix (const SparseMatrixType &sparse_matrix_in, const SparsityPatternType &sparsity_pattern, const IndexSet &index_set_0, const IndexSet &index_set_1, SparseMatrixType2 &system_matrix_out, SparsityPatternType2 &sparsity_pattern_out) |
template<int dim, int spacedim, typename SparseMatrixType , typename SparsityPatternType , typename Number > | |
void | restrict_to_cells (const SparseMatrixType &system_matrix, const SparsityPatternType &sparsity_pattern, const DoFHandler< dim, spacedim > &dof_handler, std::vector< FullMatrix< Number > > &blocks) |
template<typename SparseMatrixType , typename SparsityPatternType , typename Number > | |
void | restrict_to_full_matrices (const SparseMatrixType &sparse_matrix_in, const SparsityPatternType &sparsity_pattern, const std::vector< std::vector< types::global_dof_index > > &indices, std::vector< FullMatrix< Number > > &blocks) |
A namespace to process sparse matrices.
void SparseMatrixTools::restrict_to_serial_sparse_matrix | ( | const SparseMatrixType & | sparse_matrix_in, |
const SparsityPatternType & | sparsity_pattern, | ||
const IndexSet & | requested_is, | ||
SparseMatrixType2 & | system_matrix_out, | ||
SparsityPatternType2 & | sparsity_pattern_out | ||
) |
Given a sparse matrix (system_matrix
, sparsity_pattern
), construct a new sparse matrix (system_matrix_out
, sparsity_pattern_out
) by restriction
\[ A_i = R_i A R_i^T, \]
where the Boolean matrix \(R_i\) is defined by the entries of requested_is
.
The function can be called by multiple processes with different sets of indices, allowing to assign each process a different \(A_i\).
Such a function is useful to implement Schwarz methods, where operations of type
\[ u^{n} = u^{n-1} + \sum_{i} R_i^T A_i^{-1} R_i (f - A u^{n-1}) \]
are performed to iteratively solve a system of type \(Au=f\).
sparse_matrix_in
. void SparseMatrixTools::restrict_to_serial_sparse_matrix | ( | const SparseMatrixType & | sparse_matrix_in, |
const SparsityPatternType & | sparsity_pattern, | ||
const IndexSet & | index_set_0, | ||
const IndexSet & | index_set_1, | ||
SparseMatrixType2 & | system_matrix_out, | ||
SparsityPatternType2 & | sparsity_pattern_out | ||
) |
Similar to the above function, but taking two index sets (index_set_0
, index_set_1
), allowing to block the matrix. This is particularly useful, when dealing with vectors of type parallel::distributed::Vector, where the vector is blocked according to locally owned and ghost indices. As a consequence, the most typical usecase will be to pass in the set of locally owned DoFs and set of active or locally relevant DoFs.
sparse_matrix_in
. void SparseMatrixTools::restrict_to_cells | ( | const SparseMatrixType & | system_matrix, |
const SparsityPatternType & | sparsity_pattern, | ||
const DoFHandler< dim, spacedim > & | dof_handler, | ||
std::vector< FullMatrix< Number > > & | blocks | ||
) |
A restriction operation similar to the above one. However, the operation is performed for each locally owned active cell individually and index sets are given by their DoFs. The correct entries in the resulting vector can accessed by CellAccessor::active_cell_index().
sparse_matrix_in
. void SparseMatrixTools::restrict_to_full_matrices | ( | const SparseMatrixType & | sparse_matrix_in, |
const SparsityPatternType & | sparsity_pattern, | ||
const std::vector< std::vector< types::global_dof_index > > & | indices, | ||
std::vector< FullMatrix< Number > > & | blocks | ||
) |
A restriction operation similar to the above one. However, the indices of the blocks can be chosen arbitrarily. If the indices of cells are given, the output is the same as of the above function. However, one can also provide, e.g., indices that are also part of a halo around a cell to implement element-block based overlapping Schwarz methods.
If no indices are provided for a block, the resulting matrix of this block is empty.
sparse_matrix_in
.