From 90c2491572f9c45170239e65117908b13bd63826 Mon Sep 17 00:00:00 2001 From: Antoine Marteau Date: Mon, 23 Mar 2026 10:55:22 +1100 Subject: [PATCH 1/3] fix SerendipityRefFEs FEEC basis constructor --- src/ReferenceFEs/SerendipityRefFEs.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ReferenceFEs/SerendipityRefFEs.jl b/src/ReferenceFEs/SerendipityRefFEs.jl index 277e9f1c4..32dc7758e 100644 --- a/src/ReferenceFEs/SerendipityRefFEs.jl +++ b/src/ReferenceFEs/SerendipityRefFEs.jl @@ -119,9 +119,8 @@ function compute_monomial_basis(::Type{T},p::SerendipityPolytope{D},orders) wher end function compute_poly_basis(::Type{T},p::SerendipityPolytope{D},orders,poly_type) where {T,D} - FEEC_poly_basis r = iszero(D) ? 0 : first(orders) - FEEC_poly_basis(Val(D),T,r,0,:S,poly_type) # SᵣΛ⁰(□ᴰ) + FEEC_poly_basis(Val(D),T,r,0,:S,poly_type; cart_prod=(T <: MultiValue)) # SᵣΛ⁰(□ᴰ) end function compute_own_nodes(p::SerendipityPolytope{0},orders) From ac3ac62a2d091630ea96c6ac4564dfadc7b550c4 Mon Sep 17 00:00:00 2001 From: Antoine Marteau Date: Wed, 1 Apr 2026 17:26:23 +1100 Subject: [PATCH 2/3] fix eltype of LinearCombinationDofVector e.g. a combination of PointValue cannot be a PointValue --- src/ReferenceFEs/Dofs.jl | 13 ++++++++++--- test/ReferenceFEsTests/DofsTests.jl | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/ReferenceFEs/Dofs.jl b/src/ReferenceFEs/Dofs.jl index 127ad54d5..b5fdab866 100644 --- a/src/ReferenceFEs/Dofs.jl +++ b/src/ReferenceFEs/Dofs.jl @@ -7,6 +7,13 @@ and the range the scalar set. """ abstract type Dof <: Map end +""" + struct LinearCombinationDof <: Dof + +Type to represent an element of a [`LinearCombinationDofVector`](@ref). +""" +struct LinearCombinationDof <: Dof end + """ struct LinearCombinationDofVector{T<:Dof,V,F} <: AbstractVector{T} values :: V @@ -23,7 +30,7 @@ Fields: - `values::AbstractMatrix{<:Number}` the matrix of the change from dof basis (b) to (a) - `predofs::AbstractVector{T}` A type representing dof pre-basis (b), with `T<:Dof` """ -@ahe struct LinearCombinationDofVector{T,V,F} <: AbstractVector{T} +@ahe struct LinearCombinationDofVector{T,V,F} <: AbstractVector{LinearCombinationDof} values::V predofs::F function LinearCombinationDofVector( @@ -46,7 +53,7 @@ end Base.size(a::LinearCombinationDofVector) = (size(a.values,2),) Base.IndexStyle(::LinearCombinationDofVector) = IndexLinear() -Base.getindex(::LinearCombinationDofVector{T},::Integer) where T = T() +Base.getindex(::LinearCombinationDofVector,::Integer) = LinearCombinationDof() function linear_combination(a::AbstractMatrix{<:Number}, b::AbstractVector{<:Dof}) LinearCombinationDofVector(a,b) @@ -104,7 +111,7 @@ function Base.getindex(b::ConcatenatedDofVector, i::Integer) lengths = length.(bases) first_indices = accumulate(+, lengths) basis_index = findfirst(>=(i), first_indices) - first(bases[basis_index]) # this is PointValue() or Moment() whatever i + first(bases[basis_index]) # this is PointValue(..), Moment() or LinearCombinationDof() whatever i end function Arrays.return_cache(b::ConcatenatedDofVector, field) diff --git a/test/ReferenceFEsTests/DofsTests.jl b/test/ReferenceFEsTests/DofsTests.jl index f8e20b498..a32eee8e0 100644 --- a/test/ReferenceFEsTests/DofsTests.jl +++ b/test/ReferenceFEsTests/DofsTests.jl @@ -3,6 +3,7 @@ module DofsTests using Test using Gridap using Gridap.ReferenceFEs +using Gridap.ReferenceFEs: LinearCombinationDof using Gridap.Fields using FillArrays @@ -19,6 +20,7 @@ dofs = get_dof_basis(reffe0) # length 3 dofs_lc = linear_combination(Eye(3,6), dofs) # length 6 @test dofs_lc isa AbstractVector{<:Dof} @test length(dofs_lc) == 6 +@test dofs_lc[1] isa LinearCombinationDof basis = get_prebasis(reffe1) # length 4 @test basis isa AbstractVector{<:Field} From 8bcd9af30784580fc1f058136b8cbcbe92b964c0 Mon Sep 17 00:00:00 2001 From: Antoine Marteau Date: Wed, 1 Apr 2026 17:33:05 +1100 Subject: [PATCH 3/3] update NEWS.md --- NEWS.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS.md b/NEWS.md index a606f988a..3023ccf00 100644 --- a/NEWS.md +++ b/NEWS.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- The element type of a `LinearCombinationDofVector` is now `LinearCombinationDof`, since PR[#1266](https://github.com/gridap/Gridap.jl/pull/1266). + ## [0.20.3] - 2026-03-23 ### Fixed