Skip to content

Commit

Permalink
fix default batch and dispatch
Browse files Browse the repository at this point in the history
  • Loading branch information
lxvm committed Sep 21, 2023
1 parent 83f933d commit 7740dd4
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/problems/basic_problems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -389,24 +389,23 @@ function IntegralProblem(f, args...; nout = nothing, batch = nothing, kwargs...)
if nout !== nothing || batch !== nothing
@warn "`nout` and `batch` keywords are deprecated in favor of inplace `IntegralFunction`s or `BatchIntegralFunction`s. See the updated Integrals.jl documentation for details."

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

View check run for this annotation

Codecov / codecov/patch

src/problems/basic_problems.jl#L388-L390

Added lines #L388 - L390 were not covered by tests
end

iip = isinplace(f, 3)
g = if iip
nout = nout === nothing ? 1 : nout
output_prototype = Vector{Float64}(undef, nout)
if batch == 0

max_batch = batch === nothing ? 0 : batch
g = if isinplace(f, 3)
output_prototype = Vector{Float64}(undef, nout === nothing ? 1 : nout)
if max_batch == 0
IntegralFunction(f, output_prototype)

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

View check run for this annotation

Codecov / codecov/patch

src/problems/basic_problems.jl#L393-L397

Added lines #L393 - L397 were not covered by tests
else
BatchIntegralFunction(f, output_prototype, max_batch=batch)
BatchIntegralFunction(f, output_prototype, max_batch=max_batch)

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

View check run for this annotation

Codecov / codecov/patch

src/problems/basic_problems.jl#L399

Added line #L399 was not covered by tests
end
else
if batch == 0
if max_batch == 0
IntegralFunction(f)

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

View check run for this annotation

Codecov / codecov/patch

src/problems/basic_problems.jl#L402-L403

Added lines #L402 - L403 were not covered by tests
else
BatchIntegralFunction(f, max_batch=batch)
BatchIntegralFunction(f, max_batch=max_batch)

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

View check run for this annotation

Codecov / codecov/patch

src/problems/basic_problems.jl#L405

Added line #L405 was not covered by tests
end
end
IntegralProblem{iip}(g, args...; kwargs...)
IntegralProblem(g, args...; kwargs...)

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

View check run for this annotation

Codecov / codecov/patch

src/problems/basic_problems.jl#L408

Added line #L408 was not covered by tests
end

struct QuadratureProblem end
Expand Down

0 comments on commit 7740dd4

Please sign in to comment.