Skip to content

Commit e69ef19

Browse files
committed
Clean up usage of custom init
1 parent 3bc5d23 commit e69ef19

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

src/systems/callbacks.jl

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -922,18 +922,11 @@ function generate_vector_rootfinding_callback(
922922
(cb, fn) -> begin
923923
if (save_idxs = get(ic.callback_to_clocks, cb, nothing)) !== nothing
924924
let save_idxs = save_idxs
925-
if !isnothing(fn.initialize)
926-
(i) -> begin
927-
fn.initialize(i)
928-
for idx in save_idxs
929-
SciMLBase.save_discretes!(i, idx)
930-
end
931-
end
932-
else
933-
(i) -> begin
934-
for idx in save_idxs
935-
SciMLBase.save_discretes!(i, idx)
936-
end
925+
custom_init = fn.initialize
926+
(i) -> begin
927+
isnothing(custom_init) && custom_init(i)
928+
for idx in save_idxs
929+
SciMLBase.save_discretes!(i, idx)
937930
end
938931
end
939932
end

0 commit comments

Comments
 (0)