gtool5 Fortran 90/95 ライブラリ 1.0.0-rc5
English
Loading...
Searching...
No Matches
dc_trace::datadump Interface Reference

Public 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 177 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 )

1 次元データ出力

デバッグメッセージとして、多次元データ d (倍精度実数型) を出力します。 文字型変数 header は出力時の頭文字として利用されます。 strlen を与える事で、一行の文字数を指定できます (デフォルトは dc_types::STRING)。 multi(:) を与えることで、header の後ろに次元添字をつける事が可能です。

利用例に関しては dc_trace の Example を参照して下さい。

Note
このサブルーチンを用いても内部変数 level の値は変化しません。
Parameters
[in]headerデータの名称 (出力時の接頭辞)
[in]d倍精度実数1次元データ
[in]strlen一行の文字数 (省略可)
[in]multi上位の次元添字 (省略可)

Definition at line 724 of file dc_trace.f90.

725 use dc_types, only: string, dp
726 use dc_string, only: tochar
727 character(*), intent(in) :: header
728 real(DP), intent(in) :: d(:)
729 integer, intent(in), optional:: strlen
730 integer, intent(in), optional:: multi(:)
731 integer :: i, j
732 character(STRING):: unit ! データ文字列
733 character(STRING):: unitbuf ! データ文字列バッファ
734 integer :: ucur ! unit に書かれた文字数
735 character(STRING):: cbuf ! read/write 文のバッファ
736 integer :: stat ! ステータス
737 logical :: first ! 1つ目のデータかどうか
738 integer :: begini ! 1つ目のデータの添字
739 integer :: endi ! 最後のデータの添字
740 character(STRING):: cmulti ! 次元添字用文字列
741 character(STRING):: cout ! 出力する文字列
742 character(STRING):: meshead_tmp
743 integer :: meshead_len
744 continue
745 if ( dbg < 0 ) return
746 ! 初期化
747 unit = ''
748 unitbuf = ''
749 ucur = 0
750 stat = 0
751 first = .true.
752 cmulti = ''
753 ! デバッグメッセージヘッダの作成。
754 if (level < 1) then
755 meshead_tmp = ''
756 meshead_len = 0
757 else
758 meshead_tmp = meshead
759 meshead_len = len(meshead)
760 endif
761 ! 次元添字用文字列を作成
762 if (present(multi)) then
763 do j = 1, size(multi)
764 cmulti = trim(cmulti) // ', ' // trim( tochar( multi(j) ) )
765 enddo
766 endif
767 i = 1
768 dim_1_loop : do
769 if (first) begini = i
770 endi = i
771 write(cbuf, "(g40.20)") d(i)
772 if (.not. first) cbuf = ', ' // adjustl(cbuf(1:254))
773 unitbuf = unit
774 call append(unit, ucur, trim(adjustl(cbuf)), stat, strlen)
775 if ( stat /= 0 .or. i == size( d(:) ) ) then
776 ! 一回目は、文字数オーバーでもそのまま出力。
777 if (first) then
778 cout = header // '(' &
779 & // trim(tochar(begini)) &
780 & // trim(cmulti) &
781 & // ')=' // trim(unit)
782 ! 二回目以降は、オーバーしたものは次回へ
783 elseif (stat /= 0 .and. begini == endi-1) then
784 cout = header // '(' &
785 & // trim(tochar(begini)) &
786 & // trim(cmulti) &
787 & // ')='// trim(unitbuf)
788 ! 1つ巻戻す
789 i = i - 1
790 elseif (stat /= 0 .and. begini /= endi-1) then
791 cout = header // '(' &
792 & // trim(tochar(begini)) // '-' &
793 & // trim(tochar(endi-1)) &
794 & // trim(cmulti) &
795 & // ')=' // trim(unitbuf)
796 ! 1つ巻戻す
797 i = i - 1
798 ! i が size(d) まで到達した場合もそのまま出力。
799 elseif ( i == size( d(:) ) ) then
800 cout = header // '(' &
801 & // trim(tochar(begini)) // '-' &
802 & // trim(tochar(endi)) &
803 & // trim(cmulti) &
804 & // ')='// trim(unit)
805 endif
806 write(dbg, "(A, A, A, A)") &
807 & trim(head), repeat( indent, max(level-1, 0) ), &
808 & meshead_tmp(1:meshead_len), trim(cout)
809 ! unit, unitbuf をクリア
810 unit = ''
811 unitbuf = ''
812 ucur = 0
813 first = .true.
814 else
815 first = .false.
816 endif
817 if (i == size( d(:) ) ) exit dim_1_loop
818 i = i + 1
819 enddo dim_1_loop
subroutine append(unitx, ucur, val, stat)
文字型変数の操作
Definition dc_string.f90:83
種別型パラメタを提供します。
Definition dc_types.f90:55
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition dc_types.f90:137
integer, parameter, public dp
倍精度実数型変数
Definition dc_types.f90:92

References dc_trace::dbg, dc_types::dp, and dc_types::string.

◆ 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 )

2 次元データ出力

詳しくは DataDump または DataD1Dump を参照ください。

Parameters
[in]headerデータの名称
[in]d倍精度実数2次元データ
[in]strlen一行の文字数 (省略可)
[in]multi上位の次元添字 (省略可)

Definition at line 842 of file dc_trace.f90.

843 use dc_types, only: dp
844 character(*), intent(in) :: header
845 real(DP), intent(in) :: d(:,:)
846 integer, intent(in), optional:: strlen
847 integer, intent(in), optional:: multi(:)
848 integer, allocatable :: total(:)
849 integer :: j
850 continue
851 if ( dbg < 0 ) return
852 if (present(multi)) then
853 allocate( total(size(multi)+1) )
854 total(2:size(multi)+1) = multi(:)
855 else
856 allocate( total(1) )
857 endif
858 do j = 1, size( d(:,:), 2 )
859 total(1) = j
860 call datadump(header, d(:,j), strlen=strlen, multi=total(:))
861 enddo
862 deallocate( total )

References dc_trace::dbg, and dc_types::dp.

◆ 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 )

3 次元データ出力

詳しくは DataDump または DataD1Dump を参照ください。

Parameters
[in]headerデータの名称
[in]d倍精度実数3次元データ
[in]strlen一行の文字数 (省略可)
[in]multi上位の次元添字 (省略可)

Definition at line 885 of file dc_trace.f90.

886 use dc_types, only: dp
887 character(*), intent(in) :: header
888 real(DP), intent(in) :: d(:,:,:)
889 integer, intent(in), optional:: strlen
890 integer, intent(in), optional:: multi(:)
891 integer, allocatable :: total(:)
892 integer :: k
893 continue
894 if ( dbg < 0 ) return
895 if (present(multi)) then
896 allocate( total(size(multi)+1) )
897 total(2:size(multi)+1) = multi(:)
898 else
899 allocate( total(1) )
900 endif
901 do k = 1, size( d(:,:,:), 3 )
902 total(1) = k
903 call datadump(header, d(:,:,k), strlen=strlen, multi=total(:))
904 enddo
905 deallocate( total )

References dc_trace::dbg, and dc_types::dp.


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