From 468c25eabd1aaac7d02988fef97b66bb378988b3 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Wed, 26 Feb 2020 09:14:04 -0500 Subject: More cleanup and temperary saving routines for presentation --- spheres_infinite.cpp | 57 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 12 deletions(-) (limited to 'spheres_infinite.cpp') diff --git a/spheres_infinite.cpp b/spheres_infinite.cpp index af91427..3fd6da2 100644 --- a/spheres_infinite.cpp +++ b/spheres_infinite.cpp @@ -10,6 +10,46 @@ const unsigned D = 2; typedef Model, double> model; +class SaveFlip : public measurement, Radius> { + std::ofstream snapfile; + unsigned n; + + public: + SaveFlip() {} + + void pre_cluster(const Model, Radius>& m, unsigned, + const Transformation, Radius>* t) override { + snapfile.open("sphere_flip.dat"); + n = 0; + for (const Sphere* s : m.s) { + snapfile << s << " " << s->s << " " << s->x.transpose() << " "; + } + snapfile << "\n"; + } + + void plain_site_transformed(const Model, Radius>& m, + const Transformation, Radius>& t) override { + for (const Sphere* s : t.current()) { + snapfile << s << " "; + } + snapfile << "\n"; + n++; + } + + void post_cluster(const Model, Radius>& m) override { + for (const Sphere* s : m.s) { + snapfile << s << " " << s->s << " " << s->x.transpose() << " "; + } + snapfile << "\n"; + snapfile.close(); + std::cout << n << "\n"; + if (2 < n && n < 20) { + getchar(); + } + } + +}; + int main(int argc, char* argv[]) { const unsigned D = 2; @@ -65,7 +105,7 @@ int main(int argc, char* argv[]) { }; auto g1 = nudgeGen(1); - auto g2 = swapGen(0.1); + auto g2 = swapGen(0.01); auto g3 = accrossGen(0.1); auto g4 = centerGen(0); @@ -93,20 +133,13 @@ int main(int argc, char* argv[]) { sphere.dict.insert(ss); } - sphere.wolff(T, {g1, g2, g3, g4}, A, N); - - file.close(); + measurement, Radius> A_tmp; - std::ofstream snapfile; - snapfile.open("sphere_snap.dat"); + sphere.wolff(T, {g1, g2, g3, g4}, A_tmp, N); - for (Spin* s : sphere.s) { - Spin rs = sphere.s0.inverse().act(*s); - snapfile << rs.s << " " << rs.x.transpose() << "\n"; - delete s; - } + SaveFlip A_new; + sphere.wolff(T, {g2}, A_new, 10000); - snapfile.close(); return 0; } -- cgit v1.2.3-54-g00ecf