summaryrefslogtreecommitdiff
path: root/examples/src/models/ising/wolff_ising.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/src/models/ising/wolff_ising.cpp')
-rw-r--r--examples/src/models/ising/wolff_ising.cpp25
1 files changed, 10 insertions, 15 deletions
diff --git a/examples/src/models/ising/wolff_ising.cpp b/examples/src/models/ising/wolff_ising.cpp
index f7a3ada..de04f32 100644
--- a/examples/src/models/ising/wolff_ising.cpp
+++ b/examples/src/models/ising/wolff_ising.cpp
@@ -127,14 +127,12 @@ int main(int argc, char *argv[]) {
return z2_t(true);
};
- FILE **outfiles = measure_setup_files(measurement_flags, timestamp);
-
- std::function <void(const state_t<z2_t, ising_t>&)> other_f;
+ std::function <void(const state_t<z2_t, ising_t>&, const wolff_research_measurements<z2_t, ising_t>&)> other_f;
uint64_t sum_of_clusterSize = 0;
if (N_is_sweeps) {
- other_f = [&] (const state_t<z2_t, ising_t>& s) {
- sum_of_clusterSize += s.last_cluster_size;
+ other_f = [&] (const state_t<z2_t, ising_t>& s, const wolff_research_measurements<z2_t, ising_t>& meas) {
+ sum_of_clusterSize += meas.last_cluster_size;
};
} else if (draw) {
#ifdef HAVE_GLUT
@@ -148,7 +146,7 @@ int main(int argc, char *argv[]) {
glLoadIdentity();
gluOrtho2D(0.0, L, 0.0, L);
- other_f = [] (const state_t <z2_t, ising_t>& s) {
+ other_f = [] (const state_t <z2_t, ising_t>& s, const wolff_research_measurements<z2_t, ising_t>& meas) {
glClear(GL_COLOR_BUFFER_BIT);
for (v_t i = 0; i < pow(s.L, 2); i++) {
#ifdef NOFIELD
@@ -166,10 +164,10 @@ int main(int argc, char *argv[]) {
};
#endif
} else {
- other_f = [] (const state_t<z2_t, ising_t>& s) {};
+ other_f = [] (const state_t<z2_t, ising_t>& s, const wolff_research_measurements<z2_t, ising_t>& meas) {};
}
- std::function <void(const state_t<z2_t, ising_t>&)> measurements = measure_function_write_files(measurement_flags, outfiles, other_f);
+ wolff_research_measurements<z2_t, ising_t> m(measurement_flags, timestamp, other_f, s, silent);
// add line to metadata file with run info
{
@@ -185,18 +183,15 @@ int main(int argc, char *argv[]) {
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);
-
return 0;
-
}