Skip to content

Commit

Permalink
Remove the unused and deprecated third parameter for interpolations
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre committed Sep 30, 2024
1 parent ffab3f0 commit 257c564
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 70 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Removed
- The deprecated third type parameter for interpolations have been removed. Old code which
tries to use three parameters will now throw the somewhat cryptic error:
```
julia> Lagrange{2, RefCube, 1}()
ERROR: too many parameters for type
```
([#1083])

## [v1.0.0] - 2024-09-30

Ferrite version 1.0 is a relatively large release, with a lot of new features, improvements,
Expand Down Expand Up @@ -1015,3 +1026,4 @@ poking into Ferrite internals:
[#974]: https://github.com/Ferrite-FEM/Ferrite.jl/issues/974
[#1058]: https://github.com/Ferrite-FEM/Ferrite.jl/issues/1058
[#1059]: https://github.com/Ferrite-FEM/Ferrite.jl/issues/1059
[#1083]: https://github.com/Ferrite-FEM/Ferrite.jl/issues/1083
39 changes: 0 additions & 39 deletions src/deprecations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -231,31 +231,6 @@ end
struct RefCube end
export RefCube

function Lagrange{D, RefCube, O}() where {D, O}
shape = D == 1 ? RefLine : D == 2 ? RefQuadrilateral : RefHexahedron
throw(DeprecationError("Lagrange{$D, RefCube, $O}()" => "Lagrange{$(shape), $O}()"))
end
function Lagrange{2, RefTetrahedron, O}() where {O}
throw(DeprecationError("Lagrange{2, RefTetrahedron, $O}()" => "Lagrange{RefTriangle, $O}()"))
end
function DiscontinuousLagrange{D, RefCube, O}() where {D, O}
shape = D == 1 ? RefLine : D == 2 ? RefQuadrilateral : RefHexahedron
throw(DeprecationError("DiscontinuousLagrange{$D, RefCube, $O}()" => "DiscontinuousLagrange{$(shape), $O}()"))
end
function BubbleEnrichedLagrange{2, RefTetrahedron, O}() where {O}
throw(DeprecationError("BubbleEnrichedLagrange{2, RefTetrahedron, $O}()" => "BubbleEnrichedLagrange{RefTriangle, $O}()"))
end
function DiscontinuousLagrange{2, RefTetrahedron, O}() where {O}
throw(DeprecationError("DiscontinuousLagrange{2, RefTetrahedron, $O}()" => "DiscontinuousLagrange{RefTriangle, $O}()"))
end
function Serendipity{D, RefCube, O}() where {D, O}
shape = D == 1 ? RefLine : D == 2 ? RefQuadrilateral : RefHexahedron
throw(DeprecationError("Serendipity{$D, RefCube, $O}()" => "Serendipity{$(shape), $O}()"))
end
function CrouzeixRaviart{2, 1}()
throw(DeprecationError("CrouzeixRaviart{2, 1}()" => "CrouzeixRaviart{RefTriangle, 1}()"))
end

# For the quadrature: Some will be wrong for face integration, so then we warn
# in the FaceValue constructor...

Expand Down Expand Up @@ -359,20 +334,6 @@ function FacetValues(
throw(DeprecationError(msg))
end

# Hide the last unused type param...
function Base.show(io::IO, ::DiscontinuousLagrange{shape, order}) where {shape, order}
print(io, "DiscontinuousLagrange{$(shape), $(order)}()")
end
function Base.show(io::IO, ::Lagrange{shape, order}) where {shape, order}
print(io, "Lagrange{$(shape), $(order)}()")
end
function Base.show(io::IO, ::Serendipity{shape, order}) where {shape, order}
print(io, "Serendipity{$(shape), $(order)}()")
end
function Base.show(io::IO, ::CrouzeixRaviart{shape, order}) where {shape, order}
print(io, "CrouzeixRaviart{$(shape), $(order)}()")
end

function value(ip::Interpolation, ξ::Vec)
throw(DeprecationError("value(ip::Interpolation, ξ::Vec)" => "[reference_shape_value(ip, ξ, i) for i in 1:getnbasefunctions(ip)]"))
end
Expand Down
28 changes: 14 additions & 14 deletions src/interpolations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ julia> getnbasefunctions(ip)
6
```
"""
abstract type Interpolation{shape #=<: AbstractRefShape=#, order, unused} end
abstract type Interpolation{shape #=<: AbstractRefShape=#, order} end

const InterpolationByDim{dim} = Interpolation{<:AbstractRefShape{dim}}

abstract type ScalarInterpolation{ refshape, order} <: Interpolation{refshape, order, Nothing} end
abstract type VectorInterpolation{vdim, refshape, order} <: Interpolation{refshape, order, Nothing} end
abstract type ScalarInterpolation{ refshape, order} <: Interpolation{refshape, order} end
abstract type VectorInterpolation{vdim, refshape, order} <: Interpolation{refshape, order} end

# Number of components for the interpolation.
n_components(::ScalarInterpolation) = 1
Expand Down Expand Up @@ -429,9 +429,9 @@ dirichlet_boundarydof_indices(::Type{FacetIndex}) = dirichlet_facetdof_indices
"""
Piecewise discontinuous Lagrange basis via Gauss-Lobatto points.
"""
struct DiscontinuousLagrange{shape, order, unused} <: ScalarInterpolation{shape, order}
struct DiscontinuousLagrange{shape, order} <: ScalarInterpolation{shape, order}
function DiscontinuousLagrange{shape, order}() where {shape <: AbstractRefShape, order}
new{shape, order, Nothing}()
new{shape, order}()
end
end

Expand Down Expand Up @@ -486,9 +486,9 @@ is_discontinuous(::Type{<:DiscontinuousLagrange}) = true
Standard continuous Lagrange polynomials with equidistant node placement.
"""
struct Lagrange{shape, order, unused} <: ScalarInterpolation{shape, order}
struct Lagrange{shape, order} <: ScalarInterpolation{shape, order}
function Lagrange{shape, order}() where {shape <: AbstractRefShape, order}
new{shape, order, Nothing}()
new{shape, order}()
end
end

Expand Down Expand Up @@ -1269,9 +1269,9 @@ end
"""
Lagrange element with bubble stabilization.
"""
struct BubbleEnrichedLagrange{shape, order, unused} <: ScalarInterpolation{shape, order}
struct BubbleEnrichedLagrange{shape, order} <: ScalarInterpolation{shape, order}
function BubbleEnrichedLagrange{shape, order}() where {shape <: AbstractRefShape, order}
new{shape, order, Nothing}()
new{shape, order}()
end
end

Expand Down Expand Up @@ -1312,9 +1312,9 @@ end
Serendipity element on hypercubes. Currently only second order variants are implemented.
"""
struct Serendipity{shape, order, unused} <: ScalarInterpolation{shape,order}
struct Serendipity{shape, order} <: ScalarInterpolation{shape,order}
function Serendipity{shape, order}() where {shape <: AbstractRefShape, order}
new{shape, order, Nothing}()
new{shape, order}()
end
end

Expand Down Expand Up @@ -1459,9 +1459,9 @@ Classical non-conforming Crouzeix–Raviart element.
For details we refer to the original paper [CroRav:1973:cnf](@cite).
"""
struct CrouzeixRaviart{shape, order, unused} <: ScalarInterpolation{shape, order}
CrouzeixRaviart{RefTriangle, 1}() = new{RefTriangle, 1, Nothing}()
CrouzeixRaviart{RefTetrahedron, 1}() = new{RefTetrahedron, 1, Nothing}()
struct CrouzeixRaviart{shape, order} <: ScalarInterpolation{shape, order}
CrouzeixRaviart{RefTriangle, 1}() = new{RefTriangle, 1}()
CrouzeixRaviart{RefTetrahedron, 1}() = new{RefTetrahedron, 1}()
end

# CR elements are characterized by not having vertex dofs
Expand Down
17 changes: 0 additions & 17 deletions test/test_deprecations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,6 @@ end
end

@testset "Deprecation of old RefShapes" begin
# Interpolations
for order in 1:2
@test_throws Ferrite.DeprecationError Lagrange{1, RefCube, order}()
end
for order in 1:5
@test_throws Ferrite.DeprecationError Lagrange{2, RefTetrahedron, order}()
end
for order in 1:2
@test_throws Ferrite.DeprecationError Lagrange{2, RefCube, order}()
end
for order in 1:2
@test_throws Ferrite.DeprecationError Lagrange{3, RefCube, order}()
end
@test_throws Ferrite.DeprecationError Serendipity{2, RefCube, 2}()
@test_throws Ferrite.DeprecationError Serendipity{3, RefCube, 2}()
@test_throws Ferrite.DeprecationError CrouzeixRaviart{2, 1}()
@test_throws Ferrite.DeprecationError BubbleEnrichedLagrange{2, RefTetrahedron, 1}()
# Quadrature/(Cell|Face)Value combinations (sometimes warns in the QR constructor, sometimes it the FEValues constructor)
function test_combo(constructor, qdim, qshape, qargs, ip)
qr = QuadratureRule{qdim, qshape}(qargs...)
Expand Down

0 comments on commit 257c564

Please sign in to comment.