From 9be622f7703193cde9955b9663cea1259ac48efc Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Wed, 25 Jul 2018 18:14:55 -0400 Subject: trying some new c++ things, starting with graph --- lib/cluster.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'lib/cluster.h') diff --git a/lib/cluster.h b/lib/cluster.h index 3261969..03b0ac0 100644 --- a/lib/cluster.h +++ b/lib/cluster.h @@ -36,11 +36,7 @@ void flip_cluster(state_t *state, v_t v0, R_t r, gsl_rng *rand) { si_new = act (r, si_old); } - v_t nn = state->g->v_i[v + 1] - state->g->v_i[v]; - - for (v_t i = 0; i < nn; i++) { - v_t vn = state->g->v_adj[state->g->v_i[v] + i]; - + for (v_t vn : state->g.v_adj[v]) { X_t sj; if (vn != state->nv) { @@ -101,7 +97,7 @@ void flip_cluster(state_t *state, v_t v0, R_t r, gsl_rng *rand) { } } - if (v == state->g->nv - 1) { + if (v == state->nv) { free_spin(state->R); state->R = R_new; } else { @@ -109,7 +105,7 @@ void flip_cluster(state_t *state, v_t v0, R_t r, gsl_rng *rand) { state->spins[v] = si_new; } - if (v != state->g->nv - 1) { // count the number of non-external sites that flip + if (v != state->nv) { // count the number of non-external sites that flip nv++; } } -- cgit v1.2.3-70-g09d2