Skip to content

Commit

Permalink
add deprecation method
Browse files Browse the repository at this point in the history
  • Loading branch information
lxvm committed Sep 21, 2023
1 parent 5be7d7a commit 8ebfe42
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/problems/basic_problems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,28 @@ function IntegralProblem(f::AbstractIntegralFunction,
kwargs...) where {B}
IntegralProblem(f, (lb, ub), p; kwargs...)
end

# deprecation methods, which assume integrands return Float64 values (same as C libraries)
function IntegralProblem{iip}(f, args...; nout = 1, batch = 0, kwargs...) where {iip}
@warn "`nout` and `batch` keywords are deprecated in favor of inplace `IntegralFunction`s or `BatchIntegralFunction`s"
g = if iip
output_prototype = Vector{Float64}(undef, nout)
if batch == 0
IntegralFunction(f, output_prototype)
else
BatchIntegralFunction(f, output_prototype, max_batch=batch)
end
else
if batch == 0
IntegralFunction(f)

Check warning on line 400 in src/problems/basic_problems.jl

View check run for this annotation

Codecov / codecov/patch

src/problems/basic_problems.jl#L399-L400

Added lines #L399 - L400 were not covered by tests
else
BatchIntegralFunction(f, max_batch=batch)
end
end
IntegralProblem(g, args...; kwargs...)
end
function IntegralProblem(f, args...; kwargs...)
IntegralProblem(IntegralFunction(f), args...; kwargs...)
IntegralProblem{isinplace(f, 3)}(f, args...; kwargs...)
end

struct QuadratureProblem end
Expand Down

0 comments on commit 8ebfe42

Please sign in to comment.