11#include <dolfinx/common/MPI.h>
36 std::array<std::shared_ptr<const common::IndexMap>, 2> maps,
37 std::array<int, 2> bs);
52 const std::vector<std::vector<const SparsityPattern*>>& patterns,
55 std::pair<std::reference_wrapper<const common::IndexMap>,
int>>,
57 const std::array<std::vector<int>, 2>& bs);
84 std::size_t num_cols);
90 void insert(std::int32_t row, std::int32_t col);
104 void insert(std::span<const std::int32_t> rows,
105 std::span<const std::int32_t> cols);
122 std::shared_ptr<const common::IndexMap>
index_map(
int dim)
const;
148 std::int32_t
nnz_diag(std::int32_t row)
const;
161 std::pair<std::span<const std::int32_t>, std::span<const std::int64_t>>
170 MPI_Comm
comm()
const;
177 std::array<std::shared_ptr<const common::IndexMap>, 2> _index_maps;
180 std::array<int, 2> _bs;
183 std::vector<std::int64_t> _col_ghosts;
186 std::vector<std::int32_t> _col_ghost_owners;
196 std::vector<std::int32_t> _cache_brows, _cache_bcols;
197 std::vector<std::int64_t> _cache_boffs_r{0}, _cache_boffs_c{0};
208 std::vector<std::int32_t> _cache_srows;
209 std::int32_t _cache_sbs = 0;
210 std::vector<std::int64_t> _cache_soffs;
213 std::vector<std::int32_t> _cache_rows;
214 std::vector<std::int32_t> _cache_cols;
217 std::vector<std::int32_t> _cache_diag;
224 std::array<std::size_t, 3> _reserve{0, 0, 0};
228 void expand_square_offsets();
235 std::pair<std::vector<std::int64_t>, std::vector<std::int32_t>>
236 bucket_cache(std::int32_t num_rows, std::int32_t num_cols)
const;
241 std::vector<std::int32_t> _edges;
242 std::vector<std::int64_t> _offsets;
245 std::vector<std::int32_t> _off_diagonal_offsets;
A duplicate MPI communicator and manage lifetime of the communicator.
Definition MPI.h:47
Distribution of a global index range [0, N) across MPI ranks.
Definition IndexMap.h:114
SparsityPattern(SparsityPattern &&pattern)=default
Move constructor.
void reserve_blocks(std::size_t num_blocks, std::size_t num_rows, std::size_t num_cols)
Reserve storage for additional insert(rows, cols) calls.
Definition SparsityPattern.cpp:368
std::shared_ptr< const common::IndexMap > index_map(int dim) const
Index map for given dimension. Returns the index map for rows and columns that will be set by the cur...
Definition SparsityPattern.cpp:484
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.
Definition SparsityPattern.cpp:835
void finalize()
Finalize sparsity pattern and communicate off-process entries.
Definition SparsityPattern.cpp:505
int block_size(int dim) const
Return index map block size for dimension dim.
Definition SparsityPattern.cpp:503
std::int32_t nnz_diag(std::int32_t row) const
Number of non-zeros in owned columns (diagonal block) on a given row.
Definition SparsityPattern.cpp:828
void insert(std::int32_t row, std::int32_t col)
Insert non-zero locations using local (process-wise) indices.
Definition SparsityPattern.cpp:396
void insert_diagonal(std::span< const std::int32_t > rows)
Insert non-zero locations on the diagonal.
Definition SparsityPattern.cpp:471
std::int64_t num_nonzeros() const
Number of nonzeros on this rank after assembly, including ghost rows.
Definition SparsityPattern.cpp:821
std::span< const std::int32_t > off_diagonal_offsets() const
Row-wise start of off-diagonals (unowned columns) for each row.
Definition SparsityPattern.cpp:850
std::vector< std::int64_t > column_indices() const
Global column indices corresponding to the local column indices used by SparsityPattern::graph.
Definition SparsityPattern.cpp:489
SparsityPattern(MPI_Comm comm, std::array< std::shared_ptr< const common::IndexMap >, 2 > maps, std::array< int, 2 > bs)
Create an empty sparsity pattern with specified dimensions.
Definition SparsityPattern.cpp:232
MPI_Comm comm() const
Return MPI communicator.
Definition SparsityPattern.cpp:857
SparsityPattern & operator=(SparsityPattern &&pattern)=default
Move assignment.
~SparsityPattern()=default
Destructor.
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.
Definition SparsityPattern.cpp:843
Miscellaneous classes, functions and types.
Definition dolfinx_common.h:8
Linear algebra interface.
Definition dolfinx_la.h:7