FEVector
A FEVector
represents a block-structured vector used in finite element computations. It consists of one or more FEVectorBlock
s, each associated with a specific FESpace
. All blocks share a common one-dimensional array that stores the global degrees of freedom (DoFs). Each block can only write to a region of the array specified by offsets, ensuring that each FESpace
manages its own DoFs within the global vector.
Core.Array
— MethodArray(FEB::FEVectorBlock) -> Vector
Convert an FEVectorBlock
to a standard Julia array containing the coefficients for that block.
Core.Array
— MethodArray(FEV::FEVector) -> Vector
Convert an FEVector
to a standard Julia array containing all coefficients.
ExtendableFEMBase.FEVector
— Typestruct FEVector{T, Tv, Ti}
A block-structured vector for storing coefficients associated with one or more finite element spaces (FESpace
).
An FEVector
consists of a global coefficient array subdivided into multiple FEVectorBlock
s, each corresponding to a specific FESpace
. This structure enables efficient block-wise access, assembly, and manipulation of solution vectors in finite element computations, especially for multi-field or mixed problems.
Type Parameters
T
: Value type of the vector entries (e.g.,Float64
).Tv
: Value type for the associatedFESpace
.Ti
: Integer type for the associatedFESpace
.
Fields
FEVectorBlocks::Array{FEVectorBlock{T, Tv, Ti}, 1}
: Array of blocks, each representing a segment of the global vector for a specificFESpace
.entries::Array{T, 1}
: The global coefficient array, shared by all blocks.tags::Vector{Any}
: Optional tags for identifying or accessing blocks (e.g., by name or symbol).
ExtendableFEMBase.FEVector
— MethodFEVector{T}(FES; name = nothing, tags = nothing, kwargs...) where T <: Real
Constructs an FEVector
for storing coefficients associated with one or more finite element spaces (FESpace
).
- If
FES
is a singleFESpace
, the resultingFEVector
contains one block. - If
FES
is a vector ofFESpace
objects, the resultingFEVector
is block-structured, with one block per space.
Optionally, you can assign a name (as a String
for all blocks, or a vector of String
for each block) and/or tags (as an array of any type) to the blocks for identification and access.
Arguments
FES::FESpace
orFES::Vector{<:FESpace}
: The finite element space(s) for which to create the vector.
Keyword Arguments
entries
: Optional array of coefficients. If not provided, a zero vector of appropriate length is created.name
: Name for the vector or for each block (default:nothing
causes auto naming by index or tag).tags
: Array of tags for the blocks (default:[]
, i.e. block access only by index).
Returns
- An
FEVector
object with one or moreFEVectorBlock
s, each corresponding to a givenFESpace
.
ExtendableFEMBase.FEVectorBlock
— Typestruct FEVectorBlock{T, Tv, Ti, FEType, APT} <: AbstractArray{T, 1}
A block within an FEVector
representing a contiguous segment of coefficients associated with a specific finite element space (FESpace
).
Each FEVectorBlock
provides array-like access to the degrees of freedom (DOFs) for its associated FESpace
, mapping local indices to a shared global coefficient array. This enables efficient block-wise operations, assembly, and extraction of sub-vectors corresponding to different FE spaces.
Type Parameters
T
: Value type of the vector entries (e.g.,Float64
).Tv
: Value type for the associatedFESpace
.Ti
: Integer type for the associatedFESpace
.FEType
: Type of the finite element.APT
: Assembly type for the finite element.
Fields
name::String
: Name or label for this block (for identification or debugging).FES::FESpace{Tv, Ti, FEType, APT}
: The finite element space associated with this block.offset::Int
: Global offset (start index in the global vector).last_index::Int
: Global end index (inclusive).entries::Array{T, 1}
: Reference to the global coefficient array (shared with the parentFEVector
).
Usage
FEVectorBlock
is typically created internally by FEVector
constructors and provides efficient access to the coefficients for a particular FE space. Supports standard array operations (getindex
, setindex!
, size
, length
, etc.) and can be used for block-wise assembly, extraction, and manipulation.
Base.append!
— Methodappend!(
FEF::FEVector{T},
FES::FESpace{Tv, Ti, FEType, APT};
name,
tag
) -> Int64
Overloaded append
function for FEVector
that adds a FEVectorBlock at the end.
Base.fill!
— Methodfill!(b::FEVectorBlock, value)
Overloaded fill
function for FEVectorBlock
(only fills the block, not the complete FEVector).
Base.length
— Methodlength(FEB::FEVectorBlock) -> Int64
Custom length
function for FEVectorBlock
that gives the coressponding number of degrees of freedoms of the associated FESpace
Base.length
— Methodlength(FEF::FEVector) -> Int64
Custom length
function for FEVector
that gives the number of defined FEMatrixBlocks in it
Base.show
— Methodshow(io::IO, FEF::FEVector)
Custom show
function for FEVector
that prints some information on its blocks.
Base.show
— Methodshow(
io::IO,
_::MIME{Symbol("text/plain")},
FEB::FEVectorBlock
)
Custom show
function for FEVectorBlock
that prints some information and the view of that block.
Base.view
— Methodview(
FEB::FEVectorBlock,
inds::Union{Integer, AbstractArray{<:Integer}}
) -> Any
Returns a view of a slice of the FEVectorBlock, specified by local indices inds
(which can be an integer, a range, or an array of indices). The indices are relative to the block (i.e., 1
corresponds to the first entry of the block).
Arguments
FEB::FEVectorBlock
: The FEVectorBlock to view.inds
: Indices relative to the block (e.g.,1:30
,[2,4,6]
).
Returns
- A view into the underlying entries array for the specified slice.
Base.view
— Methodview(
FEB::FEVectorBlock
) -> SubArray{_A, 1, P, Tuple{UnitRange{Int64}}, true} where {_A, P<:(Vector)}
Returns a view of the part of the full FEVector that coressponds to the block.
ExtendableFEMBase.FESpaces
— MethodFESpaces(
FEV::FEVector{T, Tv, Ti}
) -> Vector{T} where T<:FESpace
Returns the vector of FEspaces for the blocks of the given FEVector.
ExtendableFEMBase.addblock!
— Methodaddblock!(
a::FEVectorBlock,
b::AbstractVector;
factor,
offset
)
Adds Array b to FEVectorBlock a.
ExtendableFEMBase.addblock!
— Methodaddblock!(a::FEVectorBlock, b::FEVectorBlock; factor)
Adds FEVectorBlock b to FEVectorBlock a.
ExtendableFEMBase.get_ncomponents
— Methodget_ncomponents(FB::FEVectorBlock) -> Any
Returns the number of components for the finite element in that block.
ExtendableFEMBase.norms
— Methodnorms(FEV::FEVector{T}) -> Any
norms(FEV::FEVector{T}, p::Real) -> Any
Returns a vector with the individual norms of all blocks.
LinearAlgebra.dot
— Methoddot(a::FEVectorBlock{T}, b::FEVectorBlock{T}) -> Any
Scalar product between two FEVEctorBlocks.