DOLFIN-X
DOLFIN-X C++ interface
|
This class provides a sparsity pattern data structure that can be used to initialize sparse matrices. More...
#include <SparsityPattern.h>
Public Member Functions | |
SparsityPattern (MPI_Comm comm, const std::array< std::shared_ptr< const common::IndexMap >, 2 > &index_maps) | |
Create an empty sparsity pattern with specified dimensions. | |
SparsityPattern (MPI_Comm comm, const std::vector< std::vector< const SparsityPattern * >> &patterns) | |
Create a new sparsity pattern by adding sub-patterns, e.g. pattern =[ pattern00 ][ pattern 01] [ pattern10 ][ pattern 11]. | |
SparsityPattern (const SparsityPattern &pattern)=delete | |
SparsityPattern (SparsityPattern &&pattern)=default | |
Move constructor. | |
~SparsityPattern ()=default | |
Destructor. | |
SparsityPattern & | operator= (SparsityPattern &&pattern)=default |
Move assignment. | |
std::array< std::int64_t, 2 > | local_range (int dim) const |
Return local range for dimension dim. | |
std::shared_ptr< const common::IndexMap > | index_map (int dim) const |
Return index map for dimension dim. | |
void | insert (const Eigen::Ref< const Eigen::Array< std::int32_t, Eigen::Dynamic, 1 >> &rows, const Eigen::Ref< const Eigen::Array< std::int32_t, Eigen::Dynamic, 1 >> &cols) |
Insert non-zero locations using local (process-wise) indices. | |
void | insert_diagonal (const Eigen::Ref< const Eigen::Array< std::int32_t, Eigen::Dynamic, 1 >> &rows) |
Insert non-zero locations on the diagonal. More... | |
void | assemble () |
Finalize sparsity pattern and communicate off-process entries. | |
std::int64_t | num_nonzeros () const |
Return number of local nonzeros. | |
Eigen::Array< std::int32_t, Eigen::Dynamic, 1 > | num_nonzeros_diagonal () const |
Fill array with number of nonzeros per row for diagonal block in local_range for dimension 0. | |
Eigen::Array< std::int32_t, Eigen::Dynamic, 1 > | num_nonzeros_off_diagonal () const |
Fill array with number of nonzeros for off-diagonal block in local_range for dimension 0. If there is no off-diagonal pattern, the returned vector will have zero-length. | |
Eigen::Array< std::int32_t, Eigen::Dynamic, 1 > | num_local_nonzeros () const |
Fill vector with number of nonzeros in local_range for dimension 0. | |
const graph::AdjacencyList< std::int32_t > & | diagonal_pattern () const |
Sparsity pattern for the owned (diagonal) block. Uses local indices for the columns. | |
const graph::AdjacencyList< std::int64_t > & | off_diagonal_pattern () const |
Sparsity pattern for the un-owned (off-diagonal) columns. Uses global indices for the columns. | |
MPI_Comm | mpi_comm () const |
Return MPI communicator. | |
std::string | str () const |
Return informal string representation (pretty-print) | |
This class provides a sparsity pattern data structure that can be used to initialize sparse matrices.
void SparsityPattern::insert_diagonal | ( | const Eigen::Ref< const Eigen::Array< std::int32_t, Eigen::Dynamic, 1 >> & | rows | ) |
Insert non-zero locations on the diagonal.
[in] | rows | The rows in local (process-wise) indices. The indices must exist in the row IndexMap. |