Skip to content

Commit

Permalink
Refactoring BSpline
Browse files Browse the repository at this point in the history
  • Loading branch information
KeitaNakamura committed Aug 10, 2024
1 parent 98f4626 commit 5c524b3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Interpolations/bspline.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ end
# Fast calculations for value, gradient and hessian
# `x` must be normalized by `h`
@inline Base.values(spline::AbstractBSpline, x, args...) = only(values(Order(0), spline, x, args...))
@inline function Base.values(order, ::AbstractBSpline{Linear}, x::Real)
@inline function Base.values(order::Order, ::AbstractBSpline{Linear}, x::Real)
T = typeof(x)
ξ = fract(x)
vals = tuple(@. T((1-ξ, ξ)))
Expand All @@ -56,7 +56,7 @@ end
end
vals
end
@inline function Base.values(order, ::AbstractBSpline{Quadratic}, x::Real)
@inline function Base.values(order::Order, ::AbstractBSpline{Quadratic}, x::Real)
T = typeof(x)
x′ = fract(x - T(0.5))
ξ = @. x′ - T((-0.5,0.5,1.5))
Expand All @@ -72,7 +72,7 @@ end
end
vals
end
@inline function Base.values(order, ::AbstractBSpline{Cubic}, x::Real)
@inline function Base.values(order::Order, ::AbstractBSpline{Cubic}, x::Real)
T = typeof(x)
x′ = fract(x)
ξ = @. x′ - T((-1,0,1,2))
Expand All @@ -91,7 +91,7 @@ end
vals
end

@generated function Base.values(order, spline::AbstractBSpline, x::Vec{dim}) where {dim}
@generated function Base.values(order::Order, spline::AbstractBSpline, x::Vec{dim}) where {dim}
T_∇∇ws = SymmetricSecondOrderTensor{dim}
∇∇ws = Array{Expr}(undef,dim,dim)
for j in 1:dim, i in 1:dim
Expand Down

0 comments on commit 5c524b3

Please sign in to comment.