From 3f7f20f21f583ca2de566bea08a87eac4b17ad29 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Mon, 23 Sep 2019 23:19:13 -0400 Subject: successfully implemented the backbone trimming with homespun graph algorithms, measurements have mostly been disabled and need to be migrated --- lib/src/graph.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'lib/src/graph.cpp') diff --git a/lib/src/graph.cpp b/lib/src/graph.cpp index bfdb952..a5063de 100644 --- a/lib/src/graph.cpp +++ b/lib/src/graph.cpp @@ -44,7 +44,7 @@ graph::graph(unsigned Nx, unsigned Ny) { dual_vertices[i].r.x = (double)((i / (Nx / 2)) % 2 + 2 * (i % (Nx / 2))); dual_vertices[i].r.y = (double)(i / (Nx / 2)); - dual_vertices[i].nd = {i, (i + Nx / 2) % nv, Nx * (i / (Nx / 2)) + (i % (Nx / 2)), (nv + i - Nx / 2) % nv}; + dual_vertices[i].nd = {i, (i + Nx / 2) % nv, Nx / 2 * (i / (Nx / 2)) + ((i + f) % (Nx / 2)), (nv + i - Nx / 2) % nv}; dual_vertices[i].polygon = { {dual_vertices[i].r.x - 1.0, vertices[i].r.y}, {dual_vertices[i].r.x, vertices[i].r.y - 1.0}, @@ -93,6 +93,16 @@ graph::graph(unsigned Nx, unsigned Ny) { } } + for (vertex& v : dual_vertices) { + v.ne.reserve(v.nd.size()); + } + + for (unsigned i = 0; i < dual_edges.size(); i++) { + for (unsigned vi : dual_edges[i].v) { + dual_vertices[vi].ne.push_back(i); + } + } + } class eulerException: public std::exception @@ -411,6 +421,16 @@ void graph::helper(unsigned nv, std::mt19937& rng) { } } + for (vertex& v : dual_vertices) { + v.ne.reserve(v.nd.size()); + } + + for (unsigned i = 0; i < dual_edges.size(); i++) { + for (unsigned vi : dual_edges[i].v) { + dual_vertices[vi].ne.push_back(i); + } + } + jcv_diagram_free(&diagram); } -- cgit v1.2.3-70-g09d2