dc_clock::predict Interface Reference

Private Member Functions

subroutine dcclockpredict0 (clk, progress, unit, err)
 

Detailed Description

Definition at line 208 of file dc_clock.f90.

Member Function/Subroutine Documentation

◆ dcclockpredict0()

subroutine dc_clock::predict::dcclockpredict0 ( type(clock), intent(in)  clk,
real, intent(in)  progress,
integer, intent(in), optional  unit,
logical, intent(out), optional  err 
)
private

Definition at line 855 of file dc_clock.f90.

855  !
856  !=== プログラムが終了するまでの予測 CPU 時間, および日時を表示
857  !
858  ! CLOCK 変数 *clk* と *progress* から, プログラムが
859  ! 終了するまでの予測 CPU 時間, および日時を以下のように表示します.
860  !
861  ! ########## PREDICTION OF CALCULATION ###########
862  ! Start Date 2007-03-08T16:49:25+09:00
863  ! Current Date 2007-03-08T16:49:27+09:00
864  ! Progress 66.67% [**************** ]
865  ! Remaining CPU TIME 0.100000E+01
866  ! Completion Date 2007-03-08T16:49:28+09:00
867  !
868  ! 第2引数である *progress* には 0 〜 1 までの値を与えてください.
869  ! プログラムの開始時を 0, 終了時を 1 とします. (例えば,
870  ! プログラムが半分進んだ時には 0.5 を与えます).
871  !
872  ! ここで行う「予測」とは, これまでの経過時間および
873  ! 終了したプログラムの分量から単純なアルゴリズムで割り出している
874  ! ものなので, 正確な予測値を返すわけではありません.
875  ! あくまで目安として利用してください.
876  !
877  ! 引数 *unit* には出力先の装置番号を
878  ! 与えてください. *unit* を与えない場合, 標準出力へ表示されます.
879  !
880  ! 第一引数 *clk* に対して DCClockCreate による初期化が行われていない場合,
881  ! エラーを発生させます. *err* を与える場合には *err* に .true. が返り,
882  ! プログラムは続行されます.
883  !
884  use dc_types, only: stdout, dp
885  use dc_message, only: messagenotify
886  use dc_string, only: tochar, cprintf, printf
889  use dc_date, only: operator(+), dcdatetimecreate, tochar, evalsec, &
891  implicit none
892  type(clock), intent(in):: clk
893  real, intent(in):: progress
894  integer, intent(in), optional:: unit
895  logical, intent(out), optional:: err
896  character(STRING):: cause_c
897  integer:: stat, out_unit
898  type(dc_difftime):: remain_diff
899  type(dc_datetime):: comp_date, cur_date
900  character(7):: prog_percent
901  character(25):: prog_bar
902  integer:: prog_bar_ptr
903  real:: prog_valid
904  character(*), parameter:: subname = 'DCClockPredict'
905  continue
906  call beginsub(subname)
907  stat = dc_noerr
908  cause_c = 'CLOCK'
909  if (.not. clk % initialized) then
910  call messagenotify('W', subname, 'Call Create before Predict in dc_clock.')
911  call dbgmessage('Ignored because input argument was not initialized.')
912  stat = dc_enotinit
913  goto 999
914  end if
915  if (progress <= 0.0) then
916  call messagenotify('W', subname, 'Specify 0.0 -- 1.0 value to "progress"')
917  return
918  elseif (progress > 1.0) then
919  call messagenotify('W', subname, 'Over 1.0 value to "progress" was modified to 1.0')
920  prog_valid = 1.0
921  else
922  prog_valid = progress
923  end if
924  if (present(unit)) then
925  out_unit = unit
926  else
927  out_unit = stdout
928  end if
929  call dcdifftimecreate( remain_diff, &
930  & sec = real(nint(EvalSec(clk) / prog_valid * (1.0 - prog_valid)), DP) )
931  call dcdatetimecreate(cur_date)
932  comp_date = cur_date + remain_diff
933  prog_percent = ''
934  prog_percent = adjustr(trim(printf_g5_2(real(prog_valid * 100, dp))) // '%')
935  prog_bar = ''
936  prog_bar_ptr = int(prog_valid * 25)
937  if (prog_bar_ptr > 0) prog_bar(1:prog_bar_ptr) = '*************************'
938  call printf(out_unit, '')
939  call printf(out_unit, &
940  & ' ########## PREDICTION OF CALCULATION ###########')
941  call printf(out_unit, &
942  & ' Start Date %c', c1=trim(tochar(clk % start_date)))
943  call printf(out_unit, &
944  & ' Current Date %c', c1=trim(tochar(cur_date)))
945  call printf(out_unit, &
946  & ' Progress %c [%c]', c1=prog_percent, c2=prog_bar)
947  call printf(out_unit, &
948  & ' Remaining CPU TIME %c %c', &
949  & c1=trim(result_value_form(evalsec(remain_diff))), &
950  & c2=trim(fit_unit_value(0.0_dp, remain_diff)))
951  call printf(out_unit, &
952  & ' Completion Date %c', c1=trim(tochar(comp_date)))
953 999 continue
954  call storeerror(stat, subname, err, cause_c)
955  call endsub(subname)
integer, parameter, public dc_enotinit
Definition: dc_error.f90:557
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition: dc_error.f90:830
integer, parameter, public dc_noerr
Definition: dc_error.f90:509
integer, parameter, public dp
倍精度実数型変数
Definition: dc_types.f90:83
integer, parameter, public stdout
標準出力の装置番号
Definition: dc_types.f90:98
文字型変数の操作.
Definition: dc_string.f90:24
種別型パラメタを提供します。
Definition: dc_types.f90:49

The documentation for this interface was generated from the following file: