Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update value and derivative deprecation message to make users aware of non-allocating batch evaluation #1125

Merged
merged 6 commits into from
Jan 10, 2025
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions src/deprecations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,30 @@
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 ")
printstyled(io, "`N`", color = :green)
print(io, ") instead.")

Check warning on line 352 in src/deprecations.jl

View check run for this annotation

Codecov / codecov/patch

src/deprecations.jl#L344-L352

Added lines #L344 - L352 were not covered by tests

throw(DeprecationError(takestring(io)))

Check warning on line 354 in src/deprecations.jl

View check run for this annotation

Codecov / codecov/patch

src/deprecations.jl#L354

Added line #L354 was not covered by tests
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 ")
printstyled(io, "`dNdξ`", color = :green)
print(io, ") instead.")

Check warning on line 365 in src/deprecations.jl

View check run for this annotation

Codecov / codecov/patch

src/deprecations.jl#L357-L365

Added lines #L357 - L365 were not covered by tests

throw(DeprecationError(takestring(io)))

Check warning on line 367 in src/deprecations.jl

View check run for this annotation

Codecov / codecov/patch

src/deprecations.jl#L367

Added line #L367 was not covered by tests
end
function value(ip::Interpolation, i::Int, ξ::Vec)
throw(DeprecationError("value(ip::Interpolation, i::Int, ξ::Vec)" => "reference_shape_value(ip, ξ, i)"))
Expand Down
Loading