SparsityPattern

class dolfin.cpp.la.SparsityPattern(*args)

Bases: object

This class implements a sparsity pattern data structure. It is used by most linear algebra backends.

Create sparsity pattern for a generic tensor.

Parameters:
  • comm (MPI_Comm) –
  • std::shared_ptr< const IndexMap >> index_maps (std::vector<) –
  • primary_dim (std::size_t) –
Type_sorted = 0
Type_unsorted = 1
apply()

Finalize sparsity pattern.

Return type:void
init()

Initialize sparsity pattern for a generic tensor.

Parameters:std::shared_ptr< const IndexMap >> index_maps (std::vector<) –
Return type:void
insert_full_rows_local()

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

Parameters:std::vector< std::size_t > & rows (const) –
Return type:void
insert_global()

Insert a global entry - will be fixed by apply

Parameters:
  • i (dolfin::la_index) –
  • j (dolfin::la_index) –
Return type:

void

insert_local()

Insert non-zero entries using local (process-wise) indices.

Parameters:std::vector< ArrayView< const dolfin::la_index >> & entries (const) –
Return type:void
insert_local_global()

Insert non-zero entries using local (process-wise) indices for the primary dimension and global indices for the co-dimension

Parameters:std::vector< ArrayView< const dolfin::la_index >> & entries (const) –
Return type:void
local_range()

Return local range for dimension dim.

Parameters:dim (std::size_t) –
Return type:std::pair< std::size_t, std::size_t >
mpi_comm()

Return MPI communicator.

Return type:MPI_Comm
num_local_nonzeros()

Fill vector with number of nonzeros in local_range for dimension 0

Parameters:std::size_t > & num_nonzeros (std::vector<) –
Return type:void
num_nonzeros()

Return number of local nonzeros.

Return type:std::size_t
num_nonzeros_diagonal()

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

Parameters:std::size_t > & num_nonzeros (std::vector<) –
Return type:void
num_nonzeros_off_diagonal()

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

Parameters:std::size_t > & num_nonzeros (std::vector<) –
Return type:void
primary_dim()

Return primary dimension (e.g., 0=row partition, 1=column partition)

Return type:std::size_t
rank()

Return rank.

Return type:std::size_t
str()

Return informal string representation (pretty-print)

Parameters:verbose (bool) –
Return type:std::string
thisown

The membership flag