gtool5 Fortran 90/95 ライブラリ 1.0.0-rc5
English
Loading...
Searching...
No Matches
Functions/Subroutines
historycopy.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine historycopy1 (hist_dest, file, hist_src, title, source, institution, origin, interval, conventions, gt_version)
 
subroutine historycopy2 (hist_dest, file, hist_src, title, source, institution, origin, interval, conventions, gt_version)
 

Function/Subroutine Documentation

◆ historycopy1()

subroutine historycopy1 ( type(gt_history), intent(out), target  hist_dest,
character(*), intent(in)  file,
type(gt_history), intent(in), optional, target  hist_src,
character(*), intent(in), optional  title,
character(*), intent(in), optional  source,
character(*), intent(in), optional  institution,
real, intent(in), optional  origin,
real, intent(in), optional  interval,
character(*), intent(in), optional  conventions,
character(*), intent(in), optional  gt_version 
)

Definition at line 61 of file historycopy.f90.

65 !
68 use gtdata_generic, only: copy_attr, get
69 use dc_present, only: present_select
70 use dc_types, only: string, dp, dp_eps
71 use dc_trace, only: beginsub, endsub
73 implicit none
74 type(GT_HISTORY), intent(out), target:: hist_dest
75 character(*), intent(in):: file
76 type(GT_HISTORY), intent(in), optional, target:: hist_src
77 character(*), intent(in), optional:: title, source, institution
78 real, intent(in), optional:: origin, interval
79 character(*), intent(in), optional:: conventions, gt_version
80 ! Internal Work
81 type(GT_HISTORY), pointer:: src =>null()
82 character(STRING) :: title_src, source_src, institution_src
83 character(STRING) :: conventions_src, gt_version_src
84 character(STRING), pointer:: dims(:) => null()
85 integer , pointer:: dimsizes(:) => null()
86 character(STRING), pointer:: longnames(:) => null()
87 character(STRING), pointer:: units(:) => null()
88 character(STRING), pointer:: xtypes(:) => null()
89 real(DP):: originw, intervalw
90 integer :: i, numdims
91 logical :: err
92 real(DP),pointer :: dimvalue(:) => null()
93 character(len = *),parameter:: subname = "HistoryCopy1"
94 continue
95 call beginsub(subname, 'file=<%c>', c1=trim(file))
96 if (present(hist_src)) then
97 src => hist_src
98 else
99 src => default
100 endif
101 if ( .not. src % mpi_gather &
102 & .or. ( src % mpi_gather .and. src % mpi_myrank == 0 ) ) then
103 numdims = size(src % dimvars)
104 call historyinquire(history=src, title=title_src, &
105 & source=source_src, institution=institution_src, &
106 & dims=dims, dimsizes=dimsizes, longnames=longnames, &
107 & units=units, xtypes=xtypes, &
108 & conventions=conventions_src, gt_version=gt_version_src)
109 if ( present(origin) ) then
110 originw = real(origin, kind(originw))
111 else
112 originw = real(src % origin, kind(originw))
113! originw = EvalByUnit( src % origin, '', src % unlimited_units_symbol )
114 end if
115 intervalw = src % interval
116! intervalw = EvalByUnit( src % interval, '', src % unlimited_units_symbol )
117 if ( present(interval) ) then
118 if ( abs(real(interval, kind(intervalw))) > dp_eps ) then
119 intervalw = real(interval, kind(intervalw))
120 end if
121 end if
122 call historycreate(file=trim(file), &
123 & title=trim(present_select('', title_src, title)), &
124 & source=trim(present_select('', source_src, source)), &
125 & institution=trim(present_select('', institution_src, institution)), &
126 & dims=dims, dimsizes=dimsizes, longnames=longnames, units=units, &
127 & origind=originw, intervald=intervalw, &
128 & xtypes=xtypes, &
129 & history=hist_dest, &
130 & conventions=trim(present_select('', conventions_src, conventions)), &
131 & gt_version=trim(present_select('', gt_version_src, gt_version)) )
132 !
133 ! 次元変数が属性を持っている場合のことも考え, 最後に直接
134 ! hist_dst % dimvars へ copy_attr (gtvarcopyattrall) をかける.
135 !
136 do i = 1, numdims
137 call copy_attr(hist_dest % dimvars(i), src % dimvars (i), global=.false.)
138 end do
139 ! dimvars を Get してみて, 値を持っているようならデータを与えてしまう.
140 do i = 1, numdims
141 if (dimsizes(i) == 0) cycle
142 call get(src % dimvars(i), dimvalue, err)
143 if (err) cycle
144 call historyput(dims(i), dimvalue, hist_dest)
145 deallocate(dimvalue)
146 end do
147 deallocate(dims, dimsizes, longnames, units, xtypes)
148 end if
149 call endsub(subname)
省略可能な制御パラメータの判定
デバッグ時の追跡用モジュール
Definition dc_trace.f90:150
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
Definition dc_trace.f90:476
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:599
種別型パラメタを提供します。
Definition dc_types.f90:55
integer, parameter, public dp
倍精度実数型変数
Definition dc_types.f90:92
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition dc_types.f90:137
real(dp), parameter, public dp_eps
倍精度実数型変数のマシンイプシロン.
Definition dc_types.f90:97
type(gt_history), target, save, public default

References dc_trace::beginsub(), gtool_history_internal::default, dc_types::dp, dc_types::dp_eps, dc_trace::endsub(), and dc_types::string.

Here is the call graph for this function:

◆ historycopy2()

subroutine historycopy2 ( type(gt_history), intent(out), target  hist_dest,
character(*), intent(in)  file,
type(gt_history), intent(in), optional, target  hist_src,
character(*), intent(in), optional  title,
character(*), intent(in), optional  source,
character(*), intent(in), optional  institution,
real, intent(in), optional  origin,
real, intent(in), optional  interval,
character(*), intent(in), optional  conventions,
character(*), intent(in), optional  gt_version 
)

出力設定のコピー (総称インターフェース)

使用方法は HistoryCopy と同様です。

Definition at line 162 of file historycopy.f90.

166 use dc_trace, only: beginsub, endsub
169 implicit none
170 type(GT_HISTORY), intent(out), target:: hist_dest
171 character(*), intent(in):: file
172 type(GT_HISTORY), intent(in), optional, target:: hist_src
173 character(*), intent(in), optional:: title, source, institution
174 real, intent(in), optional:: origin, interval
175 character(*), intent(in), optional:: conventions, gt_version
176 ! Internal Work
177 character(len = *),parameter:: subname = "HistoryCopy2"
178 continue
179 call beginsub(subname, 'file=<%c>', c1=trim(file))
180 call historycopy(hist_dest, file, hist_src, &
181 & title, source, institution, &
182 & origin, interval, &
183 & conventions, gt_version)
184 call endsub(subname)

References dc_trace::beginsub(), and dc_trace::endsub().

Here is the call graph for this function: