diff options
Diffstat (limited to 'src/wolff_ising.cpp')
-rw-r--r-- | src/wolff_ising.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
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 <getopt.h> +#ifdef HAVE_GLUT #include <GL/glut.h> +#endif // include your group and spin space #include <z2.h> @@ -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 |