Skip to content

Commit 5e97d6d

Browse files
committed
Format mcdisplay section to make for loops more readable, and add print statement to indicate how many face and verts are read
1 parent 44f8f23 commit 5e97d6d

File tree

1 file changed

+33
-31
lines changed

1 file changed

+33
-31
lines changed

mcstas-comps/union/Union_mesh.comp

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -509,48 +509,48 @@ void mcdisplay_mesh_function(struct lines_to_draw *lines_to_draw_output,int inde
509509
// Make sure it does not print a line if it is already printed.... (might take a while?)
510510
for (i = 0 ; i < counter ; i++){
511511
if (print1 == 1 && coord_comp(point1 , list_startpoints[i])){
512-
for (j = 0 ; j < counter ; j++){
513-
if (coord_comp(point2 , list_startpoints[i])){
514-
print1 = 0;
515-
}
516-
}
512+
for (j = 0 ; j < counter ; j++){
513+
if (coord_comp(point2 , list_startpoints[i])){
514+
print1 = 0;
515+
}
516+
}
517517
}
518518
if (print2 == 1 && coord_comp(point2 , list_startpoints[i])){
519-
for (j = 0 ; j < counter ; j++){
520-
if (coord_comp(point1 , list_startpoints[i])){
521-
print1 = 0;
522-
}
523-
}
519+
for (j = 0 ; j < counter ; j++){
520+
if (coord_comp(point1 , list_startpoints[i])){
521+
print1 = 0;
522+
}
523+
}
524524
}
525525
if (print2 == 1 && coord_comp(point2 , list_startpoints[i]) ){
526-
for (j = 0 ; j < counter ; j++){
527-
if (coord_comp(point3 , list_startpoints[i])){
528-
print2 = 0;
529-
}
530-
}
526+
for (j = 0 ; j < counter ; j++){
527+
if (coord_comp(point3 , list_startpoints[i])){
528+
print2 = 0;
529+
}
530+
}
531531
}
532532
if (print3 == 1 && coord_comp(point3 , list_startpoints[i]) ){
533-
for (j = 0 ; j < counter ; j++){
534-
if (coord_comp(point2 , list_startpoints[i])){
535-
print2 = 0;
536-
}
537-
}
533+
for (j = 0 ; j < counter ; j++){
534+
if (coord_comp(point2 , list_startpoints[i])){
535+
print2 = 0;
536+
}
537+
}
538538
}
539539
if (print1 == 1 && coord_comp(point1 , list_startpoints[i]) ){
540-
for (j = 0 ; j < counter ; j++){
541-
if (coord_comp(point1 , list_startpoints[i])){
542-
print3 = 0;
543-
}
544-
}
540+
for (j = 0 ; j < counter ; j++){
541+
if (coord_comp(point1 , list_startpoints[i])){
542+
print3 = 0;
543+
}
544+
}
545545
}
546546
if (print3 == 1 && coord_comp(point3 , list_startpoints[i])){
547-
for (j = 0 ; j < counter ; j++){
548-
if (coord_comp(point1 , list_startpoints[i])){
549-
print3 = 0;
550-
}
551-
}
547+
for (j = 0 ; j < counter ; j++){
548+
if (coord_comp(point1 , list_startpoints[i])){
549+
print3 = 0;
550+
}
551+
}
552552
}
553-
553+
554554
}
555555

556556

@@ -968,6 +968,8 @@ if(strcmp(dot, ".stl") == 0 || strcmp(dot, ".STL") == 0){
968968
NAME_CURRENT_COMP, filename);
969969
exit(1);
970970
}
971+
printf("\nCOMPONENT %s: Number of faces read: %d\t Number of vertices read: %d\n",
972+
NAME_CURRENT_COMP, n_verts, n_faces);
971973
// Loop over all vertices and multiply their positions with coordinate_scale
972974
for (int i = 0; i<n_verts; i++){
973975
verts[i] = coords_scale(verts[i], coordinate_scale);

0 commit comments

Comments
 (0)