Parallel Programming - Single threaded version done
[matches/honours.git] / course / semester2 / pprog / assignment1 / 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                 puts("Please provide the filename, i.e. \'nbody bodiesfield.dat\'");
19             exit(EXIT_SUCCESS);
20         }
21         if (argc == 2)
22         {
23                 System_Init(&universe,argv[1]);
24         }
25         if (argc == 3) numberOfProcessors = atoi(argv[2]);
26
27
28
29         glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
30         glutInitWindowSize(WIDTH, HEIGHT);
31         glutInitWindowPosition(POSITION_X, POSITION_Y);
32         glutCreateWindow("N-Body Parallel");
33         glutDisplayFunc(Graphics_Display);
34         glutIdleFunc(Graphics_Animate);
35         glutKeyboardFunc(Graphics_Keyboard);
36         glutReshapeFunc(Graphics_Reshape);
37         Graphics_Init();
38
39
40         printf("Use:\n X - exit\n I, J, K, M - rotate\n W, Z, A, S - move to view"
41          " point\n ./, - zoom in/out\n +/- - scaled zoom in/out\n");
42
43
44         glutMainLoop();
45 }

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