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
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
|
!****h* root/fortran/test/TH5P_F03
!
! NAME
! tH5P_F03.F90
!
! FUNCTION
! Test FORTRAN HDF5 H5P APIs which are dependent on FORTRAN 2003
! features.
!
! 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 files COPYING and Copyright.html. COPYING can be found at the root *
! of the source code distribution tree; Copyright.html can be found at the *
! root level of an installed copy of the electronic HDF5 document set and *
! is linked from the top-level documents page. It can also be found at *
! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
! access to either file, you may request a copy from help@hdfgroup.org. *
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
!
! USES
! test_genprop_cls_cb1_mod
!
! CONTAINS SUBROUTINES
! test_create, test_genprop_class_callback
!
!*****
! *****************************************
! *** H 5 P T E S T S
! *****************************************
MODULE test_genprop_cls_cb1_mod
! Callback subroutine for test_genprop_class_callback
! and the function H5Pcreate_class_f.
USE HDF5
USE ISO_C_BINDING
IMPLICIT NONE
TYPE, BIND(C) :: cop_cb_struct_ ! Struct for iterations
INTEGER :: count
INTEGER(HID_T) :: id
END TYPE cop_cb_struct_
CONTAINS
INTEGER FUNCTION test_genprop_cls_cb1_f(list_id, create_data ) bind(C)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN), VALUE :: list_id
TYPE(cop_cb_struct_) :: create_data
create_data%count = create_data%count + 1
create_data%id = list_id
test_genprop_cls_cb1_f = 0
END FUNCTION test_genprop_cls_cb1_f
END MODULE test_genprop_cls_cb1_mod
MODULE TH5P_F03
USE HDF5
USE TH5_MISC
USE TH5_MISC_GEN
USE ISO_C_BINDING
CONTAINS
!-------------------------------------------------------------------------
! * Function: test_create
! *
! * Purpose: Tests H5Pset_fill_value_f and H5Pget_fill_value_f
! *
! * Return: Success: 0
! *
! * Failure: number of errors
! *
! * Programmer: M. Scot Breitenfeld
! * June 24, 2008
! *
! * Modifications:
! *
! *-------------------------------------------------------------------------
!
SUBROUTINE test_create(total_error)
IMPLICIT NONE
INTEGER, INTENT(INOUT) :: total_error
INTEGER(HID_T) :: fapl
INTEGER(hid_t) :: file=-1, space=-1, dcpl=-1, comp_type_id=-1
INTEGER(hid_t) :: dset9=-1
INTEGER(hsize_t), DIMENSION(1:5), PARAMETER :: cur_size = (/2, 8, 8, 4, 2/)
INTEGER(hsize_t), DIMENSION(1:5), PARAMETER :: ch_size= (/1, 1, 1, 4, 1/)
CHARACTER(LEN=14) :: filename ='test_create.h5'
TYPE(comp_datatype), TARGET :: rd_c, fill_ctype
INTEGER :: error
INTEGER(SIZE_T) :: h5off
TYPE(C_PTR) :: f_ptr
CHARACTER(LEN=1) :: cfill
INTEGER :: ifill
REAL :: rfill
REAL(KIND=dp) :: dpfill
!
! * Create a file.
!
CALL h5fcreate_f(filename,H5F_ACC_TRUNC_F,file,error)
CALL check("h5fcreate_f", error, total_error)
CALL h5screate_simple_f(5, cur_size, space, error, cur_size)
CALL check("h5screate_simple_f", error, total_error)
CALL H5Pcreate_f(H5P_DATASET_CREATE_F, dcpl, error)
CALL check("H5Pcreate_f", error, total_error)
CALL h5pset_chunk_f(dcpl, 5, ch_size, error)
CALL check("h5pset_chunk_f",error, total_error)
! Create a compound datatype
CALL h5tcreate_f(H5T_COMPOUND_F, H5_SIZEOF(fill_ctype), comp_type_id, error)
CALL check("h5tcreate_f", error, total_error)
h5off = H5OFFSETOF(C_LOC(fill_ctype), C_LOC(fill_ctype%a))
CALL h5tinsert_f(comp_type_id, "a", h5off , H5T_NATIVE_REAL, error)
CALL check("h5tinsert_f", error, total_error)
CALL h5tinsert_f(comp_type_id, "x", H5OFFSETOF(C_LOC(fill_ctype), C_LOC(fill_ctype%x)), H5T_NATIVE_INTEGER, error)
CALL check("h5tinsert_f", error, total_error)
CALL h5tinsert_f(comp_type_id, "y", H5OFFSETOF(C_LOC(fill_ctype), C_LOC(fill_ctype%y)), H5T_NATIVE_DOUBLE, error)
CALL check("h5tinsert_f", error, total_error)
CALL h5tinsert_f(comp_type_id, "z", &
H5OFFSETOF(C_LOC(fill_ctype), C_LOC(fill_ctype%z)), H5T_NATIVE_CHARACTER, error)
CALL check("h5tinsert_f", error, total_error)
CALL H5Pset_alloc_time_f(dcpl, H5D_ALLOC_TIME_LATE_F,error)
CALL check("H5Pset_alloc_time_f",error, total_error)
CALL H5Pset_fill_time_f(dcpl, H5D_FILL_TIME_ALLOC_F, error)
CALL check("H5Pset_fill_time_f",error, total_error)
! Compound datatype test
f_ptr = C_LOC(fill_ctype)
CALL H5Pget_fill_value_f(dcpl, comp_type_id, f_ptr, error)
CALL check("H5Pget_fill_value_f",error, total_error)
fill_ctype%y = 4444.D0
fill_ctype%z = 'S'
fill_ctype%a = 5555.
fill_ctype%x = 55
f_ptr = C_LOC(fill_ctype)
! Test various fill values
CALL H5Pset_fill_value_f(dcpl, H5T_NATIVE_CHARACTER, 'X', error)
CALL check("H5Pset_fill_value_f",error, total_error)
CALL h5pget_fill_value_f(dcpl, H5T_NATIVE_CHARACTER, cfill, error)
CALL check("H5Pget_fill_value_f",error, total_error)
IF(cfill.NE.'X')THEN
PRINT*,"***ERROR: Returned wrong fill value (character)"
total_error = total_error + 1
ENDIF
CALL H5Pset_fill_value_f(dcpl, H5T_NATIVE_INTEGER, 9, error)
CALL check("H5Pset_fill_value_f",error, total_error)
CALL h5pget_fill_value_f(dcpl, H5T_NATIVE_INTEGER, ifill, error)
CALL check("H5Pget_fill_value_f",error, total_error)
IF(ifill.NE.9)THEN
PRINT*,"***ERROR: Returned wrong fill value (integer)"
total_error = total_error + 1
ENDIF
CALL H5Pset_fill_value_f(dcpl, H5T_NATIVE_DOUBLE, 1.0_dp, error)
CALL check("H5Pset_fill_value_f",error, total_error)
CALL h5pget_fill_value_f(dcpl, H5T_NATIVE_DOUBLE, dpfill, error)
CALL check("H5Pget_fill_value_f",error, total_error)
CALL VERIFY("***ERROR: Returned wrong fill value (double)", dpfill, 1.0_dp, total_error)
CALL H5Pset_fill_value_f(dcpl, H5T_NATIVE_REAL, 2.0, error)
CALL check("H5Pset_fill_value_f",error, total_error)
CALL h5pget_fill_value_f(dcpl, H5T_NATIVE_REAL, rfill, error)
CALL check("H5Pget_fill_value_f",error, total_error)
CALL VERIFY("***ERROR: Returned wrong fill value (real)", rfill, 2.0, total_error)
! For the actual compound type
CALL H5Pset_fill_value_f(dcpl, comp_type_id, f_ptr, error)
CALL check("H5Pget_fill_value_f",error, total_error)
CALL h5dcreate_f(file,"dset9", comp_type_id, space, dset9, error, dcpl_id=dcpl)
CALL check("h5dcreate_f", error, total_error)
CALL h5dclose_f(dset9, error)
CALL check("h5dclose_f", error, total_error)
CALL h5fclose_f(file,error)
CALL check("h5fclose_f", error, total_error)
! Open the file and get the dataset fill value from each dataset
CALL H5Pcreate_f(H5P_FILE_ACCESS_F, fapl, error)
CALL check("H5Pcreate_f",error, total_error)
CALL H5Pset_libver_bounds_f(fapl, H5F_LIBVER_LATEST_F, H5F_LIBVER_LATEST_F, error)
CALL check("H5Pset_libver_bounds_f",error, total_error)
CALL h5fopen_f (FILENAME, H5F_ACC_RDONLY_F, file, error, fapl)
CALL check("h5fopen_f", error, total_error)
! Compound datatype test
CALL h5dopen_f(file, "dset9", dset9, error)
CALL check("h5dopen_f", error, total_error)
CALL H5Pclose_f(dcpl, error)
CALL check("H5Pclose_f", error, total_error)
CALL H5Dget_create_plist_f(dset9, dcpl, error)
CALL check("H5Dget_create_plist_f", error, total_error)
f_ptr = C_LOC(rd_c)
CALL H5Pget_fill_value_f(dcpl, comp_type_id, f_ptr, error)
CALL check("H5Pget_fill_value_f", error, total_error)
CALL verify("***ERROR: Returned wrong fill value", rd_c%a, fill_ctype%a, total_error)
CALL verify("***ERROR: Returned wrong fill value", rd_c%y, fill_ctype%y, total_error)
IF( rd_c%x .NE. fill_ctype%x .OR. &
rd_c%z .NE. fill_ctype%z )THEN
PRINT*,"***ERROR: Returned wrong fill value"
total_error = total_error + 1
ENDIF
CALL h5dclose_f(dset9, error)
CALL check("h5dclose_f", error, total_error)
CALL H5Pclose_f(dcpl, error)
CALL check("H5Pclose_f", error, total_error)
CALL h5fclose_f(file,error)
CALL check("h5fclose_f", error, total_error)
END SUBROUTINE test_create
SUBROUTINE test_genprop_class_callback(total_error)
!
!
! test_genprop_class_callback(): Test basic generic property list code.
! Tests callbacks for property lists in a generic class.
!
! FORTRAN TESTS:
! Tests function H5Pcreate_class_f with callback.
!
!
USE test_genprop_cls_cb1_mod
IMPLICIT NONE
INTEGER, INTENT(INOUT) :: total_error
INTEGER(hid_t) :: cid1, cid2 ! Generic Property class ID
INTEGER(hid_t) :: lid1, lid2 ! Generic Property list ID
INTEGER(size_t) :: nprops ! Number of properties in class
TYPE(cop_cb_struct_), TARGET :: crt_cb_struct, cls_cb_struct
INTEGER :: CLASS1_NAME_SIZE = 7 ! length of class string
CHARACTER(LEN=7) :: CLASS1_NAME = "Class 1", CLASS1_NAME_BUF
TYPE(C_FUNPTR) :: f1, f5
TYPE(C_PTR) :: f2, f6
CHARACTER(LEN=10) :: PROP1_NAME = "Property 1"
INTEGER(SIZE_T) :: PROP1_SIZE = 10
CHARACTER(LEN=10) :: PROP2_NAME = "Property 2"
INTEGER(SIZE_T) :: PROP2_SIZE = 10
CHARACTER(LEN=10) :: PROP3_NAME = "Property 3"
INTEGER(SIZE_T) :: PROP3_SIZE = 10
CHARACTER(LEN=10) :: PROP4_NAME = "Property 4"
INTEGER(SIZE_T) :: PROP4_SIZE = 10
INTEGER :: PROP1_DEF_VALUE = 10
INTEGER :: PROP2_DEF_VALUE = 10
INTEGER :: PROP3_DEF_VALUE = 10
INTEGER :: PROP4_DEF_VALUE = 10
INTEGER :: error ! Generic RETURN value
LOGICAL :: flag ! for tests
f1 = C_FUNLOC(test_genprop_cls_cb1_f)
f5 = C_FUNLOC(test_genprop_cls_cb1_f)
f2 = C_LOC(crt_cb_struct)
f6 = C_LOC(cls_cb_struct)
! Create a new generic class, derived from the root of the class hierarchy
CALL h5pcreate_class_f(h5p_ROOT_F, CLASS1_NAME, cid1, error, f1, f2, c_null_funptr, c_null_ptr, f5, f6)
CALL check("h5pcreate_class_f", error, total_error)
! Insert first property into class (with no callbacks)
CALL h5pregister_f(cid1, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, error)
CALL check("h5pregister_f", error, total_error)
! Insert second property into class (with no callbacks)
CALL h5pregister_f(cid1, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, error)
CALL check("h5pregister_f", error, total_error)
! Insert third property into class (with no callbacks)
CALL h5pregister_f(cid1, PROP3_NAME, PROP3_SIZE, PROP3_DEF_VALUE, error)
CALL check("h5pregister_f", error, total_error)
! Insert fourth property into class (with no callbacks)
CALL h5pregister_f(cid1, PROP4_NAME, PROP4_SIZE, PROP4_DEF_VALUE, error)
CALL check("h5pregister_f", error, total_error)
! Check the number of properties in class
CALL h5pget_nprops_f(cid1, nprops, error)
CALL check("h5pget_nprops_f", error, total_error)
CALL verify("h5pget_nprops_f", INT(nprops), 4, total_error)
! Initialize class callback structs
crt_cb_struct%count = 0
crt_cb_struct%id = -1
cls_cb_struct%count = 0
cls_cb_struct%id = -1
! Create a property list from the class
CALL h5pcreate_f(cid1, lid1, error)
CALL check("h5pcreate_f", error, total_error)
! Get the list's class
CALL H5Pget_class_f(lid1, cid2, error)
CALL check("H5Pget_class_f", error, total_error)
! Check that the list's class is correct
CALL H5Pequal_f(cid2, cid1, flag, error)
CALL check("H5Pequal_f", error, total_error)
CALL verify("H5Pequal_f", flag, .TRUE., total_error)
! Check the class name
CALL H5Pget_class_name_f(cid2, CLASS1_NAME_BUF, CLASS1_NAME_SIZE, error)
CALL check("H5Pget_class_name_f", error, total_error)
CALL verify("H5Pget_class_name_f", CLASS1_NAME_BUF, CLASS1_NAME, error)
IF(error.NE.0)THEN
WRITE(*,*) 'Class names do not match! name=',CLASS1_NAME_BUF, 'CLASS1_NAME=',CLASS1_NAME
total_error = total_error + 1
ENDIF
! Close class
CALL h5pclose_class_f(cid2, error)
CALL check("h5pclose_class_f", error, total_error)
! Verify that the creation callback occurred
CALL verify("h5pcreate_f", crt_cb_struct%count, 1, total_error)
CALL verify("h5pcreate_f", crt_cb_struct%id, lid1, total_error)
! Check the number of properties in list
CALL h5pget_nprops_f(lid1,nprops, error)
CALL check("h5pget_nprops_f", error, total_error)
CALL verify("h5pget_nprops_f", INT(nprops), 4, total_error)
! Create another property list from the class
CALL h5pcreate_f(cid1, lid2, error)
CALL check("h5pcreate_f", error, total_error)
! Verify that the creation callback occurred
CALL verify("h5pcreate_f", crt_cb_struct%count, 2, total_error)
CALL verify("h5pcreate_f", crt_cb_struct%id, lid2, total_error)
! Check the number of properties in list
CALL h5pget_nprops_f(lid2,nprops, error)
CALL check("h5pget_nprops_f", error, total_error)
CALL verify("h5pget_nprops_f", INT(nprops), 4, total_error)
! Close first list
CALL h5pclose_f(lid1, error);
CALL check("h5pclose_f", error, total_error)
! Verify that the close callback occurred
CALL verify("h5pcreate_f", cls_cb_struct%count, 1, total_error)
CALL verify("h5pcreate_f", cls_cb_struct%id, lid1, total_error)
! Close second list
CALL h5pclose_f(lid2, error);
CALL check("h5pclose_f", error, total_error)
! Verify that the close callback occurred
CALL verify("h5pcreate_f", cls_cb_struct%count, 2, total_error)
CALL verify("h5pcreate_f", cls_cb_struct%id, lid2, total_error)
! Close class
CALL h5pclose_class_f(cid1, error)
CALL check("h5pclose_class_f", error, total_error)
END SUBROUTINE test_genprop_class_callback
!-------------------------------------------------------------------------
! Function: test_h5p_file_image
!
! Purpose: Tests APIs:
! h5pget_file_image_f and h5pset_file_image_f
!
! Return: Success: 0
! Failure: -1
!
! FORTRAN Programmer: M. Scot Breitenfeld
! April 1, 2014
!-------------------------------------------------------------------------
SUBROUTINE test_h5p_file_image(total_error)
USE, INTRINSIC :: iso_c_binding
IMPLICIT NONE
INTEGER, INTENT(INOUT) :: total_error
INTEGER(hid_t) :: fapl_1 = -1
INTEGER, PARAMETER :: count = 10
INTEGER, DIMENSION(1:count), TARGET :: buffer
INTEGER, DIMENSION(1:count), TARGET :: temp
INTEGER :: i
INTEGER(size_t) :: size
INTEGER(size_t) :: temp_size
INTEGER :: error ! error return value
TYPE(C_PTR) :: f_ptr
TYPE(C_PTR), DIMENSION(1:count) :: f_ptr1
TYPE(C_PTR), DIMENSION(1:1) :: f_ptr2
INTEGER(HSIZE_T) :: sizeof_buffer
! Initialize file image buffer
DO i = 1, count
buffer(i) = i*10
ENDDO
! Create fapl
CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl_1, error)
CALL check("h5pcreate_f", error, total_error)
! Test with NULL ptr
f_ptr2(1) = C_NULL_PTR
temp_size = 1
CALL h5pget_file_image_f(fapl_1, f_ptr2, temp_size, error)
CALL check("h5pget_file_image_f", error, total_error)
CALL verify("h5pget_file_image_f", INT(temp_size), 0, total_error)
! Set file image
f_ptr = C_LOC(buffer(1))
size = H5_SIZEOF(buffer(1))*count
CALL h5pset_file_image_f(fapl_1, f_ptr, size, error)
CALL check("h5pset_file_image_f", error, total_error)
! Get the same data back
DO i = 1, count
f_ptr1(i) = C_LOC(temp(i))
ENDDO
temp_size = 0
CALL h5pget_file_image_f(fapl_1, f_ptr1, temp_size, error)
CALL check("h5pget_file_image_f", error, total_error)
! Check that sizes are the same, and that the buffers are identical but separate
CALL verify("h5pget_file_image_f", INT(temp_size), INT(size), total_error)
! Verify the image data is correct
DO i = 1, count
CALL verify("h5pget_file_image_f", temp(i), buffer(i), total_error)
ENDDO
END SUBROUTINE test_h5p_file_image
!-------------------------------------------------------------------------
! Function: external_test_offset
!
! Purpose: Tests APIs:
! h5pset_external_f (with offsets not equal to zero), h5pget_external_f
!
! Return: Success: 0
! Failure: -1
!
! FORTRAN Programmer: M. Scot Breitenfeld
! January 10, 2012
!-------------------------------------------------------------------------
!
SUBROUTINE external_test_offset(cleanup,total_error)
IMPLICIT NONE
INTEGER, INTENT(INOUT) :: total_error
LOGICAL, INTENT(IN) :: cleanup
INTEGER(hid_t) :: fapl=-1 ! file access property list
INTEGER(hid_t) :: file=-1 ! file to write to
INTEGER(hid_t) :: dcpl=-1 ! dataset creation properties
INTEGER(hid_t) :: space=-1 ! data space
INTEGER(hid_t) :: dset=-1 ! dataset
INTEGER(hid_t) :: grp=-1 ! group to emit diagnostics
INTEGER(size_t) :: i, j ! miscellaneous counters
CHARACTER(LEN=180) :: filename ! file names
INTEGER, DIMENSION(1:25) :: part
INTEGER, DIMENSION(1:100), TARGET :: whole ! raw data buffers
INTEGER(hsize_t), DIMENSION(1:1) :: cur_size ! current data space size
INTEGER(hid_t) :: hs_space ! hyperslab data space
INTEGER(hsize_t), DIMENSION(1:1) :: hs_start = (/30/) ! hyperslab starting offset
INTEGER(hsize_t), DIMENSION(1:1) :: hs_count = (/25/) ! hyperslab size
CHARACTER(LEN=1) :: ichr1 ! character conversion holder
INTEGER :: error ! error status
TYPE(C_PTR) :: f_ptr ! fortran pointer
INTEGER(HSIZE_T) :: sizeof_part
CHARACTER(LEN=1,KIND=C_CHAR), DIMENSION(1:30) :: temparray
temparray(1:30)(1:1) = '0' ! 1 byte character
! Write the data to external files directly
DO i = 1, 4
DO j = 1, 25
part(j) = (i-1)*25+(j-1)
ENDDO
WRITE(ichr1,'(I1.1)') i
filename = "extern_"//ichr1//"a.raw"
OPEN(10, FILE=filename, ACCESS='STREAM', form='UNFORMATTED')
WRITE(10) temparray(1:(i-1)*10)
WRITE(10) part
CLOSE(10)
ENDDO
!
! Create the file and an initial group.
CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl, error)
CALL h5fcreate_f('extren_raw.h5', H5F_ACC_TRUNC_F, file, error, access_prp=fapl)
CALL check("h5fcreate_f",error,total_error)
CALL h5gcreate_f(file, "emit-diagnostics", grp, error)
CALL check("h5gcreate_f",error, total_error)
! Create the dataset
sizeof_part = INT(H5_SIZEOF(part(1))*25, hsize_t)
CALL h5pcreate_f(H5P_DATASET_CREATE_F, dcpl, error)
CALL check("h5pcreate_f", error, total_error)
CALL h5pset_external_f(dcpl, "extern_1a.raw", INT(0,off_t), sizeof_part, error)
CALL check("h5pset_external_f",error,total_error)
CALL h5pset_external_f(dcpl, "extern_2a.raw", INT(10,off_t), sizeof_part, error)
CALL check("h5pset_external_f",error,total_error)
CALL h5pset_external_f(dcpl, "extern_3a.raw", INT(20,off_t), sizeof_part, error)
CALL check("h5pset_external_f",error,total_error)
CALL h5pset_external_f(dcpl, "extern_4a.raw", INT(30,off_t), sizeof_part, error)
CALL check("h5pset_external_f",error,total_error)
cur_size(1) = 100
CALL h5screate_simple_f(1, cur_size, space, error)
CALL check("h5screate_simple_f", error, total_error)
CALL h5dcreate_f(file, "dset1", H5T_NATIVE_INTEGER, space, dset,error,dcpl_id=dcpl)
CALL check("h5dcreate_f", error, total_error)
!
! Read the entire dataset and compare with the original
whole(:) = 0
f_ptr = C_LOC(whole(1))
CALL h5dread_f(dset, H5T_NATIVE_INTEGER, f_ptr, error, mem_space_id=space, file_space_id=space)
CALL check("h5dread_f", error, total_error)
DO i = 1, 100
IF(whole(i) .NE. i-1)THEN
WRITE(*,*) "Incorrect value(s) read."
total_error = total_error + 1
EXIT
ENDIF
ENDDO
!
! Read the middle of the dataset
CALL h5scopy_f(space, hs_space, error)
CALL check("h5scopy_f", error, total_error)
CALL h5sselect_hyperslab_f(hs_space, H5S_SELECT_SET_F, hs_start, hs_count, error)
CALL check("h5sselect_hyperslab_f", error, total_error)
whole(:) = 0
f_ptr = C_LOC(whole(1))
CALL h5dread_f(dset, H5T_NATIVE_INTEGER, f_ptr, error, mem_space_id=hs_space, file_space_id=hs_space)
CALL check("h5dread_f", error, total_error)
CALL h5sclose_f(hs_space, error)
CALL check("h5sclose_f", error, total_error)
DO i = INT(hs_start(1))+1, INT(hs_start(1)+hs_count(1))
IF(whole(i) .NE. i-1)THEN
WRITE(*,*) "Incorrect value(s) read."
total_error = total_error + 1
EXIT
ENDIF
ENDDO
CALL h5dclose_f(dset, error)
CALL check("h5dclose_f", error, total_error)
CALL h5pclose_f(dcpl, error)
CALL check("h5pclose_f", error, total_error)
CALL h5sclose_f(space, error)
CALL check("h5sclose_f", error, total_error)
CALL h5fclose_f(file, error)
CALL check("h5fclose_f", error, total_error)
! cleanup
DO i = 1, 4
WRITE(ichr1,'(I1.1)') i
filename = "extern_"//ichr1//"a.raw"
CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error)
CALL check("h5_cleanup_f", error, total_error)
ENDDO
IF(cleanup) CALL h5_cleanup_f("extren_raw.h5", H5P_DEFAULT_F, error)
CALL check("h5_cleanup_f", error, total_error)
END SUBROUTINE external_test_offset
!-------------------------------------------------------------------------
! NAME
! test_vds
!
! FUNCTION
! Tests VDS API wrappers
!
! RETURNS:
! Success: 0
! Failure: number of errors
!
! FORTRAN Programmer: M. Scot Breitenfeld
! February 1, 2016
!
!-------------------------------------------------------------------------
!
SUBROUTINE test_vds(total_error)
USE ISO_C_BINDING
IMPLICIT NONE
INTEGER, INTENT(INOUT) :: total_error
INTEGER, PARAMETER :: int_kind_8 = SELECTED_INT_KIND(9) !should map to INTEGER*4 on most modern processors
INTEGER, PARAMETER :: int_kind_16 = SELECTED_INT_KIND(18) !should map to INTEGER*8 on most modern processors
CHARACTER(LEN=6), PARAMETER :: VFILENAME="vds.h5"
CHARACTER(LEN=3), PARAMETER :: DATASET="VDS"
INTEGER :: VDSDIM0
INTEGER, PARAMETER :: VDSDIM1 = 10
INTEGER, PARAMETER :: VDSDIM2 = 15
INTEGER :: DIM0
INTEGER, PARAMETER :: DIM0_1= 4 ! Initial size of the source datasets
INTEGER, PARAMETER :: DIM1 = 10
INTEGER, PARAMETER :: DIM2 = 15
INTEGER, PARAMETER :: RANK = 3
INTEGER(hsize_t), PARAMETER :: PLANE_STRIDE = 4
CHARACTER(LEN=4), DIMENSION(1:PLANE_STRIDE) :: SRC_FILE = (/"a.h5","b.h5","c.h5","d.h5"/)
CHARACTER(LEN=3), DIMENSION(1:PLANE_STRIDE) :: SRC_DATASET = (/"AAA","BBB","CCC","DDD"/)
INTEGER(hid_t) :: vfile, file, src_space, mem_space, vspace, vdset, dset !Handles
INTEGER(hid_t) :: dcpl, dapl
INTEGER :: error
INTEGER(hsize_t), DIMENSION(1:3) :: vdsdims = (/4*DIM0_1, VDSDIM1, VDSDIM2/), &
vdsdims_max, &
dims = (/DIM0_1, DIM1, DIM2/), &
memdims = (/DIM0_1, DIM1, DIM2/), &
extdims = (/0, DIM1, DIM2/), & ! Dimensions of the extended source datasets
chunk_dims = (/DIM0_1, DIM1, DIM2/), &
dims_max, &
vdsdims_out, vdsdims_max_out, &
start, & ! Hyperslab parameters
stride, &
count, &
src_count, block
INTEGER(hsize_t), DIMENSION(1:2,1:3) :: vdsdims_out_correct
INTEGER(hsize_t), DIMENSION(1:3) :: start_out, & !Hyperslab PARAMETER out
stride_out, count_out, block_out
INTEGER(hsize_t), DIMENSION(1:3,1:PLANE_STRIDE) :: start_correct
INTEGER :: i, j
INTEGER :: layout ! Storage layout
INTEGER(size_t) :: num_map ! Number of mappings
INTEGER(size_t) :: len ! Length of the string also a RETURN value
! Different sized character buffers
CHARACTER(len=LEN(SRC_FILE(1))-3) :: SRC_FILE_LEN_TINY
CHARACTER(len=LEN(SRC_FILE(1))-1) :: SRC_FILE_LEN_SMALL
CHARACTER(len=LEN(SRC_FILE(1))) :: SRC_FILE_LEN_EXACT
CHARACTER(len=LEN(SRC_FILE(1))+1) :: SRC_FILE_LEN_LARGE
CHARACTER(len=LEN(SRC_FILE(1))+10) :: SRC_FILE_LEN_HUGE
CHARACTER(len=LEN(SRC_DATASET(1))) :: SRC_DATASET_LEN_EXACT
INTEGER(HID_T) :: space_out
INTEGER :: s_type, virtual_view
INTEGER :: type1, type2
INTEGER, DIMENSION(DIM0_1*DIM1*DIM2), TARGET :: wdata
TYPE(C_PTR) :: f_ptr
INTEGER(SIZE_T) :: nsize
LOGICAL :: IsRegular
INTEGER(HSIZE_T) :: gap_size
! For testing against
vdsdims_out_correct(1,1) = DIM0_1*5
vdsdims_out_correct(2,1) = DIM0_1*8
vdsdims_out_correct(1:2,2) = VDSDIM1
vdsdims_out_correct(1:2,3) = VDSDIM2
VDSDIM0 = H5S_UNLIMITED_F
DIM0 = H5S_UNLIMITED_F
vdsdims_max = (/VDSDIM0, VDSDIM1, VDSDIM2/)
dims_max = (/DIM0, DIM1, DIM2/)
!
! Create source files and datasets.
!
DO i = 1, PLANE_STRIDE
!
! Initialize data for i-th source dataset.
DO j = 1, DIM0_1*DIM1*DIM2
wdata(j) = i
ENDDO
!
! Create the source files and datasets. Write data to each dataset and
! close all resources.
CALL h5fcreate_f(SRC_FILE(i), H5F_ACC_TRUNC_F, file, error)
CALL check("h5fcreate_f", error, total_error)
CALL h5screate_simple_f(RANK, dims, src_space, error, dims_max)
CALL check("h5screate_simple_f", error, total_error)
CALL h5pcreate_f(H5P_DATASET_CREATE_F, dcpl, error)
CALL check("h5pcreate_f", error, total_error)
CALL h5pset_chunk_f(dcpl, RANK, chunk_dims, error)
CALL check("h5pset_chunk_f",error, total_error)
CALL h5dcreate_f(file, SRC_DATASET(i), H5T_NATIVE_INTEGER, src_space, dset, error, dcpl, H5P_DEFAULT_F, H5P_DEFAULT_F)
CALL check("h5dcreate_f",error, total_error)
f_ptr = C_LOC(wdata(1))
CALL H5Dwrite_f(dset, H5T_NATIVE_INTEGER, f_ptr, error)
CALL check("H5Dwrite_f",error, total_error)
CALL H5Sclose_f(src_space, error)
CALL check("H5Sclose_f",error, total_error)
CALL H5Pclose_f(dcpl, error)
CALL check("H5Pclose_f",error, total_error)
CALL H5Dclose_f(dset, error)
CALL check("H5Dclose_f",error, total_error)
CALL H5Fclose_f(file, error)
CALL check("H5Fclose_f",error, total_error)
ENDDO
CALL h5fcreate_f(VFILENAME, H5F_ACC_TRUNC_F, vfile, error)
CALL check("h5fcreate_f", error, total_error)
! Create VDS dataspace.
CALL H5Screate_simple_f(RANK, vdsdims, vspace, error, vdsdims_max)
CALL check("H5Screate_simple_f", error, total_error)
! Create dataspaces for the source dataset.
CALL H5Screate_simple_f(RANK, dims, src_space, error, dims_max)
CALL check("H5Screate_simple_f", error, total_error)
! Create VDS creation property
CALL H5Pcreate_f (H5P_DATASET_CREATE_F, dcpl, error)
CALL check("H5Pcreate_f", error, total_error)
! Initialize hyperslab values
start(1:3) = 0
stride(1:3) = (/PLANE_STRIDE,1_hsize_t,1_hsize_t/) ! we will select every fifth plane in VDS
count(1:3) = (/H5S_UNLIMITED_F,1_hsize_t,1_hsize_t/)
src_count(1:3) = (/H5S_UNLIMITED_F,1_hsize_t,1_hsize_t/)
block(1:3) = (/1, DIM1, DIM2/)
!
! Build the mappings
!
start_correct = 0
CALL H5Sselect_hyperslab_f(src_space, H5S_SELECT_SET_F, start, src_count, error, block=block)
CALL check("H5Sselect_hyperslab_f", error, total_error)
DO i = 1, PLANE_STRIDE
start_correct(1,i) = start(1)
CALL H5Sselect_hyperslab_f(vspace, H5S_SELECT_SET_F, start, count, error, stride=stride, block=block)
CALL check("H5Sselect_hyperslab_f", error, total_error)
IF(i.eq.1)THEN ! check src_file and src_dataset with trailing blanks
CALL H5Pset_virtual_f (dcpl, vspace, SRC_FILE(i)//" ", SRC_DATASET(i)//" ", src_space, error)
ELSE
CALL H5Pset_virtual_f (dcpl, vspace, SRC_FILE(i), SRC_DATASET(i), src_space, error)
ENDIF
CALL check("H5Pset_virtual_f", error, total_error)
start(1) = start(1) + 1
ENDDO
CALL H5Sselect_none_f(vspace, error)
CALL check("H5Sselect_none_f", error, total_error)
! Create a virtual dataset
CALL H5Dcreate_f(vfile, DATASET, H5T_NATIVE_INTEGER, vspace, vdset, error, dcpl, H5P_DEFAULT_F, H5P_DEFAULT_F)
CALL check("H5Dcreate_f", error, total_error)
CALL H5Sclose_f(vspace, error)
CALL check("H5Sclose_f", error, total_error)
CALL H5Sclose_f(src_space, error)
CALL check("H5Sclose_f", error, total_error)
CALL H5Pclose_f(dcpl, error)
CALL check("H5Pclose_f", error, total_error)
! Let's add data to the source datasets and check new dimensions for VDS
! We will add only one plane to the first source dataset, two planes to the
! second one, three to the third, and four to the forth.
DO i = 1, PLANE_STRIDE
!
! Initialize data for i-th source dataset.
DO j = 1, i*DIM1*DIM2
wdata(j) = 10*i
ENDDO
!
! Open the source files and datasets. Append data to each dataset and
! close all resources.
CALL H5Fopen_f (SRC_FILE(i), H5F_ACC_RDWR_F, file, error)
CALL check("H5Fopen_f", error, total_error)
CALL H5Dopen_f (file, SRC_DATASET(i), dset, error)
CALL check("H5Dopen_f", error, total_error)
extdims(1) = DIM0_1+i
CALL H5Dset_extent_f(dset, extdims, error)
CALL check("H5Dset_extent_f", error, total_error)
CALL H5Dget_space_f(dset, src_space, error)
CALL check("H5Dget_space_f", error, total_error)
start(1:3) = (/DIM0_1,0,0/)
count(1:3) = 1
block(1:3) = (/i, DIM1, DIM2/)
memdims(1) = i
CALL H5Screate_simple_f(RANK, memdims, mem_space, error)
CALL check("H5Screate_simple_f", error, total_error)
CALL H5Sselect_hyperslab_f(src_space, H5S_SELECT_SET_F, start,count, error,block=block)
CALL check("H5Sselect_hyperslab_f", error, total_error)
f_ptr = C_LOC(wdata(1))
CALL H5Dwrite_f(dset, H5T_NATIVE_INTEGER, f_ptr, error, mem_space, src_space, H5P_DEFAULT_F)
CALL check("H5Dwrite_f", error, total_error)
CALL H5Sclose_f(src_space, error)
CALL check("H5Sclose_f", error, total_error)
call H5Dclose_f(dset, error)
CALL check("H5Dclose_f", error, total_error)
call H5Fclose_f(file, error)
CALL check("H5Fclose_f", error, total_error)
ENDDO
call H5Dclose_f(vdset, error)
CALL check("H5Dclose_f", error, total_error)
call H5Fclose_f(vfile, error)
CALL check("H5Fclose_f", error, total_error)
!
! begin the read section
!
! Open file and dataset using the default properties.
CALL H5Fopen_f(VFILENAME, H5F_ACC_RDONLY_F, vfile, error)
CALL check("H5Fopen_f", error, total_error)
!
! Open VDS using different access properties to use max or
! min extents depending on the sizes of the underlying datasets
CALL H5Pcreate_f(H5P_DATASET_ACCESS_F, dapl, error)
CALL check("H5Pcreate_f", error, total_error)
DO i = 1, 2
IF(i.NE.1)THEN
CALL H5Pset_virtual_view_f(dapl, H5D_VDS_LAST_AVAILABLE_F, error)
CALL check("H5Pset_virtual_view_f", error, total_error)
ELSE
CALL H5Pset_virtual_view_f(dapl, H5D_VDS_FIRST_MISSING_F, error)
CALL check("H5Pset_virtual_view_f", error, total_error)
ENDIF
CALL H5Dopen_f(vfile, DATASET, vdset, error, dapl)
CALL check("H5Dopen_f", error, total_error)
! Let's get space of the VDS and its dimension we should get 32(or 20)x10x10
CALL H5Dget_space_f(vdset, vspace, error)
CALL check("H5Dget_space_f", error, total_error)
CALL H5Sget_simple_extent_dims_f(vspace, vdsdims_out, vdsdims_max_out, error)
CALL check("H5Sget_simple_extent_dims_f", error, total_error)
! check VDS dimensions
DO j = 1, RANK
IF(vdsdims_out(j).NE.vdsdims_out_correct(i,j))THEN
total_error = total_error + 1
EXIT
ENDIF
ENDDO
CALL H5Pget_virtual_view_f(dapl, virtual_view, error)
CALL check("h5pget_virtual_view_f", error, total_error)
IF(i.EQ.1)THEN
IF(virtual_view .NE. H5D_VDS_FIRST_MISSING_F)THEN
total_error = total_error + 1
ENDIF
ELSE
IF(virtual_view .NE. H5D_VDS_LAST_AVAILABLE_F)THEN
total_error = total_error + 1
ENDIF
ENDIF
! Close
CALL H5Dclose_f(vdset, error)
CALL check("H5Dclose_f", error, total_error)
CALL H5Sclose_f(vspace, error)
CALL check("H5Sclose_f", error, total_error)
ENDDO
CALL H5Dopen_f(vfile, DATASET, vdset, error)
CALL check("H5Dopen_f", error, total_error)
!
! Get creation property list and mapping properties.
!
CALL H5Dget_create_plist_f (vdset, dcpl, error)
CALL check("H5Dget_create_plist_f", error, total_error)
!
! Get storage layout.
CALL H5Pget_layout_f(dcpl, layout, error)
CALL check("H5Pget_layout_f", error, total_error)
IF (H5D_VIRTUAL_F .NE. layout) THEN
PRINT*,"Wrong layout found"
total_error = total_error + 1
ENDIF
!
! Find number of mappings.
CALL H5Pget_virtual_count_f(dcpl, num_map, error)
CALL check("H5Pget_virtual_count_f", error, total_error)
IF(num_map.NE.4_size_t)THEN
PRINT*,"Number of mappings is incorrect"
total_error = total_error + 1
ENDIF
!
! Get mapping parameters for each mapping.
!
DO i = 1, num_map
CALL H5Pget_virtual_vspace_f(dcpl, INT(i-1,size_t), vspace, error)
CALL check("H5Pget_virtual_vspace_f", error, total_error)
CALL h5sget_select_type_f(vspace, s_type, error)
CALL check("h5sget_select_type_f", error, total_error)
IF(s_type.EQ.H5S_SEL_HYPERSLABS_F)THEN
CALL H5Sis_regular_hyperslab_f(vspace, IsRegular, error)
CALL check("H5Sis_regular_hyperslab_f", error, total_error)
IF(IsRegular)THEN
CALL H5Sget_regular_hyperslab_f(vspace, start_out, stride_out, count_out, block_out, error)
CALL check("H5Sget_regular_hyperslab_f", error, total_error)
DO j = 1, 3
IF(start_out(j).NE.start_correct(j,i) .OR. &
stride_out(j).NE.stride(j).OR. &
count_out(j).NE.src_count(j))THEN
total_error = total_error + 1
EXIT
ENDIF
ENDDO
ENDIF
END IF
! Get source file name
CALL H5Pget_virtual_filename_f(dcpl, INT(i-1, size_t), SRC_FILE_LEN_EXACT, error, nsize)
CALL check("H5Pget_virtual_count_f", error, total_error)
IF(nsize.NE.LEN(SRC_FILE_LEN_EXACT))THEN
PRINT*,"virtual filenname size is incorrect"
total_error = total_error + 1
ENDIF
! check passing a buffer that is very small
CALL H5Pget_virtual_filename_f(dcpl, INT(i-1, size_t), SRC_FILE_LEN_TINY, error)
CALL check("H5Pget_virtual_filename_f", error, total_error)
IF(SRC_FILE_LEN_TINY.NE.SRC_FILE(i)(1:LEN(SRC_FILE_LEN_TINY)))THEN
PRINT*,"virtual filenname returned is incorrect"
total_error = total_error + 1
ENDIF
! check passing a buffer that small by one
CALL H5Pget_virtual_filename_f(dcpl, INT(i-1, size_t), SRC_FILE_LEN_SMALL, error)
CALL check("H5Pget_virtual_filename_f", error, total_error)
IF(SRC_FILE_LEN_SMALL.NE.SRC_FILE(i)(1:LEN(SRC_FILE_LEN_SMALL)))THEN
PRINT*,"virtual filenname returned is incorrect"
total_error = total_error + 1
ENDIF
! check passing a buffer that is exact
CALL H5Pget_virtual_filename_f(dcpl, INT(i-1, size_t), SRC_FILE_LEN_EXACT, error)
CALL check("H5Pget_virtual_filename_f", error, total_error)
IF(SRC_FILE_LEN_EXACT.NE.SRC_FILE(i)(1:LEN(SRC_FILE_LEN_EXACT)))THEN
PRINT*,"virtual filenname returned is incorrect"
total_error = total_error + 1
ENDIF
! check passing a buffer that bigger by one
CALL H5Pget_virtual_filename_f(dcpl, INT(i-1, size_t), SRC_FILE_LEN_LARGE, error)
CALL check("H5Pget_virtual_filename_f", error, total_error)
IF(SRC_FILE_LEN_LARGE(1:LEN(SRC_FILE_LEN_EXACT)).NE.SRC_FILE(i)(1:LEN(SRC_FILE_LEN_EXACT)).AND. &
SRC_FILE_LEN_LARGE(LEN(SRC_FILE_LEN_EXACT):).NE.'')THEN
PRINT*,"virtual filenname returned is incorrect"
total_error = total_error + 1
ENDIF
! check passing a buffer that is very big
CALL H5Pget_virtual_filename_f(dcpl, INT(i-1, size_t), SRC_FILE_LEN_HUGE, error)
CALL check("H5Pget_virtual_filename_f", error, total_error)
IF(SRC_FILE_LEN_HUGE(1:LEN(SRC_FILE_LEN_EXACT)).NE.SRC_FILE(i)(1:LEN(SRC_FILE_LEN_EXACT)).AND. &
SRC_FILE_LEN_HUGE(LEN(SRC_FILE_LEN_EXACT):).NE.'')THEN
PRINT*,"virtual filenname returned is incorrect"
total_error = total_error + 1
ENDIF
! Get source dataset name
CALL H5Pget_virtual_dsetname_f(dcpl, INT(i-1, size_t), SRC_DATASET_LEN_EXACT, error, nsize)
CALL check("H5Pget_virtual_dsetname_f", error, total_error)
CALL H5Pget_virtual_dsetname_f(dcpl, INT(i-1, size_t), SRC_DATASET_LEN_EXACT, error)
CALL check("H5Pget_virtual_dsetname_f", error, total_error)
IF(SRC_DATASET_LEN_EXACT(1:LEN(SRC_DATASET_LEN_EXACT)).NE.SRC_DATASET(i)(1:LEN(SRC_DATASET_LEN_EXACT)).AND. &
SRC_DATASET_LEN_EXACT(LEN(SRC_DATASET_LEN_EXACT):).NE.'')THEN
PRINT*,"virtual dataset returned is incorrect"
total_error = total_error + 1
ENDIF
CALL h5pget_virtual_srcspace_f(dcpl, INT(i-1,size_t), space_out, error)
CALL check("H5Pget_virtual_srcspace_f", error, total_error)
CALL h5sget_select_type_f(space_out, type1, error)
CALL check("H5Sget_select_type_f", error, total_error)
CALL h5sget_select_type_f(vspace, type2, error)
CALL check("H5Sget_select_type_f", error, total_error)
IF(type1.NE.type2)THEN
total_error = total_error + 1
ENDIF
ENDDO
!
! Close and release resources.
! Clear virtual layout in DCPL
CALL h5pset_layout_f(dcpl, H5D_VIRTUAL_F,error)
CALL check("H5Pset_layout_f", error, total_error)
CALL H5Pclose_f(dcpl, error)
CALL check("H5Pclose_f", error, total_error)
CALL H5Dclose_f(vdset, error)
CALL check("H5Dclose_f", error, total_error)
! Reopen VDS with printf gap set to 1
CALL H5Pset_virtual_printf_gap_f(dapl, 1_hsize_t, error)
CALL check("H5Pset_virtual_printf_gap_f", error, total_error)
CALL H5Dopen_f(vfile, DATASET, vdset, error, dapl)
CALL check("H5Dopen_f", error, total_error)
CALL H5Pget_virtual_printf_gap_f(dapl, gap_size, error)
CALL check("H5Pget_virtual_printf_gap_f", error, total_error)
IF(gap_size.NE.1_hsize_t)THEN
PRINT*,"gapsize is incorrect"
total_error = total_error + 1
ENDIF
CALL H5Dclose_f(vdset, error)
CALL check("H5Dclose_f", error, total_error)
CALL H5Sclose_f(vspace, error)
CALL check("H5Sclose_f", error, total_error)
CALL H5Pclose_f(dapl, error)
CALL check("H5Pclose_f", error, total_error)
CALL H5Fclose_f(vfile, error)
CALL check("H5Fclose_f", error, total_error)
END SUBROUTINE test_vds
END MODULE TH5P_F03
|