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);
123 std::shared_ptr<const common::IndexMap>
index_map(
int dim)
const;
133 std::shared_ptr<const common::IndexMap>
input_index_map(
int dim)
const;
159 std::int32_t
nnz_diag(std::int32_t row)
const;
172 std::pair<std::span<const std::int32_t>, std::span<const std::int64_t>>
181 MPI_Comm
comm()
const;
188 std::array<std::shared_ptr<const common::IndexMap>, 2> _index_maps;
192 std::shared_ptr<const common::IndexMap> _col_index_map;
195 std::array<int, 2> _bs;
198 std::vector<std::int64_t> _col_ghosts;
201 std::vector<std::int32_t> _col_ghost_owners;
211 std::vector<std::int32_t> _cache_brows, _cache_bcols;
212 std::vector<std::int64_t> _cache_boffs_r{0}, _cache_boffs_c{0};
223 std::vector<std::int32_t> _cache_srows;
224 std::int32_t _cache_sbs = 0;
225 std::vector<std::int64_t> _cache_soffs;
228 std::vector<std::int32_t> _cache_rows;
229 std::vector<std::int32_t> _cache_cols;
232 std::vector<std::int32_t> _cache_diag;
239 std::array<std::size_t, 3> _reserve{0, 0, 0};
243 void expand_square_offsets();
250 std::pair<std::vector<std::int64_t>, std::vector<std::int32_t>>
251 bucket_cache(std::int32_t num_rows, std::int32_t num_cols)
const;
256 std::vector<std::int32_t> _edges;
257 std::vector<std::int64_t> _offsets;
260 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:191
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:370
std::shared_ptr< const common::IndexMap > index_map(int dim) const
Index map for the rows and columns that will be set by the current MPI rank.
Definition SparsityPattern.cpp:486
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:844
void finalize()
Finalize sparsity pattern and communicate off-process entries.
Definition SparsityPattern.cpp:513
int block_size(int dim) const
Return index map block size for dimension dim.
Definition SparsityPattern.cpp:511
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:837
void insert(std::int32_t row, std::int32_t col)
Insert non-zero locations using local (process-wise) indices.
Definition SparsityPattern.cpp:398
void insert_diagonal(std::span< const std::int32_t > rows)
Insert non-zero locations on the diagonal.
Definition SparsityPattern.cpp:473
std::int64_t num_nonzeros() const
Number of nonzeros on this rank after assembly, including ghost rows.
Definition SparsityPattern.cpp:830
std::span< const std::int32_t > off_diagonal_offsets() const
Row-wise start of off-diagonals (unowned columns) for each row.
Definition SparsityPattern.cpp:859
std::vector< std::int64_t > column_indices() const
Global column indices corresponding to the local column indices used by SparsityPattern::graph.
Definition SparsityPattern.cpp:497
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:866
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:852
std::shared_ptr< const common::IndexMap > input_index_map(int dim) const
Input index map for the rows and columns used to construct the pattern.
Definition SparsityPattern.cpp:492
Miscellaneous classes, functions and types.
Definition dolfinx_common.h:8
Linear algebra interface.
Definition dolfinx_la.h:7