gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
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 numdims = size(src % dimvars)
102 call historyinquire(history=src, title=title_src, &
103 & source=source_src, institution=institution_src, &
104 & dims=dims, dimsizes=dimsizes, longnames=longnames, &
105 & units=units, xtypes=xtypes, &
106 & conventions=conventions_src, gt_version=gt_version_src)
107 if ( present(origin) ) then
108 originw = real(origin, kind(originw))
109 else
110 originw = real(src % origin, kind(originw))
111! originw = EvalByUnit( src % origin, '', src % unlimited_units_symbol )
112 end if
113 intervalw = src % interval
114! intervalw = EvalByUnit( src % interval, '', src % unlimited_units_symbol )
115 if ( present(interval) ) then
116 if ( abs(real(interval, kind(intervalw))) > dp_eps ) then
117 intervalw = real(interval, kind(intervalw))
118 end if
119 end if
120 call historycreate(file=trim(file), &
121 & title=trim(present_select('', title_src, title)), &
122 & source=trim(present_select('', source_src, source)), &
123 & institution=trim(present_select('', institution_src, institution)), &
124 & dims=dims, dimsizes=dimsizes, longnames=longnames, units=units, &
125 & origind=originw, intervald=intervalw, &
126 & xtypes=xtypes, &
127 & history=hist_dest, &
128 & conventions=trim(present_select('', conventions_src, conventions)), &
129 & gt_version=trim(present_select('', gt_version_src, gt_version)) )
130 !
131 ! 次元変数が属性を持っている場合のことも考え, 最後に直接
132 ! hist_dst % dimvars へ copy_attr (gtvarcopyattrall) をかける.
133 !
134 do i = 1, numdims
135 call copy_attr(hist_dest % dimvars(i), src % dimvars (i), global=.false.)
136 end do
137 ! dimvars を Get してみて, 値を持っているようならデータを与えてしまう.
138 do i = 1, numdims
139 if (dimsizes(i) == 0) cycle
140 call get(src % dimvars(i), dimvalue, err)
141 if (err) cycle
142 call historyput(dims(i), dimvalue, hist_dest)
143 deallocate(dimvalue)
144 end do
145 deallocate(dims, dimsizes, longnames, units, xtypes)
146 call endsub(subname)
Judge optional control parameters.
Debug tracing module.
Definition dc_trace.f90:150
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
Definition dc_trace.f90:457
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:580
Provides kind type parameter values.
Definition dc_types.f90:55
integer, parameter, public string
Character length for string
Definition dc_types.f90:137
real(dp), parameter, public dp_eps
Machine epsilon for dobule precision real number.
Definition dc_types.f90:97
integer, parameter, public dp
Double Precision Real number
Definition dc_types.f90:92
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 )

Copy output configurations (generic interface)

Usage is same as HistoryCopy.

Definition at line 159 of file historycopy.f90.

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

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

Here is the call graph for this function: