summaryrefslogtreecommitdiff
path: root/spheres.cpp
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2020-01-14 18:00:07 -0500
committerJaron Kent-Dobias <jaron@kent-dobias.com>2020-01-14 18:00:07 -0500
commit614575bb88a2cadc9e35b684d0f1712de822ef0d (patch)
treec3a12b4240161116d81420f07e96d384e58caf35 /spheres.cpp
parent698e4a89acc51f4da282d54cfac72938fe954a49 (diff)
downloadspace_wolff-614575bb88a2cadc9e35b684d0f1712de822ef0d.tar.gz
space_wolff-614575bb88a2cadc9e35b684d0f1712de822ef0d.tar.bz2
space_wolff-614575bb88a2cadc9e35b684d0f1712de822ef0d.zip
generalized code somewhat to accomodate simulation of infinite space, sample central field sim
Diffstat (limited to 'spheres.cpp')
-rw-r--r--spheres.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/spheres.cpp b/spheres.cpp
index f3dde42..97c1e18 100644
--- a/spheres.cpp
+++ b/spheres.cpp
@@ -3,9 +3,9 @@
#include <GL/glut.h>
const unsigned D = 2;
-typedef Model<double, D, Euclidean<double, D>, double> model;
+typedef Model<double, D, TorusGroup<double, D>, double> model;
-class animation : public measurement<double, 2, Euclidean<double, D>, double> {
+class animation : public measurement<double, 2, TorusGroup<double, D>, double> {
private:
uint64_t t1;
uint64_t t2;
@@ -27,7 +27,7 @@ class animation : public measurement<double, 2, Euclidean<double, D>, double> {
gluOrtho2D(-1, L + 1, -1 , L + 1);
}
- void pre_cluster(const model&, unsigned, const Euclidean<double, D>&) override {
+ void pre_cluster(const model&, unsigned, const TorusGroup<double, D>&) override {
tmp = 0;
}
@@ -65,8 +65,8 @@ class animation : public measurement<double, 2, Euclidean<double, D>, double> {
}
};
-std::function<Euclidean<double, D>(const model&, randutils::mt19937_rng&)> eGen(const std::vector<Matrix<double, 2>>& mats, const std::vector<Vector<double, 2>>& vecs, double ε, double L) {
- return [&mats, &vecs, L, ε] (const model& M, randutils::mt19937_rng& rng) -> Euclidean<double, 2> {
+std::function<TorusGroup<double, D>(const model&, randutils::mt19937_rng&)> eGen(const std::vector<Matrix<double, 2>>& mats, const std::vector<Vector<double, 2>>& vecs, double ε, double L) {
+ return [&mats, &vecs, L, ε] (const model& M, randutils::mt19937_rng& rng) -> TorusGroup<double, 2> {
Vector<double, D> t;
Matrix<double, D> m;
unsigned flip = rng.uniform((unsigned)0, (unsigned)(mats.size() + vecs.size() - 1));
@@ -91,7 +91,7 @@ std::function<Euclidean<double, D>(const model&, randutils::mt19937_rng&)> eGen(
t = vecs[flip - mats.size()];
}
- Euclidean<double, D> g(M.L, t, m);
+ TorusGroup<double, D> g(M.L, t, m);
return g;
};
@@ -130,8 +130,8 @@ int main(int argc, char* argv[]) {
}
}
- double k = 100.0;
- double a = 0.2;
+ double k = 1e2;
+ double a = 0.05;
std::function<double(const Spin<double, D, double>&, const Spin<double, D, double>&)> Z =
[L, a, k] (const Spin<double, D, double>& s1, const Spin<double, D, double>& s2) -> double {
@@ -158,7 +158,7 @@ int main(int argc, char* argv[]) {
std::vector<Vector<double, D>> vecs = torus_vecs<double, D>(L);
auto g = eGen(mats, vecs, L, L);
animation A(L, 750, argc, argv);
- model sphere(L, Z, B, std::floor(log2(L)), 2);
+ model sphere(L, Z, B);
randutils::mt19937_rng rng;