Switch element abbreviation from "elem" to "elt"

This commit is contained in:
Aaron Fenyes 2024-02-04 16:08:13 -05:00
parent a3f3f6a31b
commit 21f09c4a4d

View File

@ -72,21 +72,21 @@ const coordnames = IdDict{Symbol, Vector{Union{Symbol, Nothing}}}(
nameof(Sphere) => [:rₛ, :sₛ, :xₛ, :yₛ, :zₛ] nameof(Sphere) => [:rₛ, :sₛ, :xₛ, :yₛ, :zₛ]
) )
coordname(elem::Element, index) = coordnames[nameof(typeof(elem))][index] coordname(elt::Element, index) = coordnames[nameof(typeof(elt))][index]
function pushcoordname!(coordnamelist, indexed_elem::Tuple{Any, Element}, coordindex) function pushcoordname!(coordnamelist, indexed_elt::Tuple{Any, Element}, coordindex)
elemindex, elem = indexed_elem eltindex, elt = indexed_elt
name = coordname(elem, coordindex) name = coordname(elt, coordindex)
if !isnothing(name) if !isnothing(name)
subscript = Subscripts.sub(string(elemindex)) subscript = Subscripts.sub(string(eltindex))
push!(coordnamelist, Symbol(name, subscript)) push!(coordnamelist, Symbol(name, subscript))
end end
end end
function takecoord!(coordlist, indexed_elem::Tuple{Any, Element}, coordindex) function takecoord!(coordlist, indexed_elt::Tuple{Any, Element}, coordindex)
elem = indexed_elem[2] elt = indexed_elt[2]
if !isnothing(coordname(elem, coordindex)) if !isnothing(coordname(elt, coordindex))
push!(elem.coords, popfirst!(coordlist)) push!(elt.coords, popfirst!(coordlist))
end end
end end
@ -132,12 +132,12 @@ mutable struct Construction{T}
end end
end end
function Base.push!(ctx::Construction{T}, elem::Point{T}) where T function Base.push!(ctx::Construction{T}, elt::Point{T}) where T
push!(ctx.points, elem) push!(ctx.points, elt)
end end
function Base.push!(ctx::Construction{T}, elem::Sphere{T}) where T function Base.push!(ctx::Construction{T}, elt::Sphere{T}) where T
push!(ctx.spheres, elem) push!(ctx.spheres, elt)
end end
function Base.push!(ctx::Construction{T}, rel::Relation{T}) where T function Base.push!(ctx::Construction{T}, rel::Relation{T}) where T
@ -150,10 +150,10 @@ end
function realize(ctx::Construction{T}) where T function realize(ctx::Construction{T}) where T
# collect coordinate names # collect coordinate names
coordnamelist = Symbol[] coordnamelist = Symbol[]
elemenum = enumerate(Iterators.flatten((ctx.spheres, ctx.points))) eltenum = enumerate(Iterators.flatten((ctx.spheres, ctx.points)))
for coordindex in 1:5 for coordindex in 1:5
for indexed_elem in elemenum for indexed_elt in eltenum
pushcoordname!(coordnamelist, indexed_elem, coordindex) pushcoordname!(coordnamelist, indexed_elt, coordindex)
end end
end end
@ -161,24 +161,24 @@ function realize(ctx::Construction{T}) where T
coordring, coordqueue = polynomial_ring(parent_type(T)(), coordnamelist, ordering = :degrevlex) coordring, coordqueue = polynomial_ring(parent_type(T)(), coordnamelist, ordering = :degrevlex)
# retrieve coordinates # retrieve coordinates
for (_, elem) in elemenum for (_, elt) in eltenum
empty!(elem.coords) empty!(elt.coords)
end end
for coordindex in 1:5 for coordindex in 1:5
for indexed_elem in elemenum for indexed_elt in eltenum
takecoord!(coordqueue, indexed_elem, coordindex) takecoord!(coordqueue, indexed_elt, coordindex)
end end
end end
# construct coordinate vectors # construct coordinate vectors
for (_, elem) in elemenum for (_, elt) in eltenum
buildvec!(elem) buildvec!(elt)
end end
# turn relations into equations # turn relations into equations
eqns = vcat( eqns = vcat(
equation.(ctx.relations), equation.(ctx.relations),
[elem.rel for (_, elem) in elemenum if !isnothing(elem.rel)] [elt.rel for (_, elt) in eltenum if !isnothing(elt.rel)],
) )
Generic.Ideal(coordring, eqns) Generic.Ideal(coordring, eqns)
end end