Skip to content

Commit a1aa2f2

Browse files
Fix tests
1 parent de20255 commit a1aa2f2

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/operations.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ Base.show(io::IO, O::Operation) = print(io, convert(Expr, O))
2121

2222

2323
"""
24-
find_replace(O::Operation,x::Variable,y::Expression)
24+
find_replace(O::Operation, x::Expression, y::Expression)
2525
26-
Finds the variable `x` in Operation `O` and replaces it with the Expression `y`
26+
Finds the expression `x` in Operation `O` and replaces it with the Expression `y`
2727
"""
28-
function find_replace!(O::Operation,x::Variable,y::Expression)
28+
function find_replace!(O::Operation, x::Expression, y::Expression)
2929
for i in eachindex(O.args)
30-
if isequal(O.args[i],x)
30+
if isequal(O.args[i], x)
3131
O.args[i] = y
3232
elseif typeof(O.args[i]) <: Operation
3333
find_replace!(O.args[i],x,y)

src/systems/diffeqs/diffeqsystem.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ isintermediate(eq::Equation) = eq.lhs.diff === nothing
6363
function build_equals_expr(eq::Equation)
6464
@assert typeof(eq.lhs) <: Variable
6565

66-
lhs = Symbol("$(eq.lhs.name)")
66+
lhs = eq.lhs.name
6767
isintermediate(eq) || (lhs = Symbol(lhs, :_, "$(eq.lhs.diff.x.name)"))
6868

6969
return :($lhs = $(convert(Expr, eq.rhs)))

src/systems/nonlinear/nonlinear_system.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function generate_nlsys_function(sys::NonlinearSystem)
2727
var_exprs = [:($(sys.vs[i].name) = u[$i]) for i in 1:length(sys.vs)]
2828
param_exprs = [:($(sys.ps[i].name) = p[$i]) for i in 1:length(sys.ps)]
2929
sys_eqs, calc_eqs = partition(eq -> isequal(eq.lhs, Constant(0)), sys.eqs)
30-
calc_exprs = [:($(Symbol("$(eq.lhs.name)")) = $(eq.rhs)) for eq in calc_eqs]
30+
calc_exprs = [:($(eq.lhs.name) = $(eq.rhs)) for eq in calc_eqs if isa(eq.lhs, Variable)]
3131
sys_exprs = [:($(Symbol("resid[$i]")) = $(sys_eqs[i].rhs)) for i in eachindex(sys_eqs)]
3232

3333
exprs = vcat(var_exprs,param_exprs,calc_exprs,sys_exprs)

0 commit comments

Comments
 (0)