summaryrefslogtreecommitdiff
path: root/src/net_currents.c
diff options
context:
space:
mode:
authorJaron <jaron@kent-dobias.com>2017-06-22 22:40:47 -0400
committerJaron <jaron@kent-dobias.com>2017-06-22 22:40:47 -0400
commitd59fc339a40a47405bfef8c1313e324adca70479 (patch)
treeaddf46044c3a1507bd4069797c6218c457b67e5f /src/net_currents.c
parentf4a50f1332ff323c42aa9664292910fd78933c15 (diff)
parent4764d5d407347d4dd5990411b243b3ec4bd75bff (diff)
downloadfuse_networks-d59fc339a40a47405bfef8c1313e324adca70479.tar.gz
fuse_networks-d59fc339a40a47405bfef8c1313e324adca70479.tar.bz2
fuse_networks-d59fc339a40a47405bfef8c1313e324adca70479.zip
lots of changes for merge
Diffstat (limited to 'src/net_currents.c')
-rw-r--r--src/net_currents.c51
1 files changed, 0 insertions, 51 deletions
diff --git a/src/net_currents.c b/src/net_currents.c
deleted file mode 100644
index 9bb2874..0000000
--- a/src/net_currents.c
+++ /dev/null
@@ -1,51 +0,0 @@
-
-#include "fracture.h"
-
-double *net_currents(const net_t *net, const double *voltages, cholmod_common *c) {
- uint_t ne = net->graph->ne;
- uint_t dim = net->graph->nv;
- cholmod_sparse *voltcurmat = net->graph->voltcurmat;
-
- cholmod_dense *x = CHOL_F(allocate_dense)(dim, 1, dim, CHOLMOD_REAL, c);
-
- double *tmp_x = x->x;
- x->x = (void *)voltages;
-
- cholmod_dense *y = CHOL_F(allocate_dense)(ne, 1, ne, CHOLMOD_REAL, c);
-
- double alpha[2] = {1, 0};
- double beta[2] = {0, 0};
- CHOL_F(sdmult)(voltcurmat, 0, alpha, beta, x, y, c);
-
- double *currents = (double *)malloc(ne * sizeof(double));
-
- for (int i = 0; i < ne; i++) {
- if (net->fuses[i]) {
- currents[i] = 0;
- } else {
- currents[i] = ((double *)y->x)[i];
- }
- }
-
- if (net->graph->boundary == TORUS_BOUND) {
- for (uint_t i = 0; i < net->graph->bi[1]; i++) {
- uint_t e = net->graph->b[i];
- uint_t v1 = net->graph->ev[2 * e];
- uint_t v2 = net->graph->ev[2 * e + 1];
- double v1y = net->graph->vx[2 * v1 + 1];
- double v2y = net->graph->vx[2 * v2 + 1];
-
- if (v1y > v2y) {
- currents[e] += 1;
- } else {
- currents[e] -= 1;
- }
- }
- }
-
- x->x = tmp_x;
- CHOL_F(free_dense)(&x, c);
- CHOL_F(free_dense)(&y, c);
-
- return currents;
-}