Skip to content

Commit b6e9d34

Browse files
committed
fixed FEMatrix constructor issues leading to errors in downstream tests, some more documentation improvements
1 parent 845d7c5 commit b6e9d34

File tree

3 files changed

+41
-19
lines changed

3 files changed

+41
-19
lines changed

README.md

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,13 @@
66

77
# ExtendableFEMBase
88

9-
This package provides basic finite element structures to setup finite element schemes on ExtendableGrids. For a full high-level API
10-
see [ExtendableFEM.jl](https://github.com/WIAS-PDELib/ExtendableFEM.jl).
9+
ExtendableFEMBase.jl provides foundational data structures and tools for assembling custom finite element solvers in Julia. It is designed for flexibility, efficiency, and extensibility, and serves as the low-level backend for [ExtendableFEM.jl](https://github.com/WIAS-PDELib/ExtendableFEM.jl). All functionality is built on top of [ExtendableGrids.jl](https://github.com/WIAS-PDELib/ExtendableGrids.jl).
1110

12-
This low level structures in the package incorporate:
11+
## Features
1312

14-
- Finite element types (Basis functions on reference geometries and dof management for several H1, Hdiv and Hcurl elements)
15-
- FESpace (Discrete finite element space with respect to a mesh from ExtendableGrids, knows the Dofmaps)
16-
- FEMatrix (block overlay for an ExtendableSparse matrix, where each block corresponds to a coupling between two FESpaces in a system)
17-
- FEVector (block overlay for an array, where each block corresponds to a FESpace)
18-
- FunctionOperators (primitive linear operators like Identity, Gradient, Divergence) and rules how to evaluate them for for different finite element types
19-
- FEEvaluator (finite element basis evaluators for different FunctionOperators and entities of the grid)
20-
- QuadratureRule (basic quadrature rules for different ElementGeometries from ExtendableGrids)
21-
- interpolations (standard interpolations into the provided finite element spaces, averaging routines and interpolations between meshes/FESpaces)
22-
- reconstruction operators (special FunctionOperators that involve an interpolation into a different finite element type)
23-
24-
13+
- Wide range of finite element types (H1, Hdiv, Hcurl, etc.)
14+
- Flexible finite element spaces (`FESpace`)
15+
- Block-structured matrices and vectors (`FEMatrix`, `FEVector`)
16+
- Primitive and composite function operators (e.g., gradient, divergence)
17+
- Efficient basis evaluation and quadrature routines
18+
- Interpolation and reconstruction operators

docs/src/index.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
ExtendableFEMBase.jl provides foundational data structures and tools for building custom finite element solvers in Julia. The package includes flexible representations for finite element spaces, interpolators, matrices, and vectors, all designed to work seamlessly with the [ExtendableGrids.jl](https://github.com/j-fu/ExtendableGrids.jl) infrastructure.
99

10-
With ExtendableFEMBase.jl, users can efficiently assemble and manipulate finite element systems, enabling the development of advanced simulation workflows and research codes.
11-
1210

1311
### Dependencies on other Julia packages
1412

src/fematrix.jl

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,22 @@
99
"""
1010
$(TYPEDEF)
1111
12-
block of an FEMatrix that carries coefficients for an associated pair of FESpaces and can be assigned as an two-dimensional AbstractArray (getindex, setindex, size)
12+
A block of an `FEMatrix` representing the coupling between two finite element spaces.
13+
14+
`FEMatrixBlock` acts as a two-dimensional array (subclassing `AbstractArray{TvM, 2}`) and stores the coefficients for a specific pair of row and column finite element spaces (`FESpace`).
15+
Each block is mapped to a submatrix of the global sparse matrix, with offsets and sizes corresponding to the degrees of freedom of the associated spaces.
16+
17+
# Fields
18+
- `name::String`: Name of the block (for identification and display).
19+
- `FES::FESpace{TvG, TiG, FETypeX, APTX}`: Row finite element space.
20+
- `FESY::FESpace{TvG, TiG, FETypeY, APTY}`: Column finite element space.
21+
- `offset::Int64`: Row offset in the global matrix.
22+
- `offsetY::Int64`: Column offset in the global matrix.
23+
- `last_index::Int64`: Last row index for this block.
24+
- `last_indexY::Int64`: Last column index for this block.
25+
- `entries::AbstractSparseMatrix{TvM, TiM}`: Reference to the underlying global sparse matrix (shared with the parent `FEMatrix`).
26+
27+
See also: [`FEMatrix`], [`FESpace`]
1328
"""
1429
struct FEMatrixBlock{TvM, TiM, TvG, TiG, FETypeX, FETypeY, APTX, APTY} <: AbstractArray{TvM, 2}
1530
name::String
@@ -40,7 +55,22 @@ end
4055
"""
4156
$(TYPEDEF)
4257
43-
an AbstractMatrix (e.g. an ExtendableSparseMatrix) with an additional layer of several FEMatrixBlock subdivisions each carrying coefficients for their associated pair of FESpaces
58+
A block-structured sparse matrix type for finite element assembly.
59+
60+
`FEMatrix` represents a (typically sparse) matrix with an additional layer of structure: it is subdivided into multiple `FEMatrixBlock`s, each associated with a specific pair of finite element spaces (`FESpace`).
61+
62+
# Fields
63+
- `FEMatrixBlocks::Array{FEMatrixBlock{TvM, TiM, TvG, TiG}, 1}`: The array of matrix blocks, each corresponding to a pair of row and column finite element spaces.
64+
- `entries::AbstractSparseMatrix{TvM, TiM}`: The underlying sparse matrix storing all coefficients.
65+
- `tags::Matrix{Any}`: Optional tags for identifying or accessing blocks.
66+
67+
# Type Parameters
68+
- `TvM`: Value type for matrix entries (e.g., `Float64`).
69+
- `TiM`: Integer type for matrix indices (e.g., `Int64`).
70+
- `TvG`, `TiG`: Value and index types for the associated finite element spaces.
71+
- `nbrow`: Number of block rows.
72+
- `nbcol`: Number of block columns.
73+
- `nbtotal`: Total number of blocks.
4474
"""
4575
struct FEMatrix{TvM, TiM, TvG, TiG, nbrow, nbcol, nbtotal} <: AbstractSparseMatrix{TvM, TiM}
4676
FEMatrixBlocks::Array{FEMatrixBlock{TvM, TiM, TvG, TiG}, 1}
@@ -204,7 +234,7 @@ function FEMatrix(
204234
return FEMatrix{TvM, TiM}(FESXv, FESYv; kwargs...)
205235
end
206236

207-
function FEMatrix{TvM, TiM}(FESX::Array{<:FESpace{TvG, TiG}, 1}, FESY::Array{<:FESpace{TvG, TiG}, 1}; entries = nothing, name = :automatic, tags = nothing, tagsX = tags, tagsY = tagsX, npartitions = 1, kwargs...) where {TvM, TiM, TvG, TiG}
237+
function FEMatrix{TvM, TiM}(FESX::Array{<:FESpace{TvG, TiG}, 1}, FESY::Array{<:FESpace{TvG, TiG}, 1} = FESX; entries = nothing, name = :automatic, tags = nothing, tagsX = tags, tagsY = tagsX, npartitions = 1, kwargs...) where {TvM, TiM, TvG, TiG}
208238
ndofsX, ndofsY = 0, 0
209239
for j in 1:length(FESX)
210240
ndofsX += FESX[j].ndofs

0 commit comments

Comments
 (0)