From e3fbb92e68f0410f106285c9a49ecf8cd0a488a9 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Sat, 21 Jul 2018 19:43:16 -0400 Subject: added visualization, and started potts --- src/wolff_ising.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/wolff_ising.cpp') diff --git a/src/wolff_ising.cpp b/src/wolff_ising.cpp index f4073da..83b6448 100644 --- a/src/wolff_ising.cpp +++ b/src/wolff_ising.cpp @@ -1,6 +1,8 @@ #include +#ifdef HAVE_GLUT #include +#endif // include your group and spin space #include @@ -11,7 +13,7 @@ int main(int argc, char *argv[]) { - count_t N = (count_t)1e7; + count_t N = (count_t)1e4; D_t D = 2; L_t L = 128; @@ -20,10 +22,11 @@ int main(int argc, char *argv[]) { bool silent = false; bool draw = false; + unsigned int window_size = 512; int opt; - while ((opt = getopt(argc, argv, "N:D:L:T:H:sd")) != -1) { + while ((opt = getopt(argc, argv, "N:D:L:T:H:sdw:")) != -1) { switch (opt) { case 'N': // number of steps N = (count_t)atof(optarg); @@ -44,8 +47,16 @@ int main(int argc, char *argv[]) { silent = true; break; case 'd': +#ifdef HAVE_GLUT draw = true; break; +#else + printf("You didn't compile this with the glut library installed!\n"); + exit(EXIT_FAILURE); +#endif + case 'w': + window_size = atoi(optarg); + break; default: exit(EXIT_FAILURE); } @@ -95,11 +106,12 @@ int main(int argc, char *argv[]) { } else { // a more complex example: measure the average magnetization, and draw the spin configuration to the screen +#ifdef HAVE_GLUT // initialize glut glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); - glutInitWindowSize(L,L); - glutCreateWindow("null"); + glutInitWindowSize(window_size, window_size); + glutCreateWindow("wolff"); glClearColor(0.0,0.0,0.0,0.0); glMatrixMode(GL_PROJECTION); glLoadIdentity(); @@ -118,6 +130,7 @@ int main(int argc, char *argv[]) { } glFlush(); }; +#endif } // run wolff for N cluster flips -- cgit v1.2.3-70-g09d2