summaryrefslogtreecommitdiff
path: root/lib/src
diff options
context:
space:
mode:
Diffstat (limited to 'lib/src')
-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