summaryrefslogtreecommitdiff
path: root/lib/src/graph.cpp
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2019-01-14 15:47:59 -0500
committerJaron Kent-Dobias <jaron@kent-dobias.com>2019-01-14 15:47:59 -0500
commit49ac78a6c04e215950bc9c0f97368605e63da15b (patch)
tree64b770c543a0c90bc7dcbc06ceaaa31e96e541ce /lib/src/graph.cpp
parent994cbf1a3b611ff4c94ced3b1630e51fd249d7ed (diff)
downloadc++-49ac78a6c04e215950bc9c0f97368605e63da15b.tar.gz
c++-49ac78a6c04e215950bc9c0f97368605e63da15b.tar.bz2
c++-49ac78a6c04e215950bc9c0f97368605e63da15b.zip
Large refactoring around changes in the graph class.
- Graphs now use lists of references instead of vectors of indicies. - Vertices and edges have associated classes that can be given arbitrary properties via template specification. - All essential library headers have been combined into one, wolff.hpp.
Diffstat (limited to 'lib/src/graph.cpp')
-rw-r--r--lib/src/graph.cpp55
1 files changed, 0 insertions, 55 deletions
diff --git a/lib/src/graph.cpp b/lib/src/graph.cpp
deleted file mode 100644
index 4f91be4..0000000
--- a/lib/src/graph.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-
-#include <wolff/graph.hpp>
-
-namespace wolff {
-
-graph::graph() {
- D = 0;
- L = 0;
- nv = 0;
- ne = 0;
-}
-
-graph::graph(D_t D, L_t L) : D(D), L(L) {
- nv = pow(L, D);
- ne = D * nv;
-
- adjacency.resize(nv);
- coordinate.resize(nv);
-
- for (std::vector<v_t> adj_i : adjacency) {
- adj_i.reserve(2 * D);
- }
-
- for (v_t i = 0; i < nv; i++) {
- coordinate[i].resize(D);
- for (D_t j = 0; j < D; j++) {
- coordinate[i][j] = (i / (v_t)pow(L, D - j - 1)) % L;
-
- adjacency[i].push_back(pow(L, j + 1) * (i / ((v_t)pow(L, j + 1))) + fmod(i + pow(L, j), pow(L, j + 1)));
- adjacency[i].push_back(pow(L, j + 1) * (i / ((v_t)pow(L, j + 1))) + fmod(pow(L, j+1) + i - pow(L, j), pow(L, j + 1)));
- }
- }
-}
-
-void graph::add_ghost() {
- for (std::vector<v_t>& adj_i : adjacency) {
- adj_i.push_back(nv);
- }
-
- adjacency.resize(nv + 1);
- coordinate.resize(nv + 1);
- adjacency[nv].reserve(nv);
-
- for (v_t i = 0; i < nv; i++) {
- adjacency[nv].push_back(i);
- }
-
- coordinate[nv].resize(coordinate[0].size());
-
- ne += nv;
- nv++;
-}
-
-}
-