summaryrefslogtreecommitdiff
path: root/lib/wolff.h
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2018-07-26 16:55:17 -0400
committerJaron Kent-Dobias <jaron@kent-dobias.com>2018-07-26 16:55:17 -0400
commit5f1eb9a12821e7462b7b2853e0d95c8c863bf900 (patch)
tree6aa091a95846923e253a83886c5da2a8a62d5e93 /lib/wolff.h
parent1160baa61bad605cf8a1d583e8ae356a54a942df (diff)
downloadc++-5f1eb9a12821e7462b7b2853e0d95c8c863bf900.tar.gz
c++-5f1eb9a12821e7462b7b2853e0d95c8c863bf900.tar.bz2
c++-5f1eb9a12821e7462b7b2853e0d95c8c863bf900.zip
now using const passing of object reference instead of pointers
Diffstat (limited to 'lib/wolff.h')
-rw-r--r--lib/wolff.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/wolff.h b/lib/wolff.h
index a4a663c..498f7f3 100644
--- a/lib/wolff.h
+++ b/lib/wolff.h
@@ -3,18 +3,18 @@
#include "state.h"
template <class R_t, class X_t>
-void wolff(count_t N, state_t <R_t, X_t> *s, std::function <R_t(gsl_rng *, X_t s0)> gen_R, std::function <void(const state_t <R_t, X_t> *)> measurements, gsl_rng *r, bool silent) {
+void wolff(count_t N, state_t <R_t, X_t>& s, std::function <R_t(gsl_rng *, X_t s0)> gen_R, std::function <void(const state_t <R_t, X_t>&)> measurements, gsl_rng *r, bool silent) {
#ifdef FINITE_STATES
- initialize_probs(s->J, s->H, s->T);
+ initialize_probs(s.J, s.H, s.T);
#endif
if (!silent) printf("\n");
for (count_t steps = 0; steps < N; steps++) {
- if (!silent) printf("\033[F\033[JWOLFF: step %" PRIu64 " / %" PRIu64 ": E = %.2f, S = %" PRIv "\n", steps, N, s->E, s->last_cluster_size);
+ if (!silent) printf("\033[F\033[JWOLFF: step %" PRIu64 " / %" PRIu64 ": E = %.2f, S = %" PRIv "\n", steps, N, s.E, s.last_cluster_size);
- v_t v0 = gsl_rng_uniform_int(r, s->nv);
- R_t step = gen_R(r, s->spins[v0]);
+ v_t v0 = gsl_rng_uniform_int(r, s.nv);
+ R_t step = gen_R(r, s.spins[v0]);
flip_cluster <R_t, X_t> (s, v0, step, r);
measurements(s);
@@ -23,7 +23,7 @@ void wolff(count_t N, state_t <R_t, X_t> *s, std::function <R_t(gsl_rng *, X_t s
if (!silent) {
printf("\033[F\033[J");
}
- printf("WOLFF: step %" PRIu64 " / %" PRIu64 ": E = %.2f, S = %" PRIv "\n", N, N, s->E, s->last_cluster_size);
+ printf("WOLFF: step %" PRIu64 " / %" PRIu64 ": E = %.2f, S = %" PRIv "\n", N, N, s.E, s.last_cluster_size);
}