summaryrefslogtreecommitdiff
path: root/src/wolff_cgm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wolff_cgm.cpp')
-rw-r--r--src/wolff_cgm.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/wolff_cgm.cpp b/src/wolff_cgm.cpp
index ec3ae36..ce91bf2 100644
--- a/src/wolff_cgm.cpp
+++ b/src/wolff_cgm.cpp
@@ -100,13 +100,13 @@ int main(int argc, char *argv[]) {
};
// define function that updates any number of measurements
- std::function <void(const sim_t *)> measurement;
+ std::function <void(const sim_t&)> measurement;
double average_M = 0;
if (!draw) {
// a very simple example: measure the average magnetization
- measurement = [&] (const sim_t *s) {
- average_M += (double)s->M / (double)N / (double)s->nv;
+ measurement = [&] (const sim_t& s) {
+ average_M += (double)s.M / (double)N / (double)s.nv;
};
} else {
// a more complex example: measure the average magnetization, and draw the spin configuration to the screen
@@ -122,13 +122,13 @@ int main(int argc, char *argv[]) {
glLoadIdentity();
gluOrtho2D(0.0, L, 0.0, L);
- measurement = [&] (const sim_t *s) {
- average_M += (double)s->M / (double)N / (double)s->nv;
+ measurement = [&] (const sim_t& s) {
+ average_M += (double)s.M / (double)N / (double)s.nv;
glClear(GL_COLOR_BUFFER_BIT);
double max_h = INT64_MIN;
double min_h = INT64_MAX;
for (v_t i = 0; i < pow(L, 2); i++) {
- double cur_h = (s->R.act_inverse(s->spins[i])).x;
+ double cur_h = (s.R.act_inverse(s.spins[i])).x;
if (cur_h < min_h) {
min_h = cur_h;
}
@@ -138,7 +138,7 @@ int main(int argc, char *argv[]) {
}
for (v_t i = 0; i < pow(L, 2); i++) {
- double cur_h = (s->R.act_inverse(s->spins[i])).x;
+ double cur_h = (s.R.act_inverse(s.spins[i])).x;
double mag = ((double)(cur_h - min_h)) / ((double)(max_h - min_h));
glColor3f(mag, mag, mag);
glRecti(i / L, i % L, (i / L) + 1, (i % L) + 1);
@@ -149,7 +149,7 @@ int main(int argc, char *argv[]) {
}
// run wolff for N cluster flips
- wolff(N, &s, gen_R, measurement, r, silent);
+ wolff(N, s, gen_R, measurement, r, silent);
// tell us what we found!
printf("%" PRIcount " DGM runs completed. D = %" PRID ", L = %" PRIL ", T = %g, H = %g, <M> = %g\n", N, D, L, T, H, average_M);