38
51 implicit none
52 type(GT_HISTORY), intent(inout), optional, target:: history
53
54
55
56
57
58
59
60 logical, intent(in), optional:: quiet
61
62
63
64
65
66
67 logical, intent(out), optional:: err
68
69
70
71
72
73
74
75
76
77
78
79
80
81 type(GT_HISTORY), pointer:: hst =>null()
82 character(STRING):: url, file
83 integer:: i, v_size
84 integer:: stat
85 character(STRING):: cause_c
86 character(len = *), parameter:: subname = "HistoryClose"
87 continue
90 cause_c = ""
91 if (present(history)) then
92 hst => history
93 else
95 endif
96
97
98
99
100 if ( .not. hst % initialized ) then
102 cause_c = 'GT_HISTORY'
103 goto 999
104 end if
105
106
107
108
110 call inquire( hst % dimvars(1), &
111 & url = url )
113 & file = file )
114 end if
115
116
117
118
119 v_size = size(hst % dimvars)
120 do, i = 1, v_size
121 if (.not. hst % dim_value_written(i)) &
123 call close(hst % dimvars(i))
124 enddo
125 v_size = size(hst % vars)
126 do, i = 1, v_size
127 call close(hst % vars(i))
128 enddo
129 deallocate(hst % dimvars)
130 v_size = size(hst % vars)
131
132
133
134
135 hst % unlimited_index = 0
136 hst % unlimited_units = ''
138 if (associated(hst % dim_value_written)) deallocate(hst % dim_value_written)
139 if (associated(hst % vars)) deallocate(hst % vars)
140 if (associated(hst % growable_indices)) deallocate(hst % growable_indices)
141 if (associated(hst % count)) deallocate(hst % count)
142 if (associated(hst % var_avr_count)) deallocate(hst % var_avr_count)
143 do, i = 1, v_size
144 if (associated(hst % var_avr_data(i) % a_DataAvr)) deallocate(hst % var_avr_data(i) % a_DataAvr)
145 enddo
146 if (associated(hst % var_avr_data)) deallocate(hst % var_avr_data)
147 if (associated(hst % var_avr_firstput)) deallocate(hst % var_avr_firstput)
148 if (associated(hst % var_avr_coefsum)) deallocate(hst % var_avr_coefsum)
149 if (associated(hst % var_avr_baseint)) deallocate(hst % var_avr_baseint)
150 if (associated(hst % var_avr_prevtime)) deallocate(hst % var_avr_prevtime)
151 hst % time_bnds = 0.0_dp
152 hst % time_bnds_output_count = 0
153 hst % time_nv_index = 0
154 hst % origin_setting = .false.
155
156
157
158
161 & '"%c" is closed', &
162 & c1 = trim( file ), rank_mpi = -1 )
163 end if
164
165
166
167
168 hst % initialized = .false.
169999 continue
170 call storeerror( stat, subname, err, cause_c )
Derived types and parameters for date and time.
integer, parameter, public unit_symbol_err
Symbol for invalid unit
subroutine, public storeerror(number, where, err, cause_c, cause_i)
integer, parameter, public dc_enotinit
-400 or less: DC utilities errors
integer, parameter, public dc_noerr
Error storage variables
Judge optional control parameters.
logical function, public present_and_true(arg)
subroutine, public dbgmessage(fmt, i, r, d, l, n, c1, c2, c3, ca)
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
Provides kind type parameter values.
integer, parameter, public string
Character length for string
integer, parameter, public dp
Double Precision Real number
Variable URL string parser.
type(gt_history), target, save, public default