summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpants <jaron@kent-dobias.com>2016-09-08 11:46:00 -0400
committerpants <jaron@kent-dobias.com>2016-09-08 11:46:00 -0400
commita264723b23d9ad6c3cb13450a6cf4b131f8d7338 (patch)
treed3b1c0879d162725e2b887f86381c981019f3a95 /src
parent3c5671310bdada56f5e087b951ac2e4d6086dfbf (diff)
downloadfuse_networks-a264723b23d9ad6c3cb13450a6cf4b131f8d7338.tar.gz
fuse_networks-a264723b23d9ad6c3cb13450a6cf4b131f8d7338.tar.bz2
fuse_networks-a264723b23d9ad6c3cb13450a6cf4b131f8d7338.zip
fixed some problems with square networks
Diffstat (limited to 'src')
-rw-r--r--src/geometry.c4
-rw-r--r--src/graph_create.c7
2 files changed, 5 insertions, 6 deletions
diff --git a/src/geometry.c b/src/geometry.c
index 83ef0bf..ec788f1 100644
--- a/src/geometry.c
+++ b/src/geometry.c
@@ -43,9 +43,9 @@ double dual_vert_to_coord(unsigned int width, bool periodic, unsigned int vert,
bool index) {
if (periodic) {
if (index)
- return vert % (width / 2) + (vert / (width / 2)) % 2;
+ return (2 * vert) % width + (2 * vert / width) % 2;
else
- return vert / (width / 2);
+ return 2 * vert / width;
} else {
if (index)
return (2 * vert) % (width + 1);
diff --git a/src/graph_create.c b/src/graph_create.c
index 5573064..7348142 100644
--- a/src/graph_create.c
+++ b/src/graph_create.c
@@ -246,10 +246,10 @@ graph_t *ini_square_network(uint_t width, bound_t boundary, bool side_bounds,
network->dvx =
(double *)malloc(2 * network->dnv * sizeof(double));
for (uint_t i = 0; i < network->dnv; i++) {
- network->dvx[2 * i] =
- 2*dual_vert_to_coord(width, periodic, i, 0);
network->dvx[2 * i + 1] =
- 2*dual_vert_to_coord(width, periodic, i, 1);
+ dual_vert_to_coord(width, periodic, i, 0) / width;
+ network->dvx[2 * i] =
+ dual_vert_to_coord(width, periodic, i, 1) / width;
}
network->voltcurmat = gen_voltcurmat(network->ne,
@@ -665,7 +665,6 @@ graph_t *ini_voro_graph(uint_t L, bound_t boundary, bool use_dual,
return g;
}
-
graph_t *graph_create(lattice_t lattice, bound_t bound, uint_t L, bool dual, cholmod_common *c) {
bool side_bounds;
switch (lattice) {