SparsityPattern.h¶
Note
The documentation on this page was automatically extracted from the DOLFIN C++ code and may need to be edited or expanded.
-
class
SparsityPattern¶ This class implements a sparsity pattern data structure. It is used by most linear algebra backends.
-
enum class Type Whether SparsityPattern is sorted
-
SparsityPattern(MPI_Comm comm, std::size_t primary_dim)¶ Create empty sparsity pattern
Create sparsity pattern for a generic tensor
Initialize sparsity pattern for a generic tensor
-
void
insert_global(dolfin::la_index i, dolfin::la_index j)¶ Insert a global entry - will be fixed by apply()
-
void
insert_global(const std::vector<ArrayView<const dolfin::la_index>> &entries)¶ Insert non-zero entries using global indices
-
void
insert_local(const std::vector<ArrayView<const dolfin::la_index>> &entries)¶ Insert non-zero entries using local (process-wise) indices
-
void
insert_local_global(const std::vector<ArrayView<const dolfin::la_index>> &entries)¶ Insert non-zero entries using local (process-wise) indices for the primary dimension and global indices for the co-dimension
-
void
insert_full_rows_local(const std::vector<std::size_t> &rows)¶ Insert full rows (or columns, according to primary dimension) using local (process-wise) indices. This must be called before any other sparse insertion occurs to avoid quadratic complexity of dense rows insertion
-
std::size_t
rank() const¶ Return rank
-
std::size_t
primary_dim() const¶ Return primary dimension (e.g., 0=row partition, 1=column partition)
-
std::pair<std::size_t, std::size_t>
local_range(std::size_t dim) const¶ Return local range for dimension dim
-
std::size_t
num_nonzeros() const¶ Return number of local nonzeros
-
void
num_nonzeros_diagonal(std::vector<std::size_t> &num_nonzeros) const¶ Fill array with number of nonzeros for diagonal block in local_range for dimension 0. For matrices, fill array with number of nonzeros per local row for diagonal block
-
void
num_nonzeros_off_diagonal(std::vector<std::size_t> &num_nonzeros) const¶ Fill array with number of nonzeros for off-diagonal block in local_range for dimension 0. For matrices, fill array with number of nonzeros per local row for off-diagonal block. If there is no off-diagonal pattern, the vector is resized to zero-length
-
void
num_local_nonzeros(std::vector<std::size_t> &num_nonzeros) const¶ Fill vector with number of nonzeros in local_range for dimension 0
-
void
apply()¶ Finalize sparsity pattern
-
MPI_Comm
mpi_comm() const¶ Return MPI communicator
-
std::string
str(bool verbose) const¶ Return informal string representation (pretty-print)
-
std::vector<std::vector<std::size_t>>
diagonal_pattern(Type type) const¶ Return underlying sparsity pattern (diagonal). Options are ‘sorted’ and ‘unsorted’.
-
std::vector<std::vector<std::size_t>>
off_diagonal_pattern(Type type) const¶ Return underlying sparsity pattern (off-diagonal). Options are ‘sorted’ and ‘unsorted’. Empty vector is returned if there is no off-diagonal contribution.
-