Parallel Programming - Single threaded version done
[matches/honours.git] / course / semester2 / pprog / assignment1 / main.c
index 28e6409..22bd867 100644 (file)
@@ -1,6 +1,45 @@
+
 #include <stdlib.h>
 #include <stdio.h>
+
 #include "nbody.h"
 #include "graphics.h"
 
+unsigned numberOfProcessors;
+
+System universe;
+
+// This is main function. Do not change it.
+int main(int argc, char** argv)
+{
+       glutInit(&argc, argv);
+
+       if (argc < 2) {
+               puts("Please provide the filename, i.e. \'nbody bodiesfield.dat\'");
+           exit(EXIT_SUCCESS);
+       }
+       if (argc == 2)
+       {
+               System_Init(&universe,argv[1]);
+       }
+       if (argc == 3) numberOfProcessors = atoi(argv[2]);
+
+
+
+       glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
+       glutInitWindowSize(WIDTH, HEIGHT);
+       glutInitWindowPosition(POSITION_X, POSITION_Y);
+       glutCreateWindow("N-Body Parallel");
+       glutDisplayFunc(Graphics_Display);
+       glutIdleFunc(Graphics_Animate);
+       glutKeyboardFunc(Graphics_Keyboard);
+       glutReshapeFunc(Graphics_Reshape);
+       Graphics_Init();
+
+
+       printf("Use:\n X - exit\n I, J, K, M - rotate\n W, Z, A, S - move to view"
+         " point\n ./, - zoom in/out\n +/- - scaled zoom in/out\n");
+
 
+       glutMainLoop();
+}

UCC git Repository :: git.ucc.asn.au