Adjacency

This handles adjacency matrices between entities of polyhedral complexes, e.g. nodes, cells, edges etc.

An adjacency is described by an Adjacency matrix, which is a sparse matrix whose entries a 0 or 1. While such a matrix always can be stored as a SparseMatrixCSC, in general this would be a waste of storage.

For the general case, it is sufficient to only store the column start indieces and the column entries (row numbers), and to implicitely assume that nonzero entries are 1. This kind of storage is realised in a VariableTargetAdjacency.

In many cases, this can be compressed even more, if each column has the same length. In that case, a Matrix is sufficient to store the data. This is the usual base for implementing FEM/FVM assembly, and the interface for the general case should be similar.

From these ideas we develop the following interface for an adjacency a.

In order to avoid name confusion, we introduce the following notation which should be consistent with the use in assembly loops.

source: source of adjacency link target: target of adjacency link

E.g. the cell-node adjacency for FEM assembly links a number of cells with a collection of nodes. The cells are the sources, and the targets are the nodes.

getindex(a,i,isource) aka a[i,isource]: return i-th target of source j numsources(a): overall number of sources, e.g. number of cells numtargets(a): overall number of targets numtargets(a,isource): number of targets for source given by isource numlinks(a): number of links aka nonzero entries of adjacency matrix show(a): print stuff

Further API ideas:

  • Convert between Matrix and Variable target stuff using 0 entries as "padding"

API

ExtendableGrids.VariableTargetAdjacencyMethod
VariableTargetAdjacency(
    m::SparseArrays.SparseMatrixCSC{Tv<:Integer, Ti<:Integer}
) -> VariableTargetAdjacency{Ti} where Ti<:Integer

Create variable target adjacency from adjacency matrix

source
Base.append!Method
append!(adj::SerialVariableTargetAdjacency, len) -> Vector

Append a column to adjacency.

source
Base.append!Method
append!(adj::VariableTargetAdjacency, column) -> Vector

Append a column to adjacency.

source
Base.getindexMethod
getindex(
    adj::SerialVariableTargetAdjacency,
    i,
    isource
) -> Any

Access adjacency as if it is a 2D Array

source
Base.getindexMethod
getindex(adj::VariableTargetAdjacency, i, isource) -> Any

Access adjacency as if it is a 2D Array

source
Base.showMethod
show(io::IO, adj::SerialVariableTargetAdjacency)

Show adjacency (in trasposed form; preliminary)

source
Base.showMethod
show(io::IO, adj::VariableTargetAdjacency)

Show adjacency (in trasposed form; preliminary)

source
ExtendableGrids.asparseMethod
asparse(
    a::VariableTargetAdjacency
) -> SparseArrays.SparseMatrixCSC{Int64}

Create sparse incidence matrix from adjacency

source
ExtendableGrids.makevarMethod
makevar(a::Array{T, 2}) -> VariableTargetAdjacency

Turn fixed target adjacency into variable target adjacency

source
ExtendableGrids.tryfixMethod
tryfix(
    a::Union{Array{T, 2}, VariableTargetAdjacency{T}}
) -> Any

Try to turn variable target adjacency into fixed target adjacency

source