From 4312dd98eb34b36cba2d654704719a6edb4497b9 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Thu, 24 Jan 2019 18:29:57 -0500 Subject: updated square lattice graph construction to use new crossing info --- lib/src/graph.cpp | 8 ++++++-- 1 file 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 -- cgit v1.2.3-70-g09d2