summaryrefslogtreecommitdiff
path: root/ising_animate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ising_animate.cpp')
-rw-r--r--ising_animate.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/ising_animate.cpp b/ising_animate.cpp
index f3ab314..2ea6500 100644
--- a/ising_animate.cpp
+++ b/ising_animate.cpp
@@ -1,4 +1,5 @@
#include "animation.hpp"
+#include <fstream>
#include "ising.hpp"
int main(int argc, char* argv[]) {
@@ -65,5 +66,27 @@ int main(int argc, char* argv[]) {
ising.wolff(T, {g}, A, N);
+ std::vector<std::vector<int>> finalState(L);
+
+ for (std::vector<int>& v : finalState) {
+ v.resize(L);
+ }
+
+ for (const isingSpin* s: ising.s) {
+ Vector<int, 2> v = ising.s0.inverse().act(s->x);
+ finalState[v[0]][v[1]] = s->s;
+ }
+
+ std::ofstream outfile("ising_snap.dat");
+
+ for (const std::vector<int>& v : finalState) {
+ for (int s : v) {
+ outfile << s << " ";
+ }
+ outfile << "\n";
+ }
+
+ outfile.close();
+
return 0;
}