summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2019-01-24 18:29:57 -0500
committerJaron Kent-Dobias <jaron@kent-dobias.com>2019-01-24 18:29:57 -0500
commit4312dd98eb34b36cba2d654704719a6edb4497b9 (patch)
tree0f4393c8d798a58c040ba1ddacd16a76f7f07225
parent47c58a2acad34d3de0bb784ea6aca7b55ed9ce92 (diff)
downloadfuse_networks-4312dd98eb34b36cba2d654704719a6edb4497b9.tar.gz
fuse_networks-4312dd98eb34b36cba2d654704719a6edb4497b9.tar.bz2
fuse_networks-4312dd98eb34b36cba2d654704719a6edb4497b9.zip
updated square lattice graph construction to use new crossing info
-rw-r--r--lib/src/graph.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/src/graph.cpp b/lib/src/graph.cpp
index 2bd62a5..f59a817 100644
--- a/lib/src/graph.cpp
+++ b/lib/src/graph.cpp
@@ -55,14 +55,18 @@ graph::graph(unsigned int Nx, unsigned int Ny) {
unsigned int v1 = (Nx * x) / 2 + ((y + x % 2) / 2) % (Nx / 2);
unsigned int v2 = ((Nx * (x + 1)) / 2 + ((y + (x + 1) % 2) / 2) % (Nx / 2)) % nv;
- edges.push_back({{v1, v2}, {0.5 + (double)y, 0.5 + (double)x}});
+ bool crossed_x = y == Nx - 1;
+ bool crossed_y = x == Ny - 1;
+
+ edges.push_back({{v1, v2}, {0.5 + (double)y, 0.5 + (double)x}, {crossed_x, crossed_y}});
unsigned int dv1 = (Nx * x) / 2 + ((y + (x + 1) % 2) / 2) % (Nx / 2);
unsigned int dv2 = ((Nx * (x + 1)) / 2 + ((y + x % 2) / 2) % (Nx / 2)) % nv;
- dual_edges.push_back({{dv1, dv2}, {0.5 + (double)y, 0.5 + (double)x}});
+ dual_edges.push_back({{dv1, dv2}, {0.5 + (double)y, 0.5 + (double)x}, {crossed_x, crossed_y}});
}
}
+
}
class eulerException: public std::exception