diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2017-01-15 00:50:38 -0500 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2017-01-15 00:50:38 -0500 |
commit | 57857b9ebfb2c0a78c2eb1128d3fb4ed8d597ec4 (patch) | |
tree | 805830d2729ad1fec1711c9b6ecb0890088d904a | |
parent | a66e8e2d7a1e9d5eb51f4954435513f6ecb8383c (diff) | |
download | fuse_networks-57857b9ebfb2c0a78c2eb1128d3fb4ed8d597ec4.tar.gz fuse_networks-57857b9ebfb2c0a78c2eb1128d3fb4ed8d597ec4.tar.bz2 fuse_networks-57857b9ebfb2c0a78c2eb1128d3fb4ed8d597ec4.zip |
about to change a whole bunch to get voltage and toriodal boundaries working
-rw-r--r-- | src/fracture.c | 4 | ||||
-rw-r--r-- | src/gen_laplacian.c | 37 |
2 files changed, 13 insertions, 28 deletions
diff --git a/src/fracture.c b/src/fracture.c index af9cd0f..1ed594f 100644 --- a/src/fracture.c +++ b/src/fracture.c @@ -327,8 +327,8 @@ int main(int argc, char *argv[]) { FILE *testout = fopen("test.txt", "w"); double *tmp_voltage = net_voltages(net, &c); - for (uint_t j = 0; j < g->bound_inds[1]; j++) { - fprintf(testout, "%g ", tmp_voltage[g->bound_verts[j]]-tmp_voltage[g->nv+j]); + for (uint_t j = 0; j < g->nv; j++) { + fprintf(testout, "%g ", tmp_voltage[j]); } fclose(testout); free(tmp_voltage); diff --git a/src/gen_laplacian.c b/src/gen_laplacian.c index 04f1f9b..411734c 100644 --- a/src/gen_laplacian.c +++ b/src/gen_laplacian.c @@ -106,7 +106,7 @@ cholmod_sparse *gen_laplacian(const net_t *instance, cholmod_common *c, } else { num_gedges = network->bound_inds[num_bounds] + (num_bounds - 2) * 2; } - if (network->boundary == TORUS_BOUND) num_gedges = 3 * bound_inds[1]; + if (network->boundary == TORUS_BOUND) num_gedges = bound_inds[1]; uint_t num_gverts = network->break_dim; uint_t nnz = num_gverts + 2 * num_gedges; @@ -147,45 +147,30 @@ cholmod_sparse *gen_laplacian(const net_t *instance, cholmod_common *c, acoo[num_gverts + 2*i+1] = -1; acoo[vv]++; acoo[network->nv + i]++; - - rowind[num_gverts + 2 * network->bound_inds[1] + 2*i] = network->nv + i; - colind[num_gverts + 2 * network->bound_inds[1] + 2*i] = network->nv + network->bound_inds[1]; - acoo[num_gverts + 2 * network->bound_inds[1] + 2*i] = -1; - rowind[num_gverts + 2 * network->bound_inds[1] + 2*i+1] = network->nv + network->bound_inds[1]; - colind[num_gverts + 2 * network->bound_inds[1] + 2*i+1] = network->nv + i; - acoo[num_gverts + 2 * network->bound_inds[1] + 2*i+1] = -1; - acoo[network->nv + i]++; - acoo[network->nv + network->bound_inds[1]]++; - - rowind[num_gverts + 4 * network->bound_inds[1] + 2*i] = vv; - colind[num_gverts + 4 * network->bound_inds[1] + 2*i] = network->nv + network->bound_inds[1]; - acoo[num_gverts + 4 * network->bound_inds[1] + 2*i] = -1; - rowind[num_gverts + 4 * network->bound_inds[1] + 2*i+1] = network->nv + network->bound_inds[1]; - colind[num_gverts + 4 * network->bound_inds[1] + 2*i+1] = vv; - acoo[num_gverts + 4 * network->bound_inds[1] + 2*i+1] = -1; - acoo[vv]++; - acoo[network->nv + network->bound_inds[1]]++; } acoo[bound_verts[0]]++; } if (network->boundary != TORUS_BOUND) { - if (network->boundary != EMBEDDED_BOUND) acoo[0]++; - if (voltage_bound) { for (uint_t i = 0; i < num_bounds; i++) { for (uint_t j = 0; j < bound_inds[i + 1] - bound_inds[i]; j++) { acoo[bound_verts[bound_inds[i] + j]]++; - rowind[num_gverts + 2 * (bound_inds[i] + j)] = network->nv; - colind[num_gverts + 2 * (bound_inds[i] + j)] = bound_verts[bound_inds[i] + j]; - rowind[num_gverts + 2 * (bound_inds[i] + j) + 1] = bound_verts[bound_inds[i] + j]; - colind[num_gverts + 2 * (bound_inds[i] + j) + 1] = network->nv; - acoo[network->nv]++; + + rowind[nnz - 1 - 2 * (bound_inds[i] + j)] = bound_verts[bound_inds[i] + j]; + colind[nnz - 1 - 2 * (bound_inds[i] + j)] = num_gverts - 1; + acoo[nnz - 1 - 2 * (bound_inds[i] + j)] = -1; + rowind[nnz - 1 - 2 * (bound_inds[i] + j) - 1] = num_gverts - 1; + colind[nnz - 1 - 2 * (bound_inds[i] + j) - 1] = bound_verts[bound_inds[i] + j]; + acoo[nnz - 1 - 2 * (bound_inds[i] + j) - 1] = -1; + acoo[num_gverts - 1]++; acoo[bound_verts[bound_inds[i] + j]]++; } } } else { for (uint_t i = 0; i < num_bounds; i++) { + if (network->boundary != EMBEDDED_BOUND) acoo[0]++; + rowind[num_verts + i] = num_verts + i; colind[num_verts + i] = num_verts + i; if (i < 2) |