Skip to content

Commit a30df65

Browse files
committed
rename At to EvalAt
1 parent f50dc26 commit a30df65

File tree

4 files changed

+27
-27
lines changed

4 files changed

+27
-27
lines changed

src/ModelingToolkit.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ function var_derivative_graph! end
142142
include("bipartite_graph.jl")
143143
using .BipartiteGraphs
144144

145-
export At
145+
export EvalAt
146146
include("variables.jl")
147147
include("parameters.jl")
148148
include("independent_variables.jl")

src/variables.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -616,11 +616,11 @@ getshift(x::Symbolic) = Symbolics.getmetadata(x, VariableShift, 0)
616616
###################
617617
### Evaluate at ###
618618
###################
619-
struct At <: Symbolics.Operator
619+
struct EvalAt <: Symbolics.Operator
620620
t::Union{Symbolic, Number}
621621
end
622622

623-
function (A::At)(x::Symbolic)
623+
function (A::EvalAt)(x::Symbolic)
624624
if symbolic_type(x) == NotSymbolic() || !iscall(x)
625625
if x isa Symbolics.CallWithMetadata
626626
return x(A.t)
@@ -637,18 +637,18 @@ function (A::At)(x::Symbolic)
637637
A(x)
638638
else
639639
length(arguments(x)) !== 1 &&
640-
error("Variable $x has too many arguments. At can only be applied to one-argument variables.")
640+
error("Variable $x has too many arguments. EvalAt can only be applied to one-argument variables.")
641641
(symbolic_type(only(arguments(x))) !== ScalarSymbolic()) && return x
642642
return operation(x)(A.t)
643643
end
644644
end
645645

646-
function (A::At)(x::Union{Num, Symbolics.Arr})
646+
function (A::EvalAt)(x::Union{Num, Symbolics.Arr})
647647
wrap(A(unwrap(x)))
648648
end
649-
SymbolicUtils.isbinop(::At) = false
649+
SymbolicUtils.isbinop(::EvalAt) = false
650650

651-
Base.nameof(::At) = :At
652-
Base.show(io::IO, A::At) = print(io, "At(", A.t, ")")
653-
Base.:(==)(A1::At, A2::At) = isequal(A1.t, A2.t)
654-
Base.hash(A::At, u::UInt) = hash(A.t, u)
651+
Base.nameof(::EvalAt) = :EvalAt
652+
Base.show(io::IO, A::EvalAt) = print(io, "EvalAt(", A.t, ")")
653+
Base.:(==)(A1::EvalAt, A2::EvalAt) = isequal(A1.t, A2.t)
654+
Base.hash(A::EvalAt, u::UInt) = hash(A.t, u)

test/model_parsing.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,12 +1037,12 @@ end
10371037
x ~ y
10381038
end
10391039
@constraints begin
1040-
At(0.3)(x) ~ 3
1040+
EvalAt(0.3)(x) ~ 3
10411041
y 4
10421042
end
10431043
@costs begin
10441044
x + y
1045-
At(1)(y)^2
1045+
EvalAt(1)(y)^2
10461046
end
10471047
@consolidate f(u) = u[1]^2 + log(u[2])
10481048
end
@@ -1053,8 +1053,8 @@ end
10531053
costs = ModelingToolkit.get_costs(ex)
10541054
constrs = ModelingToolkit.get_constraints(ModelingToolkit.get_constraintsystem(ex))
10551055
@test isequal(costs[1], ex.x + ex.y)
1056-
@test isequal(costs[2], At(1)(ex.y)^2)
1057-
@test isequal(constrs[1], -3 + At(0.3)(ex.x) ~ 0)
1056+
@test isequal(costs[2], EvalAt(1)(ex.y)^2)
1057+
@test isequal(constrs[1], -3 + EvalAt(0.3)(ex.x) ~ 0)
10581058
@test isequal(constrs[2], -4 + ex.y 0)
10591059
@test ModelingToolkit.get_consolidate(ex)([1, 2]) 1 + log(2)
10601060
end

test/variable_utils.jl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -164,23 +164,23 @@ end
164164
@variables x(t) v(..) w(t)[1:3]
165165
@parameters y z(u, t) r[1:3]
166166

167-
@test At(1)(x) isa Num
168-
@test isequal(At(1)(y), y)
169-
@test_throws ErrorException At(1)(z)
170-
@test isequal(At(1)(v), v(1))
171-
@test isequal(At(1)(v(t)), v(1))
172-
@test isequal(At(1)(v(2)), v(2))
167+
@test EvalAt(1)(x) isa Num
168+
@test isequal(EvalAt(1)(y), y)
169+
@test_throws ErrorException EvalAt(1)(z)
170+
@test isequal(EvalAt(1)(v), v(1))
171+
@test isequal(EvalAt(1)(v(t)), v(1))
172+
@test isequal(EvalAt(1)(v(2)), v(2))
173173

174-
arr = At(1)(w)
175-
var = At(1)(w[1])
174+
arr = EvalAt(1)(w)
175+
var = EvalAt(1)(w[1])
176176
@test arr isa Symbolics.Arr
177177
@test var isa Num
178178

179-
@test isequal(At(1)(r), r)
180-
@test isequal(At(1)(r[2]), r[2])
179+
@test isequal(EvalAt(1)(r), r)
180+
@test isequal(EvalAt(1)(r[2]), r[2])
181181

182182
_x = ModelingToolkit.unwrap(x)
183-
@test At(1)(_x) isa Symbolics.BasicSymbolic
184-
@test only(arguments(At(1)(_x))) == 1
185-
@test At(1)(D(x)) isa Num
183+
@test EvalAt(1)(_x) isa Symbolics.BasicSymbolic
184+
@test only(arguments(EvalAt(1)(_x))) == 1
185+
@test EvalAt(1)(D(x)) isa Num
186186
end

0 commit comments

Comments
 (0)