Skip to content

Commit

Permalink
Remove redundant pointer transfer helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
lukem12345 committed Jun 26, 2024
1 parent 137a8bc commit 813f521
Showing 1 changed file with 0 additions and 69 deletions.
69 changes: 0 additions & 69 deletions src/openoperators.jl
Original file line number Diff line number Diff line change
@@ -1,72 +1,3 @@
# Transferring pointers
# --------------------

""" function transfer_parents!(d::SummationDecapode, x, y)
Transfer the parents of x to y. Also transfer TVar status from x to y.
"""
function transfer_parents!(d::SummationDecapode, x, y)
#set_subpart!(d, incident(d, x, [:tgt], copy=true), :tgt, y)
#set_subpart!(d, incident(d, x, [:res], copy=true), :res, y)
#set_subpart!(d, incident(d, x, [:sum], copy=true), :sum, y)
#set_subpart!(d, incident(d, x, [:incl], copy=true), :incl, y)
# XXX: This avoids allocations.
for i in parts(d, :Op1)
if d.subparts.tgt[i] == x
d.subparts.tgt[i] = y
end
end
for i in parts(d, :Op2)
if d.subparts.res[i] == x
d.subparts.res[i] = y
end
end
for i in parts(d, )
if d.subparts.sum[i] == x
d.subparts.sum[i] = y
end
end
for i in parts(d, :TVar)
if d.subparts.incl[i] == x
d.subparts.incl[i] = y
end
end
d
end

""" function transfer_children!(d::SummationDecapode, x, y)
Transfer the children of x to y.
"""
function transfer_children!(d::SummationDecapode, x, y)
#set_subpart!(d, incident(d, x, [:src], copy=true), :src, y)
#set_subpart!(d, incident(d, x, [:proj1], copy=true), :proj1, y)
#set_subpart!(d, incident(d, x, [:proj2], copy=true), :proj2, y)
#set_subpart!(d, incident(d, x, [:summand], copy=true), :summand, y)
# XXX: This avoids allocations.
for i in parts(d, :Op1)
if d.subparts.src[i] == x
d.subparts.src[i] = y
end
end
for i in parts(d, :Op2)
if d.subparts.proj1[i] == x
d.subparts.proj1[i] = y
end
end
for i in parts(d, :Op2)
if d.subparts.proj2[i] == x
d.subparts.proj2[i] = y
end
end
for i in parts(d, :Summand)
if d.subparts.summand[i] == x
d.subparts.summand[i] = y
end
end
d
end

# Opening up Op1s
# --------------

Expand Down

0 comments on commit 813f521

Please sign in to comment.