DOLFINx 0.12.0.0
DOLFINx C++
Loading...
Searching...
No Matches
dolfinx::fem::sparsitybuild Namespace Reference

Support for building sparsity patterns from degree-of-freedom maps. More...

Functions

template<std::ranges::input_range R0, std::ranges::input_range R1>
void cells (la::SparsityPattern &pattern, const std::pair< R0, R1 > &cells, std::array< std::reference_wrapper< const DofMap >, 2 > dofmaps)
 Iterate over cells and insert entries into sparsity pattern.
std::vector< std::pair< std::span< const int >, std::span< const int > > > entity_closure_blocks (const ElementDofLayout &layout_rows, const ElementDofLayout &layout_cols)
 Element-matrix blocks of an entity-closure stencil.
void entity_closure (la::SparsityPattern &pattern, std::span< const std::int32_t > cells, std::array< std::reference_wrapper< const DofMap >, 2 > dofmaps)
 Iterate over cells and insert the entity-closure blocks into a sparsity pattern.
void interior_facets (la::SparsityPattern &pattern, std::array< std::span< const std::int32_t >, 2 > cells, std::array< std::reference_wrapper< const DofMap >, 2 > dofmaps)
 Iterate over interior facets and insert entries into sparsity pattern.

Detailed Description

Support for building sparsity patterns from degree-of-freedom maps.

Function Documentation

◆ cells()

template<std::ranges::input_range R0, std::ranges::input_range R1>
void cells ( la::SparsityPattern & pattern,
const std::pair< R0, R1 > & cells,
std::array< std::reference_wrapper< const DofMap >, 2 > dofmaps )

Iterate over cells and insert entries into sparsity pattern.

Inserts the rectangular blocks of indices dofmap[0][cells[0][i]] x dofmap[1][cells[1][i]] into the sparsity pattern, i.e. entries (dofmap[0][cells[0][i]][k0], dofmap[0][cells[0][i]][k1]) will appear in the sparsity pattern.

Parameters
patternSparsity pattern to insert into.
cellsLists of cells to iterate over. cells[0] and cells[1] must have the same size.
dofmapsDofmaps to used in building the sparsity pattern.
Note
The sparsity pattern is not finalised.

◆ entity_closure()

void entity_closure ( la::SparsityPattern & pattern,
std::span< const std::int32_t > cells,
std::array< std::reference_wrapper< const DofMap >, 2 > dofmaps )

Iterate over cells and insert the entity-closure blocks into a sparsity pattern.

Inserts, for each mesh entity of each cell, the dofmaps[0] degrees-of-freedom on the entity against the dofmaps[1] degrees-of-freedom on the closure of that entity. This is narrower than sparsitybuild::cells, and is the sparsity of an operator whose dofmaps[0] degrees-of-freedom are moments over the entity they are attached to, since such a moment sees only dofmaps[1] restricted to that entity. fem::discrete_gradient and fem::discrete_curl insert into exactly these blocks.

Entries that the operator evaluates to zero are part of the structure and are included; a consumer that reads the sparsity rather than the values, such as PETSc's PCBDDC Nedelec support, requires them.

Parameters
patternSparsity pattern to insert into.
cellsCells to iterate over.
dofmapsDofmaps used in building the sparsity pattern, dofmaps[0] for the rows and dofmaps[1] for the columns.
Note
The sparsity pattern is not finalised.

◆ entity_closure_blocks()

std::vector< std::pair< std::span< const int >, std::span< const int > > > entity_closure_blocks ( const ElementDofLayout & layout_rows,
const ElementDofLayout & layout_cols )

Element-matrix blocks of an entity-closure stencil.

Parameters
[in]layout_rowsDof layout of the space of the rows.
[in]layout_colsDof layout of the space of the columns.
Returns
For each reference-cell entity carrying layout_rows degrees-of-freedom, the cell-local layout_rows degrees-of-freedom on the entity and the cell-local layout_cols degrees-of-freedom on its closure. The spans point into the layouts, which must outlive the return value.

◆ interior_facets()

void interior_facets ( la::SparsityPattern & pattern,
std::array< std::span< const std::int32_t >, 2 > cells,
std::array< std::reference_wrapper< const DofMap >, 2 > dofmaps )

Iterate over interior facets and insert entries into sparsity pattern.

Inserts the rectangular block of indices [dofmap[0][cell0], dofmap[0][cell1]] x [dofmap[1][cell0], dofmap[1][cell1]] where cell0 and cell1 are the two cells attached to a facet.

Parameters
[in,out]patternSparsity pattern to insert into.
[in]cellsCells to index into each dofmap. cells[i] is a list of (cell0, cell1) pairs for each interior facet to index into dofmap[i]. cells[0] and cells[1] must have the same size. A negative cell index means no cell exists on that side (e.g. an interface between two domains); no entries are inserted for it.
[in]dofmapsDofmaps to use in building the sparsity pattern.
Note
The sparsity pattern is not finalised.