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> FiniteElementContainers.AbstractFieldFiniteElementContainers.AbstractField

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))2×10 H1Field{Float64, Vector{Float64}, 2}: 0.135951 0.755349 0.263679 0.813254 … 0.85748 0.006324 0.348699 0.331497 0.122509 0.332607 0.241887 0.698033 0.378197 0.188524

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

julia> field.data20-element Vector{Float64}:
 0.1359506124971115
 0.3314969084331616
 0.7553494839129873
 0.12250926787453109
 0.2636792934019886
 0.3326071071622495
 0.8132543249749686
 0.24188658660953755
 0.28372547026092654
 0.15099288813734868
 0.26419188885486067
 0.07177322913856143
 0.5237418324158382
 0.9552553263119065
 0.8574798250572453
 0.6980332553738868
 0.006323999476585573
 0.3781972324887449
 0.348699357710911
 0.1885236389522853

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

julia> field[1, 1]0.1359506124971115
julia> field[1, :]10-element Vector{Float64}:
 0.1359506124971115
 0.7553494839129873
 0.2636792934019886
 0.8132543249749686
 0.28372547026092654
 0.26419188885486067
 0.5237418324158382
 0.8574798250572453
 0.006323999476585573
 0.348699357710911

etc.

Fields

The base type for fields is the AbstractField abstract type.

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