diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-07-18 16:03:08 -0400 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-07-18 16:03:08 -0400 |
commit | b6b6235e9563b003e1932fd757b947e5a2eb9c9a (patch) | |
tree | 9e4d56c40466f9f382343cbe29b52b30ee67cf1a /src | |
parent | cd85d3696be4a7ee65b0cf6669fc62dc4841aef3 (diff) | |
download | c++-b6b6235e9563b003e1932fd757b947e5a2eb9c9a.tar.gz c++-b6b6235e9563b003e1932fd757b947e5a2eb9c9a.tar.bz2 c++-b6b6235e9563b003e1932fd757b947e5a2eb9c9a.zip |
used typedefs to shorten lines
Diffstat (limited to 'src')
-rw-r--r-- | src/wolff_heisenberg.cpp | 14 | ||||
-rw-r--r-- | src/wolff_planar.cpp | 14 |
2 files changed, 16 insertions, 12 deletions
diff --git a/src/wolff_heisenberg.cpp b/src/wolff_heisenberg.cpp index f38fa96..5403b49 100644 --- a/src/wolff_heisenberg.cpp +++ b/src/wolff_heisenberg.cpp @@ -4,6 +4,8 @@ #include <correlation.h> #include <wolff.h> +typedef state_t <orthogonal_t <3, double>, vector_t <3, double>> sim_t; + int main(int argc, char *argv[]) { count_t N = (count_t)1e7; @@ -61,7 +63,7 @@ int main(int argc, char *argv[]) { timestamp = spec.tv_sec*1000000000LL + spec.tv_nsec; } - std::function <orthogonal_t <3, double>(gsl_rng *, const state_t <orthogonal_t <3, double>, vector_t <3, double>> *)> gen_R; + std::function <orthogonal_t <3, double>(gsl_rng *, const sim_t *)> gen_R; const char *pert_type; @@ -108,20 +110,20 @@ int main(int argc, char *argv[]) { free(filename_S); free(filename_X); - std::function <void(const state_t <orthogonal_t <3, double>, vector_t <3, double>> *)> *measurements = (std::function <void(const state_t <orthogonal_t <3, double>, vector_t <3, double>> *)> *)malloc(4 * sizeof(std::function <void(const state_t <orthogonal_t <3, double>, vector_t <3, double>> *)>)); + std::function <void(const sim_t *)> *measurements = (std::function <void(const sim_t *)> *)malloc(4 * sizeof(std::function <void(const sim_t *)>)); - measurements[0] = [&](const state_t <orthogonal_t <3, double>, vector_t <3, double>> *s) { + measurements[0] = [&](const sim_t *s) { float smaller_E = (float)s->E; fwrite(&smaller_E, sizeof(float), 1, outfile_E); }; - measurements[1] = [&](const state_t <orthogonal_t <3, double>, vector_t <3, double>> *s) { + measurements[1] = [&](const sim_t *s) { float smaller_X = (float)correlation_length(s); fwrite(&smaller_X, sizeof(float), 1, outfile_X); }; - measurements[2] = [&](const state_t <orthogonal_t <3, double>, vector_t <3, double>> *s) { + measurements[2] = [&](const sim_t *s) { write_magnetization(s->M, outfile_M); }; - measurements[3] = [&](const state_t <orthogonal_t <3, double>, vector_t <3, double>> *s) { + measurements[3] = [&](const sim_t *s) { fwrite(&(s->last_cluster_size), sizeof(uint32_t), 1, outfile_S); }; diff --git a/src/wolff_planar.cpp b/src/wolff_planar.cpp index 4f26471..37eb6f8 100644 --- a/src/wolff_planar.cpp +++ b/src/wolff_planar.cpp @@ -4,6 +4,8 @@ #include <wolff.h> #include <correlation.h> +typedef state_t <orthogonal_t <2, double>, vector_t <2, double>> sim_t; + int main(int argc, char *argv[]) { count_t N = (count_t)1e7; @@ -63,7 +65,7 @@ int main(int argc, char *argv[]) { const char *pert_type; - std::function <orthogonal_t <2, double>(gsl_rng *, const state_t <orthogonal_t <2, double>, vector_t <2, double>> *)> gen_R; + std::function <orthogonal_t <2, double>(gsl_rng *, const sim_t *)> gen_R; if (use_pert) { gen_R = std::bind(generate_rotation_perturbation <2>, std::placeholders::_1, std::placeholders::_2, epsilon); @@ -109,20 +111,20 @@ int main(int argc, char *argv[]) { free(filename_S); free(filename_X); - std::function <void(const state_t <orthogonal_t <2, double>, vector_t <2, double>> *)> *measurements = (std::function <void(const state_t <orthogonal_t <2, double>, vector_t <2, double>> *)> *)calloc(4, sizeof(std::function <void(const state_t <orthogonal_t <2, double>, vector_t <2, double>> *)>)); + std::function <void(const sim_t *)> *measurements = (std::function <void(const sim_t *)> *)calloc(4, sizeof(std::function <void(const sim_t *)>)); - measurements[0] = (std::function <void(const state_t <orthogonal_t <2, double>, vector_t <2, double>> *)>)[&](const state_t <orthogonal_t <2, double>, vector_t <2, double>> *s) { + measurements[0] = (std::function <void(const sim_t *)>)[&](const sim_t *s) { float smaller_E = (float)s->E; fwrite(&smaller_E, sizeof(float), 1, outfile_E); }; - measurements[1] = [&](const state_t <orthogonal_t <2, double>, vector_t <2, double>> *s) { + measurements[1] = [&](const sim_t *s) { float smaller_X = (float)correlation_length(s); fwrite(&smaller_X, sizeof(float), 1, outfile_X); }; - measurements[2] = [&](const state_t <orthogonal_t <2, double>, vector_t <2, double>> *s) { + measurements[2] = [&](const sim_t *s) { write_magnetization(s->M, outfile_M); }; - measurements[3] = [&](const state_t <orthogonal_t <2, double>, vector_t <2, double>> *s) { + measurements[3] = [&](const sim_t *s) { fwrite(&(s->last_cluster_size), sizeof(uint32_t), 1, outfile_S); }; |