Skip to content

Commit 2e306e3

Browse files
Force more function specialization
1 parent e73e4bb commit 2e306e3

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/SciMLBase.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ $(TYPEDEF)
587587
588588
Base for types defining SciML functions.
589589
"""
590-
abstract type AbstractSciMLFunction{iip} <: Function end
590+
abstract type AbstractSciMLFunction{iip} end
591591

592592
"""
593593
$(TYPEDEF)
@@ -622,7 +622,7 @@ abstract type AbstractHistoryFunction end
622622
"""
623623
$(TYPEDEF)
624624
"""
625-
abstract type AbstractReactionNetwork <: Function end
625+
abstract type AbstractReactionNetwork end
626626

627627
"""
628628
$(TYPEDEF)

src/function_wrappers.jl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
mutable struct TimeGradientWrapper{iip, fType, uType, P} <: AbstractSciMLFunction{iip}
1+
abstract type AbstractWrappedFunction{iip} end
2+
isinplace(f::AbstractWrappedFunction{iip}) where {iip} = iip
3+
mutable struct TimeGradientWrapper{iip, fType, uType, P} <: AbstractWrappedFunction{iip}
24
f::fType
35
uprev::uType
46
p::P
@@ -18,7 +20,7 @@ end
1820

1921
(ff::TimeGradientWrapper{false})(t) = ff.f(ff.uprev, ff.p, t)
2022

21-
mutable struct UJacobianWrapper{iip, fType, tType, P} <: AbstractSciMLFunction{iip}
23+
mutable struct UJacobianWrapper{iip, fType, tType, P} <: AbstractWrappedFunction{iip}
2224
f::fType
2325
t::tType
2426
p::P
@@ -41,7 +43,7 @@ end
4143
(ff::UJacobianWrapper{false})(uprev) = ff.f(uprev, ff.p, ff.t)
4244
(ff::UJacobianWrapper{false})(uprev, p, t) = ff.f(uprev, p, t)
4345

44-
mutable struct TimeDerivativeWrapper{iip, F, uType, P} <: AbstractSciMLFunction{iip}
46+
mutable struct TimeDerivativeWrapper{iip, F, uType, P} <: AbstractWrappedFunction{iip}
4547
f::F
4648
u::uType
4749
p::P
@@ -58,7 +60,7 @@ end
5860
(ff::TimeDerivativeWrapper{true})(du1, t) = ff.f(du1, ff.u, ff.p, t)
5961
(ff::TimeDerivativeWrapper{true})(t) = (du1 = similar(ff.u); ff.f(du1, ff.u, ff.p, t); du1)
6062

61-
mutable struct UDerivativeWrapper{iip, F, tType, P} <: AbstractSciMLFunction{iip}
63+
mutable struct UDerivativeWrapper{iip, F, tType, P} <: AbstractWrappedFunction{iip}
6264
f::F
6365
t::tType
6466
p::P
@@ -73,7 +75,7 @@ UDerivativeWrapper(f::F, t, p) where {F} = UDerivativeWrapper{isinplace(f, 4)}(f
7375
(ff::UDerivativeWrapper{true})(du1, u) = ff.f(du1, u, ff.p, ff.t)
7476
(ff::UDerivativeWrapper{true})(u) = (du1 = similar(u); ff.f(du1, u, ff.p, ff.t); du1)
7577

76-
mutable struct ParamJacobianWrapper{iip, fType, tType, uType} <: AbstractSciMLFunction{iip}
78+
mutable struct ParamJacobianWrapper{iip, fType, tType, uType} <: AbstractWrappedFunction{iip}
7779
f::fType
7880
t::tType
7981
u::uType
@@ -95,7 +97,7 @@ function (ff::ParamJacobianWrapper{false})(du1, p)
9597
du1 .= ff.f(ff.u, p, ff.t)
9698
end
9799

98-
mutable struct JacobianWrapper{iip, fType, pType} <: AbstractSciMLFunction{iip}
100+
mutable struct JacobianWrapper{iip, fType, pType} <: AbstractWrappedFunction{iip}
99101
f::fType
100102
p::pType
101103
end

0 commit comments

Comments
 (0)