gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
gtvarcopyattrall.f90
Go to the documentation of this file.
1!> @file gtvarcopyattrall.f90
2!>
3!> @author Eizi TOYODA, Yasuhiro MORIKAWA
4!> @copyright Copyright (C) GFD Dennou Club, 2000-2026. All rights reserved. <br/>
5!> License is BSD-2-Clause. See [COPYRIGHT](@ref COPYRIGHT) in detail
6!>
7!> @en
8!> @brief Copy all attributes
9!>
10!> This subroutine is provided as gtdata_generic#Copy_Attr
11!> through gtdata_generic.
12!> @enden
13!>
14!> @ja
15!> @brief 全属性のコピー
16!>
17!> このサブルーチンは gtdata_generic から gtdata_generic#Copy_Attr
18!> として提供されます。
19!> @endja
20!>
21
22!>
23!> @en
24!> @brief Copy all attributes from one variable to another
25!>
26!> Copies all attributes of variable from to variable to.
27!> By default, global attributes are also copied.
28!> If global is set to .false., global attributes are not copied.
29!>
30!> Copy_Attr is a generic name for 2 subroutines; there is also
31!> a method to copy by specifying an attribute.
32!> @param[inout] to Destination variable handle
33!> @param[inout] from Source variable handle
34!> @param[out] err Error flag (optional)
35!> @param[in] global Whether to copy global attributes (optional)
36!> @enden
37!>
38!> @ja
39!> @brief 1つの変数から別の変数へ全属性をコピー
40!>
41!> 変数 from の全ての属性を変数 to へコピーします。
42!> デフォルトでは大域属性もコピーしますが、
43!> global に .false. を与える場合、大域属性をコピーしません。
44!>
45!> Copy_Attr は 2 つのサブルーチンの総称名であり、
46!> 他にも属性を指定してコピーする方法もあります。
47!> @param[inout] to コピー先の変数ハンドル
48!> @param[inout] from コピー元の変数ハンドル
49!> @param[out] err エラーフラグ (省略可能)
50!> @param[in] global 大域属性をコピーするか (省略可能)
51!> @endja
52!>
53subroutine gtvarcopyattrall(to, from, err, global)
54 use gtdata_types, only: gt_variable
57 use dc_url, only: gt_plus
58 use dc_error, only: dumperror
60 use dc_types, only: string
61 type(gt_variable), intent(inout):: to
62 type(gt_variable), intent(inout):: from
63 logical, intent(out), optional:: err
64 logical, intent(in), optional:: global
65 character(len = *), parameter:: subnam = "GTVarCopyAttrAll"
66 character(len = STRING):: aname
67 logical:: end
68continue
69 if (present(err)) err = .false.
70 call beginsub(subnam)
71 call attr_rewind(from)
72 do
73 call attr_next(from, aname, end)
74 if (end) exit
75 if ( (present_and_false(global)) .and. (aname(1:1) == gt_plus) ) then
76 call dbgmessage("Ignored attr=%c", c1=aname)
77 cycle
78 end if
79 call dbgmessage("Copied attr=%c", c1=aname)
80 call gtvarcopyattr(to=to, attrname=aname, from=from, err=err)
81 if (present_and_true(err)) err = .false.
82 enddo
83 call endsub(subnam)
84end subroutine gtvarcopyattrall
subroutine gtvarcopyattr(to, attrname, from, err)
subroutine gtvarcopyattrall(to, from, err, global)
Procedure reference specification. Made as an external function to be replaceable in the future.
Definition dc_error.f90:592
Error handling module.
Definition dc_error.f90:454
Judge optional control parameters.
logical function, public present_and_false(arg)
logical function, public present_and_true(arg)
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
Variable URL string parser.
Definition dc_url.f90:61
character, parameter, public gt_plus
Definition dc_url.f90:109