diff --git a/src/graphics/graphics.c b/src/graphics/graphics.c index 8919024..1a3b3b3 100644 --- a/src/graphics/graphics.c +++ b/src/graphics/graphics.c @@ -617,9 +617,6 @@ static inline int erase_arrow (int arrows_nb, int address, arrows_ptr[address].y = arrows_ptr[arrows_nb].y; arrows_ptr[address].z = arrows_ptr[arrows_nb].z; - /* for (int i = 0 + address; i < 6 + address; i++) */ - /* buffer_vertex_origin [(long) buffer_vertex_0_arrow + i] = buffer_vertex_origin[(long) buffer_vertex_size - 6 + i]; */ - /* for (int j = 0 + address; j < 4 + address; j++) */ /* buffer_lines_origin [(long) buffer_lines_0_arrow + j] = buffer_lines_origin[(long) buffer_lines_size - 4 + j]; */ @@ -636,19 +633,27 @@ static inline int erase_arrow (int arrows_nb, int address, // Attention : à la création des vertex, tous les vertex centraux sont redondants (au maximum 6) - buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 0] = buffer_vertex_origin[(long) buffer_vertex_size - 6]; - buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 1] = buffer_vertex_origin[(long) buffer_vertex_size - 5]; - buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 2] = buffer_vertex_origin[(long) buffer_vertex_size - 4]; - buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 3] = buffer_vertex_origin[(long) buffer_vertex_size - 3]; - buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 4] = buffer_vertex_origin[(long) buffer_vertex_size - 2]; - buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 5] = buffer_vertex_origin[(long) buffer_vertex_size - 1]; + for (int i = 0 + address * 6; i < 6 + address * 6; i++) + buffer_vertex_origin [(long) buffer_vertex_0_arrow + i] + = buffer_vertex_origin [(long) buffer_vertex_size - 6 + i]; - buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + 0] = buffer_colors_origin[(long) buffer_colors_size - 6]; - buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + 1] = buffer_colors_origin[(long) buffer_colors_size - 5]; - buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + 2] = buffer_colors_origin[(long) buffer_colors_size - 4]; - buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + 3] = buffer_colors_origin[(long) buffer_colors_size - 3]; - buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + 4] = buffer_colors_origin[(long) buffer_colors_size - 2]; - buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + 5] = buffer_colors_origin[(long) buffer_colors_size - 1]; + /* for (int i = 0; i < 6; i++) */ + /* buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + i] */ + /* = buffer_colors_origin [(long) buffer_colors_size - 6 + i]; */ + + /* buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 0] = buffer_vertex_origin[(long) buffer_vertex_size - 6]; */ + /* buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 1] = buffer_vertex_origin[(long) buffer_vertex_size - 5]; */ + /* buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 2] = buffer_vertex_origin[(long) buffer_vertex_size - 4]; */ + /* buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 3] = buffer_vertex_origin[(long) buffer_vertex_size - 3]; */ + /* buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 4] = buffer_vertex_origin[(long) buffer_vertex_size - 2]; */ + /* buffer_vertex_origin [(long) buffer_vertex_0_arrow + address * 6 + 5] = buffer_vertex_origin[(long) buffer_vertex_size - 1]; */ + + /* buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + 0] = buffer_colors_origin[(long) buffer_colors_size - 6]; */ + /* buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + 1] = buffer_colors_origin[(long) buffer_colors_size - 5]; */ + /* buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + 2] = buffer_colors_origin[(long) buffer_colors_size - 4]; */ + /* buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + 3] = buffer_colors_origin[(long) buffer_colors_size - 3]; */ + /* buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + 4] = buffer_colors_origin[(long) buffer_colors_size - 2]; */ + /* buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + 5] = buffer_colors_origin[(long) buffer_colors_size - 1]; */ buffer_vertex_size -= 6; buffer_colors_size -= 6; @@ -661,6 +666,7 @@ static inline int erase_arrow (int arrows_nb, int address, if (console) print_arrows_array (arrows_ptr, arrows_nb, 0); + if (1) print_arrows_array (arrows_ptr, arrows_nb, 0); return arrows_nb; } @@ -723,7 +729,8 @@ static inline int set_arrow (struct arrow_t *arrows_ptr, int arrows_nb, } } } -// print_vertex_and_lines_buffers (arrows_ptr, arrows_nb, address, requested_weight, current_weight, site, x, y, z); + if (console) print_vertex_and_lines_buffers (arrows_ptr, arrows_nb, address, requested_weight, current_weight, site, x, y, z); + if (1) print_vertex_and_lines_buffers (arrows_ptr, arrows_nb, address, requested_weight, current_weight, site, x, y, z); if (requested_weight == 0 && console) printf(" - set_arrow() invoked with requested weight = %2d bf_vrtx = %d bf_ln = %d add: %d",\ @@ -751,18 +758,18 @@ static inline void print_buffers_array_head () {printf(" [rank] load | site static inline void print_empty_buffers_array () {printf(" [NULL] ---- | ---- --- --- --- -1 --- --- ---\n");} static void print_one_arrow_in_buffers (struct arrow_t *arrows, int i, int arrows_nb, int address) { - printf(" [%4d] = %2d | %2d, %2d, %2d, %2d, (%2d) %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f\n",\ + printf(" [%4d] = %2d | %2d, %2d, %2d, %2d, (%2d) %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f %4d %4d\n",\ i, arrows[i].load, arrows[i].site, arrows[i].x, arrows[i].y, arrows[i].z, address, - buffer_vertex_origin [buffer_vertex_0_arrow + i * 3 + 0], - buffer_vertex_origin [buffer_vertex_0_arrow + i * 3 + 1], - buffer_lines_origin [buffer_lines_0_arrow + i * 3 + 2], + buffer_vertex_origin [buffer_vertex_0_arrow + i * 6 + 0], + buffer_vertex_origin [buffer_vertex_0_arrow + i * 6 + 1], + buffer_vertex_origin [buffer_vertex_0_arrow + i * 6 + 2], - buffer_vertex_origin [buffer_vertex_0_arrow + i * 3 + 3], - buffer_vertex_origin [buffer_vertex_0_arrow + i * 3 + 4], - buffer_lines_origin [buffer_lines_0_arrow + i * 3 + 5], + buffer_vertex_origin [buffer_vertex_0_arrow + i * 6 + 3], + buffer_vertex_origin [buffer_vertex_0_arrow + i * 6 + 4], + buffer_vertex_origin [buffer_vertex_0_arrow + i * 6 + 5], buffer_lines_origin [buffer_lines_0_arrow + i * 2 + 0], buffer_lines_origin [buffer_lines_0_arrow + i * 2 + 1]); @@ -799,10 +806,10 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void) int rand(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 arbitrary = 3; + int space_X = rand() % arbitrary, + space_Y = rand() % arbitrary, + space_Z = rand() % arbitrary; int density_max = space_X * space_Y * space_Z; int max = fmax(space_X, space_Y); max = fmax(max, space_Z); @@ -897,18 +904,18 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void) arrows_nb = 0; arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, - rand() % arbitrary + 1, // load / weight + 1 + rand() % arbitrary, // load / weight 0,//rand() % 6, // site, - 0,//rand() % space_X, // x - 0,//rand() % space_Y, // y - 0, 0);//rand() % space_Z); // z + rand() % space_X, // x + rand() % space_Y, // y + rand() % space_Z, 0); // z arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, - rand() % arbitrary + 1, // load / weight + 1 + rand() % arbitrary, // load / weight 1,//rand() % 6, // site, - 0,//rand() % space_X, // x - 0,//rand() % space_Y, // y - 0, 0);//rand() % space_Z); // z + rand() % space_X, // x + rand() % space_Y, // y + rand() % space_Z, 0); // 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);} */ @@ -929,27 +936,27 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void) /* if (0) 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, - 1,//rand() % arbitrary + 1, // load / weight + 1 + rand() % arbitrary, // load / weight 2,//rand() % 6, // site, - 0,//rand() % space_X, // x - 0,//rand() % space_Y, // y - 0, 0);//rand() % space_Z); // z + rand() % space_X, // x + rand() % space_Y, // y + rand() % space_Z, 0); // 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, - 1,//rand() % arbitrary + 1, // load / weight + 1 + rand() % arbitrary, // load / weight 3,//rand() % 6, // site, - 0,//rand() % space_X, // x - 0,//rand() % space_Y, // y - 0, 0);//rand() % space_Z); // z + rand() % space_X, // x + rand() % space_Y, // y + rand() % space_Z, 0); // z 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, 0);//rand() % space_Z); // z + rand() % space_X, // x + rand() % space_Y, // y + rand() % space_Z, 0); // z /* arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, */ /* 0,//rand() % arbitrary + 1, // load / weight */