Skip to content

Commit 355d125

Browse files
Fix method overwriting issues in initialization algorithms
- Remove conflicting constructor overloads - Keep only positional argument constructors for backward compatibility - Add helper functions for parameter extraction from both base and extended types - Update OrdinaryDiffEqNonlinearSolve to handle both DiffEqBase and extended types
1 parent 25bca1d commit 355d125

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

lib/OrdinaryDiffEqCore/src/initialize_dae.jl

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,10 @@ function ShampineCollocationInitExt(initdt)
1616
ShampineCollocationInitExt(; initdt = initdt, nlsolve = nothing)
1717
end
1818

19-
# Constructor that delegates to extended version for backward compatibility
20-
function ShampineCollocationInit(; initdt = nothing, nlsolve = nothing)
21-
if initdt !== nothing || nlsolve !== nothing
22-
ShampineCollocationInitExt(initdt, nlsolve)
23-
else
24-
DiffEqBase.ShampineCollocationInit()
25-
end
19+
# Constructor for backward compatibility when passing initdt
20+
function ShampineCollocationInit(initdt::T) where T
21+
ShampineCollocationInitExt(; initdt = initdt, nlsolve = nothing)
2622
end
27-
ShampineCollocationInit(initdt) = ShampineCollocationInitExt(; initdt = initdt, nlsolve = nothing)
2823

2924
struct BrownFullBasicInit{T, F} <: SciMLBase.DAEInitializationAlgorithm
3025
abstol::T
@@ -38,13 +33,9 @@ BrownFullBasicInit(abstol) = BrownFullBasicInit(; abstol = abstol, nlsolve = not
3833
# Alias for consistency with DiffEqBase naming
3934
const BrownBasicInitExt = BrownFullBasicInit
4035

41-
# Constructor that delegates for backward compatibility
42-
function BrownBasicInit(; abstol = nothing, nlsolve = nothing)
43-
if abstol !== nothing || nlsolve !== nothing
44-
BrownFullBasicInit(something(abstol, 1e-10), nlsolve)
45-
else
46-
DiffEqBase.BrownBasicInit()
47-
end
36+
# Constructor for backward compatibility when passing abstol
37+
function BrownBasicInit(abstol::T) where T
38+
BrownFullBasicInit(abstol, nothing)
4839
end
4940

5041
## Notes

0 commit comments

Comments
 (0)