Parallel Programming - Work on pthreaded version
[matches/honours.git] / course / semester2 / pprog / assignment1 / single-thread / main.c
1
2 #include <stdlib.h>
3 #include <stdio.h>
4
5 #include "nbody.h"
6 #include "graphics.h"
7
8 unsigned numberOfProcessors;
9
10 System universe;
11
12 // This is main function. Do not change it.
13 int main(int argc, char** argv)
14 {
15         glutInit(&argc, argv);
16
17         if (argc < 2) 
18         {
19                 printf("Please provide the filename, i.e. \'%s bodiesfield.dat\'\n", argv[0]);
20                 exit(EXIT_SUCCESS);
21         }
22         if (argc == 2)
23         {
24                 System_Init(&universe,argv[1]);
25                 atexit(Universe_Cleanup);
26         }
27         if (argc == 3) 
28         {
29                 numberOfProcessors = atoi(argv[2]);
30         }
31
32
33
34         glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
35         glutInitWindowSize(WIDTH, HEIGHT);
36         glutInitWindowPosition(POSITION_X, POSITION_Y);
37         glutCreateWindow("N-Body : Single Threaded");
38         glutDisplayFunc(Graphics_Display);
39         glutIdleFunc(Graphics_Animate);
40         glutKeyboardFunc(Graphics_Keyboard);
41         glutReshapeFunc(Graphics_Reshape);
42         Graphics_Init();
43
44
45         printf("Use:\n X - exit\n I, J, K, M - rotate\n W, Z, A, S - move to view"
46                 " point\n ./, - zoom in/out\n +/- - scaled zoom in/out\n");
47
48         glutMainLoop();
49         
50 }

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