From 1343a3fe6bd17a2487f12a0d61be8dc83cd722a0 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Mon, 15 Oct 2018 22:57:17 -0400 Subject: many changes, including reworking the measurements system --- examples/src/models/On/wolff_On.cpp | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'examples/src/models/On') diff --git a/examples/src/models/On/wolff_On.cpp b/examples/src/models/On/wolff_On.cpp index ad2ac77..67f28a5 100644 --- a/examples/src/models/On/wolff_On.cpp +++ b/examples/src/models/On/wolff_On.cpp @@ -188,14 +188,12 @@ int main(int argc, char *argv[]) { fclose(outfile_info); - FILE **outfiles = measure_setup_files(measurement_flags, timestamp); - - std::function other_f; + std::function &)> other_f; uint64_t sum_of_clusterSize = 0; if (N_is_sweeps) { - other_f = [&] (const On_t& s) { - sum_of_clusterSize += s.last_cluster_size; + other_f = [&] (const On_t& s, const wolff_research_measurements& m) { + sum_of_clusterSize += m.last_cluster_size; }; } else if (draw) { #ifdef HAVE_GLUT @@ -209,7 +207,7 @@ int main(int argc, char *argv[]) { glLoadIdentity(); gluOrtho2D(0.0, L, 0.0, L); - other_f = [&] (const On_t& s) { + other_f = [&] (const On_t& s, const wolff_research_measurements& m) { glClear(GL_COLOR_BUFFER_BIT); for (v_t i = 0; i < pow(L, 2); i++) { #ifdef NOFIELD @@ -228,11 +226,9 @@ int main(int argc, char *argv[]) { }; #endif } else { - other_f = [] (const On_t& s) {}; + other_f = [] (const On_t& s, const wolff_research_measurements& m) {}; } - std::function measurements = measure_function_write_files(measurement_flags, outfiles, other_f); - std::function H; if (modulated_field) { @@ -251,20 +247,21 @@ int main(int argc, char *argv[]) { state_t s(D, L, T, dot ); #endif + wolff_research_measurements m(measurement_flags, timestamp, other_f, s, silent); + if (N_is_sweeps) { count_t N_rounds = 0; printf("\n"); while (sum_of_clusterSize < N * s.nv) { - printf("\033[F\033[J\033[F\033[JWOLFF: sweep %" PRIu64 " / %" PRIu64 ": E = %.2f, S = %" PRIv "\n", (count_t)((double)sum_of_clusterSize / (double)s.nv), N, s.E, s.last_cluster_size); - wolff (N, s, gen_R, measurements, rng, silent); + printf("\033[F\033[J\033[F\033[JWOLFF: sweep %" PRIu64 " / %" PRIu64 ": E = %.2f, S = %" PRIv "\n", (count_t)((double)sum_of_clusterSize / (double)s.nv), N, m.E, m.last_cluster_size); + wolff (N, s, gen_R, m, rng); N_rounds++; } - printf("\033[F\033[J\033[F\033[JWOLFF: sweep %" PRIu64 " / %" PRIu64 ": E = %.2f, S = %" PRIv "\n\n", (count_t)((double)sum_of_clusterSize / (double)s.nv), N, s.E, s.last_cluster_size); + printf("\033[F\033[J\033[F\033[JWOLFF: sweep %" PRIu64 " / %" PRIu64 ": E = %.2f, S = %" PRIv "\n\n", (count_t)((double)sum_of_clusterSize / (double)s.nv), N, m.E, m.last_cluster_size); } else { - wolff (N, s, gen_R, measurements, rng, silent); + wolff (N, s, gen_R, m, rng); } - measure_free_files(measurement_flags, outfiles); free(H_vec); return 0; -- cgit v1.2.3-70-g09d2