From 72a5c761e2fd52f4338f89f3f094d08b8895a72c Mon Sep 17 00:00:00 2001 From: Thomas Kemmer Date: Tue, 10 Sep 2024 10:43:21 +0200 Subject: [PATCH] Simplify overly specific methods --- src/base/constants.jl | 2 +- src/base/util.jl | 6 +++--- src/bem/local.jl | 2 +- src/bem/nonlocal.jl | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/base/constants.jl b/src/base/constants.jl index b98f7ab1..bbbd45a2 100644 --- a/src/base/constants.jl +++ b/src/base/constants.jl @@ -137,4 +137,4 @@ Exponent ``1/Λ`` for the fundamental solution of the yukawa operator # Return type `T` """ -@inline yukawa(opt::Option{T}) where T = √(opt.εΣ/opt.ε∞)/opt.λ +@inline yukawa(opt::Option) = √(opt.εΣ/opt.ε∞)/opt.λ diff --git a/src/base/util.jl b/src/base/util.jl index 3a1970fe..3ba8c4ec 100644 --- a/src/base/util.jl +++ b/src/base/util.jl @@ -13,7 +13,7 @@ and area. Returns the completely initialized Triangle as a copy. # Return type `Triangle` """ -function props(elem::Triangle{T}) where T +function props(elem::Triangle) # reject degenerate triangles @assert !isdegenerate(elem) "Degenerate triangle $(elem)" @@ -397,7 +397,7 @@ Fast Euclidean norm for 3-element vectors. # Return type `T` """ -@inline function _norm(u::AbstractVector{T}) where T +@inline function _norm(u::AbstractVector) √_dot(u, u) end @@ -412,7 +412,7 @@ IDs of the vector elements to the corresponding position in the vector. # Return type `Dict{UInt, UInt}` """ -@inline function reverseindex(v::AbstractVector{T}) where T +@inline function reverseindex(v::AbstractVector) Dict{UInt, UInt}(objectid(e) => i for (i,e) in enumerate(v)) end diff --git a/src/bem/local.jl b/src/bem/local.jl index 92bc109b..140b61c2 100644 --- a/src/bem/local.jl +++ b/src/bem/local.jl @@ -161,7 +161,7 @@ struct LocalSystemMatrix{T} <: AbstractArray{T, 2} params::Option{T} end -Base.size(A::LocalSystemMatrix{T}) where T = size(A.K) +@inline Base.size(A::LocalSystemMatrix) = size(A.K) function LinearAlgebra.diag( A::LocalSystemMatrix{T}, diff --git a/src/bem/nonlocal.jl b/src/bem/nonlocal.jl index 19b6b336..fd9a2555 100644 --- a/src/bem/nonlocal.jl +++ b/src/bem/nonlocal.jl @@ -191,7 +191,7 @@ struct NonlocalSystemMatrix{T} <: AbstractArray{T, 2} end end -Base.size(A::NonlocalSystemMatrix{T}) where T = 3 .* size(A.K) +@inline Base.size(A::NonlocalSystemMatrix) = 3 .* size(A.K) function LinearAlgebra.diag(A::NonlocalSystemMatrix{T}, k::Int = 0) where T k != 0 && error("diag not defined for k != 0 on ", typeof(A))