diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-07-26 13:06:54 -0400 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-07-26 13:06:54 -0400 |
commit | 870555f569bc63fecdc7c0b16e72e4e002f21c13 (patch) | |
tree | 704fc4669fa3c69af8882b10eff0e89321b3be83 /src | |
parent | 215c40813a35c4fdc0bb5f1b8fdea125b9e9d2e4 (diff) | |
download | c++-870555f569bc63fecdc7c0b16e72e4e002f21c13.tar.gz c++-870555f569bc63fecdc7c0b16e72e4e002f21c13.tar.bz2 c++-870555f569bc63fecdc7c0b16e72e4e002f21c13.zip |
all the R_t have been objectified
Diffstat (limited to 'src')
-rw-r--r-- | src/analyze_correlations.cpp | 3 | ||||
-rw-r--r-- | src/wolff_On.cpp | 2 | ||||
-rw-r--r-- | src/wolff_cgm.cpp | 4 | ||||
-rw-r--r-- | src/wolff_clock.cpp | 10 | ||||
-rw-r--r-- | src/wolff_dgm.cpp | 4 | ||||
-rw-r--r-- | src/wolff_ising.cpp | 6 | ||||
-rw-r--r-- | src/wolff_potts.cpp | 7 |
7 files changed, 17 insertions, 19 deletions
diff --git a/src/analyze_correlations.cpp b/src/analyze_correlations.cpp index e108f98..5f3dda0 100644 --- a/src/analyze_correlations.cpp +++ b/src/analyze_correlations.cpp @@ -1,6 +1,7 @@ #include <types.h> -#include <measurement.h> +#include <cmath> +#include <cstring> #include <stdio.h> #include <stdlib.h> #include <getopt.h> diff --git a/src/wolff_On.cpp b/src/wolff_On.cpp index 15a9553..5458860 100644 --- a/src/wolff_On.cpp +++ b/src/wolff_On.cpp @@ -189,7 +189,7 @@ int main(int argc, char *argv[]) { other_f = [&] (const On_t *s) { glClear(GL_COLOR_BUFFER_BIT); for (v_t i = 0; i < pow(L, 2); i++) { - vector_R_t v_tmp = act_inverse(s->R, s->spins[i]); + vector_R_t v_tmp = s->R.act_inverse(s->spins[i]); double thetai = fmod(2 * M_PI + theta(v_tmp), 2 * M_PI); double saturation = 0.7; double value = 0.9; diff --git a/src/wolff_cgm.cpp b/src/wolff_cgm.cpp index 10477bd..7613691 100644 --- a/src/wolff_cgm.cpp +++ b/src/wolff_cgm.cpp @@ -128,7 +128,7 @@ int main(int argc, char *argv[]) { double max_h = INT64_MIN; double min_h = INT64_MAX; for (v_t i = 0; i < pow(L, 2); i++) { - double cur_h = act_inverse(s->R, 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 = act_inverse(s->R, 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); diff --git a/src/wolff_clock.cpp b/src/wolff_clock.cpp index e186c44..bc2c5d1 100644 --- a/src/wolff_clock.cpp +++ b/src/wolff_clock.cpp @@ -18,7 +18,7 @@ #include <rand.h> #include <wolff.h> -typedef state_t <dihedral_t<q_t,POTTSQ>, potts_t<POTTSQ>> sim_t; +typedef state_t <dihedral_t<POTTSQ>, potts_t<POTTSQ>> sim_t; int main(int argc, char *argv[]) { @@ -88,11 +88,11 @@ int main(int argc, char *argv[]) { }; // initialize state object - state_t <dihedral_t<q_t,POTTSQ>, potts_t<POTTSQ>> s(D, L, T, Z, B); + state_t <dihedral_t<POTTSQ>, potts_t<POTTSQ>> s(D, L, T, Z, B); // define function that generates self-inverse rotations - std::function <dihedral_t<q_t,POTTSQ>(gsl_rng *, potts_t<POTTSQ>)> gen_R = [] (gsl_rng *r, potts_t<POTTSQ> v) -> dihedral_t<q_t,POTTSQ> { - dihedral_t<q_t,POTTSQ> rot; + std::function <dihedral_t<POTTSQ>(gsl_rng *, potts_t<POTTSQ>)> gen_R = [] (gsl_rng *r, potts_t<POTTSQ> v) -> dihedral_t<POTTSQ> { + dihedral_t<POTTSQ> rot; rot.is_reflection = true; q_t x = gsl_rng_uniform_int(r, POTTSQ - 1); rot.x = (2 * v.x + x + 1) % POTTSQ; @@ -127,7 +127,7 @@ int main(int argc, char *argv[]) { average_M += (double)s->M[0] / (double)N / (double)s->nv; glClear(GL_COLOR_BUFFER_BIT); for (v_t i = 0; i < pow(L, 2); i++) { - potts_t<POTTSQ> tmp_s = act_inverse(s->R, s->spins[i]); + potts_t<POTTSQ> tmp_s = s->R.act_inverse(s->spins[i]); glColor3f(hue_to_R(tmp_s.x * 2 * M_PI / POTTSQ), hue_to_G(tmp_s.x * 2 * M_PI / POTTSQ), hue_to_B(tmp_s.x * 2 * M_PI / POTTSQ)); glRecti(i / L, i % L, (i / L) + 1, (i % L) + 1); } diff --git a/src/wolff_dgm.cpp b/src/wolff_dgm.cpp index 6271b79..2583704 100644 --- a/src/wolff_dgm.cpp +++ b/src/wolff_dgm.cpp @@ -133,7 +133,7 @@ int main(int argc, char *argv[]) { int64_t max_h = INT64_MIN; int64_t min_h = INT64_MAX; for (v_t i = 0; i < pow(L, 2); i++) { - int64_t cur_h = act_inverse(s->R, s->spins[i]).x; + int64_t cur_h = (s->R.act_inverse(s->spins[i])).x; if (cur_h < min_h) { min_h = cur_h; } @@ -143,7 +143,7 @@ int main(int argc, char *argv[]) { } for (v_t i = 0; i < pow(L, 2); i++) { - int64_t cur_h = act_inverse(s->R, s->spins[i]).x; + int64_t 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); diff --git a/src/wolff_ising.cpp b/src/wolff_ising.cpp index 93b7ea4..410e046 100644 --- a/src/wolff_ising.cpp +++ b/src/wolff_ising.cpp @@ -120,10 +120,8 @@ int main(int argc, char *argv[]) { state_t <z2_t, ising_t> s(D, L, T, Z, B); // define function that generates self-inverse rotations - std::function <z2_t(gsl_rng *, ising_t)> gen_R = [] (gsl_rng *, ising_t s) -> z2_t { - z2_t rot; - rot.x = true; - return rot; + std::function <z2_t(gsl_rng *, ising_t)> gen_R = [] (gsl_rng *, const ising_t& s) -> z2_t { + return z2_t(true); }; FILE **outfiles = measure_setup_files(measurement_flags, timestamp); diff --git a/src/wolff_potts.cpp b/src/wolff_potts.cpp index cdc4c07..07663d5 100644 --- a/src/wolff_potts.cpp +++ b/src/wolff_potts.cpp @@ -118,7 +118,6 @@ int main(int argc, char *argv[]) { // define function that generates self-inverse rotations std::function <symmetric_t<POTTSQ>(gsl_rng *, potts_t<POTTSQ>)> gen_R = [] (gsl_rng *r, potts_t<POTTSQ> v) -> symmetric_t<POTTSQ> { symmetric_t<POTTSQ> rot; - init(&rot); q_t j = gsl_rng_uniform_int(r, POTTSQ - 1); q_t swap_v; @@ -128,8 +127,8 @@ int main(int argc, char *argv[]) { swap_v = j + 1; } - rot.perm[v.x] = swap_v; - rot.perm[swap_v] = v.x; + rot[v.x] = swap_v; + rot[swap_v] = v.x; return rot; }; @@ -158,7 +157,7 @@ int main(int argc, char *argv[]) { other_f = [] (const sim_t *s) { glClear(GL_COLOR_BUFFER_BIT); for (v_t i = 0; i < pow(s->L, 2); i++) { - potts_t<POTTSQ> tmp_s = act_inverse(s->R, s->spins[i]); + potts_t<POTTSQ> tmp_s = s->R.act_inverse(s->spins[i]); glColor3f(hue_to_R(tmp_s.x * 2 * M_PI / POTTSQ), hue_to_G(tmp_s.x * 2 * M_PI / POTTSQ), hue_to_B(tmp_s.x * 2 * M_PI / POTTSQ)); glRecti(i / s->L, i % s->L, (i / s->L) + 1, (i % s->L) + 1); } |