52 type(
gt_history),
intent(inout),
optional,
target:: history
60 logical,
intent(in),
optional:: quiet
67 logical,
intent(out),
optional:: err
82 character(STRING):: url, file
85 character(STRING):: cause_c
86 character(len = *),
parameter:: subname =
"HistoryClose"
91 if (
present(history))
then
100 if ( .not. hst % initialized )
then
102 cause_c =
'GT_HISTORY'
109 if ( .not. hst % mpi_gather &
110 & .or. ( hst % mpi_gather .and. hst % mpi_myrank == 0 ) )
then
112 call inquire( hst % dimvars(1), &
122 if ( .not. hst % mpi_gather &
123 & .or. ( hst % mpi_gather .and. hst % mpi_myrank == 0 ) )
then
124 v_size =
size(hst % dimvars)
126 if (.not. hst % dim_value_written(i)) &
128 call close(hst % dimvars(i))
130 v_size =
size(hst % vars)
132 call close(hst % vars(i))
135 deallocate(hst % dimvars)
136 v_size =
size(hst % vars)
141 hst % unlimited_index = 0
142 hst % unlimited_units =
''
144 if (
associated(hst % dim_value_written))
deallocate(hst % dim_value_written)
145 if (
associated(hst % vars))
deallocate(hst % vars)
146 if (
associated(hst % growable_indices))
deallocate(hst % growable_indices)
147 if (
associated(hst % count))
deallocate(hst % count)
148 if (
associated(hst % var_avr_count))
deallocate(hst % var_avr_count)
150 if (
associated(hst % var_avr_data(i) % a_DataAvr))
deallocate(hst % var_avr_data(i) % a_DataAvr)
152 if (
associated(hst % var_avr_data))
deallocate(hst % var_avr_data)
153 if (
associated(hst % var_avr_firstput))
deallocate(hst % var_avr_firstput)
154 if (
associated(hst % var_avr_coefsum))
deallocate(hst % var_avr_coefsum)
155 if (
associated(hst % var_avr_baseint))
deallocate(hst % var_avr_baseint)
156 if (
associated(hst % var_avr_prevtime))
deallocate(hst % var_avr_prevtime)
157 hst % time_bnds = 0.0_dp
158 hst % time_bnds_output_count = 0
159 hst % time_nv_index = 0
160 hst % origin_setting = .false.
161 if (
associated( hst % mpi_fileinfo % axes ) )
deallocate( hst % mpi_fileinfo % axes )
162 if (
associated( hst % mpi_fileinfo ) )
deallocate( hst % mpi_fileinfo )
163 v_size =
size(hst % mpi_dimdata_all)
165 if (
associated( hst % mpi_dimdata_all(i) % a_Axis ) )
deallocate( hst % mpi_dimdata_all(i) % a_Axis )
166 if (
associated( hst % mpi_dimdata_all(i) % attrs ) )
deallocate( hst % mpi_dimdata_all(i) % attrs )
168 if (
associated( hst % mpi_dimdata_all ) )
deallocate( hst % mpi_dimdata_all )
169 v_size =
size(hst % mpi_dimdata_each)
171 if (
associated( hst % mpi_dimdata_each(i) % a_Axis ) )
deallocate( hst % mpi_dimdata_each(i) % a_Axis )
173 if (
associated( hst % mpi_dimdata_each ) )
deallocate( hst % mpi_dimdata_each )
174 if (
associated( hst % mpi_gthr_info ) )
then
175 v_size =
size(hst % mpi_gthr_info)
177 if (
associated( hst % mpi_gthr_info(i) % index_all ) )
deallocate( hst % mpi_gthr_info(i) % index_all )
178 if (
associated( hst % mpi_gthr_info(i) % length ) )
deallocate( hst % mpi_gthr_info(i) % length )
180 deallocate( hst % mpi_gthr_info )
182 if (
associated(hst % mpi_varinfo) )
then
183 v_size =
size(hst % mpi_varinfo)
187 deallocate( hst % mpi_varinfo )
189 if (
associated(hst % mpi_vars_index) )
then
190 v_size =
size(hst % mpi_vars_index)
192 if (
associated( hst % mpi_vars_index(i) % each2all ) )
deallocate( hst % mpi_vars_index(i) % each2all )
193 if (
associated( hst % mpi_vars_index(i) % allcount ) )
deallocate( hst % mpi_vars_index(i) % allcount )
195 deallocate( hst % mpi_vars_index )
201 if ( .not. hst % mpi_gather &
202 & .or. ( hst % mpi_gather .and. hst % mpi_myrank == 0 ) )
then
205 &
'"%c" is closed', &
206 & c1 = trim( file ), rank_mpi = -1 )
209 hst % mpi_myrank = -1
210 hst % mpi_nprocs = -1
211 hst % mpi_gather = .false.
212 hst % mpi_split = .false.
217 hst % initialized = .false.
219 call storeerror( stat, subname, err, cause_c )
subroutine historyclose(history, quiet, err)
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)