gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
historyaxiscopy.f90
Go to the documentation of this file.
1!> @file historyaxiscopy.f90
2!>
3!> @author Yasuhiro MORIKAWA
4!> @copyright Copyright (C) GFD Dennou Club, 2004-2026. All rights reserved. <br/>
5!> License is BSD-2-Clause. See [COPYRIGHT](@ref COPYRIGHT) in detail
6!>
7!> @en
8!> @brief Copy GT_HISTORY_AXIS
9!> @enden
10!>
11!> @ja
12!> @brief GT_HISTORY_AXIS のコピー
13!> @endja
14
15!>
16!> @en
17!> @brief Copy a GT_HISTORY_AXIS variable
18!>
19!> Copies the GT_HISTORY_AXIS variable axis_src
20!> to axis_dest.
21!> axis_src must be initialized by HistoryAxisCreate.
22!> To add attributes, use HistoryAxisAddAttr.
23!>
24!> If err is given, the program does not abort on error;
25!> instead, err returns .true.
26!>
27!> Arguments after err are values to override during copy.
28!> @param[out] axis_dest Destination GT_HISTORY_AXIS
29!> @param[in] axis_src Source GT_HISTORY_AXIS
30!> @param[out] err Error flag (optional)
31!> @param[in] name Dimension variable name (optional, override)
32!> @param[in] length Dimension length (optional, override)
33!> @param[in] longname Descriptive name (optional, override)
34!> @param[in] units Units (optional, override)
35!> @param[in] xtype Type (optional, override)
36!> @enden
37!>
38!> @ja
39!> @brief GT_HISTORY_AXIS 型変数コピー
40!>
41!> GT_HISTORY_AXIS 型の変数 axis_src を
42!> axis_dest にコピーします。
43!> axis_src は HistoryAxisCreate によって初期設定されている必要が
44!> あります。
45!> さらに属性を付加する場合には HistoryAxisAddAttr
46!> を用いてください。
47!>
48!> err を与えておくと、コピーの際何らかの不具合が生じても
49!> 終了せずに err が真になって返ります。
50!>
51!> err 以降の引数は、コピーの際に上書きする値です。
52!> @param[out] axis_dest コピー先 GT_HISTORY_AXIS
53!> @param[in] axis_src コピー元 GT_HISTORY_AXIS
54!> @param[out] err エラーフラグ (省略可能)
55!> @param[in] name 次元変数名 (省略可能, 上書き)
56!> @param[in] length 次元長 (省略可能, 上書き)
57!> @param[in] longname 次元変数の記述的名称 (省略可能, 上書き)
58!> @param[in] units 次元変数の単位 (省略可能, 上書き)
59!> @param[in] xtype 次元変数の型 (省略可能, 上書き)
60!> @endja
61!>
62 subroutine historyaxiscopy1(axis_dest, axis_src, err, &
63 & name, length, longname, units, xtype)
64 !
67 use dc_trace, only: beginsub, endsub
68 use dc_present, only: present_select
69 use dc_string, only: cprintft
70 implicit none
71 type(gt_history_axis),intent(out) :: axis_dest ! コピー先 GT_HISTORY_AXIS
72 type(gt_history_axis),intent(in) :: axis_src ! コピー元 GT_HISTORY_AXIS
73 logical, intent(out), optional :: err
74 character(*) , intent(in), optional:: name ! 次元変数名
75 integer, intent(in), optional:: length ! 次元長 (配列サイズ)
76 character(*) , intent(in), optional:: longname ! 次元変数の記述的名称
77 character(*) , intent(in), optional:: units ! 次元変数の単位
78 character(*) , intent(in), optional:: xtype ! 次元変数の型
79 character(*), parameter:: subname = "HistoryAxisCopy1"
80 continue
81 call beginsub(subname)
82 axis_dest % name = cprintft('%c', c1=present_select('', axis_src % name, name))
83 axis_dest % length = present_select(.false., axis_src % length, length)
84 axis_dest % longname = present_select('', axis_src % longname, longname)
85 axis_dest % units = present_select('', axis_src % units, units)
86 axis_dest % xtype = cprintft('%c', c1=present_select('', axis_src % xtype, xtype))
87
88 if (associated( axis_src % attrs ) ) then
89 allocate( axis_dest % attrs( size( axis_src % attrs) ) )
90 call copy_attrs( from = axis_src % attrs, &
91 & to = axis_dest % attrs, err = err)
92 end if
93 call endsub(subname)
94 end subroutine historyaxiscopy1
95
96 !-------------------------------------------------------------------
97
98!> @en
99 !> @brief Copy a GT_HISTORY_AXIS variable (generic interface)
100 !>
101 !> Usage is same as HistoryAxisCopy.
102 !> @enden
103 !> @ja
104 !> @brief GT_HISTORY_AXIS 型変数コピー (総称インターフェース)
105 !>
106 !> 使用方法は HistoryAxisCopy と同様です。
107 !> @endja
108 subroutine historyaxiscopy2(axis_dest, axis_src, err, &
109 & name, length, longname, units, xtype)
112 use dc_trace, only: beginsub, endsub
113 implicit none
114 type(gt_history_axis),intent(out) :: axis_dest ! コピー先 GT_HISTORY_AXIS
115 type(gt_history_axis),intent(in) :: axis_src ! コピー元 GT_HISTORY_AXIS
116 logical, intent(out), optional :: err
117 character(*) , intent(in), optional:: name ! 次元変数名
118 integer, intent(in), optional:: length ! 次元長 (配列サイズ)
119 character(*) , intent(in), optional:: longname ! 次元変数の記述的名称
120 character(*) , intent(in), optional:: units ! 次元変数の単位
121 character(*) , intent(in), optional:: xtype ! 次元変数の型
122 character(*), parameter:: subname = "HistoryAxisCopy2"
123 continue
124 call beginsub(subname)
125 call historyaxiscopy(axis_dest, axis_src, err, &
126 & name, length, longname, units, xtype)
127 call endsub(subname)
128 end subroutine historyaxiscopy2
subroutine historyaxiscopy2(axis_dest, axis_src, err, name, length, longname, units, xtype)
subroutine historyaxiscopy1(axis_dest, axis_src, err, name, length, longname, units, xtype)
Judge optional control parameters.
Handling character types.
Definition dc_string.f90:83
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