Skip to content

Commit a698ec1

Browse files
committed
make inner so there's no overriding
1 parent 02c6300 commit a698ec1

15 files changed

+276
-243
lines changed

src/problems/analytical_problems.jl

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,6 @@ end
2929

3030
export AnalyticalProblem, AbstractAnalyticalProblem
3131

32-
struct AnalyticalAliasSpecifier <: AbstractAliasSpecifier
33-
alias_p::Union{Bool, Nothing}
34-
alias_f::Union{Bool, Nothing}
35-
alias_u0::Union{Bool, Nothing}
36-
alias_du0::Union{Bool, Nothing}
37-
alias_tstops::Union{Bool, Nothing}
38-
end
3932

4033
@doc doc"""
4134
@@ -54,13 +47,24 @@ When a keyword argument is `nothing`, the default behaviour of the solver is use
5447
* `alias::Union{Bool, Nothing}`: sets all fields of the `AnalyticalAliasSpecifier` to `alias`
5548
5649
"""
57-
function AnalyticalAliasSpecifier(; alias_p = nothing, alias_f = nothing, alias_u0 = nothing,
58-
alias_du0 = nothing, alias_tstops = nothing, alias = nothing)
59-
if alias == true
60-
AnalyticalAliasSpecifier(true, true, true, true, true)
61-
elseif alias == false
62-
AnalyticalAliasSpecifier(false, false, false, false, false)
63-
elseif isnothing(alias)
64-
AnalyticalAliasSpecifier(alias_p, alias_f, alias_u0, alias_du0, alias_tstops)
50+
struct AnalyticalAliasSpecifier <: AbstractAliasSpecifier
51+
alias_p::Union{Bool, Nothing}
52+
alias_f::Union{Bool, Nothing}
53+
alias_u0::Union{Bool, Nothing}
54+
alias_du0::Union{Bool, Nothing}
55+
alias_tstops::Union{Bool, Nothing}
56+
57+
function AnalyticalAliasSpecifier(;
58+
alias_p = nothing, alias_f = nothing, alias_u0 = nothing,
59+
alias_du0 = nothing, alias_tstops = nothing, alias = nothing)
60+
if alias == true
61+
new(true, true, true, true, true)
62+
elseif alias == false
63+
new(false, false, false, false, false)
64+
elseif isnothing(alias)
65+
new(alias_p, alias_f, alias_u0, alias_du0, alias_tstops)
66+
end
6567
end
66-
end
68+
end
69+
70+

