Skip to content

Commit 454eaed

Browse files
committed
remove excessive branches
1 parent 33e180d commit 454eaed

File tree

1 file changed

+7
-23
lines changed

1 file changed

+7
-23
lines changed

src/systems/clock_inference.jl

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -362,42 +362,26 @@ function generate_discrete_affect(
362362
for (val, i) in zip(result, $cont_to_disc_idxs)
363363
$(_set_parameter_unchecked!)(p, val, i; update_dependent = false)
364364
end
365-
end
366-
else
367-
:(copyto!(c2d_view, c2d_obs(integrator.u, p, t)))
368-
end
369-
)
370-
# @show "after c2d", p
371-
$(
372-
if use_index_cache
373-
quote
374365
if !$empty_disc
375366
# NOTE: the first and third arguments to `disc` MAY NOT be aliased
376367
disc(cache, disc_unknowns, p..., t) # Cache needed for atomic state update
377368
for (val, i) in zip(cache, $disc_range)
378369
$(_set_parameter_unchecked!)(p, val, i; update_dependent = false)
379370
end
380-
copyto!(disc_unknowns, cache)
371+
# copyto!(disc_unknowns, cache)
381372
end
382-
end
383-
else
384-
quote
385-
$empty_disc || disc(cache, disc_unknowns, p, t) # Cache needed for atomic state update
386-
copyto!(disc_unknowns, cache)
387-
end
388-
end
389-
)
390-
# @show "after state update", p
391-
$(
392-
if use_index_cache
393-
quote
394373
result = d2c_obs(disc_unknowns, p..., t)
395374
for (val, i) in zip(result, $disc_to_cont_idxs)
396375
$(_set_parameter_unchecked!)(p, val, i; update_dependent = false)
397376
end
398377
end
399378
else
400-
:(copyto!(d2c_view, d2c_obs(disc_unknowns, p, t)))
379+
quote
380+
copyto!(c2d_view, c2d_obs(integrator.u, p, t))
381+
$empty_disc || disc(cache, disc_unknowns, p, t) # Cache needed for atomic state update
382+
copyto!(disc_unknowns, cache)
383+
copyto!(d2c_view, d2c_obs(disc_unknowns, p, t))
384+
end
401385
end
402386
)
403387

0 commit comments

Comments
 (0)