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.Adjacency
— TypeAdjacency type as union of FixedTargetAdjacency and VariableTargetAdjacency
ExtendableGrids.Adjacency
— MethodConstructors for Adjacency
ExtendableGrids.FixedTargetAdjacency
— Typemutable struct Array{T, 2} <: DenseArray{T, 2}
Use Matrix to store fixed target adjacency
ExtendableGrids.SerialVariableTargetAdjacency
— MethodSerialVariableTargetAdjacency(
+Adjacency · ExtendableGrids.jl 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.Adjacency
— TypeAdjacency type as union of FixedTargetAdjacency and VariableTargetAdjacency
sourceExtendableGrids.Adjacency
— MethodConstructors for Adjacency
sourceExtendableGrids.FixedTargetAdjacency
— Typemutable struct Array{T, 2} <: DenseArray{T, 2}
Use Matrix to store fixed target adjacency
sourceExtendableGrids.SerialVariableTargetAdjacency
— MethodSerialVariableTargetAdjacency(
) -> SerialVariableTargetAdjacency{Int64}
-
Create an empty SerialVariableTargetAdjacency with default type
sourceExtendableGrids.SerialVariableTargetAdjacency
— MethodSerialVariableTargetAdjacency(
+
Create an empty SerialVariableTargetAdjacency with default type
sourceExtendableGrids.SerialVariableTargetAdjacency
— MethodSerialVariableTargetAdjacency(
t::Type{T}
) -> SerialVariableTargetAdjacency
-
Create an empty SerialVariableTargetAdjacency
sourceExtendableGrids.VariableTargetAdjacency
— Typestruct VariableTargetAdjacency{T}
Adjacency struct. Essentially, this is the sparsity pattern of a matrix whose nonzero elements all have the same value in the CSC format.
sourceExtendableGrids.VariableTargetAdjacency
— MethodVariableTargetAdjacency() -> VariableTargetAdjacency{Int64}
-
Create an empty VariableTargetAdjacency with default type
sourceExtendableGrids.VariableTargetAdjacency
— MethodVariableTargetAdjacency(
+
Create an empty SerialVariableTargetAdjacency
sourceExtendableGrids.VariableTargetAdjacency
— Typestruct VariableTargetAdjacency{T}
Adjacency struct. Essentially, this is the sparsity pattern of a matrix whose nonzero elements all have the same value in the CSC format.
sourceExtendableGrids.VariableTargetAdjacency
— MethodVariableTargetAdjacency() -> VariableTargetAdjacency{Int64}
+
Create an empty VariableTargetAdjacency with default type
sourceExtendableGrids.VariableTargetAdjacency
— MethodVariableTargetAdjacency(
m::Array{T, 2}
) -> VariableTargetAdjacency
-
Create a VariableTargetAdjacency from Matrix
sourceExtendableGrids.VariableTargetAdjacency
— MethodVariableTargetAdjacency(
+
Create a VariableTargetAdjacency from Matrix
sourceExtendableGrids.VariableTargetAdjacency
— MethodVariableTargetAdjacency(
m::SparseArrays.SparseMatrixCSC{Tv<:Integer, Ti<:Integer}
) -> VariableTargetAdjacency
-
Create variable target adjacency from adjacency matrix
sourceExtendableGrids.VariableTargetAdjacency
— MethodVariableTargetAdjacency(
+
Create variable target adjacency from adjacency matrix
sourceExtendableGrids.VariableTargetAdjacency
— MethodVariableTargetAdjacency(
t::Type{T}
) -> VariableTargetAdjacency
-
Create an empty VariableTargetAdjacency
sourceBase.:==
— Method==(a, b)
-
Comparison of two adjacencies
sourceBase.:==
— Method==(a, b)
-
Comparison of two adjacencies
sourceBase.append!
— Methodappend!(adj::SerialVariableTargetAdjacency, len) -> Vector
-
Append a column to adjacency.
sourceBase.append!
— Methodappend!(adj::VariableTargetAdjacency, column) -> Vector
-
Append a column to adjacency.
sourceBase.getindex
— Methodgetindex(
+
Create an empty VariableTargetAdjacency
sourceBase.:==
— Method==(a, b)
+
Comparison of two adjacencies
sourceBase.:==
— Method==(a, b)
+
Comparison of two adjacencies
sourceBase.append!
— Methodappend!(adj::SerialVariableTargetAdjacency, len) -> Vector
+
Append a column to adjacency.
sourceBase.append!
— Methodappend!(adj::VariableTargetAdjacency, column) -> Vector
+
Append a column to adjacency.
sourceBase.getindex
— Methodgetindex(
adj::SerialVariableTargetAdjacency,
i,
isource
) -> Any
-
Access adjacency as if it is a 2D Array
sourceBase.getindex
— Methodgetindex(adj::VariableTargetAdjacency, i, isource) -> Any
-
Access adjacency as if it is a 2D Array
sourceBase.show
— Methodshow(io::IO, adj::SerialVariableTargetAdjacency)
-
Show adjacency (in trasposed form; preliminary)
sourceBase.show
— Methodshow(io::IO, adj::VariableTargetAdjacency)
-
Show adjacency (in trasposed form; preliminary)
sourceExtendableGrids.asparse
— Methodasparse(a::Matrix) -> SparseArrays.SparseMatrixCSC{Int64}
-
Create sparse incidence matrix from adjacency
sourceExtendableGrids.asparse
— Methodasparse(
+
Access adjacency as if it is a 2D Array
sourceBase.getindex
— Methodgetindex(adj::VariableTargetAdjacency, i, isource) -> Any
+
Access adjacency as if it is a 2D Array
sourceBase.show
— Methodshow(io::IO, adj::SerialVariableTargetAdjacency)
+
Show adjacency (in trasposed form; preliminary)
sourceBase.show
— Methodshow(io::IO, adj::VariableTargetAdjacency)
+
Show adjacency (in trasposed form; preliminary)
sourceExtendableGrids.asparse
— Methodasparse(a::Matrix) -> SparseArrays.SparseMatrixCSC{Int64}
+
Create sparse incidence matrix from adjacency
sourceExtendableGrids.asparse
— Methodasparse(
a::VariableTargetAdjacency
) -> SparseArrays.SparseMatrixCSC{Int64}
-
Create sparse incidence matrix from adjacency
sourceExtendableGrids.atranspose
— MethodTranspose adjacency
sourceExtendableGrids.makevar
— Methodmakevar(a::Array{T, 2}) -> VariableTargetAdjacency
-
Turn fixed target adjacency into variable target adjacency
sourceExtendableGrids.max_num_targets_per_source
— Methodmax_num_targets_per_source(adj::Matrix) -> Int64
-
Maximum number of targets per source
sourceExtendableGrids.max_num_targets_per_source
— Methodmax_num_targets_per_source(
+
Create sparse incidence matrix from adjacency
sourceExtendableGrids.atranspose
— MethodTranspose adjacency
sourceExtendableGrids.makevar
— Methodmakevar(a::Array{T, 2}) -> VariableTargetAdjacency
+
Turn fixed target adjacency into variable target adjacency
sourceExtendableGrids.max_num_targets_per_source
— Methodmax_num_targets_per_source(adj::Matrix) -> Int64
+
Maximum number of targets per source
sourceExtendableGrids.max_num_targets_per_source
— Methodmax_num_targets_per_source(
adj::SerialVariableTargetAdjacency
) -> Any
-
Maximum number of targets per source
sourceExtendableGrids.max_num_targets_per_source
— Methodmax_num_targets_per_source(
+
Maximum number of targets per source
sourceExtendableGrids.max_num_targets_per_source
— Methodmax_num_targets_per_source(
adj::VariableTargetAdjacency
) -> Any
-
Maximum number of targets per source
sourceExtendableGrids.num_links
— Methodnum_links(adj::Matrix) -> Int64
-
Number of entries
sourceExtendableGrids.num_links
— Methodnum_links(adj::VariableTargetAdjacency) -> Int64
-
Number of links
sourceExtendableGrids.num_sources
— Methodnum_sources(adj::Matrix) -> Int64
-
Number of sources in adjacency
sourceExtendableGrids.num_sources
— Methodnum_sources(adj::SerialVariableTargetAdjacency) -> Int64
-
Number of sources in adjacency
sourceExtendableGrids.num_sources
— Methodnum_sources(adj::VariableTargetAdjacency) -> Int64
-
Number of sources in adjacency
sourceExtendableGrids.num_targets
— Methodnum_targets(adj::Matrix, isource) -> Int64
-
Number of targets per source if adjacency is a matrix
sourceExtendableGrids.num_targets
— Methodnum_targets(adj::Matrix) -> Any
-
Overall number of targets
sourceExtendableGrids.num_targets
— Methodnum_targets(
+
Maximum number of targets per source
sourceExtendableGrids.num_links
— Methodnum_links(adj::Matrix) -> Int64
+
Number of entries
sourceExtendableGrids.num_links
— Methodnum_links(adj::VariableTargetAdjacency) -> Int64
+
Number of links
sourceExtendableGrids.num_sources
— Methodnum_sources(adj::Matrix) -> Int64
+
Number of sources in adjacency
sourceExtendableGrids.num_sources
— Methodnum_sources(adj::SerialVariableTargetAdjacency) -> Int64
+
Number of sources in adjacency
sourceExtendableGrids.num_sources
— Methodnum_sources(adj::VariableTargetAdjacency) -> Int64
+
Number of sources in adjacency
sourceExtendableGrids.num_targets
— Methodnum_targets(adj::Matrix, isource) -> Int64
+
Number of targets per source if adjacency is a matrix
sourceExtendableGrids.num_targets
— Methodnum_targets(adj::Matrix) -> Any
+
Overall number of targets
sourceExtendableGrids.num_targets
— Methodnum_targets(
adj::SerialVariableTargetAdjacency,
isource
) -> Any
-
Number of targets for given source
sourceExtendableGrids.num_targets
— Methodnum_targets(adj::VariableTargetAdjacency, isource) -> Any
-
Number of targets for given source
sourceExtendableGrids.num_targets
— Methodnum_targets(adj::VariableTargetAdjacency) -> Any
-
Number of targeta
sourceExtendableGrids.tryfix
— Methodtryfix(
+
Number of targets for given source
sourceExtendableGrids.num_targets
— Methodnum_targets(adj::VariableTargetAdjacency, isource) -> Any
+
Number of targets for given source
sourceExtendableGrids.num_targets
— Methodnum_targets(adj::VariableTargetAdjacency) -> Any
+
Number of targeta
sourceExtendableGrids.tryfix
— Methodtryfix(
a::Union{Array{T, 2}, VariableTargetAdjacency{T}}
) -> Any
-
Try to turn variable target adjacency into fixed target adjacency
sourceSettings
This document was generated with Documenter.jl version 0.27.25 on Tuesday 25 July 2023. Using Julia version 1.9.2.
+
Try to turn variable target adjacency into fixed target adjacency