gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
Public Member Functions | List of all members
gtool_history_internal::copy_attrs Interface Reference

Public Member Functions

subroutine copy_attrs (from, to, err)
 

Detailed Description

Definition at line 75 of file gtool_history_internal.f90.

Constructor & Destructor Documentation

◆ copy_attrs()

subroutine gtool_history_internal::copy_attrs::copy_attrs ( type(gt_history_attr), dimension(:), intent(in)  from,
type(gt_history_attr), dimension(:), intent(out)  to,
logical, intent(out), optional  err 
)

Definition at line 171 of file gtool_history_internal.f90.

172 !
173 ! GT_HISTORY_ATTR 変数をコピーするためのサブルーチン
174 ! このモジュール内部で利用されることを想定している.
175 ! from と to の配列サイズは同じであることが想定されている.
176 ! err を与えると, コピーの際何らかの不具合が生じると
177 ! 終了せずに err が真になって返る.
178 !
179 use dc_string,only: lchar, strhead
181 use dc_error, only: storeerror, &
183 use dc_types, only: string
185 implicit none
186 type(GT_HISTORY_ATTR), intent(in) :: from(:)
187 type(GT_HISTORY_ATTR), intent(out) :: to(:)
188 logical, intent(out), optional :: err
189 integer :: i, stat
190 character(STRING) :: cause_c
191 character(STRING), parameter:: subname = "copy_attrs"
192 continue
193 call beginsub(subname)
194 stat = dc_noerr
195 cause_c = ''
196 call dbgmessage('size(from)=<%d>, size(to)=<%d>, So copy <%d> times.', &
197 & i=(/ size(from), size(to), min(size(from),size(to)) /) )
198 if ( size(to) < size(from) ) then
200 cause_c = 'from is larger than to'
201 goto 999
202 end if
203 ! from と to の小さい方に合わせてループ
204 do i = 1, min( size(from), size(to) )
205 ! attrname と attrtype と array はまずコピー
206 to(i)%attrname = from(i)%attrname
207 to(i)%attrtype = from(i)%attrtype
208 to(i)%array = from(i)%array
209 ! from(i)%attrtype の種別でコピーする変数を変える.
210 if ( strhead( 'char', trim(lchar(from(i)%attrtype))) ) then
211 to(i)%Charvalue = from(i)%Charvalue
212 elseif ( strhead( &
213 & lchar('Int'), trim(lchar(from(i)%attrtype)))) then
214 if ( from(i)%array ) then
215 allocate( to(i)%Intarray( size(from(i)%Intarray) ) )
216 to(i)%Intarray = from(i)%Intarray
217 else
218 to(i)%Intvalue = from(i)%Intvalue
219 endif
220 elseif ( strhead( &
221 & lchar('Real'), trim(lchar(from(i)%attrtype)))) then
222 if ( from(i)%array ) then
223 allocate( to(i)%Realarray( size(from(i)%Realarray) ) )
224 to(i)%Realarray = from(i)%Realarray
225 else
226 to(i)%Realvalue = from(i)%Realvalue
227 endif
228 elseif ( strhead( &
229 & lchar('Double'), trim(lchar(from(i)%attrtype)))) then
230 if ( from(i)%array ) then
231 allocate( to(i)%Doublearray( size(from(i)%Doublearray) ) )
232 to(i)%Doublearray = from(i)%Doublearray
233 else
234 to(i)%Doublevalue = from(i)%Doublevalue
235 endif
236 elseif ( strhead( 'logical', trim(lchar(from(i)%attrtype))) ) then
237 to(i)%Logicalvalue = from(i)%Logicalvalue
238 else
239 stat = gt_ebadattrname
240 cause_c = from(i)%attrtype
241 goto 999
242 endif
243 enddo
244999 continue
245 call storeerror(stat, subname, err, cause_c=cause_c)
246 call endsub(subname)
Error handling module.
Definition dc_error.f90:454
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:891
integer, parameter, public dc_noerr
Error storage variables
Definition dc_error.f90:468
integer, parameter, public gt_eargsizemismatch
Definition dc_error.f90:515
integer, parameter, public gt_ebadattrname
Definition dc_error.f90:521
Handling character types.
Definition dc_string.f90:83
Debug tracing module.
Definition dc_trace.f90:150
subroutine, public dbgmessage(fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:661
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

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_error::dc_noerr, dc_trace::endsub(), dc_error::gt_eargsizemismatch, dc_error::gt_ebadattrname, dc_error::storeerror(), and dc_types::string.

Here is the call graph for this function:

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