Skip to content

Commit 31c59e0

Browse files
committed
crossing_ruleset constant
1 parent 763bf37 commit 31c59e0

File tree

6 files changed

+10
-86
lines changed

6 files changed

+10
-86
lines changed

project/pathwidth.jl

Lines changed: 0 additions & 71 deletions
This file was deleted.

project/vizgadget.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ function viz_gadget(p::Pattern)
6464
end
6565

6666
function pattern2tikz(folder::String)
67-
for (p, sub) in ((Cross{true}(), "crosscon"), (Cross{false}(), "cross"),
68-
(Turn(), "turn"))
67+
for (p, sub) in UnitDiskMapping.crossing_ruleset
6968
open(joinpath(folder, sub*"-udg.tex"), "w") do f
7069
write(f, viz_gadget(p))
7170
end

src/mapping.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,12 @@ end
6969
# TODO:
7070
# 1. check if the resulting graph is a unit-disk
7171
# 2. other simplification rules
72-
function apply_crossing_gadgets!(ug::UGrid, ruleset=(
73-
Cross{false}(),
72+
const crossing_ruleset = (Cross{false}(),
7473
Turn(), WTurn(), Branch(), BranchFix(), TCon(), TrivialTurn(),
7574
RotatedGadget(TCon(), 1), ReflectedGadget(Cross{true}(), "y"),
7675
ReflectedGadget(TrivialTurn(), "y"), BranchFixB(),
77-
ReflectedGadget(RotatedGadget(TCon(), 1), "y"),
78-
))
76+
ReflectedGadget(RotatedGadget(TCon(), 1), "y"))
77+
function apply_crossing_gadgets!(ug::UGrid, ruleset=crossing_ruleset)
7978
tape = Tuple{Pattern,Int,Int}[]
8079
n = length(ug.lines)
8180
for j=1:n # start from 0 because there can be one empty padding column/row.

test/extracting_results.jl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@ using UnitDiskMapping, Test
22
using GraphTensorNetworks
33

44
@testset "map results back" begin
5-
for s in (Cross{false}(), Cross{true}(), Turn(), TCon(),
6-
WTurn(), Branch(), BranchFix(), TrivialTurn(),
7-
RotatedGadget(TCon(), 1), ReflectedGadget(Cross{true}(), "y"),
8-
ReflectedGadget(TrivialTurn(), "y"), BranchFixB(),
9-
ReflectedGadget(RotatedGadget(TCon(), 1), "y"),)
5+
for s in UnitDiskMapping.crossing_ruleset
106
_, g0, pins0 = source_graph(s)
117
locs, g, pins = mapped_graph(s)
128
d1 = mapped_entry_to_compact(s)

test/gadgets.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ using Graphs
2121
end
2222
return true, x
2323
end
24-
for s in (Cross{false}(), Cross{true}(), Turn(),
25-
TrivialTurn(), Branch(), TCon(), BranchFixB(), BranchFix(), WTurn(), RotatedGadget(TCon(), 1),
26-
ReflectedGadget(TCon(), "x")
27-
)
24+
for s in UnitDiskMapping.crossing_ruleset
2825
println("Testing gadget:\n$s")
2926
locs1, g1, pins1 = source_graph(s)
3027
locs2, g2, pins2 = mapped_graph(s)

test/runtests.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
using UnitDiskMapping
22
using Test
33

4+
@testset "utils" begin
5+
include("utils.jl")
6+
end
7+
48
@testset "mapping" begin
59
include("mapping.jl")
610
end

0 commit comments

Comments
 (0)