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

Checker of validation of variable names that are loaded from NAMELIST . More...

Go to the source code of this file.

Functions/Subroutines

subroutine historyautoallvarfix
 

Detailed Description

Checker of validation of variable names that are loaded from NAMELIST

.

Author
Yasuhiro MORIKAWA

Definition in file historyautoallvarfix.f90.

Function/Subroutine Documentation

◆ historyautoallvarfix()

subroutine historyautoallvarfix

Check validation of variable names loaded from NAMELIST

This subroutine performs following acts.

  • Check that invalid variable names are loaded from NAMELIST or not.
  • Print registered variable names by HistoryAutoAddVariable.

If HistoryAutoAddVariable is called after this subroutine is called, an error is occurred.

Definition at line 38 of file historyautoallvarfix.f90.

42 use gtool_history, only: historyvarinfoinquire
43 use dc_trace, only: beginsub, endsub
45 use dc_message, only: messagenotify
46 use dc_date, only: operator(*), operator(+)
47 use dc_string, only: joinchar
48 use dc_types, only: string, token
49
50 implicit none
51 logical:: allvar_invalid
52 ! 無効な変数名のチェックフラグ.
53 ! Check flag of invalid variable names.
54
55 integer, parameter:: names_limit = 100
56 character(names_limit):: names_invalid
57 ! 無効な変数名.
58 ! Invalid variable names.
59
60 character(STRING):: name, units, longname, var_info_str
61 character(TOKEN), pointer:: dims(:) =>null()
62 integer:: msnot_rank
63 integer:: stat, i
64 character(STRING):: cause_c
65 character(*), parameter:: subname = "HistoryAutoAllVarFix"
66 continue
67 call beginsub(subname)
68 stat = dc_noerr
69 cause_c = ""
70
71 ! 初期設定チェック
72 ! Check initialization
73 !
74 if ( .not. initialized ) then
75 stat = dc_enotinit
76 cause_c = 'gtool_historyauto'
77 goto 999
78 end if
79
80 ! 既に確定後であれば何もせずに終了.
81 ! Nothing is done after fixed
82 !
83 if ( flag_allvarfixed ) goto 999
84
85
86 ! 無効な変数名のチェック (初回のみ)
87 ! Check invalid variable names (at only first time)
88 !
90 & gthstnml = gthstnml, & ! (inout)
91 & invalid = allvar_invalid, names = names_invalid ) ! (out)
92
93 if ( len_trim(names_invalid) > (names_limit - 5) ) then
94 names_invalid = names_invalid(1:names_limit - 5) // ' ....'
95 end if
96
97 if ( allvar_invalid ) then
98 stat = hst_ebadvarname
99 cause_c = names_invalid
100 call messagenotify( 'W', subname, &
101 & 'names "%c" from NAMELIST "gtool_historyauto_nml" are invalid.', &
102 & c1 = trim(names_invalid) )
103 goto 999
104 end if
105
106 ! 登録された変数の印字 (初回のみ)
107 ! Print registered variables (at only first time)
108 !
109 msnot_rank = -1
110 if ( save_mpi_gather ) msnot_rank = 0
111 call messagenotify( 'M', sub_sname, '-------------------------------------------', rank_mpi = msnot_rank )
112 call messagenotify( 'M', sub_sname, '----- Registered variables for output -----', rank_mpi = msnot_rank )
113 call messagenotify( 'M', sub_sname, '-------------------------------------------', rank_mpi = msnot_rank )
114
115 do i = 1, numvars
116 call historyvarinfoinquire( &
117 & varinfo = gthst_vars(i), & ! (in)
118 & name = name, & ! (out) optional
119 & dims = dims, & ! (out) optional
120 & longname = longname, & ! (out) optional
121 & units = units ) ! (out) optional
122
123 var_info_str = trim( longname ) // ' [' // &
124 & trim( units ) // '] {' // &
125 & trim( joinchar( dims, ',' ) ) // '}'
126 deallocate( dims )
127
128 call messagenotify( 'M', sub_sname, ' %c (%c)', &
129 & c1 = trim(name), c2 = trim(var_info_str), rank_mpi = msnot_rank )
130
131 end do
132 call messagenotify( 'M', sub_sname, '-----', rank_mpi = msnot_rank )
133
134 ! フラグの設定
135 ! Set a flag
136 !
137 if ( .not. flag_allvarfixed ) flag_allvarfixed = .true.
138
139999 continue
140 call storeerror(stat, subname, cause_c = cause_c)
141 call endsub(subname, 'stat=%d', i = (/stat/) )
Date and time manipulation module.
Definition dc_date.f90:57
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 hst_ebadvarname
Definition dc_error.f90:563
integer, parameter, public dc_enotinit
-400 or less: DC utilities errors
Definition dc_error.f90:534
Message output module.
Handling character types.
Definition dc_string.f90:83
character(string) function, public joinchar(carray, expr)
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 token
Character length for word, token
Definition dc_types.f90:128
integer, parameter, public string
Character length for string
Definition dc_types.f90:137
type(gthst_nmlinfo), save, public gthstnml
type(gt_history_varinfo), dimension(1:max_vars), save, public gthst_vars
character(*), parameter, public sub_sname

References dc_trace::beginsub(), dc_error::dc_enotinit, dc_error::dc_noerr, dc_trace::endsub(), gtool_historyauto_internal::flag_allvarfixed, gtool_historyauto_internal::gthst_vars, gtool_historyauto_internal::gthstnml, dc_error::hst_ebadvarname, gtool_historyauto_internal::initialized, dc_string::joinchar(), gtool_historyauto_internal::numvars, gtool_historyauto_internal::save_mpi_gather, dc_error::storeerror(), dc_types::string, gtool_historyauto_internal::sub_sname, and dc_types::token.

Here is the call graph for this function: