gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
hstnmlinfodelete.f90 File Reference

Delete output information of a variable . More...

Go to the source code of this file.

Functions/Subroutines

recursive subroutine hstnmlinfodelete (gthstnml, name, err)

Detailed Description

Delete output information of a variable

.

Author
Yasuhiro MORIKAWA

Definition in file hstnmlinfodelete.f90.

Function/Subroutine Documentation

◆ hstnmlinfodelete()

recursive subroutine hstnmlinfodelete ( type(gthst_nmlinfo), intent(inout) gthstnml,
character(*), intent(in) name,
logical, intent(out), optional err )

Delete output information of a variable

Delete output information of a variable.

If gthstnml is not initialized by HstNmlInfoCreate yet, error is occurred.

Parameters
[in,out]gthstnmlgtool_history_nmlinfo_types::GTHST_NMLINFO 型変数
[in]name変数名. 先頭の空白は無視されます. "Data1,Data2" のようにカンマで区切って複数指定可能. Variable identifier. Blanks at the head of the name are ignored. Multiple variables can be specified as "Data1,Data2".
[out]err例外処理用フラグ. Exception handling flag.

Definition at line 39 of file hstnmlinfodelete.f90.

45 use dc_string, only: split
47 use dc_types, only: string, token
49 implicit none
50 type(GTHST_NMLINFO), intent(inout):: gthstnml
51 character(*), intent(in):: name
52 ! 変数名.
53 !
54 ! 先頭の空白は無視されます.
55 !
56 ! "Data1,Data2" のようにカンマで区切って複数
57 ! の変数を指定することが可能です.
58 !
59 ! Variable identifier.
60 !
61 ! Blanks at the head of the name are ignored.
62 !
63 ! Multiple variables can be specified
64 ! as "Data1,Data2". Delimiter is comma.
65 !
66 logical, intent(out), optional:: err
67 ! 例外処理用フラグ.
68 ! デフォルトでは, この手続き内でエラーが
69 ! 生じた場合, プログラムは強制終了します.
70 ! 引数 *err* が与えられる場合,
71 ! プログラムは強制終了せず, 代わりに
72 ! *err* に .true. が代入されます.
73 !
74 ! Exception handling flag.
75 ! By default, when error occur in
76 ! this procedure, the program aborts.
77 ! If this *err* argument is given,
78 ! .true. is substituted to *err* and
79 ! the program does not abort.
80
81 !-----------------------------------
82 ! 作業変数
83 ! Work variables
84 type(GTHST_NMLINFO_ENTRY), pointer:: hptr =>null()
85 type(GTHST_NMLINFO_ENTRY), pointer:: hptr_prev =>null()
86 type(GTHST_NMLINFO_ENTRY), pointer:: hptr_next =>null()
87 character(TOKEN), pointer:: varnames_array(:) =>null()
88 integer:: i, vnmax
89 integer:: stat
90 character(STRING):: cause_c
91 character(*), parameter:: subname = 'HstNmlInfoDelete'
92 continue
93 call beginsub( subname, &
94 & fmt = '@name=%c', &
95 & c1 = trim( name ) )
96 stat = dc_noerr
97 cause_c = ''
98
99 !-----------------------------------------------------------------
100 ! 初期設定のチェック
101 ! Check initialization
102 !-----------------------------------------------------------------
103 if ( .not. gthstnml % initialized ) then
104 stat = dc_enotinit
105 cause_c = 'GTHST_NMLINFO'
106 goto 999
107 end if
108
109 if ( .not. gthstnml % define_mode ) then
110 stat = hst_enotindefine
111 cause_c = 'Delete'
112 goto 999
113 end if
114
115 !-----------------------------------------------------------------
116 ! 複数の変数を削除する場合
117 ! Delete multiple variables
118 !-----------------------------------------------------------------
119 if ( present_and_not_empty(name) ) then
120 if ( index(name, name_delimiter) > 0 ) then
121 call dbgmessage( 'multiple entries (%c) will be deleted', c1 = trim(name) )
122 call split( str = name, sep = name_delimiter, & ! (in)
123 & carray = varnames_array ) ! (out)
124 vnmax = size( varnames_array )
125
126 do i = 1, vnmax
127 call hstnmlinfodelete( &
128 & gthstnml = gthstnml, & ! (inout)
129 & name = varnames_array(i), & ! (in)
130 & err = err ) ! (out)
131 if ( present_and_true( err ) ) then
132 deallocate( varnames_array )
133 stat = usr_errno
134 goto 999
135 end if
136 end do
137 deallocate( varnames_array )
138 goto 999
139 end if
140 end if
141
142 !-----------------------------------------------------------------
143 ! *gthstnml* の情報を削除.
144 ! Delete information in *gthstnml*
145 !-----------------------------------------------------------------
146 hptr => gthstnml % gthstnml_list
147 call listsearch( gthstnml_list = hptr, & ! (inout)
148 & name = name, & ! (in)
149 & previous = hptr_prev, & ! (out)
150 & next = hptr_next ) ! (out)
151
152 if ( .not. associated( hptr ) ) goto 999
153 if ( ( trim(hptr % name) /= '' ) .and. associated( hptr_prev ) ) then
154 call dbgmessage( 'entry (%c) is deleted', c1 = trim( adjustl( name ) ) )
155 hptr_prev % next => hptr_next
156 deallocate( hptr )
157 end if
158
159 !-----------------------------------------------------------------
160 ! 終了処理, 例外処理
161 ! Termination and Exception handling
162 !-----------------------------------------------------------------
163999 continue
164 call storeerror( stat, subname, err, cause_c )
165 call endsub( subname )
recursive subroutine hstnmlinfodelete(gthstnml, name, err)
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 usr_errno
-1000 or less: User-defined errors
Definition dc_error.f90:579
integer, parameter, public dc_enotinit
-400 or less: DC utilities errors
Definition dc_error.f90:534
integer, parameter, public dc_noerr
Error storage variables
Definition dc_error.f90:468
integer, parameter, public hst_enotindefine
-500 or less: Data I/O layer errors
Definition dc_error.f90:557
Judge optional control parameters.
logical function, public present_and_not_empty(arg)
logical function, public present_and_true(arg)
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 token
Character length for word, token
Definition dc_types.f90:128
integer, parameter, public string
Character length for string
Definition dc_types.f90:137
character(1), parameter, public name_delimiter

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_error::dc_enotinit, dc_error::dc_noerr, dc_trace::endsub(), dc_error::hst_enotindefine, hstnmlinfodelete(), gtool_history_nmlinfo_internal::name_delimiter, dc_present::present_and_not_empty(), dc_present::present_and_true(), dc_error::storeerror(), dc_types::string, dc_types::token, and dc_error::usr_errno.

Here is the call graph for this function: