WIP: mesures & vérifications pour optimisations

This commit is contained in:
Jean Sirmai 2023-11-04 15:19:41 +01:00
parent 74f8fc53d6
commit a79f468f19
Signed by: jean
GPG Key ID: FB3115C340E057E3
2 changed files with 23 additions and 8 deletions

View File

@ -37,8 +37,6 @@ int write_one_arrow_vertex (int space_X_int, int space_Y_int, int space_Z_int,
int weight, int site, int arrow_x, int arrow_y, int arrow_z, int print)
{
printf("In write_one_arrow_vertex() site = %d\n", site);
float max = fmax(space_X_int, space_Y_int);
max = fmax(max, space_Z_int);

View File

@ -694,7 +694,7 @@ static inline int set_arrow (struct arrow_t *arrows_ptr, int arrows_nb, int spac
int address = -1, current_weight = -1;
if (console) printf("in set_arrow (begin) arrows_nb = %d requested site: %d > ", arrows_nb, site);
if (console) for (int i = 0; i < arrows_nb; i++) {printf(" [%d] = %d ", i, arrows_ptr[i].site); if (site == arrows_ptr[i].site) break;}
/* if (console) for (int i = 0; i < arrows_nb; i++) {printf(" [%d] = %d ", i, arrows_ptr[i].site); if (site == arrows_ptr[i].site) break;} */
for (int i = 0; i < arrows_nb; i++)
if ((site == arrows_ptr[i].site)
@ -756,13 +756,13 @@ void main_test_graphics (void)
srand(time(NULL)); int rand(void); void srand(unsigned int seed);
int randomize = 5, console = 0, arrows_nb = 0, space_X = 1, space_Y = 1, space_Z = 1;
int randomize = 60, console = 0, arrows_nb = 0, space_X = 1, space_Y = 1, space_Z = 1;
if (randomize) {
space_X = 1 + rand() % randomize;
space_Y = 1 + rand() % randomize;
space_Z = 1 + rand() % randomize;
}
int density_max = space_X * space_Y * space_Z, specified_arrows_nb = rand() % density_max;
int density_max = space_X * space_Y * space_Z, specified_arrows_nb = density_max;
int max = fmax(space_X, space_Y); max = fmax(max, space_Z);
@ -790,7 +790,10 @@ void main_test_graphics (void)
/*------------------------------------------------------------------------*/
printf("specified_arrows_nb: %d\n", specified_arrows_nb);
if (randomize) for (int i = 0; i < specified_arrows_nb; i++)
{
arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z,
1, // load
rand() % 6, // site
@ -798,11 +801,15 @@ void main_test_graphics (void)
rand() % space_Y, // y
rand() % space_Z, // z
console);
if (i > 0 && i % 1000 == 0) printf("|");
if (i > 0 && i % 100000 == 0) printf("\n");
}
else for (int i = 0; i < 6; i++)
arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 1, i, 0, 0, 0, 0);
int max_arrows_nb = arrows_nb;
printf("\nend initial arrows drawing\n");
if (randomize) for (int i = 0; i < specified_arrows_nb * 6; i++)
if (randomize) for (int i = 0; i < 6; i++)
arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z,
rand() % 1, // load
rand() % 6, // site
@ -811,9 +818,19 @@ void main_test_graphics (void)
rand() % space_Z, // z
console);
else for (int i = 0; i < 6; i++)
arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 0, i, 0, 0, 0, 1);
arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 0, i, 0, 0, 0, 0);
if (randomize) print_user_choices(arrows_ptr, max_arrows_nb, arrows_nb, space_X, space_Y, space_Z, 1, 0);
int angle = 9;
if (space_X > angle && space_Y > angle && space_Z > angle) for (int i = 0; i < angle; i++)
for (int u = 0; u < angle; u++) for (int v = 0; v < angle; v++) for (int w = 0; w < angle; w++)
if (u + v + w < angle * 3)
arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 0, i, u, v, w, 0);
if (space_X > angle && space_Y > angle && space_Z > angle)
printf("+ effacement des flèches dans l'angle-origine\
<=> contrôle graphique de la fonction erase_arrow()\n");
if (randomize) print_user_choices(arrows_ptr, max_arrows_nb, arrows_nb, space_X, space_Y, space_Z, 0, 0);