Skip to content

Commit

Permalink
Remove error checking on function definition of batch integral
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Sep 19, 2023
1 parent f56d654 commit e3ee453
Showing 1 changed file with 2 additions and 29 deletions.
31 changes: 2 additions & 29 deletions src/scimlfunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -224,27 +224,6 @@ function Base.showerror(io::IO, e::IntegrandMismatchFunctionError)
printstyled(io, e.integrand_passed; bold = true, color = :red)

Check warning on line 224 in src/scimlfunctions.jl

View check run for this annotation

Codecov / codecov/patch

src/scimlfunctions.jl#L219-L224

Added lines #L219 - L224 were not covered by tests
end

const BATCH_INTEGRAND_MISMATCH_FUNCTIONS_ERROR_MESSAGE = """
Nonconforming functions detected. If an integrand function `f` is defined
as out-of-place (`f(u,p)`), then no integrand_prototype can be passed into the
function constructor. Likewise if `f` is defined as in-place (`f(out,u,p)`), then
an integrand_prototype is required. Either change the use of the function
constructor or define the appropriate dispatch for `f`.
"""

struct BatchedIntegrandMismatchFunctionError <: Exception
iip::Bool
integrand_passed::Bool
end

function Base.showerror(io::IO, e::BatchedIntegrandMismatchFunctionError)
println(io, BATCH_INTEGRAND_MISMATCH_FUNCTIONS_ERROR_MESSAGE)
print(io, "Mismatch: IIP=")
printstyled(io, e.iip; bold = true, color = :red)
print(io, ", Integrand passed=")
printstyled(io, e.integrand_passed; bold = true, color = :red)
end

"""
$(TYPEDEF)
"""
Expand Down Expand Up @@ -4142,17 +4121,11 @@ function BatchIntegralFunction{iip}(f, output_prototype, integrand_prototype; kw
return BatchIntegralFunction{iip, FullSpecialize}(f, output_prototype, integrand_prototype; kwargs...)

Check warning on line 4121 in src/scimlfunctions.jl

View check run for this annotation

Codecov / codecov/patch

src/scimlfunctions.jl#L4120-L4121

Added lines #L4120 - L4121 were not covered by tests
end
function BatchIntegralFunction(f, output_prototype; kwargs...)
calcuated_iip = isinplace(f, 4, "batchintegral", iip)
if !calcuated_iip
throw(BatchedIntegrandMismatchFunctionError(calculated_iip, false))
end
calcuated_iip = isinplace(f, 3, "batchintegral", iip)
BatchIntegralFunction{false}(f, output_prototype, nothing; kwargs...)

Check warning on line 4125 in src/scimlfunctions.jl

View check run for this annotation

Codecov / codecov/patch

src/scimlfunctions.jl#L4123-L4125

Added lines #L4123 - L4125 were not covered by tests
end
function BatchIntegralFunction(f, output_prototype, integrand_prototype; kwargs...)
calcuated_iip = isinplace(f, 4, "batchintegral", iip)
if !calcuated_iip
throw(BatchIntegrandMismatchFunctionError(calculated_iip, true))
end
calcuated_iip = isinplace(f, 3, "batchintegral", iip)
BatchIntegralFunction{true}(f, output_prototype, integrand_prototype; kwargs...)

Check warning on line 4129 in src/scimlfunctions.jl

View check run for this annotation

Codecov / codecov/patch

src/scimlfunctions.jl#L4127-L4129

Added lines #L4127 - L4129 were not covered by tests
end

Expand Down

0 comments on commit e3ee453

Please sign in to comment.