diff --git a/src/graphics/graphics.c b/src/graphics/graphics.c index d7270bb..7b626f4 100644 --- a/src/graphics/graphics.c +++ b/src/graphics/graphics.c @@ -593,7 +593,7 @@ static inline int create_arrow (int arrows_nb, arrows_nb ++; - print_arrows_array (arrows_ptr, arrows_nb, 1); + if (0) print_arrows_array (arrows_ptr, arrows_nb, 1); return arrows_nb; } @@ -616,11 +616,8 @@ static inline int erase_arrow (int arrows_nb, int address, int site, int x, int if (arrows_nb > 0) { void *newptr = g_realloc(arrows_ptr, arrows_nb * sizeof(struct arrow_t)); - - if (newptr) - arrows_ptr = newptr; - else - perror("In erase arrow, can't allocate new arrow buffer !\n"); + if (newptr) arrows_ptr = newptr; + else perror("In erase arrow, can't re_allocate for arrow list.\n"); } print_arrows_array (arrows_ptr, arrows_nb,0); @@ -658,7 +655,7 @@ static inline int set_arrow (struct arrow_t *arrows_ptr, int arrows_nb, } } } - //printf("\n[%d]set_arrow() invoked with requested weight = %2d + ", arrows_nb, requested_weight); + if (requested_weight == 0) printf("[%d]set_arrow() invoked with requested weight = %2d\n", arrows_nb, requested_weight); if (TEST) show_user_action(arrows_ptr, arrows_nb, address, requested_weight, current_weight, site, x, y, z); @@ -698,9 +695,9 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void) void srand(unsigned int seed); // printf ("Valeur max : %d\n", RAND_MAX); min + rand() % (max+1 - min); int arbitrary = 5; - int space_X = 1 + rand() % arbitrary, - space_Y = 1 + rand() % arbitrary, - space_Z = 1 + rand() % arbitrary; + int space_X = 1,// + rand() % arbitrary, + space_Y = 1,// + rand() % arbitrary, + space_Z = 1;// + rand() % arbitrary; int density_max = space_X * space_Y * space_Z; int max = fmax(space_X, space_Y); max = fmax(max, space_Z); @@ -713,7 +710,6 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void) int print_inter_results = 0; if (print_inter_results) clock_gettime(CLOCK_REALTIME, &ts); t_initial = ts.tv_sec; if (print_inter_results) printf("%10d | ", specif_arrows_nb / 1000); - printf("I N I T I A L D A T A A R E N O W S P E C I F I E D\n"); /*--------------------------------------------------------------------------------*/ @@ -728,17 +724,17 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void) /* S P A C E */ - if (1) printf("buffer_vertex_size before writing 8 space_ridges_vertex : %3d (x 3 = %d)\n", buffer_vertex_size / 3, buffer_vertex_size); + if (0) printf("buffer_vertex_size before writing 8 space_ridges_vertex : %3d (x 3 = %d)\n", buffer_vertex_size / 3, buffer_vertex_size); write_space_ridges_vertex (buffer_vertex_size, space_X, space_Y, space_Z); /* buffer_colors_size = buffer_vertex_size; */ - if (1) printf("buffer_vertex_size after writing 8 space_ridges_vertex : %3d (x 3 = %d)\n", buffer_vertex_size / 3, buffer_vertex_size); + if (0) printf("buffer_vertex_size after writing 8 space_ridges_vertex : %3d (x 3 = %d)\n", buffer_vertex_size / 3, buffer_vertex_size); write_grids_on_space_faces_vertex (space_X, space_Y, space_Z); /* buffer_colors_size = buffer_vertex_size; */ - if (1) printf("buffer_vertex_size after writing %3d space_faces_vertex : %3d (x 3 = %4d)\n\n", buffer_vertex_size / 3 - 8, buffer_vertex_size / 3, buffer_vertex_size); + if (0) printf("buffer_vertex_size after writing %3d space_faces_vertex : %3d (x 3 = %4d)\n\n", buffer_vertex_size / 3 - 8, buffer_vertex_size / 3, buffer_vertex_size); /* if (0) printf("(space_X - 1) * 4 + (space_Y - 1) * 4 + (space_Z - 1) * 4 = %3d (x 3 = %4d)\n\n",\ */ /* (space_X - 1) * 4 + (space_Y - 1) * 4 + (space_Z - 1) * 4, ((space_X - 1) * 4 + (space_Y - 1) * 4 + (space_Z - 1) * 4) * 3); */ @@ -776,7 +772,7 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void) if (0) printf("buffer_lines_size before writing (n) space_faces_lines : %2d (* 2 = %2d)\n", buffer_lines_size / 2, buffer_lines_size); write_grids_on_space_faces_lines (buffer_lines_size, space_X, space_Y, space_Z); - if (1) printf("buffer_lines_size after writing (n) space_faces_lines : %d (* 2 = %d)\n\n", buffer_lines_size / 2, buffer_lines_size); + if (0) printf("buffer_lines_size after writing (n) space_faces_lines : %d (* 2 = %d)\n\n", buffer_lines_size / 2, buffer_lines_size); /* A R R O W S */ @@ -785,32 +781,22 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void) /* while (arrows_nb < specif_arrows_nb){ */ arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, rand() % arbitrary + 1, // load / weight - rand() % 6, // site, - rand() % space_X, // x - rand() % space_Y, // y - rand() % space_Z); // z + 0,//rand() % 6, // site, + 0,//rand() % space_X, // x + 0,//rand() % space_Y, // y + 0);//rand() % space_Z); // z arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, rand() % arbitrary + 1, // load / weight - rand() % 6, // site, - rand() % space_X, // x - rand() % space_Y, // y - rand() % space_Z); // z + 1,//rand() % 6, // site, + 0,//rand() % space_X, // x + 0,//rand() % space_Y, // y + 0);//rand() % space_Z); // z /* clock_gettime(CLOCK_REALTIME, &ts); < Je n'arrive pas à afficher les temps en cours d'exécutuion */ /* if (arrows_nb % 1000 == 0) {cpt++; printf("%8d", arrows_nb / 1000); if (cpt % 22 == 0) printf(" %f\n%10d | ", specif_arrows_nb / 1000, ts.tv_sec - t_initial);} */ if (print_inter_results && arrows_nb % 1000 == 0) {cpt++; printf("%8d", arrows_nb / 1000); if (cpt % 24 == 0) printf("\n%10d | ", specif_arrows_nb / 1000);} /* } */ -/* } */ - /* for (int i = 0; i < arrows_nb; i++) { */ - /* load = arrows_ptr[i].load; */ - /* site = arrows_ptr[i].site; */ - /* x = arrows_ptr[i].x; */ - /* y = arrows_ptr[i].y; */ - /* z = arrows_ptr[i].z; */ - - /* buffer_vertex_size += write_one_arrow_line (buffer_vertex_size); */ - /* } */ @@ -825,17 +811,17 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void) /*--------------------------------------------------------------------------------*/ + if (1) print_user_choices(arrows_ptr, arrows_nb, space_X, space_Y, space_Z, print_arrows_data, 0); + + arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, + 0,//rand() % arbitrary + 1, // load / weight + 0,//rand() % 6, // site, + 0,//rand() % space_X, // x + 0,//rand() % space_Y, // y + 0);//rand() % space_Z); // z + print_user_choices(arrows_ptr, arrows_nb, space_X, space_Y, space_Z, print_arrows_data, 0); - /* arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, */ - /* 0,//rand() % arbitrary + 1, // load / weight */ - /* 0,//rand() % 6, // site, */ - /* 0,//rand() % space_X, // x */ - /* 0,//rand() % space_Y, // y */ - /* 0);//rand() % space_Z); // z */ - - /* print_user_choices(arrows_ptr, arrows_nb, space_X, space_Y, space_Z, print_arrows_data, 0); */ - /* arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, */ /* 0,//rand() % arbitrary + 1, // load / weight */ /* 1,//rand() % 6, // site, */