REF: OK POUR DES PETITES VALEURS (RANDOM) - VERTEX & LIGNES GROUPÉES
This commit is contained in:
parent
16cb145586
commit
01fcc4f69e
|
@ -38,8 +38,11 @@ void show_arrows_array_head(int one_batch_size, long nb_batches_specified, int v
|
|||
void show_one_arrow_in_array(struct arrow_t *arrows, int i);
|
||||
void show_empty_arrows_array();
|
||||
void show_arrows_array (struct arrow_t *arrows, int arrows_nb, int x, int y, int z);
|
||||
|
||||
|
||||
void print_user_action(struct arrow_t *arrows, int arrows_nb, int address, int requested_weight,
|
||||
int current_weight, int site, int x, int y, int z);
|
||||
void print_user_choices(struct arrow_t *arrows, int arrows_nb,
|
||||
int space_size_x, int space_size_y, int space_size_z,
|
||||
int show_array, int show_space_design);
|
||||
/*
|
||||
* Prints the initial user choices :
|
||||
* - space dimension size and appearance (grids)
|
||||
|
|
|
@ -30,6 +30,43 @@
|
|||
|
||||
|
||||
|
||||
/* Prints the arrows[] array
|
||||
*
|
||||
* For each arrow the following parameters are displayed :
|
||||
* - rank in the array
|
||||
* - load (or weight)
|
||||
* - coordinates in space (site, x, y, z)
|
||||
*/
|
||||
static void print_arrows_array (struct arrow_t *arrows, int arrows_nb)
|
||||
{
|
||||
printf(" [rank] load | site x y z");
|
||||
for (int i = 0; i < arrows_nb; i++)
|
||||
printf("\n [%4d] = %2d | %2d, %2d, %2d, %2d", i, arrows[i].load,\
|
||||
arrows[i].site, arrows[i].x, arrows[i].y, arrows[i].z);
|
||||
if (arrows_nb == 0) printf("\n [NULL] ---- | ---- --- --- ---");
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
/* Prints the initial user choices :
|
||||
* - space dimension size and appearance (grids)
|
||||
* - arrows[] array
|
||||
* NB The space may be empty or saturated with arrows or any value in between
|
||||
* Only one arrow per possible coordinates with a load max equal to ? TODO
|
||||
*/
|
||||
void print_user_choices(struct arrow_t *arrows, int arrows_nb,
|
||||
int space_size_x, int space_size_y, int space_size_z,
|
||||
int show_array, int show_space_design)
|
||||
{
|
||||
printf("model + user constraints :\tspace size x,y,z = %d,%d,%d\tarrows nb = %d\t",\
|
||||
space_size_x, space_size_y, space_size_z, arrows_nb);
|
||||
|
||||
if (show_space_design) printf("orientations grilles alternées");
|
||||
printf("\n");
|
||||
|
||||
if (show_array) print_arrows_array (arrows, arrows_nb);
|
||||
}
|
||||
|
||||
/*
|
||||
* Prints the arrows[] array
|
||||
*
|
||||
|
@ -154,3 +191,40 @@ void show_buffers_states(int space_X, int space_Y, int space_Z,
|
|||
nb_batches_specified * one_batch_size - (buffer_lines_size - buffer_lines_size_after_cubes) / 14);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Prints the result of the function set_arrow()
|
||||
* and indicates the reasons of the choice (call) this function makes (see this function)
|
||||
*/
|
||||
void print_user_action(struct arrow_t *arrows, int arrows_nb, int address, int requested_weight,
|
||||
int current_weight, int site, int x, int y, int z)
|
||||
{
|
||||
if (address == -1 && requested_weight > 0) { // *(arrows + i * 5 + 0)
|
||||
printf("no such arrow found (%2d,%2d,%2d,%2d)", site, x, y, z); //arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4]);
|
||||
if (! TEST) printf("\n "); else printf(" ");
|
||||
printf("=> CREATE"); return;}
|
||||
|
||||
if (address >= 0 && requested_weight == 0) {
|
||||
printf("arrow (%2d,%2d,%2d,%2d) found at address %2d; current_weight = %2d;", site, x, y, z, address, current_weight); // arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4], address/5, current_weight);
|
||||
if (! TEST) printf("\n "); else printf(" ");
|
||||
printf("=> ERASE"); return;}
|
||||
|
||||
if (address >= 0 && current_weight != requested_weight) {
|
||||
printf("arrow (%2d,%2d,%2d,%2d) found at address %2d; current_weight = %2d;", site, x, y, z, address, current_weight); // arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4], address/5, current_weight);
|
||||
if (! TEST) printf("\n "); else printf(" ");
|
||||
printf("=> MODIFY"); return;}
|
||||
|
||||
if (address >= 0 && current_weight == requested_weight){
|
||||
printf("arrow (%2d,%2d,%2d,%2d) found at address %2d;", site, x, y, z, address); // arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4], address/5);
|
||||
if (! TEST) printf("\n "); else printf(" ");
|
||||
printf("requested_weight == current_weight => END"); return;}
|
||||
|
||||
if (address == -1 && requested_weight == 0) {
|
||||
printf("no such arrow found (%2d,%2d,%2d,%2d)", site, x, y, z); // arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4]);
|
||||
if (! TEST) printf("\n "); else printf(" ");
|
||||
printf("=> END"); return;}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -540,82 +540,6 @@ bool graphics_shutdown(const void *gl_area)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Prints the arrows[] array
|
||||
*
|
||||
* For each arrow the following parameters are displayed :
|
||||
* - rank in the array
|
||||
* - load (or weight)
|
||||
* - coordinates in space (site, x, y, z)
|
||||
*/
|
||||
static void print_arrows_array (struct arrow_t *arrows, int arrows_nb)
|
||||
{
|
||||
printf(" [rank] load | site x y z");
|
||||
for (int i = 0; i < arrows_nb; i++)
|
||||
printf("\n [%4d] = %2d | %2d, %2d, %2d, %2d", i, arrows[i].load,\
|
||||
arrows[i].site, arrows[i].x, arrows[i].y, arrows[i].z);
|
||||
if (arrows_nb == 0) printf("\n [NULL] ---- | ---- --- --- ---");
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Prints the initial user choices :
|
||||
* - space dimension size and appearance (grids)
|
||||
* - arrows[] array
|
||||
* NB The space may be empty or saturated with arrows or any value in between
|
||||
* Only one arrow per possible coordinates with a load max equal to ? TODO
|
||||
*/
|
||||
static void print_user_choices(struct arrow_t *arrows, int arrows_nb,
|
||||
int space_size_x, int space_size_y, int space_size_z,
|
||||
int show_array, int show_space_design)
|
||||
{
|
||||
printf("model + user constraints :\tspace size x,y,z = %d,%d,%d\tarrows nb = %d\t",\
|
||||
space_size_x, space_size_y, space_size_z, arrows_nb);
|
||||
|
||||
if (show_space_design) printf("orientations grilles alternées");
|
||||
printf("\n");
|
||||
|
||||
if (show_array) print_arrows_array (arrows, arrows_nb);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Assigns a new load to the arrow at address (address)
|
||||
|
@ -733,84 +657,6 @@ static inline int set_arrow (struct arrow_t *arrows, int arrows_nb, int requeste
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Prints the result of the function set_arrow()
|
||||
* and indicates the reasons of the choice (call) this function makes (see this function)
|
||||
*/
|
||||
static void show_user_action(struct arrow_t *arrows, int arrows_nb, int address, int requested_weight,
|
||||
int current_weight, int site, int x, int y, int z)
|
||||
{
|
||||
if (address == -1 && requested_weight > 0) { // *(arrows + i * 5 + 0)
|
||||
printf("no such arrow found (%2d,%2d,%2d,%2d)", site, x, y, z); //arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4]);
|
||||
if (! TEST) printf("\n "); else printf(" ");
|
||||
printf("=> CREATE"); return;}
|
||||
|
||||
if (address >= 0 && requested_weight == 0) {
|
||||
printf("arrow (%2d,%2d,%2d,%2d) found at address %2d; current_weight = %2d;", site, x, y, z, address, current_weight); // arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4], address/5, current_weight);
|
||||
if (! TEST) printf("\n "); else printf(" ");
|
||||
printf("=> ERASE"); return;}
|
||||
|
||||
if (address >= 0 && current_weight != requested_weight) {
|
||||
printf("arrow (%2d,%2d,%2d,%2d) found at address %2d; current_weight = %2d;", site, x, y, z, address, current_weight); // arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4], address/5, current_weight);
|
||||
if (! TEST) printf("\n "); else printf(" ");
|
||||
printf("=> MODIFY"); return;}
|
||||
|
||||
if (address >= 0 && current_weight == requested_weight){
|
||||
printf("arrow (%2d,%2d,%2d,%2d) found at address %2d;", site, x, y, z, address); // arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4], address/5);
|
||||
if (! TEST) printf("\n "); else printf(" ");
|
||||
printf("requested_weight == current_weight => END"); return;}
|
||||
|
||||
if (address == -1 && requested_weight == 0) {
|
||||
printf("no such arrow found (%2d,%2d,%2d,%2d)", site, x, y, z); // arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4]);
|
||||
if (! TEST) printf("\n "); else printf(" ");
|
||||
printf("=> END"); return;}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//#define RAND_MAX
|
||||
/*
|
||||
* Init space and arrows (= initial state)
|
||||
* and allows ulterior creations, suppressions or modifications of the arrows[] array
|
||||
|
@ -836,7 +682,7 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
|
|||
int density_max = space_X * space_Y * space_Z;
|
||||
int max = fmax(space_X, space_Y); max = fmax(max, space_Z);
|
||||
|
||||
int show_space_design = 0, print_arrows_array = 0;
|
||||
int show_space_design = 0, print_arrows_data = 0;
|
||||
|
||||
int load = 0, site = 0, x = 0, y = 0, z = 0;
|
||||
int specif_arrows_nb = rand() % density_max / 3;
|
||||
|
@ -851,7 +697,7 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void)
|
|||
rand() % space_Z); // z
|
||||
}
|
||||
|
||||
print_user_choices(arrows, arrows_nb, space_X, space_Y, space_Z, print_arrows_array, show_space_design);
|
||||
print_user_choices(arrows, arrows_nb, space_X, space_Y, space_Z, print_arrows_data, show_space_design);
|
||||
|
||||
/* DATA ARE NOW ALL SPECIFIED - DRAWING CAN START */
|
||||
|
||||
|
|
Loading…
Reference in New Issue