diff options
Diffstat (limited to 'fortran')
-rw-r--r-- | fortran/test/Makefile.in | 39 | ||||
-rw-r--r-- | fortran/test/fflush1.f90 | 39 | ||||
-rw-r--r-- | fortran/test/fflush2.f90 | 47 | ||||
-rw-r--r-- | fortran/test/fortranlib_test.f90 | 51 | ||||
-rw-r--r-- | fortran/test/hdf5test.f90 | 16 | ||||
-rw-r--r-- | fortran/test/t.c | 115 | ||||
-rw-r--r-- | fortran/test/t.h | 34 | ||||
-rw-r--r-- | fortran/test/tH5A.f90 | 41 | ||||
-rw-r--r-- | fortran/test/tH5D.f90 | 80 | ||||
-rw-r--r-- | fortran/test/tH5E.f90 | 46 | ||||
-rw-r--r-- | fortran/test/tH5F.f90 | 176 | ||||
-rw-r--r-- | fortran/test/tH5G.f90 | 39 | ||||
-rw-r--r-- | fortran/test/tH5I.f90 | 19 | ||||
-rw-r--r-- | fortran/test/tH5P.f90 | 43 | ||||
-rw-r--r-- | fortran/test/tH5R.f90 | 82 | ||||
-rw-r--r-- | fortran/test/tH5S.f90 | 65 | ||||
-rw-r--r-- | fortran/test/tH5Sselect.f90 | 123 | ||||
-rw-r--r-- | fortran/test/tH5T.f90 | 71 | ||||
-rw-r--r-- | fortran/test/tf.f90 | 134 | ||||
-rw-r--r-- | fortran/testpar/Makefile.in | 22 | ||||
-rw-r--r-- | fortran/testpar/ptesthdf5_fortran.f90 | 19 | ||||
-rw-r--r-- | fortran/testpar/tcheck.f90 | 16 | ||||
-rw-r--r-- | fortran/testpar/thdf5.f90 | 15 | ||||
-rw-r--r-- | fortran/testpar/thyperslab_wr.f90 | 38 |
24 files changed, 987 insertions, 383 deletions
diff --git a/fortran/test/Makefile.in b/fortran/test/Makefile.in index ba4b919..1d74697 100644 --- a/fortran/test/Makefile.in +++ b/fortran/test/Makefile.in @@ -1,8 +1,17 @@ ## HDF5-Fortran test/Makefile(.in) + ## -## Copyright (C) 2000 National Center for Supercomputing Applications. -## All rights reserved. +## 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have +## access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. ## top_srcdir=@top_srcdir@/.. top_builddir=../.. @@ -16,25 +25,31 @@ hdf5_builddir=$(top_builddir)/src LT_LINK_LIB=$(LT) --mode=link $(F9X) -static -rpath $(libdir) FLIB=../src/libhdf5_fortran.la HDF5LIB=$(hdf5_builddir)/libhdf5.la +TCLIB=../../test/.libs/libh5test.a +LIB=libh5test_fortran.la +LIB_CSRC=t.c +LIB_FSRC=tf.f90 +LIB_OBJ=$(LIB_FSRC:.f90=.lo) $(LIB_CSRC:.c=.lo) TEST_PROGS_SRC=fortranlib_test.f90 fflush1.f90 fflush2.f90 TEST_PROGS=$(TEST_PROGS_SRC:.f90=) -TEST_SRC=hdf5test.f90 tH5F.f90 tH5D.f90 tH5R.f90 tH5S.f90 tH5T.f90 \ - tH5Sselect.f90 tH5P.f90 tH5A.f90 tH5I.f90 tH5G.f90 tH5E.f90 -TEST_OBJ=$(TEST_SRC:.f90=.lo) +TEST_FSRC= tH5F.f90 tH5D.f90 tH5R.f90 tH5S.f90 tH5T.f90 \ + tH5Sselect.f90 tH5P.f90 tH5A.f90 tH5I.f90 tH5G.f90 tH5E.f90 tf.f90 +TEST_CSRC = t.c +TEST_OBJ=$(TEST_FSRC:.f90=.lo) $(TEST_CSRC:.c=.lo) -DISTCLEAN=$(TEST_PROGS_SRC:.f90=.lo) $(TEST_PROGS_SRC:.f90=.o) *.h5 +DISTCLEAN=$(TEST_PROGS_SRC:.f90=.lo) $(TEST_PROGS_SRC:.f90=.o) *.h5 *.tmp -$(TEST_PROGS): $(FLIB) +$(TEST_PROGS): $(LIB) $(FLIB) fortranlib_test: fortranlib_test.lo $(TEST_OBJ) - @$(LT_LINK_FEXE) $(FFLAGS) -o $@ fortranlib_test.lo $(TEST_OBJ) $(FLIB) $(LIBS) $(HDF5LIB) + @$(LT_LINK_FEXE) $(FFLAGS) -o $@ fortranlib_test.lo $(TEST_OBJ) $(LIB) $(TCLIB) $(FLIB) $(LIBS) $(HDF5LIB) -fflush1: fflush1.lo hdf5test.lo - @$(LT_LINK_FEXE) $(FFLAGS) -o $@ fflush1.lo hdf5test.lo $(FLIB) $(LIBS) $(HDF5LIB) +fflush1: fflush1.lo + @$(LT_LINK_FEXE) $(FFLAGS) -o $@ fflush1.lo $(LIB) $(TCLIB) $(FLIB) $(LIBS) $(HDF5LIB) -fflush2: fflush2.lo hdf5test.lo - @$(LT_LINK_FEXE) $(FFLAGS) -o $@ fflush2.lo hdf5test.lo $(FLIB) $(LIBS) $(HDF5LIB) +fflush2: fflush2.lo + @$(LT_LINK_FEXE) $(FFLAGS) -o $@ fflush2.lo $(LIB) $(TCLIB) $(FLIB) $(LIBS) $(HDF5LIB) @CONCLUDE@ diff --git a/fortran/test/fflush1.f90 b/fortran/test/fflush1.f90 index d71a7c0..a529eef 100644 --- a/fortran/test/fflush1.f90 +++ b/fortran/test/fflush1.f90 @@ -1,9 +1,24 @@ - ! - ! Purpose: This is the first half of a two-part test that makes sure - ! that a file can be read after an application crashes as long - ! as the file was flushed first. We simulate by exit the - ! the program using stop statement - ! + +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +! +! Purpose: This is the first half of a two-part test that makes sure +! that a file can be read after an application crashes as long +! as the file was flushed first. We simulate by exit the +! the program using stop statement +! PROGRAM FFLUSH1EXAMPLE @@ -14,7 +29,8 @@ ! !the respective filename is "fflush1.h5" ! - CHARACTER(LEN=10), PARAMETER :: filename = "fflush1.h5" + CHARACTER(LEN=7), PARAMETER :: filename = "fflush1" + CHARACTER(LEN=80) :: fix_filename ! !data space rank and dimensions @@ -75,7 +91,7 @@ !Initialize FORTRAN predifined datatypes ! CALL h5open_f(error) - CALL check("h5init_types_f",error,total_error) + CALL check("h5open_f",error,total_error) ! !Initialize data_in buffer @@ -89,7 +105,12 @@ ! !Create file "fflush1.h5" using default properties. ! - CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) + if (error .ne. 0) then + write(*,*) "Cannot modify filename" + stop + endif + CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file_id, error) CALL check("h5fcreate_f",error,total_error) ! diff --git a/fortran/test/fflush2.f90 b/fortran/test/fflush2.f90 index d7e5053..41b94cb 100644 --- a/fortran/test/fflush2.f90 +++ b/fortran/test/fflush2.f90 @@ -1,9 +1,24 @@ - ! - ! Purpose: This is the second half of a two-part test that makes sure - ! that a file can be read after an application crashes as long - ! as the file was flushed first. This half tries to read the - ! file created by the first half. - ! + +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +! +! Purpose: This is the second half of a two-part test that makes sure +! that a file can be read after an application crashes as long +! as the file was flushed first. This half tries to read the +! file created by the first half. +! PROGRAM FFLUSH2EXAMPLE @@ -11,10 +26,8 @@ IMPLICIT NONE - ! - !the respective filename is "fflush1.h5" - ! - CHARACTER(LEN=10), PARAMETER :: filename = "fflush1.h5" + CHARACTER(LEN=7), PARAMETER :: filename = "fflush1" + CHARACTER(LEN=80) :: fix_filename ! !data space rank and dimensions @@ -75,12 +88,17 @@ !Initialize FORTRAN predifined datatypes ! CALL h5open_f(error) - CALL check("h5init_types_f",error,total_error) + CALL check("h5open_f",error,total_error) ! !Open the file. ! - CALL h5fopen_f(filename, H5F_ACC_RDONLY_F, file_id, error) + CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) + if (error .ne. 0) then + write(*,*) "Cannot modify filename" + stop + endif + CALL h5fopen_f(fix_filename, H5F_ACC_RDONLY_F, file_id, error) CALL check("h5fopen_f",error,total_error) ! @@ -154,8 +172,9 @@ ! !Close FORTRAN predifined datatypes - ! + ! + CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) CALL h5close_f(error) CALL check("h5close_types_f",error,total_error) - + END PROGRAM FFLUSH2EXAMPLE diff --git a/fortran/test/fortranlib_test.f90 b/fortran/test/fortranlib_test.f90 index 2c5c13a..7756eee 100644 --- a/fortran/test/fortranlib_test.f90 +++ b/fortran/test/fortranlib_test.f90 @@ -1,3 +1,18 @@ + +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! ! ! ! Testing Fortran functionality. @@ -30,6 +45,8 @@ CHARACTER(LEN=8) :: success = ' PASSED ' CHARACTER(LEN=8) :: failure = '*FAILED*' CHARACTER(LEN=4) :: e_format ='(8a)' + LOGICAL :: cleanup = .TRUE. +! LOGICAL :: cleanup = .FALSE. CALL h5open_f(error) write(*,*) ' ========================== ' @@ -40,7 +57,7 @@ ! write(*,*) '=========================================' error_string = failure - CALL mountingtest(mounting_total_error) + CALL mountingtest(cleanup, mounting_total_error) IF (mounting_total_error == 0) error_string = success write(*, fmt = '(14a)', advance = 'no') ' Mounting test' write(*, fmt = '(56x,a)', advance = 'no') ' ' @@ -49,7 +66,7 @@ total_error = total_error + mounting_total_error error_string = failure - CALL reopentest(reopen_total_error) + CALL reopentest(cleanup, reopen_total_error) IF (reopen_total_error == 0) error_string = success write(*, fmt = '(12a)', advance = 'no') ' Reopen test' write(*, fmt = '(58x,a)', advance = 'no') ' ' @@ -63,7 +80,7 @@ ! write(*,*) '=========================================' error_string = failure - CALL datasettest(dataset_total_error) + CALL datasettest(cleanup, dataset_total_error) IF (dataset_total_error == 0) error_string = success write(*, fmt = '(13a)', advance = 'no') ' Dataset test' write(*, fmt = '(57x,a)', advance = 'no') ' ' @@ -71,7 +88,7 @@ total_error = total_error + dataset_total_error error_string = failure - CALL extenddsettest(extend_dataset_total_error) + CALL extenddsettest(cleanup, extend_dataset_total_error) IF (extend_dataset_total_error == 0) error_string = success write(*, fmt = '(24a)', advance = 'no') ' Extendible dataset test' write(*, fmt = '(46x,a)', advance = 'no') ' ' @@ -84,7 +101,7 @@ ! write(*,*) '=========================================' error_string = failure - CALL dataspace_basic_test(dataspace_total_error) + CALL dataspace_basic_test(cleanup, dataspace_total_error) IF (dataspace_total_error == 0) error_string = success write(*, fmt = '(21a)', advance = 'no') ' Basic dataspace test' write(*, fmt = '(49x,a)', advance = 'no') ' ' @@ -98,7 +115,7 @@ ! write(*,*) '=========================================' error_string = failure - CALL refobjtest(refobj_total_error) + CALL refobjtest(cleanup, refobj_total_error) IF (refobj_total_error == 0) error_string = success write(*, fmt = '(25a)', advance = 'no') ' Reference to object test' write(*, fmt = '(45x,a)', advance = 'no') ' ' @@ -106,7 +123,7 @@ total_error = total_error + refobj_total_error error_string = failure - CALL refregtest(refreg_total_error) + CALL refregtest(cleanup, refreg_total_error) IF (refreg_total_error == 0) error_string = success write(*, fmt = '(33a)', advance = 'no') ' Reference to dataset region test' write(*, fmt = '(37x,a)', advance = 'no') ' ' @@ -119,7 +136,7 @@ ! write(*,*) '=========================================' error_string = failure - CALL test_basic_select(basic_select_total_error) + CALL test_basic_select(cleanup, basic_select_total_error) IF (basic_select_total_error == 0) error_string = success write(*, fmt = '(21a)', advance = 'no') ' Basic selection test' write(*, fmt = '(49x,a)', advance = 'no') ' ' @@ -127,7 +144,7 @@ total_error = total_error + basic_select_total_error error_string = failure - CALL test_select_hyperslab( hyperslab_total_error) + CALL test_select_hyperslab( cleanup, hyperslab_total_error) IF ( hyperslab_total_error == 0) error_string = success write(*, fmt = '(25a)', advance = 'no') ' Hyperslab selection test' write(*, fmt = '(45x,a)', advance = 'no') ' ' @@ -135,7 +152,7 @@ total_error = total_error + hyperslab_total_error error_string = failure - CALL test_select_element(element_total_error) + CALL test_select_element(cleanup, element_total_error) IF (element_total_error == 0) error_string = success write(*, fmt = '(23a)', advance = 'no') ' Element selection test' write(*, fmt = '(47x,a)', advance = 'no') ' ' @@ -149,7 +166,7 @@ ! write(*,*) '=========================================' error_string = failure - CALL basic_data_type_test(basic_datatype_total_error) + CALL basic_data_type_test(cleanup, basic_datatype_total_error) IF (basic_datatype_total_error == 0) error_string = success write(*, fmt = '(20a)', advance = 'no') ' Basic datatype test' write(*, fmt = '(50x,a)', advance = 'no') ' ' @@ -157,7 +174,7 @@ total_error = total_error + basic_datatype_total_error error_string = failure - CALL compoundtest(total_error_compoundtest) + CALL compoundtest(cleanup, total_error_compoundtest) IF (total_error_compoundtest == 0) error_string = success write(*, fmt = '(23a)', advance = 'no') ' Compound datatype test' write(*, fmt = '(47x,a)', advance = 'no') ' ' @@ -170,7 +187,7 @@ ! write(*,*) '=========================================' error_string = failure - CALL external_test(external_total_error) + CALL external_test(cleanup, external_total_error) IF (external_total_error == 0) error_string = success write(*, fmt = '(22a)', advance = 'no') ' External dataset test' write(*, fmt = '(48x,a)', advance = 'no') ' ' @@ -183,7 +200,7 @@ ! write(*,*) '=========================================' error_string = failure - CALL attribute_test(attribute_total_error) + CALL attribute_test(cleanup, attribute_total_error) write(*, fmt = '(15a)', advance = 'no') ' Attribute test' write(*, fmt = '(55x,a)', advance = 'no') ' ' IF (attribute_total_error == 0) error_string = success @@ -196,7 +213,7 @@ ! write(*,*) '=========================================' error_string = failure - CALL identifier_test(identifier_total_error) + CALL identifier_test(cleanup, identifier_total_error) IF (identifier_total_error == 0) error_string = success write(*, fmt = '(16a)', advance = 'no') ' Identifier test' write(*, fmt = '(54x,a)', advance = 'no') ' ' @@ -209,7 +226,7 @@ ! write(*,*) '=========================================' error_string = failure - CALL group_test(group_total_error) + CALL group_test(cleanup, group_total_error) IF (group_total_error == 0) error_string = success write(*, fmt = '(11a)', advance = 'no') ' Group test' write(*, fmt = '(59x,a)', advance = 'no') ' ' @@ -217,7 +234,7 @@ total_error = total_error + identifier_total_error error_string = failure - CALL error_report_test(error_total_error) + CALL error_report_test(cleanup, error_total_error) IF (error_total_error == 0) error_string = success write(*, fmt = '(11a)', advance = 'no') ' Error test' write(*, fmt = '(59x,a)', advance = 'no') ' ' diff --git a/fortran/test/hdf5test.f90 b/fortran/test/hdf5test.f90 deleted file mode 100644 index 978c832..0000000 --- a/fortran/test/hdf5test.f90 +++ /dev/null @@ -1,16 +0,0 @@ -! -! -! This module contains check subroutine which is used in -! all the fortran h5 test files -! - - SUBROUTINE check(string,error,total_error) - CHARACTER(LEN=*) :: string - INTEGER :: error, total_error - if (error .lt. 0) then - total_error=total_error+1 - write(*,*) string, " failed" - endif - RETURN - END SUBROUTINE check - diff --git a/fortran/test/t.c b/fortran/test/t.c new file mode 100644 index 0000000..ed18c0f --- /dev/null +++ b/fortran/test/t.c @@ -0,0 +1,115 @@ + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include "t.h" + +/*---------------------------------------------------------------------------- + * Name: h5_fixname_c + * Purpose: Call h5_fixname to modify file name + * Inputs: base_name - name of the file + * base_namelen - name length + * fapl - file access property list + * full_name - buffer to return full name + * full_namelen - name length + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Friday, September 13, 2002 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5_fixname_c(_fcd base_name, int_f *base_namelen, hid_t_f* fapl, _fcd full_name, int_f *full_namelen) +{ + int ret_value = -1; + char *c_base_name; + int c_base_namelen; + int c_full_namelen; + char *c_full_name; + hid_t c_fapl; + + /* + * Define ifile access property list + */ + c_fapl = (hid_t)*fapl; + /* + * Convert FORTRAN name to C name + */ + c_base_namelen = *base_namelen; + c_base_name = (char *)HD5f2cstring(base_name, c_base_namelen); + if (c_base_name == NULL) goto DONE; + c_full_name = (char *) HDmalloc(*full_namelen + 1); + if (c_full_name == NULL) goto DONE; + + /* + * Call h5_fixname function. + */ + if (NULL != h5_fixname(c_base_name, c_fapl, c_full_name, *full_namelen + 1)) { + HD5packFstring(c_full_name, _fcdtocp(full_name), *full_namelen); + ret_value = 0; + goto DONE; + } +DONE: + if (NULL != c_base_name) HDfree(c_base_name); + if (NULL != c_full_name) HDfree(c_full_name); + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5_cleanup_c + * Purpose: Call h5_cleanup to clean temporary files. + * Inputs: base_name - name of the file + * base_namelen - name length + * fapl - file access property list + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Thursday, September 19, 2002 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5_cleanup_c(_fcd base_name, int_f *base_namelen, hid_t_f* fapl) +{ + char filename[1024]; + int ret_value = -1; + char *c_base_name[1]; + int c_base_namelen; + hid_t c_fapl; + + /* + * Define ifile access property list + */ + c_fapl = (hid_t)*fapl; + /*c_fapl = H5Pcreate(H5P_FILE_ACCESS);*/ + /* + * Convert FORTRAN name to C name + */ + c_base_namelen = *base_namelen; + c_base_name[0] = (char *)HD5f2cstring(base_name, c_base_namelen); + if (c_base_name[0] == NULL) goto DONE; + + /* + * Call h5_cleanup function. + */ + /*if (h5_cleanup(c_base_name, c_fapl) != 0) { + ret_value = 0; + goto DONE; + } +*/ + h5_fixname(c_base_name[0], c_fapl, filename, sizeof(filename)); + remove(filename); + ret_value =0; +DONE: + if (NULL != c_base_name[0]) HDfree(c_base_name[0]); + return ret_value; + +} diff --git a/fortran/test/t.h b/fortran/test/t.h new file mode 100644 index 0000000..980e597 --- /dev/null +++ b/fortran/test/t.h @@ -0,0 +1,34 @@ + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include "../../src/hdf5.h" +#include "../src/H5f90i.h" + +/* + * Functions from t.c + */ +#ifdef DF_CAPFNAMES +# define nh5_fixname_c FNAME(H5_FIXNAME_C) +# define nh5_cleanup_c FNAME(H5_CLEANUP_C) +#else /* !DF_CAPFNAMES */ +# define nh5_fixname_c FNAME(h5_fixname_c) +# define nh5_cleanup_c FNAME(h5_cleanup_c) +#endif /* DF_CAPFNAMES */ + + H5_DLL int_f nh5_fixname_c +(_fcd base_name, int_f *base_namelen, hid_t_f *fapl, _fcd full_name, int_f *full_namelen); + + H5_DLL int_f nh5_cleanup_c +(_fcd base_name, int_f *base_namelen, hid_t_f *fapl); diff --git a/fortran/test/tH5A.f90 b/fortran/test/tH5A.f90 index cec25de..7f984e5 100644 --- a/fortran/test/tH5A.f90 +++ b/fortran/test/tH5A.f90 @@ -1,17 +1,33 @@ - SUBROUTINE attribute_test(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, +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! + 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, ! USE HDF5 ! This module contains all necessary modules IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error - CHARACTER(LEN=8), PARAMETER :: filename = "atest.h5" !File name + CHARACTER(LEN=5), PARAMETER :: filename = "atest.h5" !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 @@ -114,7 +130,12 @@ ! ! Create the file. ! - CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + 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) ! @@ -291,7 +312,7 @@ ! ! Open file ! - CALL h5fopen_f(filename, H5F_ACC_RDWR_F, file_id, error) + CALL h5fopen_f(fix_filename, H5F_ACC_RDWR_F, file_id, error) CALL check("h5open_f",error,total_error) ! ! Reopen dataset @@ -507,6 +528,10 @@ ! 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 diff --git a/fortran/test/tH5D.f90 b/fortran/test/tH5D.f90 index 1f32fbb..c808f22 100644 --- a/fortran/test/tH5D.f90 +++ b/fortran/test/tH5D.f90 @@ -1,25 +1,36 @@ + +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! ! ! ! Testing Dataset Interface functionality. ! -! MODULE H5DTEST - -! USE HDF5 ! This module contains all necessary modules - -! CONTAINS - ! -!The following subroutine tests the following functionalities: -!h5dcreate_f, h5dopen_f, h5dclose_f, h5dget_space_f, h5dget_type_f, -!h5dread_f, and h5dwrite_f +! The following subroutine tests the following functionalities: +! h5dcreate_f, h5dopen_f, h5dclose_f, h5dget_space_f, h5dget_type_f, +! h5dread_f, and h5dwrite_f ! - SUBROUTINE datasettest(total_error) + SUBROUTINE datasettest(cleanup, total_error) USE HDF5 ! This module contains all necessary modules IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error - CHARACTER(LEN=8), PARAMETER :: filename = "dsetf.h5" ! File name + CHARACTER(LEN=5), PARAMETER :: filename = "dsetf" ! File name + CHARACTER(LEN=80) :: fix_filename CHARACTER(LEN=4), PARAMETER :: dsetname = "dset" ! Dataset name INTEGER(HID_T) :: file_id ! File identifier @@ -47,16 +58,16 @@ end do end do - ! - ! Initialize FORTRAN predefined datatypes. - ! -! CALL h5init_types_f(error) -! CALL check("h5init_types_f", error, total_error) ! ! Create a new file using default properties. ! - CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) + if (error .ne. 0) then + write(*,*) "Cannot modify filename" + stop + endif + CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file_id, error) CALL check("h5fcreate_f", error, total_error) @@ -104,7 +115,7 @@ ! ! Open the existing file. ! - CALL h5fopen_f (filename, H5F_ACC_RDWR_F, file_id, error) + CALL h5fopen_f (fix_filename, H5F_ACC_RDWR_F, file_id, error) CALL check("h5fopen_f", error, total_error) ! @@ -165,13 +176,9 @@ ! CALL h5fclose_f(file_id, error) CALL check("h5fclose_f", error, total_error) + if(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) - ! - !Close FORTRAN predifined datatypes - ! -! CALL h5close_types_f(error) -! CALL check("h5close_types_f",error,total_error) - RETURN END SUBROUTINE datasettest @@ -179,16 +186,18 @@ !the following subroutine tests h5dextend_f functionality ! - SUBROUTINE extenddsettest(total_error) + SUBROUTINE extenddsettest(cleanup, total_error) USE HDF5 ! This module contains all necessary modules IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error ! !the dataset is stored in file "extf.h5" ! - CHARACTER(LEN=7), PARAMETER :: filename = "extf.h5" + CHARACTER(LEN=4), PARAMETER :: filename = "extf" + CHARACTER(LEN=80) :: fix_filename ! !dataset name is "ExtendibleArray" @@ -266,7 +275,12 @@ ! !Create a new file using default properties. ! - CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) + if (error .ne. 0) then + write(*,*) "Cannot modify filename" + stop + endif + CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file_id, error) CALL check("h5fcreate_f",error,total_error) @@ -347,7 +361,7 @@ ! !Open the file. ! - CALL h5fopen_f (filename, H5F_ACC_RDONLY_F, file_id, error) + CALL h5fopen_f (fix_filename, H5F_ACC_RDONLY_F, file_id, error) CALL check("hfopen_f",error,total_error) ! @@ -444,16 +458,10 @@ ! CALL h5fclose_f(file_id, error) CALL check("h5fclose_f",error,total_error) - - ! - ! Close FORTRAN predefined datatypes. - ! -! CALL h5close_types_f(error) -! CALL check("h5close_types_f",error,total_error) + if(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) RETURN END SUBROUTINE extenddsettest - -! END MODULE H5DTEST diff --git a/fortran/test/tH5E.f90 b/fortran/test/tH5E.f90 index c14b101..d0e1317 100644 --- a/fortran/test/tH5E.f90 +++ b/fortran/test/tH5E.f90 @@ -1,14 +1,32 @@ - SUBROUTINE error_report_test(total_error) -!THis subroutine tests following functionalities: h5eprint_f +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! + SUBROUTINE error_report_test(cleanup, total_error) + +! This subroutine tests following functionalities: h5eprint_f USE HDF5 ! This module contains all necessary modules IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error - CHARACTER(LEN=9), PARAMETER :: filename = "etestf.h5" ! File name - CHARACTER(LEN=12), PARAMETER :: err_file_name = "err_file.tmp"! Error output file + CHARACTER(LEN=6), PARAMETER :: filename = "etestf" ! File name + CHARACTER(LEN=80) :: fix_filename + CHARACTER(LEN=8), PARAMETER :: err_filename = "err_file"! Error output file + CHARACTER(LEN=80) :: fix_err_filename @@ -22,7 +40,12 @@ ! ! Create a new file using default properties. ! - CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) + if (error .ne. 0) then + write(*,*) "Cannot modify filename" + stop + endif + CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file_id, error) CALL check("h5fcreate_f",error,total_error) ! @@ -30,9 +53,14 @@ ! Error message should go to the err_file_name file. ! CALL h5gopen_f(file_id, "Doesnotexist1", grp_id, tmp_error) - CALL h5eprint_f(error, err_file_name) + CALL h5_fixname_f(err_filename, fix_err_filename, H5P_DEFAULT_F, error) + if (error .ne. 0) then + write(*,*) "Cannot modify filename" + stop + endif + CALL h5eprint_f(error, fix_err_filename) CALL h5gopen_f(file_id, "Doesnotexist2", grp_id, tmp_error) - CALL h5eprint_f(error, err_file_name) + CALL h5eprint_f(error, fix_err_filename) ! ! Close the file. @@ -40,5 +68,9 @@ CALL h5fclose_f(file_id, error) CALL check("h5fclose_f",error,total_error) + if(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + if(cleanup) CALL h5_cleanup_f(err_filename, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) RETURN END SUBROUTINE error_report_test diff --git a/fortran/test/tH5F.f90 b/fortran/test/tH5F.f90 index 31da85d..0f058d9 100644 --- a/fortran/test/tH5F.f90 +++ b/fortran/test/tH5F.f90 @@ -1,28 +1,40 @@ + +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! ! ! ! Testing File Interface functionality. ! -! MODULE H5FTEST - -! USE HDF5 ! This module contains all necessary modules - -! CONTAINS - -!In the mountingtest subroutine we create one file with a group in it, -!and another file with a dataset. Mounting is used to -!access the dataset from the second file as a member of a group -!in the first file. +! In the mountingtest subroutine we create one file with a group in it, +! and another file with a dataset. Mounting is used to +! access the dataset from the second file as a member of a group +! in the first file. ! - SUBROUTINE mountingtest(total_error) + SUBROUTINE mountingtest(cleanup, total_error) USE HDF5 ! This module contains all necessary modules IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error ! !the respective filename is "mount1.h5" and "mount2.h5" ! - CHARACTER(LEN=9), PARAMETER :: filename1 = "mount1.h5" - CHARACTER(LEN=9), PARAMETER :: filename2 = "mount2.h5" + CHARACTER(LEN=6) :: filename1 + CHARACTER(LEN=6) :: filename2 + CHARACTER(LEN=80) :: fix_filename1 + CHARACTER(LEN=80) :: fix_filename2 ! !data space rank and dimensions @@ -82,12 +94,13 @@ INTEGER, DIMENSION(NX,NY) :: data_in, data_out INTEGER, DIMENSION(7) :: data_dims - ! - !Initialize FORTRAN predifined datatypes - ! -! CALL h5init_types_f(error) -! CALL check("h5init_types_f",error,total_error) + filename1 = "mount1" + filename2 = "mount2" + do i = 1,80 + fix_filename1(i:i) = " " + fix_filename2(i:i) = " " + enddo ! !Initialize data_in buffer ! @@ -98,9 +111,17 @@ end do ! + ! Fix names of the files + ! + CALL h5_fixname_f(filename1, fix_filename1, H5P_DEFAULT_F, error) + if(error .ne. 0) stop + CALL h5_fixname_f(filename2, fix_filename2, H5P_DEFAULT_F, error) + if(error .ne. 0) stop + + ! !Create first file "mount1.h5" using default properties. ! - CALL h5fcreate_f(filename1, H5F_ACC_TRUNC_F, file1_id, error) + CALL h5fcreate_f(fix_filename1, H5F_ACC_TRUNC_F, file1_id, error) CALL check("h5fcreate_f",error,total_error) @@ -121,7 +142,7 @@ ! !Create second file "mount2.h5" using default properties. ! - CALL h5fcreate_f(filename2, H5F_ACC_TRUNC_F, file2_id, error) + CALL h5fcreate_f(fix_filename2, H5F_ACC_TRUNC_F, file2_id, error) CALL check("h5fcreate_f",error,total_error) ! @@ -158,26 +179,26 @@ ! !test whether files are in hdf5 format ! - CALL h5fis_hdf5_f(filename1, status, error) + CALL h5fis_hdf5_f(fix_filename1, status, error) CALL check("h5fis_hdf5_f",error,total_error) IF ( .NOT. status ) THEN - write(*,*) "File ", filename1, " is not in hdf5 format" + write(*,*) "File ", fix_filename1, " is not in hdf5 format" stop END IF - CALL h5fis_hdf5_f(filename2, status, error) + CALL h5fis_hdf5_f(fix_filename2, status, error) CALL check("h5fis_hdf5_f",error,total_error) IF ( .NOT. status ) THEN - write(*,*) "File ", filename2, " is not in hdf5 format" + write(*,*) "File ", fix_filename2, " is not in hdf5 format" stop END IF ! !reopen both files. ! - CALL h5fopen_f (filename1, H5F_ACC_RDWR_F, file1_id, error) + CALL h5fopen_f (fix_filename1, H5F_ACC_RDWR_F, file1_id, error) CALL check("hfopen_f",error,total_error) - CALL h5fopen_f (filename2, H5F_ACC_RDWR_F, file2_id, error) + CALL h5fopen_f (fix_filename2, H5F_ACC_RDWR_F, file2_id, error) CALL check("h5fopen_f",error,total_error) ! @@ -239,34 +260,33 @@ CALL h5fclose_f(file2_id, error) CALL check("h5fclose_f",error,total_error) - ! - ! Close FORTRAN predefined datatypes. - ! -! CALL h5close_types_f(error) -! CALL check("h5close_types_f",error,total_error) + if(cleanup) CALL h5_cleanup_f(filename1, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + if(cleanup) CALL h5_cleanup_f(filename2, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) RETURN END SUBROUTINE mountingtest ! -!The following subroutine tests h5freopen_f. -!It creates the file which has name "reopen.h5" and -!the "/dset" dataset inside the file. -!writes the data to the file, close the dataset. -!Reopen the file based upon the file_id, open the -!dataset use the reopen_id then reads the -!dataset back to memory to test whether the data -!read is identical to the data written +! The following subroutine tests h5freopen_f. +! It creates the file which has name "reopen.h5" and +! the "/dset" dataset inside the file. +! writes the data to the file, close the dataset. +! Reopen the file based upon the file_id, open the +! dataset use the reopen_id then reads the +! dataset back to memory to test whether the data +! read is identical to the data written ! - SUBROUTINE reopentest(total_error) + SUBROUTINE reopentest(cleanup, total_error) USE HDF5 ! This module contains all necessary modules IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error ! - !the dataset is stored in file "dsetf.h5" - ! - CHARACTER(LEN=9), PARAMETER :: filename = "reopen.h5" + CHARACTER(LEN=6), PARAMETER :: filename = "reopen" + CHARACTER(LEN=80) :: fix_filename INTEGER(HID_T) :: file_id, reopen_id ! File identifiers INTEGER(HID_T) :: dset_id ! Dataset identifier @@ -328,7 +348,12 @@ ! !Create file "reopen.h5" using default properties. ! - CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) + if (error .ne. 0) then + write(*,*) "Cannot modify filename" + stop + endif + CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file_id, error) CALL check("h5fcreate_f",error,total_error) ! @@ -408,35 +433,34 @@ CALL h5fclose_f(reopen_id, error) CALL check("h5fclose_f",error,total_error) - ! - !Close FORTRAN predifined datatypes - ! -! CALL h5close_types_f(error) -! CALL check("h5close_types_f",error,total_error) - + if(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) RETURN END SUBROUTINE reopentest ! -!The following example demonstrates how to get creation property list, -!and access property list. -!We first create a file using the default creation and access property -!list. Then, the file was closed and reopened. We then get the -!creation and access property lists of the first file. The second file is -!created using the got property lists - - SUBROUTINE plisttest(total_error) +! The following example demonstrates how to get creation property list, +! and access property list. +! We first create a file using the default creation and access property +! list. Then, the file was closed and reopened. We then get the +! creation and access property lists of the first file. The second file is +! created using the got property lists + + SUBROUTINE plisttest(cleanup, total_error) USE HDF5 ! This module contains all necessary modules IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error ! !file names are "plist1.h5" and "plist2.h5" ! - CHARACTER(LEN=9), PARAMETER :: filename1 = "plist1.h5" - CHARACTER(LEN=9), PARAMETER :: filename2 = "plist2.h5" + CHARACTER(LEN=6), PARAMETER :: filename1 = "plist1" + CHARACTER(LEN=80) :: fix_filename1 + CHARACTER(LEN=6), PARAMETER :: filename2 = "plist2" + CHARACTER(LEN=80) :: fix_filename2 INTEGER(HID_T) :: file1_id, file2_id ! File identifiers INTEGER(HID_T) :: prop_id ! File creation property list identifier @@ -446,15 +470,14 @@ INTEGER :: error ! - !Initialize FORTRAN predifined datatypes - ! -! CALL h5init_types_f(error) -! CALL check("h5init_types_f",error,total_error) - - ! !Create a file1 using default properties. ! - CALL h5fcreate_f(filename1, H5F_ACC_TRUNC_F, file1_id, error) + CALL h5_fixname_f(filename1, fix_filename1, H5P_DEFAULT_F, error) + if (error .ne. 0) then + write(*,*) "Cannot modify file name" + stop + endif + CALL h5fcreate_f(fix_filename1, H5F_ACC_TRUNC_F, file1_id, error) CALL check("h5fcreate_f",error,total_error) ! @@ -466,7 +489,7 @@ ! !Open an existing file. ! - CALL h5fopen_f (filename1, H5F_ACC_RDWR_F, file1_id, error) + CALL h5fopen_f (fix_filename1, H5F_ACC_RDWR_F, file1_id, error) CALL check("h5fopen_f",error,total_error) ! @@ -485,7 +508,12 @@ !based on the creation property list id and access property list id !create a new file ! - CALL h5fcreate_f(filename2, H5F_ACC_TRUNC_F, file2_id, error, & + CALL h5_fixname_f(filename2, fix_filename2, H5P_DEFAULT_F, error) + if (error .ne. 0) then + write(*,*) "Cannot modify file name" + stop + endif + CALL h5fcreate_f(fix_filename2, H5F_ACC_TRUNC_F, file2_id, error, & prop_id, access_id) CALL check("h5create_f",error,total_error) @@ -506,17 +534,15 @@ CALL h5fclose_f(file2_id, error) CALL check("h5fclose_f",error,total_error) - ! - !Close FORTRAN predifined datatypes - ! -! CALL h5close_types_f(error) -! CALL check("h5close_types_f",error,total_error) + if(cleanup) CALL h5_cleanup_f(filename1, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + if(cleanup) CALL h5_cleanup_f(filename2, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) RETURN END SUBROUTINE plisttest -! END MODULE H5FTEST diff --git a/fortran/test/tH5G.f90 b/fortran/test/tH5G.f90 index 8200f6b..f4b17f5 100644 --- a/fortran/test/tH5G.f90 +++ b/fortran/test/tH5G.f90 @@ -1,16 +1,33 @@ - SUBROUTINE group_test(total_error) -!THis subroutine tests following functionalities: -! h5gcreate_f, h5gopen_f, h5gclose_f, (?)h5gget_obj_info_idx_f, h5gn_members_f -!h5glink_f, h5gunlink_f, h5gmove_f, h5gget_linkval_f, h5gset_comment_f, -! h5gget_comment_f +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! + SUBROUTINE group_test(cleanup, total_error) + +! This subroutine tests following functionalities: +! h5gcreate_f, h5gopen_f, h5gclose_f, (?)h5gget_obj_info_idx_f, h5gn_members_f +! h5glink_f, h5gunlink_f, h5gmove_f, h5gget_linkval_f, h5gset_comment_f, +! h5gget_comment_f USE HDF5 ! This module contains all necessary modules IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error - CHARACTER(LEN=8), PARAMETER :: filename = "gtest.h5" !File name + CHARACTER(LEN=5), PARAMETER :: filename = "gtest" !File name + CHARACTER(LEN=80) :: fix_filename CHARACTER(LEN=33), PARAMETER :: comment = "Testing the group functionalities" ! comment for this file CHARACTER(LEN=7), PARAMETER :: groupname1 = "MyGroup" ! Group name @@ -45,7 +62,12 @@ ! ! Create the file. ! - CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) + if (error .ne. 0) then + write(*,*) "Cannot modify filename" + stop + endif + CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file_id, error) CALL check("h5fcreate_f",error,total_error) ! @@ -205,4 +227,7 @@ CALL check("h5dclose_f", error, total_error) CALL h5sclose_f(dspace_id, error) CALL check("h5sclose_f", error, total_error) + + if(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) END SUBROUTINE group_test diff --git a/fortran/test/tH5I.f90 b/fortran/test/tH5I.f90 index 958453b..7fd2edc 100644 --- a/fortran/test/tH5I.f90 +++ b/fortran/test/tH5I.f90 @@ -1,13 +1,16 @@ - SUBROUTINE identifier_test(total_error) -!THis subroutine tests following functionalities: h5iget_type_f + SUBROUTINE identifier_test(cleanup, total_error) + +! This subroutine tests following functionalities: h5iget_type_f USE HDF5 ! This module contains all necessary modules IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error - CHARACTER(LEN=9), PARAMETER :: filename = "itestf.h5" ! File name + CHARACTER(LEN=6), PARAMETER :: filename = "itestf" ! File name + CHARACTER(LEN=80) :: fix_filename CHARACTER(LEN=9), PARAMETER :: dsetname = "itestdset" ! Dataset name CHARACTER(LEN=10), PARAMETER :: groupname = "itestgroup"! group name CHARACTER(LEN=10), PARAMETER :: aname = "itestattr"! group name @@ -40,7 +43,12 @@ ! ! Create a new file using default properties. ! - CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) + if (error .ne. 0) then + write(*,*) "Cannot modify filename" + stop + endif + CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file_id, error) CALL check("h5fcreate_f",error,total_error) ! @@ -178,5 +186,8 @@ CALL h5fclose_f(file_id, error) CALL check("h5fclose_f",error,total_error) + if(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + RETURN END SUBROUTINE identifier_test diff --git a/fortran/test/tH5P.f90 b/fortran/test/tH5P.f90 index 0567b21..440f814 100644 --- a/fortran/test/tH5P.f90 +++ b/fortran/test/tH5P.f90 @@ -1,15 +1,32 @@ - SUBROUTINE external_test(total_error) -!THis subroutine tests following functionalities: -!h5pset_external_f, h5pget_external_count_f, -!h5pget_external_f +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! + SUBROUTINE external_test(cleanup, total_error) + +! This subroutine tests following functionalities: +! h5pset_external_f, h5pget_external_count_f, +! h5pget_external_f USE HDF5 ! This module contains all necessary modules IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error - CHARACTER(LEN=11), PARAMETER :: filename = "external.h5" + CHARACTER(LEN=8), PARAMETER :: filename = "external" + CHARACTER(LEN=80) :: fix_filename INTEGER(HID_T) :: file_id INTEGER(HID_T) :: plist_id INTEGER(HID_T) :: space_id @@ -28,16 +45,16 @@ !specified dataset INTEGER(SIZE_T) :: namesize - ! - ! Initialize FORTRAN predefined datatypes - ! -! CALL h5init_types_f(error) -! CALL check("h5init_types_f",error,total_error) ! !Create file "external.h5" using default properties. ! - CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) + if (error .ne. 0) then + write(*,*) "Cannot modify filename" + stop + endif + CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file_id, error) CALL check("h5fcreate_f",error,total_error) CALL h5pcreate_f(H5P_DATASET_CREATE_F, plist_id, error) @@ -93,9 +110,9 @@ CALL h5fclose_f(file_id, error) CALL check("h5fclose_f", error, total_error) -! CALL h5close_types_f(error) -! CALL check("h5close_types_f", error, total_error) + if(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) RETURN END SUBROUTINE external_test diff --git a/fortran/test/tH5R.f90 b/fortran/test/tH5R.f90 index 345345b..deb4b8a 100644 --- a/fortran/test/tH5R.f90 +++ b/fortran/test/tH5R.f90 @@ -1,22 +1,33 @@ + +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! ! ! ! Testing Reference Interface functionality. ! -! MODULE H5RTEST - -! USE HDF5 ! This module contains all necessary modules - -! CONTAINS -! -!The following subroutine tests h5rcreate_f, h5rdereference_f -!and H5Rget_object_type functions +! The following subroutine tests h5rcreate_f, h5rdereference_f +! and H5Rget_object_type functions ! - SUBROUTINE refobjtest(total_error) + SUBROUTINE refobjtest(cleanup, total_error) USE HDF5 ! This module contains all necessary modules IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error - CHARACTER(LEN=12), PARAMETER :: filename = "reference.h5" + CHARACTER(LEN=9), PARAMETER :: filename = "reference" + CHARACTER(LEN=80) :: fix_filename CHARACTER(LEN=8), PARAMETER :: dsetnamei = "INTEGERS" CHARACTER(LEN=17), PARAMETER :: dsetnamer = "OBJECT_REFERENCES" CHARACTER(LEN=6), PARAMETER :: groupname1 = "GROUP1" @@ -42,17 +53,17 @@ INTEGER, DIMENSION(5) :: data = (/1, 2, 3, 4, 5/) INTEGER, DIMENSION(7) :: data_dims - ! - ! Initialize FORTRAN predefined datatypes - ! -! CALL h5init_types_f(error) -! CALL check("h5init_types_f",error,total_error) ! !Create a new file with Default file access and !file creation properties . ! - CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) + if (error .ne. 0) then + write(*,*) "Cannot modify filename" + stop + endif + CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file_id, error) CALL check("h5fcreate_f",error,total_error) @@ -179,24 +190,25 @@ CALL check("h5dclose_f",error,total_error) CALL h5fclose_f(file_id, error) CALL check("h5fclose_f",error,total_error) - ! - ! Close FORTRAN predefined datatypes. - ! -! CALL h5close_types_f(error) -! CALL check("h5close_types_f",error,total_error) + + + if(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) RETURN END SUBROUTINE refobjtest ! -!The following subroutine tests h5rget_region_f, h5rcreate_f -!and h5rdereference_f functionalities +! The following subroutine tests h5rget_region_f, h5rcreate_f +! and h5rdereference_f functionalities ! - SUBROUTINE refregtest(total_error) + SUBROUTINE refregtest(cleanup, total_error) USE HDF5 ! This module contains all necessary modules IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error - CHARACTER(LEN=9), PARAMETER :: filename = "Refreg.h5" + CHARACTER(LEN=6), PARAMETER :: filename = "Refreg" + CHARACTER(LEN=80) :: fix_filename CHARACTER(LEN=6), PARAMETER :: dsetnamev = "MATRIX" CHARACTER(LEN=17), PARAMETER :: dsetnamer = "REGION_REFERENCES" @@ -232,7 +244,12 @@ ! ! Create a new file. ! - CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) + if (error .ne. 0) then + write(*,*) "Cannot modify filename" + stop + endif + CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file_id, error) ! Default file access and file creation ! properties are used. CALL check("h5fcreate_f", error, total_error) @@ -311,7 +328,7 @@ ! ! Reopen the file to test selections. ! - CALL h5fopen_f (filename, H5F_ACC_RDWR_F, file_id, error) + CALL h5fopen_f (fix_filename, H5F_ACC_RDWR_F, file_id, error) CALL check("h5fopen_f", error, total_error) CALL h5dopen_f(file_id, dsetnamer, dsetr_id, error) CALL check("h5dopen_f", error, total_error) @@ -366,14 +383,11 @@ CALL check("h5dclose_f", error, total_error) CALL h5fclose_f(file_id, error) CALL check("h5fclose_f", error, total_error) - ! - ! Close FORTRAN predefined datatypes. - ! -! CALL h5close_types_f(error) -! CALL check("h5close_types_f",error,total_error) + + + if(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) RETURN END SUBROUTINE refregtest - -! END MODULE H5RTEST diff --git a/fortran/test/tH5S.f90 b/fortran/test/tH5S.f90 index c20c445..cbdf5e6 100644 --- a/fortran/test/tH5S.f90 +++ b/fortran/test/tH5S.f90 @@ -1,29 +1,41 @@ + +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! ! ! ! Testing Dataspace Interface functionality. ! -! MODULE H5STEST - -! USE HDF5 ! This module contains all necessary modules - -! CONTAINS - ! -!The following subroutine tests the following functionalities: -!h5screate_f, h5scopy_f, h5screate_simple_f, h5sis_simple_f, -!h5sget_simple_extent_dims_f,h5sget_simple_extent_ndims_f -!h5sget_simple_extent_npoints_f, h5sget_simple_extent_type_f, -!h5sextent_copy_f, h5sset_extent_simple_f, h5sset_extent_none_f +! The following subroutine tests the following functionalities: +! h5screate_f, h5scopy_f, h5screate_simple_f, h5sis_simple_f, +! h5sget_simple_extent_dims_f,h5sget_simple_extent_ndims_f +! h5sget_simple_extent_npoints_f, h5sget_simple_extent_type_f, +! h5sextent_copy_f, h5sset_extent_simple_f, h5sset_extent_none_f ! - SUBROUTINE dataspace_basic_test(total_error) + SUBROUTINE dataspace_basic_test(cleanup, total_error) USE HDF5 ! This module contains all necessary modules IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error - CHARACTER(LEN=13), PARAMETER :: filename1 = "basicspace.h5" ! File1 name - CHARACTER(LEN=12), PARAMETER :: filename2 = "copyspace.h5" ! File2 name + CHARACTER(LEN=10), PARAMETER :: filename1 = "basicspace" ! File1 name + CHARACTER(LEN=9), PARAMETER :: filename2 = "copyspace" ! File2 name + CHARACTER(LEN=80) :: fix_filename1 + CHARACTER(LEN=80) :: fix_filename2 CHARACTER(LEN=9), PARAMETER :: dsetname = "basicdset" ! Dataset name INTEGER(HID_T) :: file1_id, file2_id ! File identifiers @@ -73,10 +85,20 @@ ! ! Create new files using default properties. ! - CALL h5fcreate_f(filename1, H5F_ACC_TRUNC_F, file1_id, error) + CALL h5_fixname_f(filename1, fix_filename1, H5P_DEFAULT_F, error) + if (error .ne. 0) then + write(*,*) "Cannot modify filename" + stop + endif + CALL h5fcreate_f(fix_filename1, H5F_ACC_TRUNC_F, file1_id, error) CALL check("h5fcreate_f", error, total_error) - CALL h5fcreate_f(filename2, H5F_ACC_TRUNC_F, file2_id, error) + CALL h5_fixname_f(filename2, fix_filename2, H5P_DEFAULT_F, error) + if (error .ne. 0) then + write(*,*) "Cannot modify filename" + stop + endif + CALL h5fcreate_f(fix_filename2, H5F_ACC_TRUNC_F, file2_id, error) CALL check("h5fcreate_f", error, total_error) ! @@ -243,14 +265,11 @@ CALL h5fclose_f(file2_id, error) CALL check("h5fclose_f", error, total_error) - ! - !Close FORTRAN predifined datatypes - ! -! CALL h5close_types_f(error) -! CALL check("h5close_types_f",error,total_error) + if(cleanup) CALL h5_cleanup_f(filename1, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + if(cleanup) CALL h5_cleanup_f(filename2, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) RETURN END SUBROUTINE dataspace_basic_test - -! END MODULE H5STEST diff --git a/fortran/test/tH5Sselect.f90 b/fortran/test/tH5Sselect.f90 index 64d4916..8f653d3 100644 --- a/fortran/test/tH5Sselect.f90 +++ b/fortran/test/tH5Sselect.f90 @@ -1,27 +1,41 @@ + +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! ! ! Testing Selection-related Dataspace Interface functionality. ! ! -!The following subroutines tests the following functionalities: -!h5sget_select_npoints_f, h5sselect_elements_f, h5sselect_all_f, -!h5sselect_none_f, h5sselect_valid_f, h5sselect_hyperslab_f, -!h5sget_select_bounds_f, h5sget_select_elem_pointlist_f, -!h5sget_select_elem_npoints_f, h5sget_select_hyper_blocklist_f, -!h5sget_select_hyper_nblocks_f, h5sget_select_npoints_f +! The following subroutines tests the following functionalities: +! h5sget_select_npoints_f, h5sselect_elements_f, h5sselect_all_f, +! h5sselect_none_f, h5sselect_valid_f, h5sselect_hyperslab_f, +! h5sget_select_bounds_f, h5sget_select_elem_pointlist_f, +! h5sget_select_elem_npoints_f, h5sget_select_hyper_blocklist_f, +! h5sget_select_hyper_nblocks_f, h5sget_select_npoints_f ! - SUBROUTINE test_select_hyperslab(total_error) + SUBROUTINE test_select_hyperslab(cleanup, total_error) USE HDF5 ! This module contains all necessary modules IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error - ! - !the dataset is stored in file "sdsf.h5" - ! - CHARACTER(LEN=7), PARAMETER :: filename = "sdsf.h5" + CHARACTER(LEN=7), PARAMETER :: filename = "tselect" + CHARACTER(LEN=80) :: fix_filename ! !dataset name is "IntArray" @@ -136,7 +150,12 @@ ! !Create a new file using default properties. ! - CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) + if (error .ne. 0) then + write(*,*) "Cannot modify filename" + stop + endif + CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file_id, error) CALL check("h5fcreate_f", error, total_error) ! @@ -197,7 +216,7 @@ ! !Open the file. ! - CALL h5fopen_f (filename, H5F_ACC_RDONLY_F, file_id, error) + CALL h5fopen_f (fix_filename, H5F_ACC_RDONLY_F, file_id, error) CALL check("h5fopen_f", error, total_error) ! @@ -282,11 +301,9 @@ CALL h5fclose_f(file_id, error) CALL check("h5fclose_f", error, total_error) - ! - ! Close FORTRAN predefined datatypes. - ! -! CALL h5close_types_f(error) -! CALL check("h5close_types_f", error, total_error) + + if(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) RETURN END SUBROUTINE test_select_hyperslab @@ -295,22 +312,25 @@ !Subroutine to test element selection ! - SUBROUTINE test_select_element(total_error) + SUBROUTINE test_select_element(cleanup, total_error) USE HDF5 ! This module contains all necessary modules IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error ! !the dataset1 is stored in file "copy1.h5" ! - CHARACTER(LEN=8), PARAMETER :: filename1 = "copy1.h5" + CHARACTER(LEN=13), PARAMETER :: filename1 = "tselect_copy1" + CHARACTER(LEN=80) :: fix_filename1 ! !the dataset2 is stored in file "copy2.h5" ! - CHARACTER(LEN=8), PARAMETER :: filename2 = "copy2.h5" + CHARACTER(LEN=13), PARAMETER :: filename2 = "tselect_copy2" + CHARACTER(LEN=80) :: fix_filename2 ! !dataset1 name is "Copy1" ! @@ -411,10 +431,20 @@ ! !Create file1, file2 using default properties. ! - CALL h5fcreate_f(filename1, H5F_ACC_TRUNC_F, file1_id, error) + CALL h5_fixname_f(filename1, fix_filename1, H5P_DEFAULT_F, error) + if (error .ne. 0) then + write(*,*) "Cannot modify filename" + stop + endif + CALL h5fcreate_f(fix_filename1, H5F_ACC_TRUNC_F, file1_id, error) CALL check("h5fcreate_f", error, total_error) - CALL h5fcreate_f(filename2, H5F_ACC_TRUNC_F, file2_id, error) + CALL h5_fixname_f(filename2, fix_filename2, H5P_DEFAULT_F, error) + if (error .ne. 0) then + write(*,*) "Cannot modify filename" + stop + endif + CALL h5fcreate_f(fix_filename2, H5F_ACC_TRUNC_F, file2_id, error) CALL check("h5fcreate_f", error, total_error) ! @@ -484,10 +514,10 @@ ! !Open the files. ! - CALL h5fopen_f (filename1, H5F_ACC_RDWR_F, file1_id, error) + CALL h5fopen_f (fix_filename1, H5F_ACC_RDWR_F, file1_id, error) CALL check("h5fopen_f", error, total_error) - CALL h5fopen_f (filename2, H5F_ACC_RDWR_F, file2_id, error) + CALL h5fopen_f (fix_filename2, H5F_ACC_RDWR_F, file2_id, error) CALL check("h5fopen_f", error, total_error) ! @@ -588,10 +618,10 @@ ! !Open the files. ! - CALL h5fopen_f (filename1, H5F_ACC_RDWR_F, file1_id, error) + CALL h5fopen_f (fix_filename1, H5F_ACC_RDWR_F, file1_id, error) CALL check("h5fopen_f", error, total_error) - CALL h5fopen_f (filename2, H5F_ACC_RDWR_F, file2_id, error) + CALL h5fopen_f (fix_filename2, H5F_ACC_RDWR_F, file2_id, error) CALL check("h5fopen_f", error, total_error) ! @@ -651,25 +681,27 @@ CALL h5fclose_f(file2_id, error) CALL check("h5fclose_f", error, total_error) - ! - ! Close FORTRAN predefined datatypes. - ! -! CALL h5close_types_f(error) -! CALL check("h5close_types_f", error, total_error) + if(cleanup) CALL h5_cleanup_f(filename1, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + if(cleanup) CALL h5_cleanup_f(filename2, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + RETURN END SUBROUTINE test_select_element - SUBROUTINE test_basic_select(total_error) + SUBROUTINE test_basic_select(cleanup, total_error) USE HDF5 ! This module contains all necessary modules IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error ! !the dataset is stored in file "testselect.h5" ! - CHARACTER(LEN=13), PARAMETER :: filename = "testselect.h5" + CHARACTER(LEN=10), PARAMETER :: filename = "testselect" + CHARACTER(LEN=80) :: fix_filename ! !dataspace rank @@ -809,16 +841,16 @@ coord(2,9) = 3 coord(1,10) = 5 coord(2,10) = 5 - ! - !Initialize FORTRAN predifined datatypes - ! -! CALL h5init_types_f(error) -! CALL check("h5init_types_f", error, total_error) ! !Create a new file using default properties. ! - CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) + if (error .ne. 0) then + write(*,*) "Cannot modify filename" + stop + endif + CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file_id, error) CALL check("h5fcreate_f", error, total_error) ! @@ -863,7 +895,7 @@ ! !Open the file. ! - CALL h5fopen_f (filename, H5F_ACC_RDONLY_F, file_id, error) + CALL h5fopen_f (fix_filename, H5F_ACC_RDONLY_F, file_id, error) CALL check("h5fopen_f", error, total_error) ! @@ -995,12 +1027,11 @@ CALL h5fclose_f(file_id, error) CALL check("h5fclose_f", error, total_error) - ! - ! Close FORTRAN predefined datatypes. - ! -! CALL h5close_types_f(error) -! CALL check("h5close_types_f", error, total_error) + if(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + + RETURN END SUBROUTINE test_basic_select diff --git a/fortran/test/tH5T.f90 b/fortran/test/tH5T.f90 index 43c3a9e..d546cd0 100644 --- a/fortran/test/tH5T.f90 +++ b/fortran/test/tH5T.f90 @@ -1,4 +1,19 @@ - SUBROUTINE compoundtest(total_error) + +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! + SUBROUTINE compoundtest(cleanup, total_error) ! ! This program creates a dataset that is one dimensional array of ! structures { @@ -18,9 +33,11 @@ USE HDF5 ! This module contains all necessary modules IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error - CHARACTER(LEN=11), PARAMETER :: filename = "compound.h5" ! File name + CHARACTER(LEN=8), PARAMETER :: filename = "compound" ! File name + CHARACTER(LEN=80) :: fix_filename CHARACTER(LEN=8), PARAMETER :: dsetname = "Compound" ! Dataset name INTEGER, PARAMETER :: dimsize = 6 ! Size of the dataset INTEGER, PARAMETER :: COMP_NUM_MEMBERS = 4 ! Number of members in the compound datatype @@ -88,11 +105,6 @@ enddo ! - ! Initialize FORTRAN predefined datatypes. - ! -! CALL h5init_types_f(error) -! CALL check("h5init_types_f", error, total_error) - ! ! Set dataset transfer property to preserve partially initialized fields ! during write/read to/from dataset with compound datatype. ! @@ -103,7 +115,12 @@ ! ! Create a new file using default properties. ! - CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) + if (error .ne. 0) then + write(*,*) "Cannot modify filename" + stop + endif + CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file_id, error) CALL check("h5fcreate_f", error, total_error) ! @@ -229,9 +246,6 @@ CALL check("h5tclose_f", error, total_error) CALL h5tclose_f(dt4_id, error) CALL check("h5tclose_f", error, total_error) -! We will keep this type open -! CALL h5tclose_f(dt5_id, error) -! CALL check("h5tclose_f", error, total_error) ! ! Create and store compound datatype with the character and @@ -264,7 +278,7 @@ ! ! Open the file. ! - CALL h5fopen_f (filename, H5F_ACC_RDWR_F, file_id, error) + CALL h5fopen_f (fix_filename, H5F_ACC_RDWR_F, file_id, error) CALL check("h5fopen_f", error, total_error) ! ! Open the dataset. @@ -297,6 +311,7 @@ CALL check("h5tget_member_name_f", error, total_error) CALL h5tget_member_offset_f(dtype_id, i-1, offset_out, error) CALL check("h5tget_member_offset_f", error, total_error) + CHECK_NAME: SELECT CASE (member_name(1:len)) CASE("char_field") if(offset_out .ne. 0) then @@ -455,33 +470,30 @@ CALL check("h5tclose_f", error, total_error) CALL h5fclose_f(file_id, error) CALL check("h5fclose_f", error, total_error) - ! - ! Close FORTRAN predefined datatypes. - ! -! CALL h5close_types_f(error) -! CALL check("h5close_types_f", error, total_error) + if(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) RETURN END SUBROUTINE compoundtest - SUBROUTINE basic_data_type_test(total_error) -!THis subroutine tests following functionalities: -!H5tget_precision_f, H5tset_precision_f, H5tget_offset_f -!H5tset_offset_f, H5tget_pad_f, H5tset_pad_f, H5tget_sign_f, -!H5tset_sign_f, H5tget_ebias_f,H5tset_ebias_f, H5tget_norm_f, -!H5tset_norm_f, H5tget_inpad_f, H5tset_inpad_f, H5tget_cset_f, -!H5tset_cset_f, H5tget_strpad_f, H5tset_strpad_f + SUBROUTINE basic_data_type_test(cleanup, total_error) + +! This subroutine tests following functionalities: +! H5tget_precision_f, H5tset_precision_f, H5tget_offset_f +! H5tset_offset_f, H5tget_pad_f, H5tset_pad_f, H5tget_sign_f, +! H5tset_sign_f, H5tget_ebias_f,H5tset_ebias_f, H5tget_norm_f, +! H5tset_norm_f, H5tget_inpad_f, H5tset_inpad_f, H5tget_cset_f, +! H5tset_cset_f, H5tget_strpad_f, H5tset_strpad_f USE HDF5 ! This module contains all necessary modules IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error - CHARACTER(LEN=13), PARAMETER :: filename = "basic_type.h5" ! File name - INTEGER(HID_T) :: dtype1_id, dtype2_id, dtype3_id, dtype4_id, dtype5_id ! datatype identifiers INTEGER(SIZE_T) :: precision ! Datatype precision @@ -499,11 +511,6 @@ INTEGER :: cset !character set type of a string datatype INTEGER :: strpad !string padding method for a string datatype INTEGER :: error !error flag - ! - ! Initialize FORTRAN predefined datatypes - ! -! CALL h5init_types_f(error) -! CALL check("h5init_types_f",error,total_error) ! @@ -692,8 +699,6 @@ CALL h5tclose_f(dtype5_id, error) CALL check("h5tclose_f", error, total_error) -! CALL h5close_types_f(error) -! CALL check("h5close_types_f", error, total_error) RETURN END SUBROUTINE basic_data_type_test diff --git a/fortran/test/tf.f90 b/fortran/test/tf.f90 new file mode 100644 index 0000000..ef4c784 --- /dev/null +++ b/fortran/test/tf.f90 @@ -0,0 +1,134 @@ + +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +! +! +! This file contains subroutines which are used in +! all the hdf5 fortran tests +! + + SUBROUTINE check(string,error,total_error) + CHARACTER(LEN=*) :: string + INTEGER :: error, total_error + if (error .lt. 0) then + total_error=total_error+1 + write(*,*) string, " failed" + endif + RETURN + END SUBROUTINE check + +!---------------------------------------------------------------------- +! Name: h5_fixname_f +! +! Purpose: Create a file name from the a file base name. +! It is a fortran counterpart for the h5_fixname in ../../test/h5test.c +! +! Inputs: +! base_name - base name of the file +! fapl - file access property list +! Outputs: +! full_name - full file name +! hdferr: - error code +! Success: 0 +! Failure: -1 +! +! Programmer: Elena Pourmal +! September 13, 2002 +! +! +!---------------------------------------------------------------------- + SUBROUTINE h5_fixname_f(base_name, full_name, fapl, hdferr) +! + USE H5GLOBAL + IMPLICIT NONE + CHARACTER(LEN=*), INTENT(IN) :: base_name ! base name + CHARACTER(LEN=*), INTENT(IN) :: full_name ! full name + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), INTENT(IN) :: fapl ! file access property list + + INTEGER :: base_namelen ! Length of the base name character string + INTEGER :: full_namelen ! Length of the full name character string +! INTEGER(HID_T) :: fapl_default + + INTERFACE + INTEGER FUNCTION h5_fixname_c(base_name, base_namelen, fapl, & + full_name, full_namelen) + USE H5GLOBAL + !DEC$ IF DEFINED(HDF5F90_WINDOWS) + !MS$ATTRIBUTES C,reference,alias:'_H5_FIXNAME_C':: h5_fixname_c + !DEC$ ENDIF + !DEC$ATTRIBUTES reference :: base_name + !DEC$ATTRIBUTES reference :: full_name + CHARACTER(LEN=*), INTENT(IN) :: base_name + INTEGER :: base_namelen + INTEGER(HID_T), INTENT(IN) :: fapl + CHARACTER(LEN=*), INTENT(IN) :: full_name + INTEGER :: full_namelen + END FUNCTION h5_fixname_c + END INTERFACE + + base_namelen = LEN(base_name) + full_namelen = LEN(full_name) + hdferr = h5_fixname_c(base_name, base_namelen, fapl, & + full_name, full_namelen) + + END SUBROUTINE h5_fixname_f + +!---------------------------------------------------------------------- +! Name: h5_cleanup_f +! +! Purpose: Cleanups tests files +! It is a fortran counterpart for the h5_cleanup in ../../test/h5test.c +! +! Inputs: +! base_name - base name of the file +! fapl - file access property list +! Outputs: +! hdferr: - error code +! Success: 0 +! Failure: -1 +! +! Programmer: Elena Pourmal +! September 19, 2002 +! +! +!---------------------------------------------------------------------- + SUBROUTINE h5_cleanup_f(base_name, fapl, hdferr) +! + USE H5GLOBAL + IMPLICIT NONE + CHARACTER(LEN=*), INTENT(IN) :: base_name ! base name + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), INTENT(IN) :: fapl ! file access property list + + INTEGER :: base_namelen ! Length of the base name character string + + INTERFACE + INTEGER FUNCTION h5_cleanup_c(base_name, base_namelen, fapl) + USE H5GLOBAL + !DEC$ IF DEFINED(HDF5F90_WINDOWS) + !MS$ATTRIBUTES C,reference,alias:'_H5_CLEANUP_C':: h5_cleanup_c + !DEC$ ENDIF + !DEC$ATTRIBUTES reference :: base_name + CHARACTER(LEN=*), INTENT(IN) :: base_name + INTEGER :: base_namelen + INTEGER(HID_T), INTENT(IN) :: fapl + END FUNCTION h5_cleanup_c + END INTERFACE + + base_namelen = LEN(base_name) + hdferr = h5_cleanup_c(base_name, base_namelen, fapl) + + END SUBROUTINE h5_cleanup_f diff --git a/fortran/testpar/Makefile.in b/fortran/testpar/Makefile.in index 4f5de0e..2ee682a 100644 --- a/fortran/testpar/Makefile.in +++ b/fortran/testpar/Makefile.in @@ -1,8 +1,18 @@ ## HDF5 Fortran Parallel Library Test Makefile(.in) ## -## Copyright (C) 2000 National Center for Supercomputing Applications -## All rights reserved + +## +## 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have +## access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. ## top_srcdir=@top_srcdir@/.. top_builddir=../.. @@ -16,6 +26,8 @@ hdf5_builddir=$(top_builddir)/src LT_LINK_LIB=$(LT) --mode=link $(F9X) -static -rpath $(libdir) LIBFORTRAN=../src/libhdf5_fortran.la LIBHDF5=$(hdf5_builddir)/libhdf5.la +FTLIB = ../test/libh5test_fortran.la +CTLIB = ../../test/.libs/libh5test.a ## These tests are parallel RUNTEST=$(RUNPARALLEL) @@ -28,7 +40,7 @@ MOSTLYCLEAN=ParaEg[123].h5f DISTCLEAN=go ## Test source files -TEST_PFORTRAN_SRC=ptesthdf5_fortran.f90 thdf5.f90 tcheck.f90 thyperslab_wr.f90 +TEST_PFORTRAN_SRC=ptesthdf5_fortran.f90 thdf5.f90 thyperslab_wr.f90 TEST_PFORTRAN_OBJ=$(TEST_PFORTRAN_SRC:.f90=.lo) TEST_SRC=$(TEST_PFORTRAN_SRC) TEST_OBJ=$(TEST_SRC:.f90=.lo) @@ -44,7 +56,7 @@ $(TEST_OBJ): $(TEST_HDR) thyperslab_wr.lo: $(srcdir)/thyperslab_wr.f90 thdf5.lo ptesthdf5_fortran.lo: $(srcdir)/ptesthdf5_fortran.f90 thdf5.lo -ptesthdf5_fortran: thdf5.lo thyperslab_wr.lo tcheck.lo ptesthdf5_fortran.lo - @$(LT_LINK_FEXE) $(FFLAGS) -o $@ ptesthdf5_fortran.lo thdf5.lo thyperslab_wr.lo tcheck.lo $(LIBFORTRAN) $(LIBHDF5) $(LIBS) +ptesthdf5_fortran: thdf5.lo thyperslab_wr.lo ptesthdf5_fortran.lo + @$(LT_LINK_FEXE) $(FFLAGS) -o $@ ptesthdf5_fortran.lo thdf5.lo thyperslab_wr.lo $(FTLIB) $(CTLIB) $(LIBFORTRAN) $(LIBHDF5) $(LIBS) @CONCLUDE@ diff --git a/fortran/testpar/ptesthdf5_fortran.f90 b/fortran/testpar/ptesthdf5_fortran.f90 index c44008d..1ac0379 100644 --- a/fortran/testpar/ptesthdf5_fortran.f90 +++ b/fortran/testpar/ptesthdf5_fortran.f90 @@ -1,3 +1,18 @@ + +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! ! ! Main program for parallel HDF5 Fortran tests. @@ -16,6 +31,8 @@ INTEGER :: mpierror ! MPI error flag INTEGER :: comm, info INTEGER :: mpi_size, mpi_rank + LOGICAL :: cleanup = .TRUE. +! LOGICAL :: cleanup = .FALSE. comm = MPI_COMM_WORLD info = MPI_INFO_NULL CALL MPI_INIT(mpierror) @@ -45,7 +62,7 @@ if (mpi_rank .eq. 0) then write(*,*) 'Writing/reading dataset by hyperslabs' endif - CALL dataset_wr_by_hyperslabs(error_1) + CALL dataset_wr_by_hyperslabs(cleanup, error_1) if (error_1 .ne. 0 ) write(*,*) 'Process ', mpi_rank, 'reports failure' if (mpi_rank .eq. 0) then write(*,*) diff --git a/fortran/testpar/tcheck.f90 b/fortran/testpar/tcheck.f90 deleted file mode 100644 index 978c832..0000000 --- a/fortran/testpar/tcheck.f90 +++ /dev/null @@ -1,16 +0,0 @@ -! -! -! This module contains check subroutine which is used in -! all the fortran h5 test files -! - - SUBROUTINE check(string,error,total_error) - CHARACTER(LEN=*) :: string - INTEGER :: error, total_error - if (error .lt. 0) then - total_error=total_error+1 - write(*,*) string, " failed" - endif - RETURN - END SUBROUTINE check - diff --git a/fortran/testpar/thdf5.f90 b/fortran/testpar/thdf5.f90 index 0d38f88..abb5797 100644 --- a/fortran/testpar/thdf5.f90 +++ b/fortran/testpar/thdf5.f90 @@ -1,3 +1,18 @@ + +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! MODULE THDF5 USE HDF5 include 'mpif.h' diff --git a/fortran/testpar/thyperslab_wr.f90 b/fortran/testpar/thyperslab_wr.f90 index b6da747..ff57998 100644 --- a/fortran/testpar/thyperslab_wr.f90 +++ b/fortran/testpar/thyperslab_wr.f90 @@ -1,11 +1,29 @@ + +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! ! ! This test writes/reads dataset by hyperslabs collectively. - SUBROUTINE dataset_wr_by_hyperslabs(total_error) + SUBROUTINE dataset_wr_by_hyperslabs(cleanup, total_error) USE THDF5 IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup + INTEGER, INTENT(OUT) :: total_error - CHARACTER(LEN=7), PARAMETER :: filename = "sdsf.h5" ! File name + CHARACTER(LEN=8), PARAMETER :: filename = "par_sdsf" ! File name + CHARACTER(LEN=80) :: fix_filename CHARACTER(LEN=8), PARAMETER :: dsetname = "IntArray" ! Dataset name INTEGER(HID_T) :: file_id ! File identifier @@ -25,7 +43,7 @@ INTEGER :: i, j INTEGER :: dims(7) - INTEGER :: total_error, error ! Error flags + INTEGER :: error ! Error flag ! ! MPI definitions and calls. ! @@ -43,11 +61,12 @@ CALL check("h5pcreate_f", error, total_error) CALL h5pset_fapl_mpio_f(plac_id, comm, info, error) CALL check("h5pset_fapl_mpio_f", error, total_error) + CALL h5_fixname_f(filename, fix_filename, plac_id, error) ! ! Create the file collectively. ! - CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error, access_prp = plac_id) + CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file_id, error, access_prp = plac_id) CALL check("h5fcreate_f", error, total_error) CALL h5pclose_f(plac_id, error) CALL check("h5pclose_f", error, total_error) @@ -137,10 +156,8 @@ CALL check("h5pcreate_f", error, total_error) CALL h5pset_fapl_mpio_f(plac_id, comm, info, error) CALL check("h5pset_fapl_mpio_f", error, total_error) - CALL h5fopen_f(filename, H5F_ACC_RDWR_F, file_id, error, plac_id) + CALL h5fopen_f(fix_filename, H5F_ACC_RDWR_F, file_id, error, plac_id) CALL check("h5fopen_f", error, total_error) - CALL h5pclose_f(plac_id, error) - CALL check("h5pclose_f", error, total_error) ! ! Open dataset. ! @@ -221,4 +238,11 @@ CALL h5fclose_f(file_id, error) CALL check("h5fclose_f", error, total_error) + if(cleanup) CALL h5_cleanup_f(filename, plac_id, error) + CALL check("h5_cleanup_f", error, total_error) + + CALL h5pclose_f(plac_id, error) + CALL check("h5pclose_f", error, total_error) + + RETURN END SUBROUTINE dataset_wr_by_hyperslabs |