WIP: micro-commit (cleaning)

This commit is contained in:
Jean Sirmai 2023-11-01 12:33:33 +01:00
parent c98346545c
commit fd6f36ae45
Signed by: jean
GPG Key ID: FB3115C340E057E3
3 changed files with 56 additions and 41 deletions

View File

@ -75,3 +75,9 @@ void show_buffers_states(int space_X, int space_Y, int space_Z,
long nb_batches_specified, int one_batch_size, long nb_batches_specified, int one_batch_size,
int offset_after_grids, int buffer_vertex_size, int offset_after_grids, int buffer_vertex_size,
int buffer_lines_size_after_cubes, int buffer_lines_size); int buffer_lines_size_after_cubes, int buffer_lines_size);
void print_vertex_and_lines_buffers (struct arrow_t *arrows_ptr, int arrows_nb,
GLfloat *buffer_vertex_origin, long buffer_vertex_0_arrow,
GLfloat *buffer_lines_origin, long buffer_lines_0_arrow,
int address, int requested_weight, int current_weight, int site, int x, int y, int z);

View File

@ -128,14 +128,14 @@ void print_arrows_array (struct arrow_t *arrows, int arrows_nb, int invoked_by)
{ {
printf(" [rank] load | site x y z ("); printf(" [rank] load | site x y z (");
switch (invoked_by) { switch (invoked_by) {
case 0: printf("after deletion)"); break; case 0: printf("after deletion) arrows_nb : %d", arrows_nb); break;
case 1: printf("after creation)"); break; case 1: printf("after creation) arrows_nb : %d", arrows_nb); break;
case 2: printf("after modification)"); break; case 2: printf("after modification) arrows_nb : %d", arrows_nb); break;
case 3: printf("address >= 0 && current_weight == requested_weight)"); break; case 3: printf("address >= 0 && current_weight == requested_weight)"); break;
case 4: printf("address == -1 && requested_weight == 0)"); break; case 4: printf("address == -1 && requested_weight == 0)"); break;
case 5: printf("print_user_choices)"); break; case 5: printf("print_user_choices)"); break;
case 6: printf("print_evolution)"); break; case 6: printf("print_evolution)"); break;
case 7: printf("before deletion)"); break; case 7: printf("before deletion) arrows_nb : %d", arrows_nb); break;
} }
for (int i = 0; i < arrows_nb; i++) for (int i = 0; i < arrows_nb; i++)
printf("\n [%4d] = %2d | %2d, %2d, %2d, %2d", i, arrows[i].load,\ printf("\n [%4d] = %2d | %2d, %2d, %2d, %2d", i, arrows[i].load,\
@ -155,8 +155,8 @@ void print_user_choices(struct arrow_t *arrows, int max_arrows_nb, int arrows_nb
int space_size_x, int space_size_y, int space_size_z, int space_size_x, int space_size_y, int space_size_z,
int show_array, int show_space_design) int show_array, int show_space_design)
{ {
printf("model + user constraints :\tspace size x,y,z (%d,%d,%d)\tinitial (max) arrows nb : %d >> %d\t",\ printf("model + user constraints :\tspace size x,y,z (%d,%d,%d)\tinitial (max) arrows nb : %d",\
space_size_x, space_size_y, space_size_z, max_arrows_nb, arrows_nb); space_size_x, space_size_y, space_size_z, max_arrows_nb);
if (show_space_design) printf(" (grilles alternées)"); if (show_space_design) printf(" (grilles alternées)");
printf("\n"); printf("\n");
@ -340,3 +340,47 @@ void print_user_action(struct arrow_t *arrows, int arrows_nb, int address, int r
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,
GLfloat *buffer_vertex_origin, long buffer_vertex_0_arrow,
GLfloat *buffer_lines_origin, long buffer_lines_0_arrow,
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]);
}
void print_vertex_and_lines_buffers (struct arrow_t *arrows_ptr, int arrows_nb,
GLfloat *buffer_vertex_origin, long buffer_vertex_0_arrow,
GLfloat *buffer_lines_origin, long buffer_lines_0_arrow,
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, buffer_vertex_origin, buffer_vertex_0_arrow,
buffer_lines_origin, buffer_lines_0_arrow, i, arrows_nb, address);
if (arrows_nb == 0) print_empty_buffers_array();
}

View File

@ -552,41 +552,6 @@ bool graphics_shutdown(const void *gl_area)
return true; return true;
} }
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();
}