gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
Public Member Functions | List of all members
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 
)

Output 1-dimensional data

Outputs multi-dimensional data d (double precision real) as debug messages. The character variable header is used as a prefix for output. By providing strlen, you can specify the number of characters per line (default is dc_types::STRING). By providing multi(:), you can add dimension subscripts after the header.

See dc_trace Example for usage examples.

Note
This subroutine does not change the internal variable level.
Parameters
[in]headerData name (prefix for output)
[in]d1-dimensional double precision real data
[in]strlenNumber of characters per line (optional)
[in]multiHigher dimension subscripts (optional)

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)
Handling character types.
Definition dc_string.f90:83
Provides kind type parameter values.
Definition dc_types.f90:55
integer, parameter, public dp
Double Precision Real number
Definition dc_types.f90:92
integer, parameter, public string
Character length for string
Definition dc_types.f90:137

References append(), dc_trace::dbg, dc_types::dp, and dc_types::string.

Here is the call graph for this function:

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

Output 2-dimensional data

See DataDump or DataD1Dump for details.

Parameters
[in]headerData name (prefix for output)
[in]d2-dimensional double precision real data
[in]strlenNumber of characters per line (optional)
[in]multiHigher dimension subscripts (optional)

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 
)

Output 3-dimensional data

See DataDump or DataD1Dump for details.

Parameters
[in]headerData name (prefix for output)
[in]d3-dimensional double precision real data
[in]strlenNumber of characters per line (optional)
[in]multiHigher dimension subscripts (optional)

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: