|
|
|
@ -35,7 +35,8 @@
|
|
|
|
|
#define VERTEX_SHADER_FILE "src/shaders/shader.vert"
|
|
|
|
|
#define FRAG_SHADER_FILE "src/shaders/shader.frag"
|
|
|
|
|
|
|
|
|
|
static struct arrow_t *arrows_ptr;
|
|
|
|
|
static struct arrow_t *arrows_ptr; /* nom modifié pour pouvoir plus facilement distinguer le tableau
|
|
|
|
|
* des autres noms incluant "arrows" (de arrows_nb, par ex.) */
|
|
|
|
|
GLfloat *buffer_vertex_origin = NULL;
|
|
|
|
|
GLfloat *buffer_colors_origin = NULL;
|
|
|
|
|
GLuint *buffer_lines_origin = NULL;
|
|
|
|
@ -554,81 +555,9 @@ bool graphics_shutdown(const void *gl_area)
|
|
|
|
|
|
|
|
|
|
static inline void print_vertex_and_lines_buffers (struct arrow_t *arrows_ptr, int arrows_nb, int address, int requested_weight,
|
|
|
|
|
int current_weight, int site, int x, int y, int z);
|
|
|
|
|
static inline void print_buffers_array_head () {printf(" [rank] load | site x y z [address] buffer-vertex-1 buffer-vertex-2 buffer-lines\n");}
|
|
|
|
|
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 %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 * 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 * 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]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void print_vertex_and_lines_buffers (struct arrow_t *arrows_ptr, int arrows_nb, int address, int requested_weight,
|
|
|
|
|
int current_weight, int site, int x, int y, int z)
|
|
|
|
|
{
|
|
|
|
|
/* for (int i = 0; i < 6; i++) printf("%5.2f ", buffer_vertex_origin [buffer_vertex_0_arrow + i]); printf("\n"); */
|
|
|
|
|
/* for (int i = 0; i < 6; i++) printf("%5.2f ", buffer_lines_origin [buffer_lines_0_arrow + i]); printf("\n"); */
|
|
|
|
|
print_buffers_array_head ();
|
|
|
|
|
for (int i = 0; i < arrows_nb; i++)
|
|
|
|
|
print_one_arrow_in_buffers(arrows_ptr, i, arrows_nb, address);
|
|
|
|
|
if (arrows_nb == 0) print_empty_buffers_array();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Assigns a new load to the arrow at address (address)
|
|
|
|
|
*/
|
|
|
|
|
static int rewrite_arrow (int arrows_nb, int address, int load, int site, int x, int y, int z, int console)
|
|
|
|
|
{
|
|
|
|
|
arrows_ptr[address].load = load;
|
|
|
|
@ -638,6 +567,10 @@ static int rewrite_arrow (int arrows_nb, int address, int load, int site, int x,
|
|
|
|
|
return arrows_nb;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Creates a new arrow at address (address)
|
|
|
|
|
* NB Weights (or loads) are NOT added
|
|
|
|
|
*/
|
|
|
|
|
static inline int create_arrow (int arrows_nb,
|
|
|
|
|
int space_X, int space_Y, int space_Z,
|
|
|
|
|
int load, int site, int x, int y, int z,
|
|
|
|
@ -669,98 +602,219 @@ static inline int create_arrow (int arrows_nb,
|
|
|
|
|
return arrows_nb;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Removes an arrow at address (address)
|
|
|
|
|
*/
|
|
|
|
|
static inline int erase_arrow (int arrows_nb, int address,
|
|
|
|
|
int site, int x, int y, int z,
|
|
|
|
|
int console)
|
|
|
|
|
{
|
|
|
|
|
arrows_nb --;
|
|
|
|
|
assert (arrows_nb);
|
|
|
|
|
|
|
|
|
|
int mem = arrows_ptr[address].site;
|
|
|
|
|
arrows_ptr[address].load = arrows_ptr[arrows_nb].load;
|
|
|
|
|
arrows_ptr[address].site = arrows_ptr[arrows_nb].site;
|
|
|
|
|
arrows_ptr[address].x = arrows_ptr[arrows_nb].x;
|
|
|
|
|
arrows_ptr[address].y = arrows_ptr[arrows_nb].y;
|
|
|
|
|
arrows_ptr[address].z = arrows_ptr[arrows_nb].z;
|
|
|
|
|
|
|
|
|
|
arrows_ptr[address].load = arrows_ptr[arrows_nb].load;
|
|
|
|
|
arrows_ptr[address].site = arrows_ptr[arrows_nb].site;
|
|
|
|
|
arrows_ptr[address].x = arrows_ptr[arrows_nb].x;
|
|
|
|
|
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]; */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (console) printf("in erase_arrow() : arrows_nb = %d > %d arrow to erase > (address = %d, site = %d)\n\
|
|
|
|
|
: arrows_ptr[%d].site = %d >> %d (%d is last arrow.site)\n",\
|
|
|
|
|
arrows_nb + 1, arrows_nb, address, address, site, mem, arrows_ptr[address].site, arrows_ptr[arrows_nb].site);
|
|
|
|
|
|
|
|
|
|
// Attention : lors de la création des vertex des flèches, tous les vertex centraux sont redondants (au maximum 6)
|
|
|
|
|
if (arrows_nb > 0) {
|
|
|
|
|
|
|
|
|
|
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_lines_size -= 2;
|
|
|
|
|
|
|
|
|
|
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];
|
|
|
|
|
|
|
|
|
|
void *new_arrows_vertex_ptr = g_realloc(buffer_vertex_origin, buffer_vertex_size * sizeof(GLfloat));
|
|
|
|
|
if (new_arrows_vertex_ptr) buffer_vertex_origin = new_arrows_vertex_ptr;
|
|
|
|
|
else perror("In graphics.erase_arrow(), can't re_allocate for arrows vertex buffer.\n");
|
|
|
|
|
|
|
|
|
|
void *new_arrows_colors_ptr = g_realloc(buffer_colors_origin, buffer_colors_size * sizeof(GLfloat));
|
|
|
|
|
if (new_arrows_colors_ptr) buffer_colors_origin = new_arrows_colors_ptr;
|
|
|
|
|
else perror("In graphics.erase_arrow(), can't re_allocate for arrows colors buffer.\n");
|
|
|
|
|
void *new_arrows_lines_ptr = g_realloc(buffer_lines_origin, buffer_lines_size * sizeof(GLfloat));
|
|
|
|
|
if (new_arrows_lines_ptr) buffer_lines_origin = new_arrows_lines_ptr;
|
|
|
|
|
else perror("In graphics.erase_arrow(), can't re_allocate for arrows lines buffer.\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* buffer_vertex_size -= 6; <<< ceci est fait dans : graphics_write_vertex() */
|
|
|
|
|
/* buffer_colors_size -= 6; <<< ceci est fait dans : graphics_write_colors() */
|
|
|
|
|
/* buffer_lines_size -= 2; <<< ceci est fait dans : graphics_write_line() */
|
|
|
|
|
// 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];
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
void *new_arrows_vertex_ptr = g_realloc(buffer_vertex_origin, buffer_vertex_size * sizeof(GLfloat));
|
|
|
|
|
if (new_arrows_vertex_ptr) buffer_vertex_origin = new_arrows_vertex_ptr;
|
|
|
|
|
else perror("In graphics.erase_arrow(), can't re_allocate for arrows vertex buffer.\n");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Il ne faut pas réécrire ce qui suit: ces lignes dessinent maintenant à partir d'autres vertex */
|
|
|
|
|
/* void *new_arrows_lines_ptr = g_realloc(buffer_lines_origin, buffer_lines_size * sizeof(GLfloat)); */
|
|
|
|
|
/* if (new_arrows_lines_ptr) buffer_lines_origin = new_arrows_lines_ptr; */
|
|
|
|
|
/* else perror("In graphics.erase_arrow(), can't re_allocate for arrows lines buffer.\n"); */
|
|
|
|
|
|
|
|
|
|
if (console) print_arrows_array (arrows_ptr, arrows_nb, 0);
|
|
|
|
|
|
|
|
|
|
return arrows_nb;
|
|
|
|
|
}
|
|
|
|
|
/* if (0) { */
|
|
|
|
|
|
|
|
|
|
/* int some_nb = 12; if (arrows_nb == 1) some_nb = 9; */
|
|
|
|
|
|
|
|
|
|
/* void *new_arrows_list_ptr = g_realloc(arrows_ptr, arrows_nb * sizeof(struct arrow_t)); */
|
|
|
|
|
/* if (new_arrows_list_ptr) arrows_ptr = new_arrows_list_ptr; */
|
|
|
|
|
/* else perror("In erase arrow, can't re_allocate for arrow list.\n"); */
|
|
|
|
|
|
|
|
|
|
/* long unit = 24 * 3 * sizeof(GLfloat); // 4 * 3 * 4 = 48 sizeof(GLfloat) = 3 * 8 bits */
|
|
|
|
|
/* printf(" - erase_arrow() invoked with address = %d buffer_vertex_size - buffer_vertex_0_arrow = %d (for %d arrows)\n",\ */
|
|
|
|
|
/* address, (long) buffer_vertex_size - buffer_vertex_0_arrow, arrows_nb + 1); */
|
|
|
|
|
/* for (int i = 24; i < 36; i ++) printf(" %5.2f", buffer_vertex_origin[i]); printf("\n"); */
|
|
|
|
|
|
|
|
|
|
/* if (0) printf("buffer_vertex_0_arrow = %d arrows_nb * 3 = %d <<<<\n", buffer_vertex_0_arrow, arrows_nb * 3); */
|
|
|
|
|
/* void *new_arrows_vertex_ptr = g_realloc(buffer_vertex_origin, buffer_vertex_0_arrow + some_nb * 3 * sizeof(GLfloat)); */
|
|
|
|
|
/* if (new_arrows_vertex_ptr) buffer_vertex_origin = new_arrows_vertex_ptr; */
|
|
|
|
|
/* else perror("In erase arrow, can't re_allocate for arrow vertex buffer.\n"); */
|
|
|
|
|
|
|
|
|
|
/* if (0) printf("buffer_lines_0_arrow = %d arrows_nb * 2 = %d <<<<\n", buffer_lines_0_arrow, arrows_nb * 2); */
|
|
|
|
|
/* void *new_arrows_lines_ptr = g_realloc(buffer_lines_origin, buffer_lines_0_arrow + some_nb * 2 * sizeof(GLfloat)); */
|
|
|
|
|
/* if (new_arrows_lines_ptr) buffer_lines_origin = new_arrows_lines_ptr; */
|
|
|
|
|
/* else perror("In erase arrow, can't re_allocate for arrow lines buffer.\n"); */
|
|
|
|
|
/* } */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static inline int set_arrow (struct arrow_t *arrows_ptr, int arrows_nb, int space_X, int space_Y, int space_Z,
|
|
|
|
|
int requested_weight, int site, int arrow_x, int arrow_y, int arrow_z, int console)
|
|
|
|
|
|
|
|
|
|
static inline void print_vertex_and_lines_buffers(struct arrow_t *arrows_ptr, int arrows_nb, int address, int requested_weight,
|
|
|
|
|
int current_weight, int site, int x, int y, int z);
|
|
|
|
|
static inline void show_user_action(struct arrow_t *arrows_ptr, int arrows_nb, int address, int requested_weight,
|
|
|
|
|
int current_weight, int site, int x, int y, int z);
|
|
|
|
|
/*
|
|
|
|
|
* Calls one of the functions create_arrow(), erase_arrow() or rewrite_arrow()
|
|
|
|
|
* according to requested weight and address (coord site, x, y, z)
|
|
|
|
|
*
|
|
|
|
|
* May not call any of these three functions if :
|
|
|
|
|
* - Current_weight of an arrow located at the requested address == requested_weight
|
|
|
|
|
* - No arrow was found at the requested addres AND current_weight == requested_weight
|
|
|
|
|
*/
|
|
|
|
|
static inline int set_arrow (struct arrow_t *arrows_ptr, int arrows_nb,
|
|
|
|
|
int space_X, int space_Y, int space_Z,
|
|
|
|
|
int requested_weight, int site, int x, int y, int z, int console)
|
|
|
|
|
{
|
|
|
|
|
int address = -1, current_weight = -1;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < arrows_nb; i++)
|
|
|
|
|
if ((site == arrows_ptr[i].site)
|
|
|
|
|
&& (arrow_x == arrows_ptr[i].x)
|
|
|
|
|
&& (arrow_y == arrows_ptr[i].y)
|
|
|
|
|
&& (arrow_z == arrows_ptr[i].z))
|
|
|
|
|
#pragma omp parallel schedule(static, 12)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < arrows_nb; i++) {
|
|
|
|
|
if ((site == arrows_ptr[i].site)
|
|
|
|
|
&& (x == arrows_ptr[i].x)
|
|
|
|
|
&& (y == arrows_ptr[i].y)
|
|
|
|
|
&& (z == arrows_ptr[i].z))
|
|
|
|
|
{
|
|
|
|
|
address = i;
|
|
|
|
|
address = i * 5;
|
|
|
|
|
current_weight = arrows_ptr[i].load;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 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",\
|
|
|
|
|
requested_weight, buffer_vertex_size / 3, buffer_lines_size / 2, address);
|
|
|
|
|
|
|
|
|
|
if (console) show_user_action(arrows_ptr, arrows_nb, address, requested_weight, current_weight, site, x, y, z);
|
|
|
|
|
|
|
|
|
|
if (address == -1 && requested_weight > 0)
|
|
|
|
|
return create_arrow (arrows_nb, space_X, space_Y, space_Z, requested_weight, site, arrow_x, arrow_y, arrow_z, console);
|
|
|
|
|
if (address >= 0 && requested_weight == 0) // address >= 0 if and only if arrows_nb > 0
|
|
|
|
|
return erase_arrow (arrows_nb, address, site, arrow_x, arrow_y, arrow_z, console);
|
|
|
|
|
return create_arrow (arrows_nb, space_X, space_Y, space_Z, requested_weight, site, x, y, z, console);
|
|
|
|
|
|
|
|
|
|
if (address >= 0 && requested_weight == 0)
|
|
|
|
|
return erase_arrow (arrows_nb, address, site, x, y, z, console);
|
|
|
|
|
|
|
|
|
|
if (address >= 0 && current_weight != requested_weight)
|
|
|
|
|
return rewrite_arrow (arrows_nb, address/5, requested_weight, site, arrow_x, arrow_y, arrow_z, console);
|
|
|
|
|
if (address >= 0 && current_weight == requested_weight && console) print_arrows_array(arrows_ptr, arrows_nb, 3);
|
|
|
|
|
if (address == -1 && requested_weight == 0 && console) print_arrows_array(arrows_ptr, arrows_nb, 4);
|
|
|
|
|
return rewrite_arrow (arrows_nb, address/5, requested_weight, site, x, y, z, console);
|
|
|
|
|
|
|
|
|
|
if (address >= 0 && current_weight == requested_weight && console) print_arrows_array(arrows_ptr, arrows_nb, 3);
|
|
|
|
|
|
|
|
|
|
if (address == -1 && requested_weight == 0 && console) print_arrows_array(arrows_ptr, arrows_nb, 4);
|
|
|
|
|
|
|
|
|
|
return arrows_nb;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void print_buffers_array_head () {printf(" [rank] load | site x y z [address] buffer-vertex-1 buffer-vertex-2 buffer-lines\n");}
|
|
|
|
|
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",\
|
|
|
|
|
i,
|
|
|
|
|
arrows[i].load, arrows[i].site, arrows[i].x, arrows[i].y, arrows[i].z,
|
|
|
|
|
address,
|
|
|
|
|
|
|
|
|
|
void main_test_graphics (void)
|
|
|
|
|
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 * 3 + 3],
|
|
|
|
|
buffer_vertex_origin [buffer_vertex_0_arrow + i * 3 + 4],
|
|
|
|
|
buffer_lines_origin [buffer_lines_0_arrow + i * 3 + 5],
|
|
|
|
|
|
|
|
|
|
buffer_lines_origin [buffer_lines_0_arrow + i * 2 + 0],
|
|
|
|
|
buffer_lines_origin [buffer_lines_0_arrow + i * 2 + 1]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void print_vertex_and_lines_buffers (struct arrow_t *arrows_ptr, int arrows_nb, int address, int requested_weight,
|
|
|
|
|
int current_weight, int site, int x, int y, int z)
|
|
|
|
|
{
|
|
|
|
|
srand(time(NULL)); int rand(void); void srand(unsigned int seed); int arbitrary = 4, randomize = 0, console = 0;
|
|
|
|
|
int space_X = 1, space_Y = 1, space_Z = 1, density_max = space_X * space_Y * space_Z;
|
|
|
|
|
if (randomize) {space_X = 1 + rand() % arbitrary; space_Y = 1 + rand() % arbitrary; space_Z = 1 + rand() % arbitrary;}
|
|
|
|
|
/* for (int i = 0; i < 6; i++) printf("%5.2f ", buffer_vertex_origin [buffer_vertex_0_arrow + i]); printf("\n"); */
|
|
|
|
|
/* for (int i = 0; i < 6; i++) printf("%5.2f ", buffer_lines_origin [buffer_lines_0_arrow + i]); printf("\n"); */
|
|
|
|
|
print_buffers_array_head ();
|
|
|
|
|
for (int i = 0; i < arrows_nb; i++)
|
|
|
|
|
print_one_arrow_in_buffers(arrows_ptr, i, arrows_nb, address);
|
|
|
|
|
if (arrows_nb == 0) print_empty_buffers_array();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Init space and arrows (= initial state)
|
|
|
|
|
* and allows ulterior creations, suppressions or modifications of the arrows[] array
|
|
|
|
|
*
|
|
|
|
|
* Draws space and arrows
|
|
|
|
|
*/
|
|
|
|
|
void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
|
|
|
|
|
{
|
|
|
|
|
// assert : space dimensions (x,y,z) > 0
|
|
|
|
|
// assert : arrows localization within space and sites
|
|
|
|
|
// assert : no more than one arrow per address
|
|
|
|
|
// notify : weights are replaced, NOT added (could be !)
|
|
|
|
|
|
|
|
|
|
struct timespec ts;
|
|
|
|
|
srand(time(NULL)); // Initialisation du générateur pseudo-aléatoire
|
|
|
|
|
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 density_max = space_X * space_Y * space_Z;
|
|
|
|
|
int max = fmax(space_X, space_Y); max = fmax(max, space_Z);
|
|
|
|
|
int load = 0, site = 0, x = 0, y = 0, z = 0, arrows_nb = 0, specif_arrows_nb = rand() % density_max / 2;
|
|
|
|
|
|
|
|
|
|
int print_arrows_data = 0;
|
|
|
|
|
|
|
|
|
|
int load = 0, site = 0, x = 0, y = 0, z = 0;
|
|
|
|
|
int specif_arrows_nb = rand() % density_max / 2;
|
|
|
|
|
int arrows_nb = 0, cpt = 0, t_initial = 0;
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------------*/
|
|
|
|
@ -771,62 +825,302 @@ void main_test_graphics (void)
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
/* V E R T E X F I R S T */
|
|
|
|
|
|
|
|
|
|
/* S P A C E */
|
|
|
|
|
|
|
|
|
|
write_space_ridges_vertex (buffer_vertex_size, space_X, space_Y, space_Z);
|
|
|
|
|
write_space_ridges_lines ();
|
|
|
|
|
write_grids_on_space_faces_vertex (space_X, space_Y, space_Z);
|
|
|
|
|
write_grids_on_space_faces_lines (buffer_lines_size, space_X, space_Y, space_Z);
|
|
|
|
|
if (0) printf("buffer_vertex_size before writing 8 space_ridges_vertex : %3d (x 3 = %d)\n", buffer_vertex_size / 3, buffer_vertex_size);
|
|
|
|
|
|
|
|
|
|
buffer_vertex_0_arrow = buffer_vertex_size;
|
|
|
|
|
write_space_ridges_vertex (buffer_vertex_size, space_X, space_Y, space_Z);
|
|
|
|
|
/* buffer_colors_size = 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 (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); */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* A R R O W S */
|
|
|
|
|
|
|
|
|
|
/* if (0) printf("buffer_vertex_size before writing (%d) arrows_vertex : %d\n", arrows_nb, buffer_vertex_size / 3); */
|
|
|
|
|
|
|
|
|
|
/* 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; */
|
|
|
|
|
|
|
|
|
|
/* write_one_arrow_vertex(space_X, space_Y, space_Z, */
|
|
|
|
|
/* load, site, x, y, z); */
|
|
|
|
|
/* buffer_colors_size = buffer_vertex_size; */
|
|
|
|
|
/* } */
|
|
|
|
|
|
|
|
|
|
/* if (0) printf("buffer_vertex_size after writing (%d) arrows_vertex : %d\n", arrows_nb, buffer_vertex_size / 3); */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
/* L I N E S S E C O N D */
|
|
|
|
|
|
|
|
|
|
// buffer_vertex_size = 0; buffer_colors_size = 0; buffer_lines_size = 0;
|
|
|
|
|
|
|
|
|
|
/* S P A C E */
|
|
|
|
|
|
|
|
|
|
if (0) printf("buffer_lines_size before writing 12 space_ridges_lines : %2d (* 2 = %2d)\n", buffer_lines_size / 2, buffer_lines_size);
|
|
|
|
|
write_space_ridges_lines ();
|
|
|
|
|
if (0) printf("buffer_lines_size after writing 12 space_ridges_lines : %2d (* 2 = %2d)\n", buffer_lines_size / 2, buffer_lines_size);
|
|
|
|
|
|
|
|
|
|
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 (0) printf("buffer_lines_size after writing (n) space_faces_lines : %d (* 2 = %d)\n\n", buffer_lines_size / 2, buffer_lines_size);
|
|
|
|
|
|
|
|
|
|
/* Ce programme définit et crée séquentiellement les caractéristiques puis les images de l'espace puis celles des flèches
|
|
|
|
|
* Pour pouvoir effacer une flèche (n'importe laquelle),
|
|
|
|
|
* il est nécéssaire de connaître la taille des buffers au moment de la création de la première flèche */
|
|
|
|
|
|
|
|
|
|
buffer_vertex_0_arrow = buffer_vertex_size; // Attention, à ce stade, pas de vertex redondant
|
|
|
|
|
buffer_lines_0_arrow = buffer_lines_size;
|
|
|
|
|
if (0) printf("buffer_vertex_0_arrow = %d (%d points) buffer_lines_0_arrow = %d (%d lines)\n",\
|
|
|
|
|
buffer_vertex_0_arrow, buffer_vertex_0_arrow / 3, buffer_lines_0_arrow, buffer_lines_0_arrow / 2);
|
|
|
|
|
|
|
|
|
|
/* A R R O W S */
|
|
|
|
|
|
|
|
|
|
if (1) for (int i = 0; i < 6; i++)
|
|
|
|
|
/* #pragma omp parallel */
|
|
|
|
|
/* { */
|
|
|
|
|
/* while (arrows_nb < specif_arrows_nb){ */
|
|
|
|
|
|
|
|
|
|
arrows_nb = 0;
|
|
|
|
|
|
|
|
|
|
arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z,
|
|
|
|
|
1, i % 6, 0, 0, 0, console);
|
|
|
|
|
if (0) for (int i = 0; i < rand() % density_max; i++)
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z,
|
|
|
|
|
1, // load
|
|
|
|
|
rand() % 6, // site
|
|
|
|
|
rand() % space_X, // x
|
|
|
|
|
rand() % space_Y, // y
|
|
|
|
|
rand() % space_Z, // z
|
|
|
|
|
console);
|
|
|
|
|
rand() % arbitrary + 1, // load / weight
|
|
|
|
|
1,//rand() % 6, // site,
|
|
|
|
|
0,//rand() % space_X, // x
|
|
|
|
|
0,//rand() % space_Y, // y
|
|
|
|
|
0, 0);//rand() % space_Z); // z
|
|
|
|
|
|
|
|
|
|
if (1) print_user_choices(arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, 0);
|
|
|
|
|
/* 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);}
|
|
|
|
|
/* } */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* N E W D A T A W I L L N O W B E S P E C I F I E D */
|
|
|
|
|
|
|
|
|
|
/* A N D T H E N D R A W N E D */
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
/* N E W D A T A W I L L N O W B E S P E C I F I E D */
|
|
|
|
|
/* if (0) print_user_choices(arrows_ptr, arrows_nb, space_X, space_Y, space_Z, print_arrows_data, 0); */
|
|
|
|
|
|
|
|
|
|
/* A N D T H E N D R A W N E D */
|
|
|
|
|
arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z,
|
|
|
|
|
1,//rand() % arbitrary + 1, // load / weight
|
|
|
|
|
2,//rand() % 6, // site,
|
|
|
|
|
0,//rand() % space_X, // x
|
|
|
|
|
0,//rand() % space_Y, // y
|
|
|
|
|
0, 0);//rand() % space_Z); // z
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------------*/
|
|
|
|
|
/* print_user_choices(arrows_ptr, arrows_nb, space_X, space_Y, space_Z, print_arrows_data, 0); */
|
|
|
|
|
|
|
|
|
|
console = 1;
|
|
|
|
|
arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z,
|
|
|
|
|
1,//rand() % arbitrary + 1, // load / weight
|
|
|
|
|
3,//rand() % 6, // site,
|
|
|
|
|
0,//rand() % space_X, // x
|
|
|
|
|
0,//rand() % space_Y, // y
|
|
|
|
|
0, 0);//rand() % space_Z); // z
|
|
|
|
|
|
|
|
|
|
/* If load == 0 then erase the arrow at this address v */
|
|
|
|
|
arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, 0, 0, 0, 0, console);
|
|
|
|
|
arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, 1, 0, 0, 0, console);
|
|
|
|
|
arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, 2, 0, 0, 0, console);
|
|
|
|
|
/* arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, 3, 0, 0, 0, console); */
|
|
|
|
|
/* arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, 4, 0, 0, 0, console); */
|
|
|
|
|
/* arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 0, 5, 0, 0, 0, console); */
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
/* arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, */
|
|
|
|
|
/* 0,//rand() % arbitrary + 1, // load / weight */
|
|
|
|
|
/* 1,//rand() % 6, // site, */
|
|
|
|
|
/* 0,//rand() % space_X, // x */
|
|
|
|
|
/* 0,//rand() % space_Y, // y */
|
|
|
|
|
/* 0, 0);//rand() % space_Z); // z */
|
|
|
|
|
|
|
|
|
|
/* arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, */
|
|
|
|
|
/* 0,//rand() % arbitrary + 1, // load / weight */
|
|
|
|
|
/* 2,//rand() % 6, // site, */
|
|
|
|
|
/* 0,//rand() % space_X, // x */
|
|
|
|
|
/* 0,//rand() % space_Y, // y */
|
|
|
|
|
/* 0, 0);//rand() % space_Z); // z */
|
|
|
|
|
|
|
|
|
|
/* arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, */
|
|
|
|
|
/* 0,//rand() % arbitrary + 1, // load / weight */
|
|
|
|
|
/* 3,//rand() % 6, // site, */
|
|
|
|
|
/* 0,//rand() % space_X, // x */
|
|
|
|
|
/* 0,//rand() % space_Y, // y */
|
|
|
|
|
/* 0, 0);//rand() % space_Z); // z */
|
|
|
|
|
|
|
|
|
|
/* int address = 1; */
|
|
|
|
|
|
|
|
|
|
/* if (0) printf("buffer_lines_0_arrow = %d address = %d buffer_lines_size = %d >>>",\ */
|
|
|
|
|
/* buffer_lines_0_arrow, address, buffer_lines_size); */
|
|
|
|
|
/* //buffer_lines_origin [(long) buffer_lines_0_arrow + address * 2 + 0] = buffer_lines_origin[(long) buffer_lines_size - 2]; */
|
|
|
|
|
/* //buffer_lines_origin [(long) buffer_lines_0_arrow + address * 2 + 1] = buffer_lines_origin[(long) buffer_lines_size - 1]; */
|
|
|
|
|
|
|
|
|
|
/* buffer_lines_size -= 2; */
|
|
|
|
|
|
|
|
|
|
/* void *new_arrows_lines_ptr = g_realloc(buffer_lines_origin, buffer_lines_size * sizeof(GLfloat)); */
|
|
|
|
|
/* if (new_arrows_lines_ptr) buffer_lines_origin = new_arrows_lines_ptr; */
|
|
|
|
|
/* else perror("In experience, can't re_allocate for arrows lines buffer.\n"); */
|
|
|
|
|
/* if (0) printf(">>> buffer_lines_size = %d\n", buffer_lines_size); */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* // Attention : à la création des vertex, tous les vertex centraux sont redondants (au maximum 6) */
|
|
|
|
|
/* if (0) printf("buffer_vertex_0_arrow = %d address = %d buffer_vertex_size = %d >>>", buffer_vertex_0_arrow, address, buffer_vertex_size); */
|
|
|
|
|
/* 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 * 6 + 0] = buffer_colors_origin[(long) buffer_colors_size - 6]; */
|
|
|
|
|
/* buffer_colors_origin [(long) buffer_colors_0_arrow + address * 6 + 1] = buffer_colors_origin[(long) buffer_colors_size - 5]; */
|
|
|
|
|
/* buffer_colors_origin [(long) buffer_colors_0_arrow + address * 6 + 2] = buffer_colors_origin[(long) buffer_colors_size - 4]; */
|
|
|
|
|
/* buffer_colors_origin [(long) buffer_colors_0_arrow + address * 6 + 3] = buffer_colors_origin[(long) buffer_colors_size - 3]; */
|
|
|
|
|
/* buffer_colors_origin [(long) buffer_colors_0_arrow + address * 6 + 4] = buffer_colors_origin[(long) buffer_colors_size - 2]; */
|
|
|
|
|
/* buffer_colors_origin [(long) buffer_colors_0_arrow + address * 6 + 5] = buffer_colors_origin[(long) buffer_colors_size - 1]; */
|
|
|
|
|
|
|
|
|
|
/* buffer_vertex_size -= 6; */
|
|
|
|
|
/* buffer_colors_size -= 6; */
|
|
|
|
|
|
|
|
|
|
/* void *new_arrows_vertex_ptr = g_realloc(buffer_vertex_origin, buffer_vertex_size * sizeof(GLfloat)); */
|
|
|
|
|
/* if (new_arrows_vertex_ptr) buffer_vertex_origin = new_arrows_vertex_ptr; */
|
|
|
|
|
/* else perror("In experience, can't re_allocate for arrows vertex buffer.\n"); */
|
|
|
|
|
/* if (0) printf(">>> buffer_vertex_size = %d\n", buffer_vertex_size); */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
/* F R E E */
|
|
|
|
|
|
|
|
|
|
/* ( F R E E 'S P A C E' : S E E G R A P H I C S H U T D O W N ) */
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------------*/
|
|
|
|
|
if (0) printf("buffer_lines_0_arrow = %d\n", buffer_lines_0_arrow);
|
|
|
|
|
|
|
|
|
|
free(arrows_ptr); arrows_ptr = NULL; arrows_nb = 0;
|
|
|
|
|
if (0) for (long h = buffer_lines_0_arrow; h < buffer_lines_size; h++) {
|
|
|
|
|
if (h == buffer_lines_0_arrow) printf("\n");
|
|
|
|
|
if (h % 2 == 0) printf("\n");
|
|
|
|
|
printf("%2d ", buffer_lines_origin [h]);
|
|
|
|
|
}
|
|
|
|
|
if (0) printf("\n");
|
|
|
|
|
|
|
|
|
|
if (0) for (long a = buffer_vertex_0_arrow; a < buffer_vertex_size; a++) {
|
|
|
|
|
if (a % 6 == 0) printf("\n");
|
|
|
|
|
if (a % 3 == 0) printf("\n");
|
|
|
|
|
printf("[%d] %5.2f ", a/3, buffer_vertex_origin [a]);
|
|
|
|
|
}
|
|
|
|
|
if (0) printf("\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 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 */
|
|
|
|
|
|
|
|
|
|
/* 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, */
|
|
|
|
|
/* 1,//rand() % arbitrary + 1, // load / weight */
|
|
|
|
|
/* 2,//rand() % 6, // site, */
|
|
|
|
|
/* 0,//rand() % space_X, // x */
|
|
|
|
|
/* 0,//rand() % space_Y, // y */
|
|
|
|
|
/* 0, 0);//rand() % space_Z); // z */
|
|
|
|
|
|
|
|
|
|
/* arrows_nb = set_arrow (arrows_ptr, arrows_nb, */
|
|
|
|
|
/* 1,//rand() % arbitrary + 1, // load / weight */
|
|
|
|
|
/* 3,//rand() % 6, // site, */
|
|
|
|
|
/* 0,//rand() % space_X, // x */
|
|
|
|
|
/* 0,//rand() % space_Y, // y */
|
|
|
|
|
/* 0, 0);//rand() % space_Z); // z */
|
|
|
|
|
|
|
|
|
|
/* printf("On devrait avoir deux flèches Y+Y- (Zénith-Nadir) dessinées (au lieu des deux flèches X+X- Est-Ouest)...\n"); */
|
|
|
|
|
|
|
|
|
|
/* print_user_choices(arrows_ptr, arrows_nb, space_X, space_Y, space_Z, print_arrows_data, 0); */
|
|
|
|
|
|
|
|
|
|
// buffer_vertex_size -= 2;
|
|
|
|
|
// buffer_vertex_size += 3;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* assert : arrows_nb > arbitrary; */
|
|
|
|
|
/* int random_choice, modified = 0, deleted = 0; */
|
|
|
|
|
|
|
|
|
|
/* #pragma omp parallel */
|
|
|
|
|
/* { */
|
|
|
|
|
/* while (modified < arbitrary) { */
|
|
|
|
|
|
|
|
|
|
/* random_choice = rand() % 6; */
|
|
|
|
|
/* if (random_choice == 0) deleted++; */
|
|
|
|
|
|
|
|
|
|
/* modified = set_arrow (arrows_ptr, arrows_nb + modified, */
|
|
|
|
|
/* random_choice, // load / weight */
|
|
|
|
|
/* rand() % 6, // site, */
|
|
|
|
|
/* rand() % space_X, // x */
|
|
|
|
|
/* rand() % space_Y, // y */
|
|
|
|
|
/* rand() % space_Z, 0); // z */
|
|
|
|
|
/* } */
|
|
|
|
|
/* } */
|
|
|
|
|
|
|
|
|
|
/* #pragma omp parallel */
|
|
|
|
|
/* { */
|
|
|
|
|
/* for (int i = 0; i < arrows_nb + modified; 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_vertex(space_X, space_Y, space_Z, */
|
|
|
|
|
/* load, site, x, y, z); */
|
|
|
|
|
/* buffer_colors_size = buffer_vertex_size; */
|
|
|
|
|
/* } */
|
|
|
|
|
|
|
|
|
|
/* for (int i = 0; i < arrows_nb + modified; 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); */
|
|
|
|
|
/* } */
|
|
|
|
|
/* } */
|
|
|
|
|
|
|
|
|
|
/* print_evolution (arrows_ptr, arrows_nb, arbitrary, deleted, print_arrows_data); */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ? free (space) TODO
|
|
|
|
|
|
|
|
|
|
free(arrows_ptr);
|
|
|
|
|
arrows_ptr = NULL;
|
|
|
|
|
arrows_nb = 0;
|
|
|
|
|
}
|
|
|
|
|