summaryrefslogtreecommitdiffstats
path: root/fortran
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2007-02-06 00:13:51 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2007-02-06 00:13:51 (GMT)
commit4e57d80f2e085a80dfe5f55a39c15e1edc4366f9 (patch)
treebb62a843f67c0e873b25e85a87aff438dba927a3 /fortran
parentc560e68258bef4235fac0cebfe65e8850e25b61d (diff)
downloadhdf5-4e57d80f2e085a80dfe5f55a39c15e1edc4366f9.zip
hdf5-4e57d80f2e085a80dfe5f55a39c15e1edc4366f9.tar.gz
hdf5-4e57d80f2e085a80dfe5f55a39c15e1edc4366f9.tar.bz2
[svn-r13242] Bug fix.
It was hardcoded to use /tmp/... as the default test file name. Changed it to use $HDF5_PARAPREFIX/... to compose the test file name. Platform Tested: tg-ncsa since it failed there. (Will test other platforms after commit.)
Diffstat (limited to 'fortran')
-rw-r--r--fortran/examples/ph5example.f9018
1 files changed, 16 insertions, 2 deletions
diff --git a/fortran/examples/ph5example.f90 b/fortran/examples/ph5example.f90
index 4f19268..543e6fa 100644
--- a/fortran/examples/ph5example.f90
+++ b/fortran/examples/ph5example.f90
@@ -22,10 +22,11 @@
IMPLICIT NONE
INCLUDE 'mpif.h'
- ! Hard coded the file name. Change it according to where your PFS is.
- CHARACTER(LEN=20), PARAMETER :: filename = "/tmp/sds.h5" ! File name
+ CHARACTER(LEN=10), PARAMETER :: default_fname = "sds.h5" ! Default name
CHARACTER(LEN=8), PARAMETER :: dsetname = "IntArray" ! Dataset name
+ CHARACTER(LEN=100) :: filename ! File name
+ INTEGER :: fnamelen ! File name length
INTEGER(HID_T) :: file_id ! File identifier
INTEGER(HID_T) :: dset_id ! Dataset identifier
INTEGER(HID_T) :: filespace ! Dataspace identifier in file
@@ -73,6 +74,19 @@
CALL h5pset_fapl_mpio_f(plist_id, comm, info, error)
!
+ ! Figure out the filename to use. If your system does not support
+ ! getenv, comment that statement with this,
+ ! filename = ""
+ CALL getenv("HDF5_PARAPREFIX", filename)
+ fnamelen = LEN_TRIM(filename)
+ if ( fnamelen == 0 ) then
+ filename = default_fname
+ else
+ filename = filename(1:fnamelen) // "/" // default_fname
+ endif
+ print *, "Using filename = ", filename
+
+ !
! Create the file collectively.
!
CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error, access_prp = plist_id)