Skip to content

Commit 84eb679

Browse files
Remove unnecessary utility functions
1 parent 79b8772 commit 84eb679

File tree

5 files changed

+1
-29
lines changed

5 files changed

+1
-29
lines changed

src/ModelingToolkit.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ include("variables.jl")
1515
Base.promote_rule(::Type{T},::Type{T2}) where {T<:Number,T2<:Expression} = Expression
1616
Base.zero(::Type{<:Expression}) = Constant(0)
1717
Base.one(::Type{<:Expression}) = Constant(1)
18-
Base.convert(::Type{Variable},x::Int64) = Constant(x)
1918

2019
function caclulate_jacobian end
2120

src/equations.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ struct Equation
55
lhs::Expression
66
rhs::Expression
77
end
8-
Base.broadcastable(eq::Equation) = Ref(eq)
98
Base.:(==)(a::Equation, b::Equation) = (a.lhs, a.rhs) == (b.lhs, b.rhs)
109

1110
Base.:~(lhs::Expression, rhs::Expression) = Equation(lhs, rhs)

src/operations.jl

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,6 @@ Base.convert(::Type{Expr}, O::Operation) =
1919
build_expr(:call, Any[Symbol(O.op); convert.(Expr, O.args)])
2020
Base.show(io::IO, O::Operation) = print(io, convert(Expr, O))
2121

22-
23-
"""
24-
find_replace(O::Operation, x::Expression, y::Expression)
25-
26-
Finds the expression `x` in Operation `O` and replaces it with the Expression `y`
27-
"""
28-
function find_replace!(O::Operation, x::Expression, y::Expression)
29-
for i in eachindex(O.args)
30-
if isequal(O.args[i], x)
31-
O.args[i] = y
32-
elseif typeof(O.args[i]) <: Operation
33-
find_replace!(O.args[i],x,y)
34-
end
35-
end
36-
end
37-
3822
# For inv
3923
Base.convert(::Type{Operation}, x::Number) = Operation(identity, Expression[Constant(x)])
4024
Base.convert(::Type{Operation}, x::Operation) = x

src/systems/diffeqs/first_order_transform.jl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
extract_idv(eq::DiffEq) = eq.D.x
2-
31
function lower_varname(D::Differential, x; lower=false)
42
order = lower ? D.order-1 : D.order
53
return lower_varname(x, D.x, order)
@@ -21,7 +19,7 @@ function ode_order_lowering(eqs, iv)
2119
new_eqs = similar(eqs, DiffEq)
2220

2321
for (i, eq) enumerate(eqs)
24-
var, maxorder = extract_var_order(eq)
22+
var, maxorder = eq.var, eq.D.order
2523
maxorder == 1 && continue # fast pass
2624
if maxorder > get(var_order, var, 0)
2725
var_order[var] = maxorder
@@ -51,6 +49,4 @@ function rename(O::Expression)
5149
return Operation(O.op, rename.(O.args))
5250
end
5351

54-
extract_var_order(eq::DiffEq) = (eq.var, eq.D.order)
55-
5652
export ode_order_lowering

src/utils.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ function build_expr(head::Symbol, args)
1717
append!(ex.args, args)
1818
ex
1919
end
20-
expr_arr_to_block(exprs) = build_expr(:block, exprs)
2120

2221
# used in parsing
2322
isblock(x) = length(x) == 1 && x[1] isa Expr && x[1].head == :block
@@ -31,11 +30,6 @@ function flatten_expr!(x)
3130
x
3231
end
3332

34-
function partition(f, xs)
35-
idxs = map(f, xs)
36-
return (xs[idxs], xs[(!).(idxs)])
37-
end
38-
3933
is_constant(::Constant) = true
4034
is_constant(::Any) = false
4135

0 commit comments

Comments
 (0)