This package implements interfaces that may eventually be integrated into the IgaBase.jl
package.
SpecialSpaces.jl
The core function spaces in SuiteSplines are SplineSpace
and tensor-products thereof.
SpecialSpaces.jl
introduces convenient interfaces for handling spaces used to represent scalar-, vector- and mixed-valued fields and geometric mappings.
Note on higher dimensions
Almost everything described on this page generalizes to higher dimensions, e.g.
julia> Ω = Interval(0.0, 2.0) ⨱ Interval(0.0, 4.0) ⨱ Interval(-1.0, 1.0)
2×2×2 SuiteSplines.CartesianProducts.CartesianProduct{3, Tuple{Float64, Float64, Float64}, Tuple{SuiteSplines.SortedSequences.Interval{Float64}, SuiteSplines.SortedSequences.Interval{Float64}, SuiteSplines.SortedSequences.Interval{Float64}}}: [:, :, 1] = (0.0, 0.0, -1.0) (0.0, 4.0, -1.0) (2.0, 0.0, -1.0) (2.0, 4.0, -1.0) [:, :, 2] = (0.0, 0.0, 1.0) (0.0, 4.0, 1.0) (2.0, 0.0, 1.0) (2.0, 4.0, 1.0)
julia> Δ = Partition(Ω, (3, 5, 7));
julia> S = ScalarSplineSpace(4, Δ)
SuiteSplines.CartesianProducts.TensorProduct{3, SuiteSplines.UnivariateSplines.SplineSpace{Float64}}((SplineSpace(degree = 4, interval = [0.0, 2.0], dimension = 6), SplineSpace(degree = 4, interval = [0.0, 4.0], dimension = 8), SplineSpace(degree = 4, interval = [-1.0, 1.0], dimension = 10)))
The only exception are the Raviart-Thomas and Taylor-Hood spaces, which are implemented only in two and three dimensions.
Domains and partitions
All spline spaces are defined on a Partition
of some Domain
. A Cartesian product domain in two dimensions may be defined as a Cartesian product of intervals,
julia> Ω = Interval(0.0, 2.0) ⨱ Interval(0.0, 4.0)
2×2 SuiteSplines.CartesianProducts.CartesianProduct{2, Tuple{Float64, Float64}, Tuple{SuiteSplines.SortedSequences.Interval{Float64}, SuiteSplines.SortedSequences.Interval{Float64}}}: (0.0, 0.0) (0.0, 4.0) (2.0, 0.0) (2.0, 4.0)
A partition of the domain Ω
is just another Cartesian product of a strictly increasing real numbers on the intervals defining each domain dimension. To generate an uniform partition we can use IncreasingRange
,
julia> Δ = IncreasingRange(Ω.data[1]..., 3) ⨱ IncreasingRange(Ω.data[2], 5)
3×5 SuiteSplines.CartesianProducts.CartesianProduct{2, Tuple{Float64, Float64}, Tuple{SuiteSplines.SortedSequences.IncreasingRange{Float64}, SuiteSplines.SortedSequences.IncreasingRange{Float64}}}: (0.0, 0.0) (0.0, 1.0) (0.0, 2.0) (0.0, 3.0) (0.0, 4.0) (1.0, 0.0) (1.0, 1.0) (1.0, 2.0) (1.0, 3.0) (1.0, 4.0) (2.0, 0.0) (2.0, 1.0) (2.0, 2.0) (2.0, 3.0) (2.0, 4.0)
Less explicitly, we can also call
julia> Δ = Partition(Ω, (3, 5))
3×5 SuiteSplines.CartesianProducts.CartesianProduct{2, Tuple{Float64, Float64}, Tuple{SuiteSplines.SortedSequences.IncreasingRange{Float64}, SuiteSplines.SortedSequences.IncreasingRange{Float64}}}: (0.0, 0.0) (0.0, 1.0) (0.0, 2.0) (0.0, 3.0) (0.0, 4.0) (1.0, 0.0) (1.0, 1.0) (1.0, 2.0) (1.0, 3.0) (1.0, 4.0) (2.0, 0.0) (2.0, 1.0) (2.0, 2.0) (2.0, 3.0) (2.0, 4.0)
which gives us a Cartesian product partition with 3 breakpoints in the first and 5 breakpoints the second dimension.
Scalar spline spaces
Given a partition, a tensor-product ScalarSplineSpace
of degree 2 can be constructed by calling
julia> S = ScalarSplineSpace(2, Δ)
SuiteSplines.CartesianProducts.TensorProduct{2, SuiteSplines.UnivariateSplines.SplineSpace{Float64}}((SplineSpace(degree = 2, interval = [0.0, 2.0], dimension = 4), SplineSpace(degree = 2, interval = [0.0, 4.0], dimension = 6)))
This is equivalent to
julia> SplineSpace(2, Δ.data[1]) ⨷ SplineSpace(2, Δ.data[2])
SuiteSplines.CartesianProducts.TensorProduct{2, SuiteSplines.UnivariateSplines.SplineSpace{Float64}}((SplineSpace(degree = 2, interval = [0.0, 2.0], dimension = 4), SplineSpace(degree = 2, interval = [0.0, 4.0], dimension = 6)))
In fact, ScalarSplineSpace
is just a type alias for a tensor-product of univariate spline spaces. The dimension of the tensor-product was inferred from the dimension of the provided partition. SpecialSpaces.jl
implements a few more handy constructors for tensor-product spline spaces, e.g. with different degrees in each dimension.
Conveniently, we can obtain the dimension and linear indices of the tensor-product space by
julia> linds = indices(S)
1:24
julia> dim = dimension(S)
24
Linear indices are useful when handling solution vectors, fields and geometric mappings on more complex spaces. These spaces follow next.
Vector spline spaces
A tensor-product VectorSplineSpace
can be constructed from multiple scalar spline spaces,
julia> V = VectorSplineSpace(S, S, S)
SuiteSplines.SpecialSpaces.VectorSplineSpace{2, 3, Float64} with 3 components
The requirement here is that the scalar spaces are defined on the same partition.
To access the scalar space corresponding to the k
th component of a vector space, we can index into the collection,
julia> V[1]
SuiteSplines.CartesianProducts.TensorProduct{2, SuiteSplines.UnivariateSplines.SplineSpace{Float64}}((SplineSpace(degree = 2, interval = [0.0, 2.0], dimension = 4), SplineSpace(degree = 2, interval = [0.0, 4.0], dimension = 6)))
julia> V[1] == V[2] == V[3]
true
Note that in this example the domain dimension is two and the codomain dimension is three. More commonly, the dimension and codimension coincide and a vector space of degree 2 can be defined directly as
julia> V = VectorSplineSpace(2, Δ)
SuiteSplines.SpecialSpaces.VectorSplineSpace{2, 2, Float64} with 2 components
The linear indices for each component are
julia> for k in 1:2 @show indices(V, k) end
indices(V, k) = 1:24 indices(V, k) = 25:48
Note here the subtlety of calling indices(V, k)
instead of indices(V[k])
. The element type of V
is
julia> eltype(V)
SuiteSplines.CartesianProducts.TensorProduct{2, SuiteSplines.UnivariateSplines.SplineSpace{Float64}}
Thus an expression like the one below will call the indices
method for a scalar spline space,
julia> indices.(V)
2-element Vector{UnitRange{Int64}}: 1:24 1:24
This does not give the desired result. The following expression on the other hand does,
julia> indices.(Ref(V), 1:2)
2-element Vector{UnitRange{Int64}}: 1:24 25:48
As expected, the complete range of linear indices for a vector space is
julia> indices(V)
1:48
Mixed spline spaces
Mixed spline function spaces are defined as custom structs subtyping MixedSplineSpace
, where each struct field corresponds to a scalar or vector spline space.
A basic definition of a custom mixed spline space might look like the following:
struct TaylorHood{Dim,T} <: MixedSplineSpace{Dim,T}
V::VectorSplineSpace{Dim,Dim,T}
Q::ScalarSplineSpace{Dim,T}
function TaylorHood(p::Degree, Δ::Partition{Dim,T}) where {Dim,T<:Real}
@assert p ≥ 2
p = ntuple(i -> p, Dim)
V = VectorSplineSpace(ntuple(i -> ScalarSplineSpace(p, Δ), Dim)...)
Q = ScalarSplineSpace(p .- 1, Δ)
new{Dim,T}(V, Q)
end
end
SpecialSpaces.jl
implements interfaces that allow us to operate on such spaces.
Taylor–Hood
One implemented example of a mixed spline space is the TaylorHood
space, which defines an inf-sub stable pair of spaces for velocities and pressure.
julia> th = TaylorHood(2, Δ)
SuiteSplines.SpecialSpaces.TaylorHood{2, 3, Float64} with fields (:V, :Q)
julia> dimension(th)
63
julia> dimension(th, :Q)
15
julia> dimension(th, :V)
48
julia> dimension(th, :V, 1)
24
julia> dimension(th, :V, 2)
24
julia> indices(th, :Q)
49:63
julia> indices(th, :V)
1:48
julia> indices(th, :V, 1)
1:24
julia> indices(th, :V, 2)
25:48
Raviart–Thomas
Another implemented example of a mixed spline space is the RaviartThomas
space, which constructs a structure preserving (divergence conforming) pair of spline spaces for velocities and pressure.
julia> rt = RaviartThomas(2, Δ)
SuiteSplines.SpecialSpaces.RaviartThomas{2, 3, Float64} with fields (:V, :Q)
julia> dimension(rt)
53
julia> dimension(rt, :Q)
15
julia> dimension(rt, :V)
38
julia> dimension(rt, :V, 1)
20
julia> dimension(rt, :V, 2)
18
julia> indices(rt, :Q)
39:53
julia> indices(rt, :V)
1:38
julia> indices(rt, :V, 1)
1:20
julia> indices(rt, :V, 2)
21:38
Both examples are implemented for dimensions two and three and arbitrary degrees.
Iterable mixed spline space
If a custom struct defining a mixed spline space is not desired, SpecialSpaces.jl
implements an iterable mixed spline space for general use. IterableMixedSplineSpace
can be constructed from a named tuple of scalar and vector spline spaces.
julia> V = VectorSplineSpace(2, Δ)
SuiteSplines.SpecialSpaces.VectorSplineSpace{2, 2, Float64} with 2 components
julia> Q = ScalarSplineSpace(1, Δ)
SuiteSplines.CartesianProducts.TensorProduct{2, SuiteSplines.UnivariateSplines.SplineSpace{Float64}}((SplineSpace(degree = 1, interval = [0.0, 2.0], dimension = 3), SplineSpace(degree = 1, interval = [0.0, 4.0], dimension = 5)))
julia> ith = IterableMixedSplineSpace((V=V, Q=Q))
SuiteSplines.SpecialSpaces.IterableMixedSplineSpace{2, 3, Float64} with fields (:V, :Q)
julia> dimension(ith, :Q)
15
julia> dimension(ith, :V)
48
The example above reproduces the Taylor–Hood mixed spline space.
In addition to the usual interface for mixed spaces, it is also possible to iterate over the spaces collected in the iterable mixed spline space,
julia> map(dimension, ith)
2-element Vector{Int64}: 48 15
Mappings
SpecialSpaces.jl
implements convenient constructors for fields and geometric mappings defined on special spaces introduced above. For example,
julia> ϕʰ = GeometricMapping(Ω, S);
julia> t = Field(V);
julia> uʰ = GeometricMapping(Ω, rt, :V);
julia> pʰ = GeometricMapping(Ω, rt, :Q);
Now, given a solution vector x
from some computation with the Raviart–Thomas space, we can set the coefficients of the geometric mappings uʰ
and pʰ
as follows
julia> x = rand(dimension(rt));
julia> setcoeffs!(uʰ, rt, :V, x);
julia> setcoeffs!(pʰ, rt, :Q, x);
We can also obtain vertically concatenated coefficients of fields and geometric mappings,
julia> getcoeffs(uʰ) == x[indices(rt, :V)]
true
julia> getcoeffs(pʰ) == x[indices(rt, :Q)]
true
The interface for scalar and vector spaces is identical but without the field symbol.
Constraints
Recall that space constraints on univariate SplineSpace
are enforced by extraction operators,
julia> space = SplineSpace(4, IncreasingRange(0.0, π, 5); cleft=[1,2])
SplineSpace(degree = 4, interval = [0.0, 3.141592653589793], dimension = 6)
julia> space.C # extraction operator
8×6 SparseArrays.SparseMatrixCSC{Float64, Int64} with 6 stored entries: ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 1.0 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 1.0 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 1.0 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 1.0 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 1.0 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 1.0
Naturally, space constraints on tensor-product spaces can be enforced by Kronecker product extraction operators. To avoid tedious work on the level of univariate spline spaces, i.e. defining univariate spline spaces with the arguments cleft
, cright
, cperiodic
, SpecialSpaces.jl
implements containers for collecting constraints on scalar, vector and mixed spline spaces. Upon passing these collections to respective space constructors, the contraints are distributed down to the univariate spaces.
Scalar spline space constraints
On the lowest abstraction level, there are three rather self-explanatory methods:
These methods operate on scalar constraint containers and push constraint conditions for a univariate spline space in dimension dim
to the container.
The following is equivalent to setting cleft=[1]
argument on the spline space in the first dimension of the tensor-product space.
julia> C = ScalarSplineSpaceConstraints{2}()
SuiteSplines.SpecialSpaces.ScalarSplineSpaceConstraints{2, Int8}
julia> left_constraint!(C; dim=1) # or left_constraint!(S; c=[1,], dim=1)
SuiteSplines.SpecialSpaces.ScalarSplineSpaceConstraints{2, Int8}
This constraint container with dimension two can be then applied while constructing a tensor-product space of dimension two. Let us reuse the existing scalar spline space S
and construct a scalar spline space with constraint conditions defined in C
julia> S
SuiteSplines.CartesianProducts.TensorProduct{2, SuiteSplines.UnivariateSplines.SplineSpace{Float64}}((SplineSpace(degree = 2, interval = [0.0, 2.0], dimension = 4), SplineSpace(degree = 2, interval = [0.0, 4.0], dimension = 6)))
julia> S[1].C
4×4 SparseArrays.SparseMatrixCSC{Float64, Int64} with 4 stored entries: 1.0 ⋅ ⋅ ⋅ ⋅ 1.0 ⋅ ⋅ ⋅ ⋅ 1.0 ⋅ ⋅ ⋅ ⋅ 1.0
julia> S = ScalarSplineSpace(S, C)
SuiteSplines.CartesianProducts.TensorProduct{2, SuiteSplines.UnivariateSplines.SplineSpace{Float64}}((SplineSpace(degree = 2, interval = [0.0, 2.0], dimension = 3), SplineSpace(degree = 2, interval = [0.0, 4.0], dimension = 6)))
julia> S[1].C
4×3 SparseArrays.SparseMatrixCSC{Float64, Int64} with 3 stored entries: ⋅ ⋅ ⋅ 1.0 ⋅ ⋅ ⋅ 1.0 ⋅ ⋅ ⋅ 1.0
Vector spline space constraints
Existing spaces can be used to construct suitable (empty) constraint containers. For example, to construct a constraints container for the vector spline space V
we can write
julia> C = VectorSplineSpaceConstraints(V)
SuiteSplines.SpecialSpaces.VectorSplineSpaceConstraints{2, 2, Int8}
VectorSplineSpaceConstraints
is just a collection of ScalarSplineSpaceConstraints
so that left_constraint!
, right_constraint!
and periodic_constraint!
can be applied to each element of this container.
julia> left_constraint!(C[1]; dim=1)
SuiteSplines.SpecialSpaces.ScalarSplineSpaceConstraints{2, Int8}
julia> V[1]
SuiteSplines.CartesianProducts.TensorProduct{2, SuiteSplines.UnivariateSplines.SplineSpace{Float64}}((SplineSpace(degree = 2, interval = [0.0, 2.0], dimension = 4), SplineSpace(degree = 2, interval = [0.0, 4.0], dimension = 6)))
julia> V = VectorSplineSpace(V, C);
julia> V[1]
SuiteSplines.CartesianProducts.TensorProduct{2, SuiteSplines.UnivariateSplines.SplineSpace{Float64}}((SplineSpace(degree = 2, interval = [0.0, 2.0], dimension = 3), SplineSpace(degree = 2, interval = [0.0, 4.0], dimension = 6)))
Mixed spline space constraints
MixedSplineSpaceConstraints
is just a type alias for a named tuple.
julia> C = MixedSplineSpaceConstraints((V=VectorSplineSpaceConstraints(rt.V), Q=ScalarSplineSpaceConstraints(rt.Q)))
(V = SuiteSplines.SpecialSpaces.VectorSplineSpaceConstraints{2, 2, Int8}, Q = SuiteSplines.SpecialSpaces.ScalarSplineSpaceConstraints{2, Int8})
julia> C.V
SuiteSplines.SpecialSpaces.VectorSplineSpaceConstraints{2, 2, Int8}
julia> C.Q
SuiteSplines.SpecialSpaces.ScalarSplineSpaceConstraints{2, Int8}
Clamped constraints
For convenience, SuiteSplines.jl
provides clamped_constraint!
for scalar and vector spline spaces which can be set on edges/faces of the domain. For example,
julia> C = VectorSplineSpaceConstraints(V)
SuiteSplines.SpecialSpaces.VectorSplineSpaceConstraints{2, 2, Int8}
julia> clamped_constraint!(C, :top)
This is equivalent to setting left_constraint!
with the arguments (c=[1], dim=2)
in each dimension of the vector space. It is also possible to clamp multiple edges in a subset of dimensions,
julia> C = VectorSplineSpaceConstraints{3}()
SuiteSplines.SpecialSpaces.VectorSplineSpaceConstraints{3, 3, Int8}
julia> clamped_constraint!(C, :left, :right, :bottom, :top, :back, :front; dim=[1,3])
In this case, the scalar spline spaces in dimensions 1 and 3 are clamped on the whole boundary of the domain. No constraints are applied in dimension 2.
Clamping for scalar spline spaces works the same way. Valid boundary labels are: :left
, :right
, :bottom
, :top
, :back
, :front
, where the last two are only valid in three dimensions.
SuiteSplines follows a simple convention for numbering boundaries of Cartesian product domains: boundaries are numbered dimension by dimension by assigning ever increasing integers first to the beginning then to the end of the interval in a particular dimension. The labels :left → :right
, :bottom → :top
, :back → :front
are directed always in the direction of the axes. See boundary_number
for more details.
Extraction operators
To obtain the Kronecker product extraction operator of a scalar spline space use
julia> extraction_operator(S)
24×18 SuiteSplines.KroneckerProducts.KroneckerProduct{Float64, 2, 2, Tuple{SparseArrays.SparseMatrixCSC{Float64, Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}}}: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 … 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 … 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ⋮ ⋮ ⋱ ⋮ 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 … 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 … 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0
julia> extraction_operator(S; sparse=true)
24×18 SparseArrays.SparseMatrixCSC{Float64, Int64} with 18 stored entries: ⎡⠢⡀⠀⠀⠀⠀⠀⠀⠀⎤ ⎢⠀⠐⢄⠀⠀⠀⠀⠀⠀⎥ ⎢⠀⠀⠀⠢⡀⠀⠀⠀⠀⎥ ⎢⠀⠀⠀⠀⠐⢄⠀⠀⠀⎥ ⎢⠀⠀⠀⠀⠀⠀⠢⡀⠀⎥ ⎣⠀⠀⠀⠀⠀⠀⠀⠐⢄⎦
The parameter sparse
can be used if we wish to obtain the Kronecker product extraction operator as a sparse matrix.
To obtain the Kronecker product extraction operator of a vector spline space use
julia> extraction_operator.(V)
2-element Vector{SuiteSplines.KroneckerProducts.KroneckerProduct{Float64, 2, 2, Tuple{SparseArrays.SparseMatrixCSC{Float64, Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}}}}: [0.0 0.0 … 0.0 0.0; 1.0 0.0 … 0.0 0.0; … ; 0.0 0.0 … 1.0 0.0; 0.0 0.0 … 0.0 1.0] [1.0 0.0 … 0.0 0.0; 0.0 1.0 … 0.0 0.0; … ; 0.0 0.0 … 1.0 0.0; 0.0 0.0 … 0.0 1.0]
julia> extraction_operator.(V; sparse=true)
2-element Vector{SparseArrays.SparseMatrixCSC{Float64, Int64}}: sparse([2, 3, 4, 6, 7, 8, 10, 11, 12, 14, 15, 16, 18, 19, 20, 22, 23, 24], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18], [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], 24, 18) sparse([1, 2, 3, 4, 5, 6, 7, 8, 9, 10 … 15, 16, 17, 18, 19, 20, 21, 22, 23, 24], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10 … 15, 16, 17, 18, 19, 20, 21, 22, 23, 24], [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 … 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], 24, 24)
or
julia> extraction_operators(V)
([0.0 0.0 … 0.0 0.0; 1.0 0.0 … 0.0 0.0; … ; 0.0 0.0 … 1.0 0.0; 0.0 0.0 … 0.0 1.0], [1.0 0.0 … 0.0 0.0; 0.0 1.0 … 0.0 0.0; … ; 0.0 0.0 … 1.0 0.0; 0.0 0.0 … 0.0 1.0])
julia> extraction_operators(V; sparse=true)
(sparse([2, 3, 4, 6, 7, 8, 10, 11, 12, 14, 15, 16, 18, 19, 20, 22, 23, 24], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18], [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], 24, 18), sparse([1, 2, 3, 4, 5, 6, 7, 8, 9, 10 … 15, 16, 17, 18, 19, 20, 21, 22, 23, 24], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10 … 15, 16, 17, 18, 19, 20, 21, 22, 23, 24], [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 … 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], 24, 24))
Note, that the extraction operator is not stored in the constraints containers!
API
Base.eltype
— MethodBase.eltype(::Type{S}) where {Dim,T<:Integer,S<:VectorSplineSpaceConstraints{Dim,<:Any,T}}
Return element type of VectorSplineSpaceConstraints
collection.
Base.eltype
— MethodBase.eltype(::Type{S}) where {T<:Integer,S<:ScalarSplineSpaceConstraints{<:Any,T}}
Return element type of ScalarSplineSpaceConstraints
collection.
Base.getindex
— MethodBase.getindex(V::S, i::Int64) where {S<:VectorFunctionSpace}
Return i
th vector function space component.
Base.getindex
— MethodBase.getindex(C::ScalarSplineSpaceConstraints, i::T) where {T<:Integer}
Return i
th component constraints in a ScalarSplineSpaceConstraints
Base.getindex
— MethodBase.getindex(C::ScalarSplineSpaceConstraints, i::T) where {T<:Integer}
Return i
th component constraints in a VectorSplineSpaceConstraints
Base.iterate
— MethodBase.iterate(C::ScalarSplineSpaceConstraints)
Base.iterate(C::ScalarSplineSpaceConstraints, i::T) where {T<:Integer} = iterate(C.data, i)
Iterate of the collection of UnivariateSplineSpaceConstraints
stored in ScalarSplineSpaceConstraints
.
Base.iterate
— MethodBase.iterate(C::VectorSplineSpaceConstraints)
Base.iterate(C::VectorSplineSpaceConstraints, i::T) where {T<:Integer} = iterate(C.data, i)
Iterate of the collection of ScalarSplineSpaceConstraints
stored in VectorSplineSpaceConstraints
.
Base.iterate
— MethodBase.iterate(V::S) where {S<:VectorFunctionSpace} = iterate(parent(V))
Base.iterate(V::S, i::Int) where {S<:VectorFunctionSpace} = iterate(parent(V), i)
Iterate over vector function space components.
Base.length
— MethodBase.length(V::S) where {S<:VectorFunctionSpace}
Return the number of vector function space components.
Base.length
— MethodBase.length(C::ScalarSplineSpaceConstraints{Dim}) where {Dim}
Return number of dimensions Dim
.
Base.length
— MethodBase.length(C::VectorSplineSpaceConstraints{<:Any,Codim}) where {Codim}
Return number of dimensions Dim
.
SuiteSplines.IgaBase.dimension
— Methoddimensions(V::ScalarSplineSpace)
Return the dimension of a ScalarSplineSpace
.
SuiteSplines.IgaBase.dimension
— MethodIgaBase.dimension(V::T) where {T<:MixedFunctionSpace}
Return the dimension of a mixed function space.
SuiteSplines.IgaBase.dimension
— MethodIgaBase.dimension(V::T) where {T<:VectorFunctionSpace}
Return the dimension of a vector function space.
SuiteSplines.IgaBase.dimension
— MethodIgaBase.dimension(V::T, k::Int) where {T<:VectorFunctionSpace}
Return the dimension of the i
th component of a vector function space.
SuiteSplines.IgaBase.dimension
— MethodIgaBase.dimension(V::T, field::Symbol, i::Int64) where {T<:MixedFunctionSpace}
Return the dimension of the i
th component of a vector function space field
in a mixed space V
.
SuiteSplines.IgaBase.dimension
— MethodIgaBase.dimension(V::T, field::Symbol) where {T<:MixedFunctionSpace}
Return the dimension of a scalar function space field
in a mixed space V
.
SuiteSplines.IgaBase.numbertype
— MethodIgaBase.numbertype(::FunctionSpace{<:Any,<:Any,T}) where {T}
Return the data type used by a function space to represent numbers.
SuiteSplines.IgaBase.numbertype
— MethodIgaBase.numbertype(::MixedFunctionSpace{<:Any,T}) where {T}
Return the data type for numbers used in space.
SuiteSplines.SpecialSpaces.boundary_number
— Methodboundary_number(s::Symbol)
Return the boundary number corresponding to boundary s
.
5
4 back
top . . . . . . .
. . . . . . . . . . . .
η . . . . . .
. . . . . . . . . . .
. left . . right . . . .
. 1 . . 2 . . . .
· · · · ξ . . . . . . . . . .
· . . . . . . . . . . . .
· bottom . . . .
ζ 3 . . . . . . .
front
6
SuiteSplines.SpecialSpaces.boundary_symbol
— Methodboundary_symbol(s::Int)
Return the boundary label (symbol) for boundary number s
.
SuiteSplines.SpecialSpaces.clamped_constraint!
— Methodclamped_constraint!(C::ScalarSplineSpaceConstraints, side::Vararg{Symbol,N}) where {N}
Clamp a scalar spline space at side
, where side
is one of the boundary labels:
:left
:right
:bottom
:top
:back
:front
SuiteSplines.SpecialSpaces.clamped_constraint!
— Methodclamped_constraint!(C::VectorSplineSpaceConstraints{Dim}, side::Vararg{Symbol,N}; dim=1:Dim) where {Dim,N}
Clamp a vector spline space in dimensions dim
at side
, where side
is one of the boundary labels:
:left
:right
:bottom
:top
:back
:front
SuiteSplines.SpecialSpaces.codimfunspace
— Methodcodimfunspace(::FunctionSpace{<:Any,Codim})
Return codomain dimension of function space
SuiteSplines.SpecialSpaces.dimensions
— Methoddimensions(V::ScalarSplineSpace)
Return the dimension of a ScalarSplineSpace
in each tensor-product direction as a tuple.
SuiteSplines.SpecialSpaces.dimensions
— Methoddimensions(V::T) where {T<:MixedFunctionSpace}
Return the dimension in each tensor-product direction of a mixed function space as a tuple.
SuiteSplines.SpecialSpaces.dimensions
— Methoddimensions(V::T) where {T<:VectorFunctionSpace}
Return the dimension in each tensor-product direction of a vector function space as a tuple.
SuiteSplines.SpecialSpaces.dimensions
— Methoddimensions(V::T, i::Int64) where {T<:VectorFunctionSpace}
Return the dimension in each tensor-product direction of the i
th component of a vector function space as a tuple.
SuiteSplines.SpecialSpaces.dimensions
— Methoddimensions(V::T, field::Symbol, i::Int64) where {T<:MixedFunctionSpace}
Return the dimension in each tensor-product direction of the i
th component of a vector function space field
in the mixed space V
as a tuple.
SuiteSplines.SpecialSpaces.dimensions
— Methoddimensions(V::T, field::Symbol, i::Int64) where {T<:MixedFunctionSpace}
Return the dimension in each tensor-product direction of the vector function space field
in the mixed space V
as a tuple.
SuiteSplines.SpecialSpaces.dimfunspace
— Methoddimfunspace(::FunctionSpace{Dim}) where {Dim}
Return domain dimension of function space.
SuiteSplines.SpecialSpaces.extraction_operator
— Methodextraction_operator(S::ScalarSplineSpace; sparse::Bool=false)
Return the extraction operator for a scalar function space.
If sparse
is true
, return a sparse matrix.
SuiteSplines.SpecialSpaces.extraction_operator
— Methodextraction_operator(S::T, field::Symbol; sparse::Bool=false) where {T<:MixedFunctionSpace}
Return the extraction operator for a scalar function space field
in mixed function space S
.
If sparse
is true
, return a sparse matrix.
SuiteSplines.SpecialSpaces.extraction_operators
— Methodextraction_operators(S::T; sparse::Bool=false) where {T<:VectorFunctionSpace}
Return the extraction operator for a vector function space.
If sparse
is true
, return a tuple of sparse matrices.
SuiteSplines.SpecialSpaces.extraction_operators
— Methodextraction_operators(S::T, field::Symbol; sparse::Bool=false) where {T<:MixedFunctionSpace}
Return the extraction operators for a vector function space field
in mixed function space S
in a tuple.
If sparse
is true
, return a tuple of sparse matrices.
SuiteSplines.SpecialSpaces.getcoeffs
— Methodgetcoeffs(f::Field)
getcoeffs(f::GeometricMapping)
Return a vector of vertically concatenated (tensor-product Bspline) mapping coefficients.
SuiteSplines.SpecialSpaces.indices
— Methodindices(V::ScalarSplineSpace)
Return linear indices for a scalar function space.
SuiteSplines.SpecialSpaces.indices
— Methodindices(space::S) where {S<:MixedFunctionSpace}
Return linear indices for a mixed function space.
SuiteSplines.SpecialSpaces.indices
— Methodindices(space::S) where {S<:VectorFunctionSpace}
Return linear indices for a vector function space.
SuiteSplines.SpecialSpaces.indices
— Methodindices(space::S, i::Int) where {S<:VectorFunctionSpace}
Return linear indices for i
th component of a vector function space.
SuiteSplines.SpecialSpaces.indices
— Methodindices(space::S, field::Symbol, i::Int) where {S<:MixedFunctionSpace}
Return linear indices for i
th component of a vector function space field
in mixed function space space
.
SuiteSplines.SpecialSpaces.indices
— Methodindices(space::S, field::Symbol) where {S<:MixedFunctionSpace}
Return linear indices for a function space field
in mixed function space space
.
SuiteSplines.SpecialSpaces.left_constraint!
— Methodleft_constraint!(C::ScalarSplineSpaceConstraints{Dim}; c::Vector{Int}=Int[1], dim::Int) where {Dim}
Push c
to vector in left
field of UnivariateSplineSpaceConstraints
stored at index dim
in ScalarSplineSpaceConstraints
.
SuiteSplines.SpecialSpaces.periodic_constraint!
— Methodperiodic_constraint!(C::ScalarSplineSpaceConstraints{Dim}; c::Vector{Int}, dim::Int) where {Dim}
Push c
to vector in periodic
field of UnivariateSplineSpaceConstraints
stored at index dim
in ScalarSplineSpaceConstraints
.
SuiteSplines.SpecialSpaces.right_constraint!
— Methodright_constraint!(C::ScalarSplineSpaceConstraints{Dim}; c::Vector{Int}=Int[1], dim::Int) where {Dim}
Push c
to vector in right
field of UnivariateSplineSpaceConstraints
stored at index dim
in ScalarSplineSpaceConstraints
.
SuiteSplines.SpecialSpaces.setcoeffs!
— Methodsetcoeffs!(f::M, v::Vector{T}, k::Int=1, slice::Base.UnitRange{Int}=Base.UnitRange(1,length(v))) where {M<:AbstractMapping,T<:Real}
Set coefficients of a mapping component to a slice of coefficients in a vector.
Arguments:
f
: mapping in questionv
: vector with coeffsslice
: range of indices of vectorv
k
: component of fieldf
SuiteSplines.SpecialSpaces.setcoeffs!
— Methodsetcoeffs!(f::M, mixedspace::S, field::Symbol, v::Vector{T}) where {M<:AbstractMapping,S<:MixedSplineSpace,T<:Real}
Set coefficients of a mapping defined on a mixedspace.
Arguments:
f
: mapping in questionmixedspace
: spacefield
: space fieldv
: vector with coeffs with lengthdim(mixedspace)
SuiteSplines.SpecialSpaces.setcoeffs!
— Methodsetcoeffs!(f::M, scalarspace::S, v::Vector{T}) where {M<:AbstractMapping,S<:ScalarSplineSpace,T<:Real}
Set coefficients of a mapping defined on a scalar space.
Arguments:
f
: mapping in questionscalarspace
: spacev
: vector with coeffs with lengthdim(scalarspace)
SuiteSplines.SpecialSpaces.setcoeffs!
— Methodsetcoeffs!(f::M, vectorspace::S, v::Vector{T}) where {M<:AbstractMapping,S<:VectorSplineSpace,T<:Real}
Set coefficients of a mapping defined on a vector space.
Arguments:
f
: mapping in questionvectorspace
: spacev
: vector with coeffs with lengthdim(vectorspace)
SuiteSplines.AbstractMappings.Field
— MethodField(space::S) where {S<:ScalarSplineSpace}
Field(space::S) where {S<:VectorSplineSpace}
Field(space::S, s::Symbol) where {S<:MixedSplineSpace}
Construct field on some spline spaces.
SuiteSplines.AbstractMappings.GeometricMapping
— MethodAbstractMappings.GeometricMapping(domain, args::ScalarScalarSpace; orientation::Int=1)
AbstractMappings.GeometricMapping(domain, args::VectorSplineSpace; orientation::Int=1)
AbstractMappings.GeometricMapping(domain, args::MixedSplineSpace, field::Symbol; orientation::Int=1)
Construct geometric mapping on some spline spaces.
SuiteSplines.SpecialSpaces.Domain
— Typeconst Domain{Dim,T} = CartesianProduct{Dim,Tuple{Vararg{T,Dim}},Tuple{Vararg{Interval{T},Dim}}}
Alias for CartesianProduct
of Interval
defining a domain.
SuiteSplines.SpecialSpaces.FunctionSpace
— Typeabstract type FunctionSpace{Dim,Codim,T}
Concrete function spaces subtype this.
Parameters
Dim
: dimension of the domainCodim
: dimension of the codomainT
: data type used for numbers (returned byIgaBase.numbertype
)
SuiteSplines.SpecialSpaces.IterableMixedSplineSpace
— Typestruct IterableMixedSplineSpace{Dim,Codim,T} <: MixedSplineSpace{Dim,Codim,T}
A general purpose mixed spline space, which can be constructed from a named tuple consisting of scalar and vector spline spaces. Besides the usual interface to mixed function spaces, it additionally supports iteration over the collection of spaces.
The supplied spaces must have the same domain dimension, partition and number type.
SuiteSplines.SpecialSpaces.MixedFunctionSpace
— Typeabstract type MixedFunctionSpace{Dim,T}
Mixed spaces like MixedSplineSpace
subtype this.
Mixed function spaces are expected to collect components as struct
fields.
SuiteSplines.SpecialSpaces.MixedSplineSpace
— Typeabstract type MixedSplineSpace{Dim,Codim,T} <: MixedFunctionSpace{Dim,Codim,T}
Concrete mixed spaces like RaviartThomas
subtype this.
SuiteSplines.SpecialSpaces.MixedSplineSpaceConstraints
— Typeconst MixedSplineSpaceConstraints
Type alias for NamedTuple
which serves as a container for mixed space constraints.
SuiteSplines.SpecialSpaces.MixedSplineSpaceConstraints
— MethodMixedSplineSpaceConstraints(S::RaviartThomas{Dim}) where {Dim}
Construct a constraints container for TaylorHood
.
SuiteSplines.SpecialSpaces.MixedSplineSpaceConstraints
— MethodMixedSplineSpaceConstraints(S::RaviartThomas{Dim}) where {Dim}
Construct a constraints container for RaviartThomas
.
SuiteSplines.SpecialSpaces.Partition
— Typeconst Partition{Dim,T} = CartesianProduct{Dim,Tuple{Vararg{T,Dim}},Tuple{Vararg{IncreasingRange{T},Dim}}}
Alias for CartesianProduct
defining a partition.
SuiteSplines.SpecialSpaces.Partition
— MethodPartition(S::ScalarSplineSpace)
Return the partition corresponding to a ScalarSplineSpace
.
SuiteSplines.SpecialSpaces.Partition
— MethodPartition(space::MixedSplineSpace)
Return the partition corresponding to a MixedSplineSpace
.
SuiteSplines.SpecialSpaces.Partition
— MethodPartition(S::VectorSplineSpace)
Return the partition corresponding to a VectorSplineSpace
.
SuiteSplines.SpecialSpaces.Partition
— MethodPartition(domain::S, n::NTuple{Dim, Int64}) where {Dim,T<:Real,S<:Domain{Dim,T}}
Return an uniform Partition
of Domain
with nₖ
breakpoints in k
th dimension.
SuiteSplines.SpecialSpaces.RaviartThomas
— Typestruct RaviartThomas{Dim,Codim,T} <: MixedSplineSpace{Dim,Codim,T}
Structure preserving pair of spline spaces for velocities and pressure in two and three dimensions.
SuiteSplines.SpecialSpaces.RaviartThomas
— MethodRaviartThomas(p::Degree, Δ::Partition{Dim,T}) where {Dim,T<:Real}
RaviartThomas(p::Degree, Δ::Partition{2,T}, C::MixedSplineSpaceConstraints{(:V,:Q)})
RaviartThomas(p::Degree, Δ::Partition{3,T}, C::MixedSplineSpaceConstraints{(:V,:Q)}) where {T<:Real}
Construct a RaviartThomas
mixed spline space.
SuiteSplines.SpecialSpaces.ScalarSplineSpace
— TypeType alias for a tensor-product SplineSpace
.
SuiteSplines.SpecialSpaces.ScalarSplineSpace
— MethodScalarSplineSpace(S::ScalarSplineSpace{Dim,T}) where {Dim,T<:Real}
ScalarSplineSpace(p::Degree, partition::Partition{Dim,T}) where {Dim,T<:Real}
ScalarSplineSpace(degrees::NTuple{Dim,Degree}, partition::Partition{Dim,T}) where {Dim,T<:Real}
ScalarSplineSpace(degrees::NTuple{Dim,Degree}, partition::Partition{Dim,T}, C::ScalarSplineSpaceConstraints{Dim}) where {Dim,T<:Real}
ScalarSplineSpace(S::ScalarSplineSpace{Dim,T}, C::ScalarSplineSpaceConstraints{Dim}) where {Dim,T<:Real}
Construct a ScalarSplineSpace
.
If constructed from another ScalarSplineSpace
, discard constraint conditions.
SuiteSplines.SpecialSpaces.ScalarSplineSpaceConstraints
— Typestruct ScalarSplineSpaceConstraints{Dim,T}
Container for ScalarSplineSpace
constraints.
Field data
stores a tuple of UnivariateSplineSpaceConstraints
for each tensor-product dimension of ScalarSplineSpace
.
SuiteSplines.SpecialSpaces.ScalarSplineSpaceConstraints
— MethodScalarSplineSpaceConstraints(::F) where {Dim,F<:ScalarSplineSpace{Dim}}
Construct a constraints container for a ScalarSplineSpace
.
SuiteSplines.SpecialSpaces.ScalarSplineSpaceConstraints
— MethodScalarSplineSpaceConstraints{Dim}() where {Dim}
ScalarSplineSpaceConstraints{Dim,T}() where {Dim,T<:Integer}
Construct default ScalarSplineSpaceConstraints
for a ScalarSplineSpace
of dimension Dim
.
SuiteSplines.SpecialSpaces.SplineSpaceConstraints
— Typeabstract type SplineSpaceConstraints{T}
Concrete spline space constraints container subtype this.
SuiteSplines.SpecialSpaces.TaylorHood
— Typestruct TaylorHood{Dim,T} <: MixedSplineSpace{Dim,T}
An inf-sup stable pair of spline spaces for velocities and pressure in two and three dimensions.
SuiteSplines.SpecialSpaces.TaylorHood
— MethodTaylorHood(p::Degree, Δ::Partition{Dim,T}) where {Dim,T<:Real}
TaylorHood(p::Degree, Δ::Partition{Dim,T}, C::MixedSplineSpaceConstraints{(:V,:Q)}) where {Dim,T<:Real}
Construct a TaylorHood
mixed spline space.
SuiteSplines.SpecialSpaces.UnivariateSplineSpaceConstraints
— Typestruct UnivariateSplineSpaceConstraints{T}
Container for SplineSpace
constraints, i.e. cleft
, cright
, cperiodic
vectors in SplineSpace
constructor stored as left
, right
and periodic
field.
SuiteSplines.SpecialSpaces.UnivariateSplineSpaceConstraints
— MethodUnivariateSplineSpaceConstraints()
Construct default UnivariateSplineSpaceConstraints
SuiteSplines.SpecialSpaces.VectorFunctionSpace
— Typeabstract type VectorFunctionSpace{Dim,T}
Concrete vector spaces like VectorSplineSpace
subtype this.
Vector function spaces are expected to collect components as a tuple in field :V
.
SuiteSplines.SpecialSpaces.VectorSplineSpace
— MethodVectorSplineSpace(degree::Degree, partition::Partition{Dim,T}) where {Dim,T<:Real}
VectorSplineSpace(degrees::NTuple{Dim,Degree}, partition::Partition{Dim,T}) where {Dim,T<:Real}
VectorSplineSpace(V::VectorSplineSpace{Dim,Codim,T}, C::VectorSplineSpaceConstraints{Dim,Codim}) where {Dim,Codim,T<:Real}
VectorSplineSpace(S::ScalarSplineSpace{Dim,T}) where {Dim,T<:Real}
VectorSplineSpace(V::NTuple{Codim,ScalarSplineSpace{Dim,T}}) where {Dim,Codim,T}
VectorSplineSpace(V::Vararg{ScalarSplineSpace{Dim,T},Codim}) where {Dim,Codim,T}
Construct a VectorSplineSpace
.
Constraints on scalar spline space arguments are preserved.
SuiteSplines.SpecialSpaces.VectorSplineSpaceConstraints
— Typestruct ScalarSplineSpaceConstraints{Dim,T}
Container for ScalarSplineSpaceConstraints
.
Field data
stores a tuple of ScalarSplineSpaceConstraints
for each component of VectorSplineSpace
.
SuiteSplines.SpecialSpaces.VectorSplineSpaceConstraints
— MethodVectorSplineSpaceConstraints(::F) where {Dim,Codim,F<:VectorSplineSpace{Dim,Codim}}
Construct a constraints container for a VectorSplineSpace
.
SuiteSplines.SpecialSpaces.VectorSplineSpaceConstraints
— MethodVectorSplineSpaceConstraints{Dim}() where {Dim}
VectorSplineSpaceConstraints{Dim,Codim}() where {Dim,Codim}
VectorSplineSpaceConstraints(args::Vararg{ScalarSplineSpaceConstraints{Dim},Codim}) where {Dim,Codim}
VectorSplineSpaceConstraints{T}(args::Vararg{ScalarSplineSpaceConstraints{Dim},Codim}) where {Dim,Codim,T}
VectorSplineSpaceConstraints{Dim,Codim,T}() where {Dim,Codim,T<:Integer}
Construct VectorSplineSpaceConstraints
for a VectorSplineSpace
of dimension Dim
and codomain dimension Codim
.