DOLFIN
DOLFIN C++ interface
|
#include <SparsityPattern.h>
Public Types | |
enum | Type { sorted, unsorted } |
Whether SparsityPattern is sorted. | |
Public Member Functions | |
SparsityPattern (MPI_Comm comm, std::size_t primary_dim) | |
Create empty sparsity pattern. | |
SparsityPattern (MPI_Comm comm, std::vector< std::shared_ptr< const IndexMap >> index_maps, std::size_t primary_dim) | |
Create sparsity pattern for a generic tensor. | |
void | init (std::vector< std::shared_ptr< const IndexMap >> index_maps) |
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) |
void | insert_full_rows_local (const std::vector< std::size_t > &rows) |
std::size_t | rank () const |
Return rank. | |
std::size_t | primary_dim () const |
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 |
void | num_nonzeros_off_diagonal (std::vector< std::size_t > &num_nonzeros) const |
void | num_local_nonzeros (std::vector< std::size_t > &num_nonzeros) const |
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 |
std::vector< std::vector< std::size_t > > | off_diagonal_pattern (Type type) const |
This class implements a sparsity pattern data structure. It is used by most linear algebra backends.
std::vector< std::vector< std::size_t > > SparsityPattern::diagonal_pattern | ( | Type | type | ) | const |
Return underlying sparsity pattern (diagonal). Options are 'sorted' and 'unsorted'.
void SparsityPattern::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
void SparsityPattern::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 SparsityPattern::num_local_nonzeros | ( | std::vector< std::size_t > & | num_nonzeros | ) | const |
Fill vector with number of nonzeros in local_range for dimension 0
void SparsityPattern::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 SparsityPattern::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
std::vector< std::vector< std::size_t > > SparsityPattern::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.
|
inline |
Return primary dimension (e.g., 0=row partition, 1=column partition)