diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-10-15 22:57:17 -0400 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-10-15 22:57:17 -0400 |
commit | 1343a3fe6bd17a2487f12a0d61be8dc83cd722a0 (patch) | |
tree | fa937f0f3ba0f4977036c862c846a2ee461540ca /lib/include/wolff.hpp | |
parent | 6e8b19e1f1a244ef09e1b63d7593250d6ce01692 (diff) | |
download | c++-1343a3fe6bd17a2487f12a0d61be8dc83cd722a0.tar.gz c++-1343a3fe6bd17a2487f12a0d61be8dc83cd722a0.tar.bz2 c++-1343a3fe6bd17a2487f12a0d61be8dc83cd722a0.zip |
many changes, including reworking the measurements system
Diffstat (limited to 'lib/include/wolff.hpp')
-rw-r--r-- | lib/include/wolff.hpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/include/wolff.hpp b/lib/include/wolff.hpp index c10a211..b730c8d 100644 --- a/lib/include/wolff.hpp +++ b/lib/include/wolff.hpp @@ -3,7 +3,7 @@ #include "wolff/state.hpp" template <class R_t, class X_t> -void wolff(count_t N, state_t <R_t, X_t>& s, std::function <R_t(std::mt19937&, X_t)> gen_R, std::function <void(const state_t <R_t, X_t>&)> measurements, std::mt19937& r, bool silent) { +void wolff(count_t N, state_t <R_t, X_t>& s, std::function <R_t(std::mt19937&, X_t)> gen_R, wolff_measurement<R_t, X_t>& m, std::mt19937& r) { #ifdef FINITE_STATES #ifdef NOFIELD @@ -15,21 +15,16 @@ void wolff(count_t N, state_t <R_t, X_t>& s, std::function <R_t(std::mt19937&, X std::uniform_int_distribution<v_t> dist(0, s.nv); - 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); - v_t v0 = dist(r); R_t step = gen_R(r, s.spins[v0]); - flip_cluster <R_t, X_t> (s, v0, step, r); - measurements(s); - } + m.pre_cluster(s, steps, N, v0, step); + + flip_cluster<R_t, X_t>(s, v0, step, r, m); - if (!silent) { - printf("\033[F\033[J"); + m.post_cluster(s, steps, N); } - printf("WOLFF: step %" PRIu64 " / %" PRIu64 ": E = %.2f, S = %" PRIv "\n", N, N, s.E, s.last_cluster_size); } |