Skip to content

Commit

Permalink
Formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
BenChung committed Dec 9, 2024
1 parent aa556d6 commit c169b9e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 2 additions & 4 deletions src/systems/imperative_affect.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ function Base.hash(a::ImperativeAffect, s::UInt)
hash(a.ctx, s)
end


namespace_affects(af::ImperativeAffect, s) = namespace_affect(af, s)
function namespace_affect(affect::ImperativeAffect, s)
ImperativeAffect(func(affect),
Expand Down Expand Up @@ -175,15 +174,15 @@ function compile_user_affect(affect::ImperativeAffect, cb, sys, dvs, ps; kwargs.
end
obs_fun = build_explicit_observed_function(
sys, Symbolics.scalarize.(obs_exprs);
mkarray = (es,_) -> MakeTuple(es))
mkarray = (es, _) -> MakeTuple(es))
obs_sym_tuple = (obs_syms...,)

# okay so now to generate the stuff to assign it back into the system
mod_pairs = mod_exprs .=> mod_syms
mod_names = (mod_syms...,)
mod_og_val_fun = build_explicit_observed_function(
sys, Symbolics.scalarize.(first.(mod_pairs));
mkarray = (es,_) -> MakeTuple(es))
mkarray = (es, _) -> MakeTuple(es))

upd_funs = NamedTuple{mod_names}((setu.((sys,), first.(mod_pairs))...,))

Expand Down Expand Up @@ -216,5 +215,4 @@ function compile_user_affect(affect::ImperativeAffect, cb, sys, dvs, ps; kwargs.
end
end


scalarize_affects(affects::ImperativeAffect) = affects
6 changes: 3 additions & 3 deletions test/symbolic_events.jl
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ end
@named trigsys = ODESystem(eqs, t; continuous_events = [evt1, evt2])
trigsys_ss = structural_simplify(trigsys)
prob = ODEProblem(trigsys_ss, [], (0.0, 2π))
sol = solve(prob, Tsit5(); dtmax=0.01)
sol = solve(prob, Tsit5(); dtmax = 0.01)
required_crossings_c1 =/ 2, 3 * π / 2]
required_crossings_c2 =/ 6, π / 2, 5 * π / 6, 7 * π / 6, 3 * π / 2, 11 * π / 6]
@test maximum(abs.(first.(cr1) .- required_crossings_c1)) < 1e-4
Expand Down Expand Up @@ -1079,8 +1079,8 @@ end
@test sort(canonicalize(Discrete(), prob.p)[1]) == [0.0, 1.0, 2.0]
sol = solve(prob, Tsit5())

@test sol[a] == [1.0,-1.0]
@test sol[b] == [2.0,5.0, 5.0]
@test sol[a] == [1.0, -1.0]
@test sol[b] == [2.0, 5.0, 5.0]
@test sol[c] == [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
end
@testset "Heater" begin
Expand Down

0 comments on commit c169b9e

Please sign in to comment.