DOLFINx 0.9.0
DOLFINx C++ interface
|
#include <SparsityPattern.h>
Public Member Functions | |
SparsityPattern (MPI_Comm comm, const std::array< std::shared_ptr< const common::IndexMap >, 2 > &maps, const std::array< int, 2 > &bs) | |
Create an empty sparsity pattern with specified dimensions. | |
SparsityPattern (MPI_Comm comm, const std::vector< std::vector< const SparsityPattern * > > &patterns, const std::array< std::vector< std::pair< std::reference_wrapper< const common::IndexMap >, int > >, 2 > &maps, const std::array< std::vector< int >, 2 > &bs) | |
SparsityPattern (const SparsityPattern &pattern)=delete | |
SparsityPattern (SparsityPattern &&pattern)=default | |
Move constructor. | |
~SparsityPattern ()=default | |
Destructor. | |
SparsityPattern & | operator= (SparsityPattern &&pattern)=default |
Move assignment. | |
void | insert (std::int32_t row, std::int32_t col) |
Insert non-zero locations using local (process-wise) indices. | |
void | insert (std::span< const std::int32_t > rows, std::span< const std::int32_t > cols) |
Insert non-zero locations using local (process-wise) indices. | |
void | insert_diagonal (std::span< const std::int32_t > rows) |
Insert non-zero locations on the diagonal. | |
void | finalize () |
Finalize sparsity pattern and communicate off-process entries. | |
std::shared_ptr< const common::IndexMap > | index_map (int dim) const |
Index map for given dimension dimension. Returns the index map for rows and columns that will be set by the current MPI rank. | |
std::vector< std::int64_t > | column_indices () const |
Global indices of non-zero columns on owned rows. | |
common::IndexMap | column_index_map () const |
Builds the index map for columns after assembly of the sparsity pattern. | |
int | block_size (int dim) const |
Return index map block size for dimension dim. | |
std::int64_t | num_nonzeros () const |
Number of nonzeros on this rank after assembly, including ghost rows. | |
std::int32_t | nnz_diag (std::int32_t row) const |
Number of non-zeros in owned columns (diagonal block) on a given row. | |
std::int32_t | nnz_off_diag (std::int32_t row) const |
Number of non-zeros in unowned columns (off-diagonal block) on a given row. | |
std::pair< std::span< const std::int32_t >, std::span< const std::int64_t > > | graph () const |
Sparsity pattern graph after assembly. Uses local indices for the columns. | |
std::span< const std::int32_t > | off_diagonal_offsets () const |
Row-wise start of off-diagonals (unowned columns) for each row. | |
MPI_Comm | comm () const |
Return MPI communicator. | |
Sparsity pattern data structure that can be used to initialize sparse matrices. After assembly, column indices are always sorted in increasing order. Ghost entries are kept after assembly.
SparsityPattern | ( | MPI_Comm | comm, |
const std::array< std::shared_ptr< const common::IndexMap >, 2 > & | maps, | ||
const std::array< int, 2 > & | bs ) |
Create an empty sparsity pattern with specified dimensions.
[in] | comm | Communicator that the pattern is defined on. |
[in] | maps | Index maps describing the [0] row and [1] column index ranges (up to a block size). |
[in] | bs | Block sizes for the [0] row and [1] column maps. |
SparsityPattern | ( | MPI_Comm | comm, |
const std::vector< std::vector< const SparsityPattern * > > & | patterns, | ||
const std::array< std::vector< std::pair< std::reference_wrapper< const common::IndexMap >, int > >, 2 > & | maps, | ||
const std::array< std::vector< int >, 2 > & | bs ) |
Create a new sparsity pattern by concatenating sub-patterns, e.g. pattern =[ pattern00 ][ pattern 01] [ pattern10 ][ pattern 11]
[in] | comm | Communicator that the pattern is defined on. |
[in] | patterns | Rectangular array of sparsity pattern. The patterns must not be finalised. Null block are permitted/ |
[in] | maps | Pairs of (index map, block size) for each row block (maps[0]) and column blocks (maps[1])/ |
[in] | bs | Block sizes for the sparsity pattern entries/ |
common::IndexMap column_index_map | ( | ) | const |
Builds the index map for columns after assembly of the sparsity pattern.
std::vector< std::int64_t > column_indices | ( | ) | const |
Global indices of non-zero columns on owned rows.
std::pair< std::span< const std::int32_t >, std::span< const std::int64_t > > graph | ( | ) | const |
Sparsity pattern graph after assembly. Uses local indices for the columns.
std::shared_ptr< const common::IndexMap > index_map | ( | int | dim | ) | const |
Index map for given dimension dimension. Returns the index map for rows and columns that will be set by the current MPI rank.
[in] | dim | Requested map, row (0) or column (1). |
void insert | ( | std::int32_t | row, |
std::int32_t | col ) |
Insert non-zero locations using local (process-wise) indices.
[in] | row | local row index |
[in] | col | local column index |
void insert | ( | std::span< const std::int32_t > | rows, |
std::span< const std::int32_t > | cols ) |
Insert non-zero locations using local (process-wise) indices.
This routine inserts non-zero locations at the outer product of rows and cols into the sparsity pattern, i.e. adds the matrix entries at A[row[i], col[j]] for all i, j.
[in] | rows | list of the local row indices |
[in] | cols | list of the local column indices |
void insert_diagonal | ( | std::span< const std::int32_t > | rows | ) |
Insert non-zero locations on the diagonal.
[in] | rows | Rows in local (process-wise) indices. The indices must exist in the row IndexMap. |
std::int32_t nnz_diag | ( | std::int32_t | row | ) | const |
Number of non-zeros in owned columns (diagonal block) on a given row.
std::int32_t nnz_off_diag | ( | std::int32_t | row | ) | const |
Number of non-zeros in unowned columns (off-diagonal block) on a given row.
std::span< const std::int32_t > off_diagonal_offsets | ( | ) | const |
Row-wise start of off-diagonals (unowned columns) for each row.