Fields

Fields serve as loose wrappers around AbstractArray subtypes such that the size of array slices are known at compile time. Although this introduces a type-instability, the idea is to do this at the top most level (mainly at setup time of a FEM simulation). By introducing this type instability, we can gain information about the field type that is used in methods downstream to construct StaticArrays of views of field types.

All fields are subtypes of the abstract type AbstractField

julia> using FiniteElementContainers
julia> AbstractFieldERROR: UndefVarError: `AbstractField` not defined

Example - H1Field a.k.a. NodalField

We can set up a H1Field in one of two ways. The simplest constructor form can be used as follows

julia> using FiniteElementContainers
julia> field = H1Field(rand(2, 10), (:field_1, :field_2))ERROR: MethodError: no method matching H1Field(::Matrix{Float64}, ::Tuple{Symbol, Symbol}) Closest candidates are: H1Field(::M) where M<:(AbstractMatrix) @ FiniteElementContainers ~/work/FiniteElementContainers.jl/FiniteElementContainers.jl/src/fields/H1Field.jl:13

This is stored in a vectorized way as can be seen above

julia> field.valsERROR: UndefVarError: `field` not defined

Fields can be indexed like regular arrays, e.g.

julia> field[1, 1]ERROR: UndefVarError: `field` not defined
julia> field[1, :]ERROR: UndefVarError: `field` not defined

etc.

But they can also be indexed by the symbols provided during construction

julia> field[:field_1]ERROR: UndefVarError: `field` not defined

Abstract type

The base type for fields is the AbstractField abstract type.

Any new field added to FiniteElementContainers should be a subtype of this type.

Methods for AbstractField

Base.fill!Method
fill!(
    field::FiniteElementContainers.AbstractField{T, N, D, NF},
    v
) -> Any
source

Implementations

The existing direct subtypes of AbstractField are the following

Connectivity

The connectivity type is a simple alias for L2ElementField defined below

H1 field

L2Element field

L2Quadrature field

There are plans to add HcurlField and HdivField types as well