I have this unhealthy habit of obsessing about the smallest, most unimportant details. For instance, I spent the greater part of the evening trying to figure out how to put a progress bar on my output. I finally stumbled into this site
http://software.intel.com/en-us/forums/showthread.php?t=73766
and got this subroutine which works perfectly. Problem is, my work computer uses a GNU compiler (which I really hate because I spend more time trying to compile the source code than actually writing it) so I wasted the next morning writing a similar code for that. So, here it is (for those who are anal-retentive like me)
program loop ! prints out the progress of an iterative calculation implicit none integer(kind=4)::i do i = 1, 10 call progress(i) ! generate the progress bar. call sleep(1) enddo write (*,*) end subroutine progress(j) implicit none integer(kind=4) :: j,k character(len=18) :: bar="\r???% | |" ! updates the fraction of calculation done write(unit=bar(2:4),fmt="(i3)") 10*j do k = 1, j bar(7+k:7+k)="*" enddo ! print the progress bar. write(*,'(a)',advance='no') bar return end
Leave a comment