From d5a7a3f2e5808e7a3327242dc9b368afed9383bf Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Wed, 12 Feb 2020 14:59:13 -0500 Subject: Changed the RNG and implemented Transformations as the method for parameterizing movement. --- spheres_infinite.cpp | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'spheres_infinite.cpp') diff --git a/spheres_infinite.cpp b/spheres_infinite.cpp index a9cd7d0..3505d6d 100644 --- a/spheres_infinite.cpp +++ b/spheres_infinite.cpp @@ -68,7 +68,7 @@ public: }; Gen, double> eGen(double ε) { - return [ε](const model& M, randutils::mt19937_rng& rng) -> Euclidean { + return [ε](model& M, Rng& rng) -> Transformation, double>* { Vector t; Matrix m; @@ -85,12 +85,12 @@ Gen, double> eGen(double ε) { } Euclidean g(t - m * t, m); - return g; + return new SpinFlip, double>(M, g, M.s[f_ind]); }; } Gen, double> mGen(double ε) { - return [ε](const model& M, randutils::mt19937_rng& rng) -> Euclidean { + return [ε](model& M, Rng& rng) -> Transformation, double>* { Matrix m; unsigned f_ind1 = rng.uniform((unsigned)0, (unsigned)M.s.size()); @@ -110,7 +110,7 @@ Gen, double> mGen(double ε) { m(1, 0) = -2 * cos(θ) * sin(θ); Euclidean g(t - m * t, m); - return g; + return new PairFlip, double>(M, g, M.s[f_ind1], M.s[f_ind2]); }; } @@ -123,9 +123,12 @@ int main(int argc, char* argv[]) { double H = 1.0; unsigned n = 25; + double k = 1e2; + double a = 0.1; + int opt; - while ((opt = getopt(argc, argv, "n:N:L:T:H:")) != -1) { + while ((opt = getopt(argc, argv, "n:N:L:T:H:a:k:")) != -1) { switch (opt) { case 'n': n = (unsigned)atof(optarg); @@ -142,14 +145,17 @@ int main(int argc, char* argv[]) { case 'H': H = atof(optarg); break; + case 'a': + a = atof(optarg); + break; + case 'k': + k = atof(optarg); + break; default: exit(1); } } - double k = 1000; - double a = 0.05; - std::function&, const Spin&)> Z = [L, a, k](const Spin& s1, const Spin& s2) -> double { Vector d = s1.x - s2.x; @@ -170,19 +176,19 @@ int main(int argc, char* argv[]) { return H * s.x.norm(); }; - auto g1 = eGen(0.25); - auto g2 = mGen(0.1); + auto g1 = eGen(0.5); + auto g2 = mGen(0.2); animation A(L, 750, argc, argv); model sphere(1, Z, B); - randutils::mt19937_rng rng; + Rng rng; sphere.s.reserve(n); unsigned nx = floor(sqrt(n)); for (unsigned i = 0; i < n; i++) { Vector pos = {(i / nx) * L / nx, (i % nx) * L / nx}; - sphere.s.push_back({pos, rng.uniform(0.45, 0.45)}); + sphere.s.push_back({pos, rng.uniform(0.25, 0.45)}); sphere.dict.insert(&sphere.s.back()); } -- cgit v1.2.3-54-g00ecf