1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
|
!> @defgroup FH5ES Fortran Event Set (H5ES) Interface
!!
!! @see H5ES, C-API
!!
!! @see @ref H5ES_UG, User Guide
!!
!
! COPYRIGHT
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
! Copyright by The HDF Group. *
! All rights reserved. *
! *
! This file is part of HDF5. The full HDF5 copyright notice, including *
! terms governing use, modification, and redistribution, is contained in *
! the COPYING file, which can be found at the root of the source code *
! distribution tree, or in https://www.hdfgroup.org/licenses. *
! If you do not have access to either file, you may request a copy from *
! help@hdfgroup.org. *
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
!
! NOTES
! _____ __ __ _____ ____ _____ _______ _ _ _______
! |_ _| \/ | __ \ / __ \| __ \__ __|/\ | \ | |__ __|
! **** | | | \ / | |__) | | | | |__) | | | / \ | \| | | | ****
! **** | | | |\/| | ___/| | | | _ / | | / /\ \ | . ` | | | ****
! **** _| |_| | | | | | |__| | | \ \ | |/ ____ \| |\ | | | ****
! |_____|_| |_|_| \____/|_| \_\ |_/_/ \_\_| \_| |_|
!
! If you add a new H5ES function to the module you must add the function name
! to the Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory.
! This is needed for Windows based operating systems.
!
MODULE H5ES
USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR, C_CHAR, C_INT64_T, C_BOOL
USE H5GLOBAL
IMPLICIT NONE
CONTAINS
!>
!! \ingroup FH5ES
!!
!! \brief Creates an event set.
!!
!! \param es_id \es_id
!! \param hdferr \fortran_error
!!
!! See C API: @ref H5EScreate()
!!
SUBROUTINE h5escreate_f(es_id, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(OUT) :: es_id
INTEGER , INTENT(OUT) :: hdferr
INTERFACE
INTEGER(HID_T) FUNCTION H5EScreate() BIND(C,NAME='H5EScreate')
IMPORT :: HID_T
END FUNCTION H5EScreate
END INTERFACE
es_id = H5EScreate()
hdferr = 0
IF(es_id.LT.0) hdferr = -1
END SUBROUTINE h5escreate_f
!>
!! \ingroup FH5ES
!!
!! \brief Retrieves number of events in an event set.
!!
!! \param es_id \es_id
!! \param count The number of events in the event set
!! \param hdferr \fortran_error
!!
!! See C API: @ref H5ESget_count()
!!
SUBROUTINE h5esget_count_f(es_id, count, hdferr)
IMPLICIT NONE
INTEGER(hid_t), INTENT(IN) :: es_id
INTEGER(size_t), INTENT(OUT) :: count
INTEGER, INTENT(OUT) :: hdferr
INTERFACE
INTEGER(C_INT) FUNCTION H5ESget_count(es_id, count) BIND(C,NAME='H5ESget_count')
IMPORT :: C_INT
IMPORT :: HID_T, SIZE_T
INTEGER(HID_T), VALUE :: es_id
INTEGER(SIZE_T) :: count
END FUNCTION H5ESget_count
END INTERFACE
hdferr = INT(H5ESget_count(es_id, count))
END SUBROUTINE h5esget_count_f
!>
!! \ingroup FH5ES
!!
!! \brief Retrieves the next operation counter to be assigned in an event set.
!!
!! \param es_id \es_id
!! \param counter The number of events in the event set
!! \param hdferr \fortran_error
!!
!! See C API: @ref H5ESget_op_counter()
!!
SUBROUTINE h5esget_op_counter_f(es_id, counter, hdferr)
IMPLICIT NONE
INTEGER(HID_T) , INTENT(IN) :: es_id
INTEGER(C_INT64_T), INTENT(OUT) :: counter
INTEGER , INTENT(OUT) :: hdferr
INTERFACE
INTEGER(C_INT) FUNCTION H5ESget_op_counter(es_id, counter) BIND(C,NAME='H5ESget_op_counter')
IMPORT :: C_INT
IMPORT :: HID_T, C_INT64_T
INTEGER(HID_T) , VALUE :: es_id
INTEGER(C_INT64_T) :: counter
END FUNCTION H5ESget_op_counter
END INTERFACE
hdferr = INT(H5ESget_op_counter(es_id, counter))
END SUBROUTINE h5esget_op_counter_f
!>
!! \ingroup FH5ES
!!
!! \brief Waits for operations in event set to complete.
!!
!! \param es_id \es_id
!! \param timeout The number of events in the event set
!! \param num_in_progress The number of operations still in progress
!! \param err_occurred Flag if an operation in the event set failed
!! \param hdferr \fortran_error
!!
!! See C API: @ref H5ESwait()
!!
SUBROUTINE h5eswait_f(es_id, timeout, num_in_progress, err_occurred, hdferr)
IMPLICIT NONE
INTEGER(HID_T) , INTENT(IN) :: es_id
INTEGER(C_INT64_T), INTENT(IN) :: timeout
INTEGER(SIZE_T) , INTENT(OUT) :: num_in_progress
LOGICAL , INTENT(OUT) :: err_occurred
INTEGER , INTENT(OUT) :: hdferr
LOGICAL(C_BOOL) :: err_occurred_c = .FALSE.
INTERFACE
INTEGER(C_INT) FUNCTION H5ESwait(es_id, timeout, num_in_progress, err_occurred) BIND(C,NAME='H5ESwait')
IMPORT :: C_INT
IMPORT :: HID_T, C_INT64_T, SIZE_T, C_BOOL
INTEGER(HID_T) , VALUE :: es_id
INTEGER(C_INT64_T), VALUE :: timeout
INTEGER(SIZE_T) :: num_in_progress
LOGICAL(C_BOOL) :: err_occurred
END FUNCTION H5ESwait
END INTERFACE
hdferr = INT(H5ESwait(es_id, timeout, num_in_progress, err_occurred_c))
! Transfer value of C c_bool type to Fortran LOGICAL
err_occurred = err_occurred_c
END SUBROUTINE h5eswait_f
!>
!! \ingroup FH5ES
!!
!! \brief Attempt to cancel operations in an event set.
!!
!! \param es_id \es_id
!! \param num_not_canceled The number of events not canceled
!! \param err_occurred Status indicating if error is present in the event set
!! \param hdferr \fortran_error
!!
!! See C API: @ref H5EScancel()
!!
SUBROUTINE h5escancel_f(es_id, num_not_canceled, err_occurred, hdferr)
IMPLICIT NONE
INTEGER(hid_t) , INTENT(IN) :: es_id
INTEGER(size_t), INTENT(OUT) :: num_not_canceled
LOGICAL , INTENT(OUT) :: err_occurred
INTEGER , INTENT(OUT) :: hdferr
LOGICAL(C_BOOL) :: err_occurred_c = .FALSE.
INTERFACE
INTEGER(C_INT) FUNCTION H5EScancel(es_id, num_not_canceled, err_occurred) BIND(C,NAME='H5EScancel')
IMPORT :: C_INT
IMPORT :: HID_T, SIZE_T, C_BOOL
INTEGER(HID_T) , VALUE :: es_id
INTEGER(SIZE_T) :: num_not_canceled
LOGICAL(C_BOOL) :: err_occurred
END FUNCTION H5EScancel
END INTERFACE
hdferr = INT(H5EScancel(es_id, num_not_canceled, err_occurred_c))
! Transfer value of C c_bool type to Fortran LOGICAL
err_occurred = err_occurred_c
END SUBROUTINE h5escancel_f
!>
!! \ingroup FH5ES
!!
!! \brief Checks for failed operations.
!!
!! \param es_id \es_id
!! \param err_occurred Status indicating if error is present in the event set
!! \param hdferr \fortran_error
!!
!! See C API: @ref H5ESget_err_status()
!!
SUBROUTINE h5esget_err_status_f(es_id, err_occurred, hdferr)
IMPLICIT NONE
INTEGER(hid_t), INTENT(IN) :: es_id
LOGICAL , INTENT(OUT) :: err_occurred
INTEGER , INTENT(OUT) :: hdferr
LOGICAL(C_BOOL) :: err_occurred_c = .FALSE.
INTERFACE
INTEGER(C_INT) FUNCTION H5ESget_err_status(es_id, err_occurred) BIND(C,NAME='H5ESget_err_status')
IMPORT :: C_INT
IMPORT :: HID_T, C_BOOL
INTEGER(HID_T) , VALUE :: es_id
LOGICAL(C_BOOL) :: err_occurred
END FUNCTION H5ESget_err_status
END INTERFACE
hdferr = INT(H5ESget_err_status(es_id, err_occurred_c))
! Transfer value of C c_bool type to Fortran LOGICAL
err_occurred = err_occurred_c
END SUBROUTINE h5esget_err_status_f
!>
!! \ingroup FH5ES
!!
!! \brief Retrieves the number of failed operations.
!!
!! \param es_id \es_id
!! \param num_errs Number of errors
!! \param hdferr \fortran_error
!!
!! See C API: @ref H5ESget_err_count()
!!
SUBROUTINE h5esget_err_count_f(es_id, num_errs, hdferr)
IMPLICIT NONE
INTEGER(HID_T) , INTENT(IN) :: es_id
INTEGER(SIZE_T), INTENT(OUT) :: num_errs
INTEGER , INTENT(OUT) :: hdferr
INTERFACE
INTEGER(C_INT) FUNCTION H5ESget_err_count(es_id, num_errs) BIND(C,NAME='H5ESget_err_count')
IMPORT :: C_INT
IMPORT :: HID_T, SIZE_T
INTEGER(HID_T) , VALUE :: es_id
INTEGER(SIZE_T) :: num_errs
END FUNCTION H5ESget_err_count
END INTERFACE
hdferr = INT(H5ESget_err_count(es_id, num_errs))
END SUBROUTINE h5esget_err_count_f
!>
!! \ingroup FH5ES
!!
!! \brief Terminates access to an event set.
!!
!! \param es_id \es_id
!! \param hdferr \fortran_error
!!
!! See C API: @ref H5ESclose()
!!
SUBROUTINE h5esclose_f(es_id, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: es_id
INTEGER , INTENT(OUT) :: hdferr
INTERFACE
INTEGER(C_INT) FUNCTION H5ESclose(es_id) BIND(C,NAME='H5ESclose')
IMPORT :: C_INT
IMPORT :: HID_T
INTEGER(HID_T), VALUE :: es_id
END FUNCTION H5ESclose
END INTERFACE
hdferr = INT(H5ESclose(es_id))
END SUBROUTINE h5esclose_f
END MODULE H5ES
|