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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
|
!****h* root/fortran/test/tH5A.f90
!
! NAME
! tH5A.f90
!
! FUNCTION
! Basic testing of Fortran H5A APIs.
!
! COPYRIGHT
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
! Copyright by The HDF Group. *
! Copyright by the Board of Trustees of the University of Illinois. *
! 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. *
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
!
! CONTAINS SUBROUTINES
! attribute_test
!
!
!*****
MODULE TH5A
USE HDF5 ! This module contains all necessary modules
USE TH5_MISC
USE TH5_MISC_GEN
CONTAINS
SUBROUTINE attribute_test(cleanup, total_error)
! This subroutine tests following functionalities:
! h5acreate_f, h5awrite_f, h5aclose_f,h5aread_f, h5aopen_name_f,
! h5aget_name_f,h5aget_space_f, h5aget_type_f,
!
IMPLICIT NONE
LOGICAL, INTENT(IN) :: cleanup
INTEGER, INTENT(INOUT) :: total_error
CHARACTER(LEN=5), PARAMETER :: filename = "atest" !File name
CHARACTER(LEN=80) :: fix_filename
CHARACTER(LEN=9), PARAMETER :: dsetname = "atestdset" !Dataset name
CHARACTER(LEN=11), PARAMETER :: aname = "attr_string" !String Attribute name
CHARACTER(LEN=14), PARAMETER :: aname2 = "attr_character"!Character Attribute name
CHARACTER(LEN=11), PARAMETER :: aname3 = "attr_double" !DOuble Attribute name
CHARACTER(LEN=9), PARAMETER :: aname4 = "attr_real" !Real Attribute name
CHARACTER(LEN=12), PARAMETER :: aname5 = "attr_integer" !Integer Attribute name
CHARACTER(LEN=9), PARAMETER :: aname6 = "attr_null" !Null Attribute name
!
!data space rank and dimensions
!
INTEGER, PARAMETER :: RANK = 2
INTEGER, PARAMETER :: NX = 4
INTEGER, PARAMETER :: NY = 5
INTEGER(HID_T) :: file_id ! File identifier
INTEGER(HID_T) :: dset_id ! Dataset identifier
INTEGER(HID_T) :: dataspace ! Dataspace identifier for dataset
INTEGER(HID_T) :: attr_id !String Attribute identifier
INTEGER(HID_T) :: attr2_id !Character Attribute identifier
INTEGER(HID_T) :: attr3_id !Double Attribute identifier
INTEGER(HID_T) :: attr4_id !Real Attribute identifier
INTEGER(HID_T) :: attr5_id !Integer Attribute identifier
INTEGER(HID_T) :: attr6_id !Null Attribute identifier
INTEGER(HID_T) :: aspace_id !String Attribute Dataspace identifier
INTEGER(HID_T) :: aspace2_id !Character Attribute Dataspace identifier
INTEGER(HID_T) :: aspace6_id !Null Attribute Dataspace identifier
INTEGER(HID_T) :: atype_id !String Attribute Datatype identifier
INTEGER(HID_T) :: atype2_id !Character Attribute Datatype identifier
INTEGER(HID_T) :: atype3_id !Double Attribute Datatype identifier
INTEGER(HID_T) :: atype4_id !Real Attribute Datatype identifier
INTEGER(HID_T) :: atype5_id !Integer Attribute Datatype identifier
INTEGER(HSIZE_T), DIMENSION(1) :: adims = (/2/) ! Attribute dimension
INTEGER(HSIZE_T), DIMENSION(1) :: adims2 = (/1/) ! Attribute dimension
INTEGER :: arank = 1 ! Attribure rank
INTEGER(SIZE_T) :: attrlen ! Length of the attribute string
INTEGER(HID_T) :: attr_space !Returned String Attribute Space identifier
INTEGER(HID_T) :: attr2_space !Returned other Attribute Space identifier
INTEGER(HID_T) :: attr_type !Returned Attribute Datatype identifier
INTEGER(HID_T) :: attr2_type !Returned CHARACTER Attribute Datatype identifier
INTEGER(HID_T) :: attr3_type !Returned DOUBLE Attribute Datatype identifier
INTEGER(HID_T) :: attr4_type !Returned REAL Attribute Datatype identifier
INTEGER(HID_T) :: attr5_type !Returned INTEGER Attribute Datatype identifier
INTEGER(HID_T) :: attr6_type !Returned NULL Attribute Datatype identifier
INTEGER :: num_attrs !number of attributes
INTEGER(HSIZE_T) :: attr_storage ! attributes storage requirements .MSB.
CHARACTER(LEN=256) :: attr_name !buffer to put attr_name
INTEGER(SIZE_T) :: name_size = 80 !attribute name length
CHARACTER(LEN=35), DIMENSION(2) :: attr_data ! String attribute data
CHARACTER(LEN=35), DIMENSION(2) :: aread_data ! Buffer to put read back
! string attr data
CHARACTER :: attr_character_data = 'A'
REAL(KIND=Fortran_DOUBLE), DIMENSION(1) :: attr_double_data = 3.459D0
REAL, DIMENSION(1) :: attr_real_data = 4.0
INTEGER, DIMENSION(1) :: attr_integer_data = 5
INTEGER(HSIZE_T), DIMENSION(7) :: data_dims
CHARACTER :: aread_character_data ! variable to put read back Character attr data
INTEGER, DIMENSION(1) :: aread_integer_data ! variable to put read back integer attr data
INTEGER, DIMENSION(1) :: aread_null_data = 7 ! variable to put read back null attr data
REAL(KIND=Fortran_DOUBLE), DIMENSION(1) :: aread_double_data ! variable to put read back double attr data
REAL, DIMENSION(1) :: aread_real_data ! variable to put read back real attr data
!
!general purpose integer
!
INTEGER :: i, j
INTEGER :: error ! Error flag
!
!The dimensions for the dataset.
!
INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/NX,NY/)
!
!data buffers
!
INTEGER, DIMENSION(NX,NY) :: data_in
!
!Initialize data_in buffer
!
DO i = 1, NX
DO j = 1, NY
data_in(i,j) = (i-1) + (j-1)
END DO
END DO
!
! Initialize attribute's data
!
attr_data(1) = 'Dataset character attribute'
attr_data(2) = 'Some other string here '
attrlen = LEN(attr_data(1))
!
! Create the file.
!
CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error)
IF (error .NE. 0) THEN
WRITE(*,*) "Cannot modify file name"
STOP
ENDIF
CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file_id, error)
CALL check("h5fcreate_f",error,total_error)
!
!Create data space for the dataset.
!
CALL h5screate_simple_f(RANK, dims, dataspace, error)
CALL check("h5screate_simple_f",error,total_error)
!
! create dataset in the file.
!
CALL h5dcreate_f(file_id, dsetname, H5T_NATIVE_INTEGER, dataspace, &
dset_id, error)
CALL check("h5dcreate_f",error,total_error)
!
! Write data_in to the dataset
!
data_dims(1) = NX
data_dims(2) = NY
CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, data_in, data_dims, error)
CALL check("h5dwrite_f",error,total_error)
!
! Create scalar data space for the String attribute.
!
CALL h5screate_simple_f(arank, adims, aspace_id, error)
CALL check("h5screate_simple_f",error,total_error)
!
! Create scalar data space for all other attributes.
!
CALL h5screate_simple_f(arank, adims2, aspace2_id, error)
CALL check("h5screate_simple_f",error,total_error)
!
! Create null data space for null attributes.
!
CALL h5screate_f(H5S_NULL_F, aspace6_id, error)
CALL check("h5screate_f",error,total_error)
!
! Create datatype for the String attribute.
!
CALL h5tcopy_f(H5T_NATIVE_CHARACTER, atype_id, error)
CALL check("h5tcopy_f",error,total_error)
CALL h5tset_size_f(atype_id, attrlen, error)
CALL check("h5tset_size_f",error,total_error)
!
! Create datatype for the Character attribute.
!
CALL h5tcopy_f(H5T_NATIVE_CHARACTER, atype2_id, error)
CALL check("h5tcopy_f",error,total_error)
!
! Create datatype for the Double attribute.
!
CALL h5tcopy_f(H5T_NATIVE_DOUBLE, atype3_id, error)
CALL check("h5tcopy_f",error,total_error)
!
! Create datatype for the Real attribute.
!
CALL h5tcopy_f(H5T_NATIVE_REAL, atype4_id, error)
CALL check("h5tcopy_f",error,total_error)
!
! Create datatype for the Integer attribute.
!
CALL h5tcopy_f(H5T_NATIVE_INTEGER, atype5_id, error)
CALL check("h5tcopy_f",error,total_error)
!
! Create dataset String attribute.
!
CALL h5acreate_f(dset_id, aname, atype_id, aspace_id, &
attr_id, error)
CALL check("h5acreate_f",error,total_error)
!
! Create dataset CHARACTER attribute.
!
CALL h5acreate_f(dset_id, aname2, atype2_id, aspace2_id, &
attr2_id, error)
CALL check("h5acreate_f",error,total_error)
!
! Create dataset DOUBLE attribute.
!
CALL h5acreate_f(dset_id, aname3, atype3_id, aspace2_id, &
attr3_id, error)
CALL check("h5acreate_f",error,total_error)
!
! Create dataset REAL attribute.
!
CALL h5acreate_f(dset_id, aname4, atype4_id, aspace2_id, &
attr4_id, error)
CALL check("h5acreate_f",error,total_error)
!
! Create dataset INTEGER attribute.
!
CALL h5acreate_f(dset_id, aname5, atype5_id, aspace2_id, &
attr5_id, error)
CALL check("h5acreate_f",error,total_error)
!
! Create dataset NULL attribute of INTEGER.
!
CALL h5acreate_f(dset_id, aname6, atype5_id, aspace6_id, &
attr6_id, error)
CALL check("h5acreate_f",error,total_error)
!
! Write the String attribute data.
!
data_dims(1) = 2
CALL h5awrite_f(attr_id, atype_id, attr_data, data_dims, error)
CALL check("h5awrite_f",error,total_error)
!
! Write the Character attribute data.
!
CALL h5awrite_f(attr2_id, atype2_id, attr_character_data, data_dims, error)
CALL check("h5awrite_f",error,total_error)
!
! Write the DOUBLE attribute data.
!
data_dims(1) = 1
CALL h5awrite_f(attr3_id, atype3_id, attr_double_data, data_dims, error)
CALL check("h5awrite_f",error,total_error)
!
! Write the Real attribute data.
!
data_dims(1) = 1
CALL h5awrite_f(attr4_id, atype4_id, attr_real_data, data_dims, error)
CALL check("h5awrite_f",error,total_error)
!
! Write the Integer attribute data.
!
data_dims(1) = 1
CALL h5awrite_f(attr5_id, atype5_id, attr_integer_data, data_dims, error)
CALL check("h5awrite_f",error,total_error)
!
! Write the NULL attribute data(nothing can be written).
!
CALL h5awrite_f(attr6_id, atype5_id, attr_integer_data, data_dims, error)
CALL check("h5awrite_f",error,total_error)
!
! check the amount of storage that is required for the specified attribute .MSB.
!
CALL h5aget_storage_size_f(attr_id, attr_storage, error)
CALL check("h5aget_storage_size_f",error,total_error)
! CALL verify("h5aget_storage_size_f",attr_storage,*SizeOf(attr_storage),total_error)
CALL h5aget_storage_size_f(attr2_id, attr_storage, error)
CALL check("h5aget_storage_size_f",error,total_error)
! CALL verify("h5aget_storage_size_f",attr_storage,1,total_error)
CALL h5aget_storage_size_f(attr3_id, attr_storage, error)
CALL check("h5aget_storage_size_f",error,total_error)
! CALL verify("h5aget_storage_size_f",attr_storage,8,total_error)
CALL h5aget_storage_size_f(attr4_id, attr_storage, error)
CALL check("h5aget_storage_size_f",error,total_error)
! CALL verify("h5aget_storage_size_f",attr_storage,4,total_error)
CALL h5aget_storage_size_f(attr5_id, attr_storage, error)
CALL check("h5aget_storage_size_f",error,total_error)
! CALL verify("h5aget_storage_size_f",attr_storage,4,total_error)
CALL h5aget_storage_size_f(attr6_id, attr_storage, error)
CALL check("h5aget_storage_size_f",error,total_error)
! CALL verify("h5aget_storage_size_f",attr_storage,0,total_error)
!
! Close the attribute.
!
CALL h5aclose_f(attr_id, error)
CALL check("h5aclose_f",error,total_error)
CALL h5aclose_f(attr2_id, error)
CALL check("h5aclose_f",error,total_error)
CALL h5aclose_f(attr3_id, error)
CALL check("h5aclose_f",error,total_error)
CALL h5aclose_f(attr4_id, error)
CALL check("h5aclose_f",error,total_error)
CALL h5aclose_f(attr5_id, error)
CALL check("h5aclose_f",error,total_error)
CALL h5aclose_f(attr6_id, error)
CALL check("h5aclose_f",error,total_error)
CALL h5tclose_f(atype_id, error)
CALL check("h5tclose_f",error,total_error)
CALL h5tclose_f(atype2_id, error)
CALL check("h5tclose_f",error,total_error)
CALL h5tclose_f(atype3_id, error)
CALL check("h5tclose_f",error,total_error)
CALL h5tclose_f(atype4_id, error)
CALL check("h5tclose_f",error,total_error)
CALL h5tclose_f(atype5_id, error)
CALL check("h5tclose_f",error,total_error)
!
! Terminate access to the data space.
!
CALL h5sclose_f(aspace_id, error)
CALL check("h5sclose_f",error,total_error)
CALL h5sclose_f(aspace2_id, error)
CALL check("h5sclose_f",error,total_error)
CALL h5sclose_f(aspace6_id, error)
CALL check("h5sclose_f",error,total_error)
!
! Terminate access to the dataset.
!
CALL h5dclose_f(dset_id, error)
CALL check("h5dclose_f",error,total_error)
!
! Terminate access to the file.
!
CALL h5fclose_f(file_id, error)
CALL check("h5fclose_f",error,total_error)
!
! Open file
!
CALL h5fopen_f(fix_filename, H5F_ACC_RDWR_F, file_id, error)
CALL check("h5open_f",error,total_error)
!
! Reopen dataset
!
CALL h5dopen_f(file_id, dsetname, dset_id, error)
CALL check("h5dopen_f",error,total_error)
!
!open the String attrbute by name
!
CALL h5aopen_name_f(dset_id, aname, attr_id, error)
CALL check("h5aopen_name_f",error,total_error)
!
!open the CHARACTER attrbute by name
!
CALL h5aopen_name_f(dset_id, aname2, attr2_id, error)
CALL check("h5aopen_name_f",error,total_error)
!
!open the DOUBLE attrbute by name
!
CALL h5aopen_name_f(dset_id, aname3, attr3_id, error)
CALL check("h5aopen_name_f",error,total_error)
!
!open the REAL attrbute by name
!
CALL h5aopen_name_f(dset_id, aname4, attr4_id, error)
CALL check("h5aopen_name_f",error,total_error)
!
!open the INTEGER attrbute by name
!
CALL h5aopen_name_f(dset_id, aname5, attr5_id, error)
CALL check("h5aopen_idx_f",error,total_error)
!
!open the NULL attrbute by name
!
CALL h5aopen_name_f(dset_id, aname6, attr6_id, error)
CALL check("h5aopen_idx_f",error,total_error)
!
!get the attrbute name
!
CALL h5aget_name_f(attr5_id, name_size, attr_name, error)
CALL check("h5aget_name_f",error,total_error)
IF (attr_name(1:12) .NE. aname5) THEN
total_error = total_error + 1
END IF
IF (error .NE. 12) THEN
total_error = total_error + 1
END IF
!
!get the STRING attrbute space
!
CALL h5aget_space_f(attr_id, attr_space, error)
CALL check("h5aget_space_f",error,total_error)
!
!get other attrbute space
!
CALL h5aget_space_f(attr2_id, attr2_space, error)
CALL check("h5aget_space_f",error,total_error)
!
!get the string attrbute datatype
!
CALL h5aget_type_f(attr_id, attr_type, error)
CALL check("h5aget_type_f",error,total_error)
!
!get the character attrbute datatype
!
CALL h5aget_type_f(attr2_id, attr2_type, error)
CALL check("h5aget_type_f",error,total_error)
!
!get the double attrbute datatype
!
CALL h5aget_type_f(attr3_id, attr3_type, error)
CALL check("h5aget_type_f",error,total_error)
!
!get the real attrbute datatype
!
CALL h5aget_type_f(attr4_id, attr4_type, error)
CALL check("h5aget_type_f",error,total_error)
!
!get the integer attrbute datatype
!
CALL h5aget_type_f(attr5_id, attr5_type, error)
CALL check("h5aget_type_f",error,total_error)
!
!get the null attrbute datatype
!
CALL h5aget_type_f(attr6_id, attr6_type, error)
CALL check("h5aget_type_f",error,total_error)
!
!get number of attributes
!
CALL h5aget_num_attrs_f(dset_id, num_attrs, error)
CALL check("h5aget_num_attrs_f",error,total_error)
IF (num_attrs .NE. 6) THEN
WRITE(*,*) "got number of attributes wrong", num_attrs
total_error = total_error +1
END IF
!
!set the read back data type's size
!
CALL h5tcopy_f(H5T_NATIVE_CHARACTER, atype_id, error)
CALL check("h5tcopy_f",error,total_error)
CALL h5tset_size_f(atype_id, attrlen, error)
CALL check("h5tset_size_f",error,total_error)
!
!read the string attribute data back to memory
!
data_dims(1) = 2
CALL h5aread_f(attr_id, atype_id, aread_data, data_dims, error)
CALL check("h5aread_f",error,total_error)
IF ( (aread_data(1) .NE. attr_data(1)) .OR. (aread_data(2) .NE. attr_data(2)) ) THEN
WRITE(*,*) "Read back string attrbute is wrong", aread_data(1), aread_data(2)
total_error = total_error + 1
END IF
!
!read the CHARACTER attribute data back to memory
!
CALL h5aread_f(attr2_id, H5T_NATIVE_CHARACTER, aread_character_data, data_dims, error)
CALL check("h5aread_f",error,total_error)
IF (aread_character_data .NE. 'A' ) THEN
WRITE(*,*) "Read back character attrbute is wrong ",aread_character_data
total_error = total_error + 1
END IF
!
!read the double attribute data back to memory
!
data_dims(1) = 1
CALL h5aread_f(attr3_id, H5T_NATIVE_DOUBLE, aread_double_data, data_dims, error)
CALL check("h5aread_f",error,total_error)
CALL VERIFY("Read back double attrbute is wrong", aread_double_data(1),3.459_Fortran_DOUBLE,total_error)
!
!read the real attribute data back to memory
!
data_dims(1) = 1
CALL h5aread_f(attr4_id, H5T_NATIVE_REAL, aread_real_data, data_dims, error)
CALL check("h5aread_f",error,total_error)
CALL VERIFY("Read back real attrbute is wrong", aread_real_data(1),4.0,total_error)
!
!read the Integer attribute data back to memory
!
data_dims(1) = 1
CALL h5aread_f(attr5_id, H5T_NATIVE_INTEGER, aread_integer_data, data_dims, error)
CALL check("h5aread_f",error,total_error)
IF (aread_integer_data(1) .NE. 5 ) THEN
WRITE(*,*) "Read back integer attrbute is wrong ", aread_integer_data
total_error = total_error + 1
END IF
!
!read the null attribute data. nothing can be read.
!
data_dims(1) = 1
CALL h5aread_f(attr6_id, H5T_NATIVE_INTEGER, aread_null_data, data_dims, error)
CALL check("h5aread_f",error,total_error)
IF (aread_null_data(1) .NE. 7 ) THEN
WRITE(*,*) "Read back null attrbute is wrong ", aread_null_data
total_error = total_error + 1
END IF
!
! Close the attribute.
!
CALL h5aclose_f(attr_id, error)
CALL check("h5aclose_f",error,total_error)
CALL h5aclose_f(attr2_id, error)
CALL check("h5aclose_f",error,total_error)
CALL h5aclose_f(attr3_id, error)
CALL check("h5aclose_f",error,total_error)
CALL h5aclose_f(attr4_id, error)
CALL check("h5aclose_f",error,total_error)
CALL h5aclose_f(attr5_id, error)
CALL check("h5aclose_f",error,total_error)
CALL h5aclose_f(attr6_id, error)
CALL check("h5aclose_f",error,total_error)
!
! Delete the attribute from the Dataset.
!
CALL h5adelete_f(dset_id, aname, error)
CALL check("h5adelete_f",error,total_error)
!
!get number of attributes
!
CALL h5aget_num_attrs_f(dset_id, num_attrs, error)
CALL check("h5aget_num_attrs_f",error,total_error)
IF (num_attrs .NE. 5) THEN
WRITE(*,*) "got number of attributes wrong", num_attrs
total_error = total_error +1
END IF
CALL h5sclose_f(attr_space, error)
CALL check("h5sclose_f",error,total_error)
CALL h5sclose_f(attr2_space, error)
CALL check("h5sclose_f",error,total_error)
!
! Terminate access to the data type.
!
CALL h5tclose_f(attr_type, error)
CALL check("h5tclose_f",error,total_error)
CALL h5tclose_f(attr2_type, error)
CALL check("h5tclose_f",error,total_error)
CALL h5tclose_f(attr3_type, error)
CALL check("h5tclose_f",error,total_error)
CALL h5tclose_f(attr4_type, error)
CALL check("h5tclose_f",error,total_error)
CALL h5tclose_f(attr5_type, error)
CALL check("h5tclose_f",error,total_error)
CALL h5tclose_f(attr6_type, error)
CALL check("h5tclose_f",error,total_error)
!
! End access to the dataset and release resources used by it.
!
CALL h5dclose_f(dset_id, error)
CALL check("h5dclose_f",error,total_error)
!
! Close the file.
!
CALL h5fclose_f(file_id, error)
CALL check("h5fclose_f",error,total_error)
!
! Remove the file
!
IF (cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error)
RETURN
END SUBROUTINE attribute_test
END MODULE TH5A
|