log_progress Subroutine

public subroutine log_progress(source, step, total)

Arguments

Type IntentOptional AttributesName
character(len=*), intent(in) :: source
integer, intent(in) :: step
integer, intent(in) :: total

Calls

proc~~log_progress~~CallsGraph proc~log_progress log_progress proc~log_write log_write proc~log_progress->proc~log_write proc~log_format_message log_format_message proc~log_progress->proc~log_format_message proc~to_string to_string proc~log_write->proc~to_string proc~date_time_str date_time_str proc~log_format_message->proc~date_time_str proc~colourise colourise proc~log_format_message->proc~colourise proc~string_index string_index proc~colourise->proc~string_index

Called by

proc~~log_progress~~CalledByGraph proc~log_progress log_progress proc~time_process_day time_process_day proc~time_process_day->proc~log_progress proc~time_process_month time_process_month proc~time_process_month->proc~time_process_day proc~time_process_years time_process_years proc~time_process_years->proc~time_process_month program~swim swim program~swim->proc~time_process_years

Contents

Source Code


Source Code

  subroutine log_progress(source, step, total)
    ! Updates progress bar on stdout as INFO
    character(len=*), intent(in) :: source
    integer, intent(in) :: step, total
    character(len=58), parameter :: &
      bar = '==========================================================', &
      emp = '                                                          '
    integer clen, length

    ! Only print progress bar if stdout == info
    if (master_log%stdout_threshold /= log_info_level) return

    ! Length of bar - 2*[] - <INFO>
    length = len(bar) - len_trim(source) - 2 - 7 - 2
    clen = int(length*step/total)
    call log_write(master_log%stdout, &
      log_format_message(20, source, "["//bar(:clen)//emp(len(emp)-length+clen+1:)//"]", datetime=.false.), &
      advance=(step == total), clear=len(bar))
    ! remember that in progress
    if (step /= total) then
      log_in_progess = len(bar)
    else
      log_in_progess = 0
    end if
  end subroutine log_progress