src/problems/bvp_problems.jl

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -439,16 +439,6 @@ function TwoPointSecondOrderBVProblem(
439439
return TwoPointSecondOrderBVProblem(f, bc, u0, (tspan[1], tspan[end]), p; kwargs...)
440440
end
441441

442-
443-
struct BVPAliasSpecifier <: AbstractAliasSpecifier
444-
alias_p::Union{Bool, Nothing}
445-
alias_f::Union{Bool, Nothing}
446-
alias_u0::Union{Bool, Nothing}
447-
alias_du0::Union{Bool, Nothing}
448-
alias_tstops::Union{Bool, Nothing}
449-
end
450-
451-
452442
@doc doc"""
453443
454444
Holds information on what variables to alias
@@ -466,13 +456,24 @@ When a keyword argument is `nothing`, the default behaviour of the solver is use
466456
* `alias::Union{Bool, Nothing}`: sets all fields of the `BVPAliasSpecifier` to `alias`
467457
468458
"""
469-
function BVPAliasSpecifier(; alias_p = nothing, alias_f = nothing, alias_u0 = nothing,
470-
alias_du0 = nothing, alias_tstops = nothing, alias = nothing)
471-
if alias == true
472-
BVPAliasSpecifier(true, true, true, true, true)
473-
elseif alias == false
474-
BVPAliasSpecifier(false, false, false, false, false)
475-
elseif isnothing(alias)
476-
BVPAliasSpecifier(alias_p, alias_f, alias_u0, alias_du0, alias_tstops)
459+
struct BVPAliasSpecifier <: AbstractAliasSpecifier
460+
alias_p::Union{Bool, Nothing}
461+
alias_f::Union{Bool, Nothing}
462+
alias_u0::Union{Bool, Nothing}
463+
alias_du0::Union{Bool, Nothing}
464+
alias_tstops::Union{Bool, Nothing}
465+
466+
function BVPAliasSpecifier(; alias_p = nothing, alias_f = nothing, alias_u0 = nothing,
467+
alias_du0 = nothing, alias_tstops = nothing, alias = nothing)
468+
if alias == true
469+
new(true, true, true, true, true)
470+
elseif alias == false
471+
new(false, false, false, false, false)
472+
elseif isnothing(alias)
473+
new(alias_p, alias_f, alias_u0, alias_du0, alias_tstops)
474+
end
477475
end
478-
end
476+
end
477+
478+
479+

src/problems/dae_problems.jl

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,6 @@ function ConstructionBase.constructorof(::Type{P}) where {P <: DAEProblem}
120120
end
121121
end
122122

123-
124-
struct DAEAliasSpecifier
125-
alias_p::Union{Bool, Nothing}
126-
alias_f::Union{Bool, Nothing}
127-
alias_u0::Union{Bool, Nothing}
128-
alias_du0::Union{Bool, Nothing}
129-
alias_tstops::Union{Bool, Nothing}
130-
end
131-
132-
133123
@doc doc"""
134124
135125
Holds information on what variables to alias
@@ -147,13 +137,24 @@ When a keyword argument is `nothing`, the default behaviour of the solver is use
147137
* `alias::Union{Bool, Nothing}`: sets all fields of the `DAEAliasSpecifier` to `alias`
148138
149139
"""
150-
function DAEAliasSpecifier(; alias_p = nothing, alias_f = nothing, alias_u0 = nothing,
151-
alias_du0 = nothing, alias_tstops = nothing, alias = nothing)
152-
if alias == true
153-
DAEAliasSpecifier(true, true, true, true, true)
154-
elseif alias == false
155-
DAEAliasSpecifier(false, false, false, false, false)
156-
elseif isnothing(alias)
157-
DAEAliasSpecifier(alias_p, alias_f, alias_u0, alias_du0, alias_tstops)
140+
struct DAEAliasSpecifier
141+
alias_p::Union{Bool, Nothing}
142+
alias_f::Union{Bool, Nothing}
143+
alias_u0::Union{Bool, Nothing}
144+
alias_du0::Union{Bool, Nothing}
145+
alias_tstops::Union{Bool, Nothing}
146+
147+
function DAEAliasSpecifier(; alias_p = nothing, alias_f = nothing, alias_u0 = nothing,
148+
alias_du0 = nothing, alias_tstops = nothing, alias = nothing)
149+
if alias == true
150+
new(true, true, true, true, true)
151+
elseif alias == false
152+
new(false, false, false, false, false)
153+
elseif isnothing(alias)
154+
new(alias_p, alias_f, alias_u0, alias_du0, alias_tstops)
155+
end
158156
end
159-
end
157+
end
158+
159+
160+

src/problems/dde_problems.jl

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -397,13 +397,6 @@ function SecondOrderDDEProblem(f::DynamicalDDEFunction, args...; kwargs...)
397397
end
398398
end
399399

400-
struct DDEAliasSpecifier
401-
alias_p
402-
alias_f
403-
alias_u0
404-
alias_tstops
405-
end
406-
407400

408401
@doc doc"""
409402
@@ -422,13 +415,22 @@ When a keyword argument is `nothing`, the default behaviour of the solver is use
422415
* `alias::Union{Bool, Nothing}`: sets all fields of the `DDEAliasSpecifier` to `alias`
423416
424417
"""
425-
function DDEAliasSpecifier(; alias_p = nothing, alias_f = nothing, alias_u0 = nothing,
426-
alias_du0 = nothing, alias_tstops = nothing, alias = nothing)
427-
if alias == true
428-
DDEAliasSpecifier(true, true, true, true, true)
429-
elseif alias == false
430-
DDEAliasSpecifier(false, false, false, false, false)
431-
elseif isnothing(alias)
432-
DDEAliasSpecifier(alias_p, alias_f, alias_u0, alias_du0, alias_tstops)
418+
struct DDEAliasSpecifier
419+
alias_p::Union{Bool, Nothing}
420+
alias_f::Union{Bool, Nothing}
421+
alias_u0::Union{Bool, Nothing}
422+
alias_tstops::Union{Bool, Nothing}
423+
424+
function DDEAliasSpecifier(; alias_p = nothing, alias_f = nothing, alias_u0 = nothing,
425+
alias_du0 = nothing, alias_tstops = nothing, alias = nothing)
426+
if alias == true
427+
new(true, true, true, true, true)
428+
elseif alias == false
429+
new(false, false, false, false, false)
430+
elseif isnothing(alias)
431+
new(alias_p, alias_f, alias_u0, alias_du0, alias_tstops)
432+
end
433433
end
434-
end
434+
end
435+
436+

src/problems/discrete_problems.jl

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,6 @@ function DiscreteProblem(u0::Union{AbstractArray, Number}, tspan::Tuple,
154154
DiscreteProblem(f, u0, tspan, p; kwargs...)
155155
end
156156

157-
struct DiscreteAliasSpecifier
158-
alias_p::Union{Bool, Nothing}
159-
alias_f::Union{Bool, Nothing}
160-
alias_u0::Union{Bool, Nothing}
161-
end
162-
163-
164157
@doc doc"""
165158
166159
Holds information on what variables to alias
@@ -176,13 +169,23 @@ When a keyword argument is `nothing`, the default behaviour of the solver is use
176169
* `alias::Union{Bool, Nothing}`: sets all fields of the `DiscreteAliasSpecifier` to `alias`
177170
178171
"""
179-
function DiscreteAliasSpecifier(; alias_p = nothing, alias_f = nothing, alias_u0 = nothing,
180-
alias_du0 = nothing, alias = nothing)
181-
if alias == true
182-
DiscreteAliasSpecifier(true, true, true, true, true)
183-
elseif alias == false
184-
DiscreteAliasAliasSpecifier(false, false, false, false, false)
185-
elseif isnothing(alias)
186-
DiscreteAliasSpecifier(alias_p, alias_f, alias_u0)
172+
struct DiscreteAliasSpecifier
173+
alias_p::Union{Bool, Nothing}
174+
alias_f::Union{Bool, Nothing}
175+
alias_u0::Union{Bool, Nothing}
176+
177+
function DiscreteAliasSpecifier(;
178+
alias_p = nothing, alias_f = nothing, alias_u0 = nothing,
179+
alias_du0 = nothing, alias = nothing)
180+
if alias == true
181+
new(true, true, true, true, true)
182+
elseif alias == false
183+
new(false, false, false, false, false)
184+
elseif isnothing(alias)
185+
new(alias_p, alias_f, alias_u0)
186+
end
187187
end
188-
end
188+
end
189+
190+
191+

src/problems/implicit_discrete_problems.jl

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,6 @@ function ImplicitDiscreteProblem(f, u0, tspan, p = NullParameters();
120120
ImplicitDiscreteProblem(ImplicitDiscreteFunction{iip}(f), u0, tspan, p; kwargs...)
121121
end
122122

123-
124-
struct ImplicitDiscreteAliasSpecifier
125-
alias_p::Union{Bool,Nothing}
126-
alias_f::Union{Bool, Nothing}
127-
alias_u0::Union{Bool, Nothing}
128-
end
129-
130123
@doc doc"""
131124
132125
Holds information on what variables to alias
@@ -142,13 +135,22 @@ When a keyword argument is `nothing`, the default behaviour of the solver is use
142135
* `alias::Union{Bool, Nothing}`: sets all fields of the `ImplicitDiscreteAliasSpecifier` to `alias`
143136
144137
"""
145-
function ImplicitDiscreteAliasSpecifier(; alias_p = nothing, alias_f = nothing, alias_u0 = nothing,
146-
alias_du0 = nothing, alias = nothing)
147-
if alias == true
148-
ImplicitDiscreteAliasSpecifier(true, true, true, true, true)
149-
elseif alias == false
150-
ImplicitDiscreteAliasAliasSpecifier(false, false, false, false, false)
151-
elseif isnothing(alias)
152-
ImplicitDiscreteAliasSpecifier(alias_p, alias_f, alias_u0)
138+
struct ImplicitDiscreteAliasSpecifier
139+
alias_p::Union{Bool,Nothing}
140+
alias_f::Union{Bool, Nothing}
141+
alias_u0::Union{Bool, Nothing}
142+
143+
function ImplicitDiscreteAliasSpecifier(;
144+
alias_p = nothing, alias_f = nothing, alias_u0 = nothing,
145+
alias_du0 = nothing, alias = nothing)
146+
if alias == true
147+
new(true, true, true, true, true)
148+
elseif alias == false
149+
new(false, false, false, false, false)
150+
elseif isnothing(alias)
151+
new(alias_p, alias_f, alias_u0)
152+
end
153153
end
154-
end
154+
end
155+
156+

src/problems/integral_problems.jl

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,6 @@ struct SampledIntegralProblem{Y, X, K} <: AbstractIntegralProblem{false}
168168
end
169169
end
170170

171-
struct IntegralAliasSpecifier <: AbstractAliasSpecifier
172-
alias_p
173-
alias_f
174-
end
175-
176171
@doc doc"""
177172
178173
Holds information on what variables to alias
@@ -187,12 +182,19 @@ When a keyword argument is `nothing`, the default behaviour of the solver is use
187182
* `alias::Union{Bool, Nothing}`: sets all fields of the `IntegralAliasSpecifier` to `alias`
188183
189184
"""
190-
function IntegralAliasSpecifier(alias_p = nothing, alias_f = nothing, alias = nothing)
191-
if alias == true
192-
IntegralAliasSpecifier(true, true)
193-
elseif alias == false
194-
IntegralAliasSpecifier(false, false)
195-
elseif isnothing(alias)
196-
IntegralAliasSpecifier(alias_p, alias_f)
185+
struct IntegralAliasSpecifier <: AbstractAliasSpecifier
186+
alias_p::Union{Bool, Nothing}
187+
alias_f::Union{Bool, Nothing}
188+
189+
function IntegralAliasSpecifier(alias_p = nothing, alias_f = nothing, alias = nothing)
190+
if alias == true
191+
new(true, true)
192+
elseif alias == false
193+
new(false, false)
194+
elseif isnothing(alias)
195+
new(alias_p, alias_f)
196+
end
197197
end
198-
end
198+
end
199+
200+

src/problems/linear_problems.jl

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ function LinearProblem(A, b, args...; kwargs...)
7777
end
7878
end
7979

80-
struct LinearAliasSpecifier <: AbstractAliasSpecifier
81-
alias_A::Union{Bool,Nothing}
82-
alias_b::Union{Bool,Nothing}
83-
end
84-
8580
@doc doc"""
8681
Holds information on what variables to alias
8782
when solving a LinearProblem. Conforms to the AbstractAliasSpecifier interface.
@@ -100,12 +95,20 @@ When a keyword argument is `nothing`, the default behaviour of the solver is use
10095
Creates a `LinearAliasSpecifier` where `alias_A` and `alias_b` default to `nothing`.
10196
When `alias_A` or `alias_b` is nothing, the default value of the solver is used.
10297
"""
103-
function LinearAliasSpecifier(;alias_A = nothing, alias_b = nothing, alias_p = nothing, alias_f = nothing, alias = nothing)
104-
if alias == true
105-
LinearAliasSpecifier(true,true,true,true)
106-
elseif alias == false
107-
LinearAliasSpecifier(false,false,false,false)
108-
elseif isnothing(alias)
109-
LinearAliasSpecifier(alias_p, alias_f, alias_A, alias_b)
98+
struct LinearAliasSpecifier <: AbstractAliasSpecifier
99+
alias_A::Union{Bool,Nothing}
100+
alias_b::Union{Bool,Nothing}
101+
102+
function LinearAliasSpecifier(; alias_A = nothing, alias_b = nothing,
103+
alias_p = nothing, alias_f = nothing, alias = nothing)
104+
if alias == true
105+
new(true, true, true, true)
106+
elseif alias == false
107+
new(false, false, false, false)
108+
elseif isnothing(alias)
109+
new(alias_p, alias_f, alias_A, alias_b)
110+
end
110111
end
111-
end
112+
end
113+
114+

0 commit comments

Comments
 (0)