Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add new remake(::AbstractSciMLFunction), fix some remake bugs. #891

Merged
merged 13 commits into from
Dec 14, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: fix remake for split functions
  • Loading branch information
AayushSabharwal committed Dec 13, 2024
commit 723abd772868848276b6f279bb4c8b446f593d7d
7 changes: 4 additions & 3 deletions src/remake.jl
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@ function remake(func::AbstractSciMLFunction; f = missing, g = missing, f2 = miss
if f === missing
# if no `f` is provided, create the same type of SciMLFunction
T = parameterless_type(func)
f = func.f
f = isdefined(func, :f) ? func.f : func.f1
elseif f isa AbstractSciMLFunction
# if `f` is a SciMLFunction, create that type
T = parameterless_type(f)
# properties of `f` take priority over those in the existing `func`
# ignore properties of `f` which are `nothing` but present in `func`
props = _similar_namedtuple_merge_ignore_nothing(props, getproperties(f))
f = f.f
f = isdefined(f, :f) ? f.f : f.f1
else
# if `f` is provided but not a SciMLFunction, create the same type
T = parameterless_type(func)
Expand All @@ -154,10 +154,11 @@ function remake(func::AbstractSciMLFunction; f = missing, g = missing, f2 = miss
# it creates a `NonlinearFunction` inside a `NonlinearFunction`. Just recursively unwrap
# in this case and forget about properties.
while f isa AbstractSciMLFunction
f = f.f
f = isdefined(f, :f) ? f.f : f.f1
end

props = @delete props.f
props = @delete props.f1

if isdefined(func, :g)
# For SDEs/SDDEs where `g` is not a keyword
Expand Down