dc_trace::datadump Interface Reference

Private Member Functions

subroutine datad1dump (header, d, strlen, multi)
 
subroutine datad2dump (header, d, strlen, multi)
 
subroutine datad3dump (header, d, strlen, multi)
 

Detailed Description

Definition at line 205 of file dc_trace.f90.

Member Function/Subroutine Documentation

◆ datad1dump()

subroutine dc_trace::datadump::datad1dump ( character(*), intent(in)  header,
real(dp), dimension(:), intent(in)  d,
integer, intent(in), optional  strlen,
integer, dimension(:), intent(in), optional  multi 
)
private

Definition at line 552 of file dc_trace.f90.

552  !
553  !== 1 次元データ出力
554  !
555  ! デバッグメッセージとして、多次元データ d (倍精度実数型)
556  ! を出力します。 文字型変数 header は出力時の頭文字として利用されます。
557  ! 整数型配列 strlen を与える事で、一行の文字数を指定できます
558  ! (デフォルトの文字数は dc_types#STRING で指定されています)。
559  ! 整数型配列 multi(:) を与えることで、
560  ! header の後ろに次元添字をつける事が可能です。
561  !
562  ! 利用例に関しては dc_trace の Example を参照して下さい。
563  !
564  !--
565  !== 開発者向け解説
566  !
567  ! このサブルーチンを用いても、このモジュール内で内部的に保持される
568  ! 整数型変数 level の値は変化しません。
569  !
570  !++
571  use dc_types, only: string, dp
572  use dc_string, only: tochar
573  character(*), intent(in) :: header ! データの名称
574  real(DP), intent(in) :: d(:) ! 倍精度実数1次元データ
575  integer, intent(in), optional:: strlen ! 一行の文字数
576  integer, intent(in), optional:: multi(:)! 上位の次元添字
577  integer :: i, j
578  character(STRING):: unit ! データ文字列
579  character(STRING):: unitbuf ! データ文字列バッファ
580  integer :: ucur ! unit に書かれた文字数
581  character(STRING):: cbuf ! read/write 文のバッファ
582  integer :: stat ! ステータス
583  logical :: first ! 1つ目のデータかどうか
584  integer :: begini ! 1つ目のデータの添字
585  integer :: endi ! 最後のデータの添字
586  character(STRING):: cmulti ! 次元添字用文字列
587  character(STRING):: cout ! 出力する文字列
588  character(STRING):: meshead_tmp
589  integer :: meshead_len
590  continue
591  if ( dbg < 0 ) return
592  ! 初期化
593  unit = ''
594  unitbuf = ''
595  ucur = 0
596  stat = 0
597  first = .true.
598  cmulti = ''
599  ! デバッグメッセージヘッダの作成。
600  if (level < 1) then
601  meshead_tmp = ''
602  meshead_len = 0
603  else
604  meshead_tmp = meshead
605  meshead_len = len(meshead)
606  endif
607  ! 次元添字用文字列を作成
608  if (present(multi)) then
609  do j = 1, size(multi)
610  cmulti = trim(cmulti) // ', ' // trim( tochar( multi(j) ) )
611  enddo
612  endif
613  i = 1
614  dim_1_loop : do
615  if (first) begini = i
616  endi = i
617  write(cbuf, "(g40.20)") d(i)
618  if (.not. first) cbuf = ', ' // adjustl(cbuf)
619  unitbuf = unit
620  call append(unit, ucur, trim(adjustl(cbuf)), stat, strlen)
621  if ( stat /= 0 .or. i == size( d(:) ) ) then
622  ! 一回目は、文字数オーバーでもそのまま出力。
623  if (first) then
624  cout = header // '(' &
625  & // trim(tochar(begini)) &
626  & // trim(cmulti) &
627  & // ')=' // trim(unit)
628  ! 二回目以降は、オーバーしたものは次回へ
629  elseif (stat /= 0 .and. begini == endi-1) then
630  cout = header // '(' &
631  & // trim(tochar(begini)) &
632  & // trim(cmulti) &
633  & // ')='// trim(unitbuf)
634  ! 1つ巻戻す
635  i = i - 1
636  elseif (stat /= 0 .and. begini /= endi-1) then
637  cout = header // '(' &
638  & // trim(tochar(begini)) // '-' &
639  & // trim(tochar(endi-1)) &
640  & // trim(cmulti) &
641  & // ')=' // trim(unitbuf)
642  ! 1つ巻戻す
643  i = i - 1
644  ! i が size(d) まで到達した場合もそのまま出力。
645  elseif ( i == size( d(:) ) ) then
646  cout = header // '(' &
647  & // trim(tochar(begini)) // '-' &
648  & // trim(tochar(endi)) &
649  & // trim(cmulti) &
650  & // ')='// trim(unit)
651  endif
652  write(dbg, "(A, A, A, A)") &
653  & trim(head), repeat( indent, max(level-1, 0) ), &
654  & meshead_tmp(1:meshead_len), trim(cout)
655  ! unit, unitbuf をクリア
656  unit = ''
657  unitbuf = ''
658  ucur = 0
659  first = .true.
660  else
661  first = .false.
662  endif
663  if (i == size( d(:) ) ) exit dim_1_loop
664  i = i + 1
665  enddo dim_1_loop
integer, parameter, public dp
倍精度実数型変数
Definition: dc_types.f90:83
文字型変数の操作.
Definition: dc_string.f90:24
種別型パラメタを提供します。
Definition: dc_types.f90:49
subroutine append(unitx, ucur, val, stat)
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition: dc_types.f90:118

◆ datad2dump()

subroutine dc_trace::datadump::datad2dump ( character(*), intent(in)  header,
real(dp), dimension(:,:), intent(in)  d,
integer, intent(in), optional  strlen,
integer, dimension(:), intent(in), optional  multi 
)
private

Definition at line 668 of file dc_trace.f90.

668  !
669  !== 2 次元データ出力
670  !
671  ! 詳しくは DataDump または DataD1Dump を参照ください。
672  !
673  use dc_types, only: string, dp
674  character(*), intent(in) :: header ! データの名称
675  real(DP), intent(in) :: d(:,:) ! 倍精度実数2次元データ
676  integer, intent(in), optional:: strlen ! 一行の文字数
677  integer, intent(in), optional:: multi(:)! 上位の次元添字
678  integer, allocatable :: total(:)
679  integer :: j
680  continue
681  if ( dbg < 0 ) return
682  if (present(multi)) then
683  allocate( total(size(multi)+1) )
684  total(2:size(multi)+1) = multi(:)
685  else
686  allocate( total(1) )
687  endif
688  do j = 1, size( d(:,:), 2 )
689  total(1) = j
690  call datadump(header, d(:,j), strlen=strlen, multi=total(:))
691  enddo
692  deallocate( total )
integer, parameter, public dp
倍精度実数型変数
Definition: dc_types.f90:83
種別型パラメタを提供します。
Definition: dc_types.f90:49
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition: dc_types.f90:118

◆ datad3dump()

subroutine dc_trace::datadump::datad3dump ( character(*), intent(in)  header,
real(dp), dimension(:,:,:), intent(in)  d,
integer, intent(in), optional  strlen,
integer, dimension(:), intent(in), optional  multi 
)
private

Definition at line 695 of file dc_trace.f90.

695  !
696  !== 3 次元データ出力
697  !
698  ! 詳しくは DataDump または DataD1Dump を参照ください。
699  !
700  use dc_types, only: string, dp
701  character(*), intent(in) :: header ! データの名称
702  real(DP), intent(in) :: d(:,:,:)! 倍精度実数3次元データ
703  integer, intent(in), optional:: strlen ! 一行の文字数
704  integer, intent(in), optional:: multi(:)! 上位の次元添字
705  integer, allocatable :: total(:)
706  integer :: k
707  continue
708  if ( dbg < 0 ) return
709  if (present(multi)) then
710  allocate( total(size(multi)+1) )
711  total(2:size(multi)+1) = multi(:)
712  else
713  allocate( total(1) )
714  endif
715  do k = 1, size( d(:,:,:), 3 )
716  total(1) = k
717  call datadump(header, d(:,:,k), strlen=strlen, multi=total(:))
718  enddo
719  deallocate( total )
integer, parameter, public dp
倍精度実数型変数
Definition: dc_types.f90:83
種別型パラメタを提供します。
Definition: dc_types.f90:49
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition: dc_types.f90:118

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