Skip to content

Commit

Permalink
Update value and derivative deprecation message to make users aware o…
Browse files Browse the repository at this point in the history
…f non-allocating batch evaluation (#1125)
  • Loading branch information
termi-official authored Jan 10, 2025
1 parent 907c8c9 commit db375ff
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/deprecations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,26 @@ function FacetValues(
end

function value(ip::Interpolation, ξ::Vec)
throw(DeprecationError("value(ip::Interpolation, ξ::Vec)" => "[reference_shape_value(ip, ξ, i) for i in 1:getnbasefunctions(ip)]"))
io = _iobuffer()
printstyled(io, "`value(ip::Interpolation, ξ::Vec)`", color = :red)
print(io, " is deprecated, use ")
printstyled(io, "`[reference_shape_value(ip, ξ, i) for i in 1:getnbasefunctions(ip)]`", color = :green)
print(io, " or ")
printstyled(io, "`reference_shape_values!(N, ip, ξ)`", color = :green)
print(io, " (with preallocated `N`) instead.")

throw(DeprecationError(takestring(io)))
end
function derivative(ip::Interpolation, ξ::Vec)
throw(DeprecationError("derivative(ip::Interpolation, ξ::Vec)" => "[reference_shape_gradient(ip, ξ, i) for i in 1:getnbasefunctions(ip)]"))
io = _iobuffer()
printstyled(io, "`derivative(ip::Interpolation, ξ::Vec)`", color = :red)
print(io, " is deprecated, use ")
printstyled(io, "`[reference_shape_gradient(ip, ξ, i) for i in 1:getnbasefunctions(ip)]`", color = :green)
print(io, " or ")
printstyled(io, "`reference_shape_gradients!(dNdξ, ip, ξ)`", color = :green)
print(io, " (with preallocated `dNdξ`) instead.")

throw(DeprecationError(takestring(io)))
end
function value(ip::Interpolation, i::Int, ξ::Vec)
throw(DeprecationError("value(ip::Interpolation, i::Int, ξ::Vec)" => "reference_shape_value(ip, ξ, i)"))
Expand Down

0 comments on commit db375ff

Please sign in to comment.