summaryrefslogtreecommitdiffstats
path: root/fortran
diff options
context:
space:
mode:
authorElena Pourmal <epourmal@hdfgroup.org>2000-11-03 19:49:59 (GMT)
committerElena Pourmal <epourmal@hdfgroup.org>2000-11-03 19:49:59 (GMT)
commitada3710bc71fc8781a69cb0d87718dc608a9e553 (patch)
tree3f98829b376de309c1946db497359f72a15e2389 /fortran
parent39e47fe74d4991ea478ab579387c1860c4f503f1 (diff)
downloadhdf5-ada3710bc71fc8781a69cb0d87718dc608a9e553.zip
hdf5-ada3710bc71fc8781a69cb0d87718dc608a9e553.tar.gz
hdf5-ada3710bc71fc8781a69cb0d87718dc608a9e553.tar.bz2
[svn-r2797]
Purpose: Maintenance Description: Updated examples to use new F90 programming model Platforms tested: O2K and Solaris2.7
Diffstat (limited to 'fortran')
-rw-r--r--fortran/examples/attrexample.f908
-rw-r--r--fortran/examples/compound.f908
-rw-r--r--fortran/examples/dsetexample.f908
-rw-r--r--fortran/examples/fileexample.f9011
-rw-r--r--fortran/examples/groupexample.f909
-rw-r--r--fortran/examples/grpdsetexample.f908
-rw-r--r--fortran/examples/grpit.f909
-rw-r--r--fortran/examples/grpsexample.f909
-rw-r--r--fortran/examples/hyperslab.f9012
-rw-r--r--fortran/examples/mountexample.f9056
-rw-r--r--fortran/examples/refobjexample.f908
-rw-r--r--fortran/examples/refregexample.f908
-rw-r--r--fortran/examples/rwdsetexample.f908
-rw-r--r--fortran/examples/selectele.f908
14 files changed, 104 insertions, 66 deletions
diff --git a/fortran/examples/attrexample.f90 b/fortran/examples/attrexample.f90
index c71939e..62df1c0 100644
--- a/fortran/examples/attrexample.f90
+++ b/fortran/examples/attrexample.f90
@@ -38,9 +38,9 @@
! attrlen = 27
attrlen = 80
!
- ! Initialize FORTRAN predefined datatypes.
+ ! Initialize FORTRAN interface.
!
- CALL h5init_types_f(error)
+ CALL h5init_fortran_f(error)
!
! Open an existing file.
@@ -94,9 +94,9 @@
CALL h5fclose_f(file_id, error)
!
- ! Close FORTRAN predefined datatypes.
+ ! Close FORTRAN interface.
!
- CALL h5close_types_f(error)
+ CALL h5close_fortran_f(error)
END PROGRAM ATTREXAMPLE
diff --git a/fortran/examples/compound.f90 b/fortran/examples/compound.f90
index f2954e8..d7a9ac6 100644
--- a/fortran/examples/compound.f90
+++ b/fortran/examples/compound.f90
@@ -62,9 +62,9 @@
enddo
!
- ! Initialize FORTRAN predefined datatypes.
+ ! Initialize FORTRAN interface.
!
- CALL h5init_types_f(error)
+ CALL h5init_fortran_f(error)
!
! Set dataset transfer property to preserve partially initialized fields
! during write/read to/from dataset with compound datatype.
@@ -206,9 +206,9 @@
CALL h5tclose_f(dt2_id, error)
CALL h5fclose_f(file_id, error)
!
- ! Close FORTRAN predefined datatypes.
+ ! Close FORTRAN interface.
!
- CALL h5close_types_f(error)
+ CALL h5close_fortran_f(error)
END PROGRAM COMPOUNDEXAMPLE
diff --git a/fortran/examples/dsetexample.f90 b/fortran/examples/dsetexample.f90
index 00974a9..2d8b96f 100644
--- a/fortran/examples/dsetexample.f90
+++ b/fortran/examples/dsetexample.f90
@@ -25,9 +25,9 @@
INTEGER :: error ! Error flag
!
- ! Initialize FORTRAN predefined datatypes.
+ ! Initialize FORTRAN interface.
!
- CALL h5init_types_f(error)
+ CALL h5init_fortran_f(error)
!
! Create a new file using default properties.
@@ -61,9 +61,9 @@
CALL h5fclose_f(file_id, error)
!
- ! Close FORTRAN predefined datatypes.
+ ! Close FORTRAN interface.
!
- CALL h5close_types_f(error)
+ CALL h5close_fortran_f(error)
END PROGRAM DSETEXAMPLE
diff --git a/fortran/examples/fileexample.f90 b/fortran/examples/fileexample.f90
index 33c3bc2..23ba664 100644
--- a/fortran/examples/fileexample.f90
+++ b/fortran/examples/fileexample.f90
@@ -13,7 +13,11 @@
INTEGER(HID_T) :: file_id ! File identifier
INTEGER :: error ! Error flag
-
+
+!
+! Initialize FORTRAN interface.
+!
+ CALL h5init_fortran_f (error)
!
! Create a new file using default properties.
!
@@ -23,5 +27,8 @@
! Terminate access to the file.
!
CALL h5fclose_f(file_id, error)
-
+!
+! Close FORTRAN interface.
+!
+ CALL h5close_fortran_f(error)
END PROGRAM FILEEXAMPLE
diff --git a/fortran/examples/groupexample.f90 b/fortran/examples/groupexample.f90
index 148a796..3b0bb0e 100644
--- a/fortran/examples/groupexample.f90
+++ b/fortran/examples/groupexample.f90
@@ -18,7 +18,10 @@
INTEGER(HID_T) :: group_id ! Group identifier
INTEGER :: error ! Error flag
-
+!
+! Initialize FORTRAN interface.
+!
+ CALL h5init_fortran_f(error)
!
! Create a new file using default properties.
!
@@ -38,5 +41,9 @@
! Terminate access to the file.
!
CALL h5fclose_f(file_id, error)
+!
+! Close FORTRAN interface.
+!
+ CALL h5close_fortran_f(error)
END PROGRAM GROUPEXAMPLE
diff --git a/fortran/examples/grpdsetexample.f90 b/fortran/examples/grpdsetexample.f90
index 75bc335..cbff722 100644
--- a/fortran/examples/grpdsetexample.f90
+++ b/fortran/examples/grpdsetexample.f90
@@ -52,9 +52,9 @@
end do
!
- ! Initialize FORTRAN predefined datatypes.
+ ! Initialize FORTRAN interface.
!
- CALL h5init_types_f(error)
+ CALL h5init_fortran_f(error)
!
! Open an existing file.
@@ -129,8 +129,8 @@
CALL h5fclose_f(file_id, error)
!
- ! Close FORTRAN predefined datatypes.
+ ! Close FORTRAN interface.
!
- CALL h5close_types_f(error)
+ CALL h5close_fortran_f(error)
END PROGRAM GRPDSETEXAMPLE
diff --git a/fortran/examples/grpit.f90 b/fortran/examples/grpit.f90
index 66fb09e..bf3ddb3 100644
--- a/fortran/examples/grpit.f90
+++ b/fortran/examples/grpit.f90
@@ -57,9 +57,9 @@
end do
!
- ! Initialize FORTRAN predefined datatypes.
+ ! Initialize FORTRAN interface.
!
- CALL h5init_types_f(error)
+ CALL h5init_fortran_f(error)
!
! Create a new file using default properties.
@@ -185,5 +185,10 @@
! Close the file.
!
CALL h5fclose_f(file_id, error)
+
+ !
+ ! Close FORTRAN interface.
+ !
+ CALL h5close_fortran_f(error)
END PROGRAM GRPITEXAMPLE
diff --git a/fortran/examples/grpsexample.f90 b/fortran/examples/grpsexample.f90
index abbc6ea..2761732 100644
--- a/fortran/examples/grpsexample.f90
+++ b/fortran/examples/grpsexample.f90
@@ -23,6 +23,10 @@
INTEGER(HID_T) :: group1_id, group2_id, group3_id ! Group identifiers
INTEGER :: error ! Error flag
+ !
+ ! Initialize FORTRAN interface.
+ !
+ CALL h5init_fortran_f(error)
!
! Create a new file using default properties.
@@ -56,4 +60,9 @@
!
CALL h5fclose_f(file_id, error)
+ !
+ ! Close FORTRAN interface.
+ !
+ CALL h5close_fortran_f(error)
+
END PROGRAM GRPSEXAMPLE
diff --git a/fortran/examples/hyperslab.f90 b/fortran/examples/hyperslab.f90
index 0be4b60..45dd7a0 100644
--- a/fortran/examples/hyperslab.f90
+++ b/fortran/examples/hyperslab.f90
@@ -61,9 +61,9 @@
!
!
- ! Initialize FORTRAN predefined datatypes
+ ! Initialize FORTRAN interface.
!
- CALL h5init_types_f(error)
+ CALL h5init_fortran_f(error)
!
! Create a new file using default properties.
@@ -120,7 +120,9 @@
!
! Open the file.
!
- CALL h5fopen_f (filename, H5F_ACC_RDONLY_F, file_id, error)
+! CALL h5fopen_f (filename, H5F_ACC_RDONLY_F, file_id, error)
+ CALL h5fopen_f (filename, H5F_ACC_RDWR_F, file_id, error)
+ write(*,*) error
!
! Open the dataset.
@@ -192,8 +194,8 @@
CALL h5fclose_f(file_id, error)
!
- ! Close FORTRAN predefined datatypes.
+ ! Close FORTRAN interface.
!
- CALL h5close_types_f(error)
+ CALL h5close_fortran_f(error)
END PROGRAM SELECTEXAMPLE
diff --git a/fortran/examples/mountexample.f90 b/fortran/examples/mountexample.f90
index 561b018..f59cd6a 100644
--- a/fortran/examples/mountexample.f90
+++ b/fortran/examples/mountexample.f90
@@ -12,7 +12,7 @@
IMPLICIT NONE
!
- !the respective filename is "mount1.h5" and "mount2.h5"
+ ! Filenames are "mount1.h5" and "mount2.h5"
!
CHARACTER(LEN=9), PARAMETER :: filename1 = "mount1.h5"
CHARACTER(LEN=9), PARAMETER :: filename2 = "mount2.h5"
@@ -35,47 +35,47 @@
INTEGER(HID_T) :: gid
!
- ! dataset identifier
+ ! Dataset identifier
!
INTEGER(HID_T) :: dset_id
!
- ! data space identifier
+ ! Data space identifier
!
INTEGER(HID_T) :: dataspace
!
- ! data type identifier
+ ! Data type identifier
!
INTEGER(HID_T) :: dtype_id
!
- !The dimensions for the dataset.
+ ! The dimensions for the dataset.
!
INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/NX,NY/)
!
- !flag to check operation success
+ ! Flag to check operation success
!
INTEGER :: error
!
- !general purpose integer
+ ! General purpose integer
!
INTEGER :: i, j
!
- !data buffers
+ ! Data buffers
!
INTEGER, DIMENSION(NX,NY) :: data_in, data_out
!
- !Initialize FORTRAN predifined datatypes
+ ! Initialize FORTRAN interface.
!
- CALL h5init_types_f(error)
+ CALL h5init_fortran_f(error)
!
- !Initialize data_in buffer
+ ! Initialize data_in buffer
!
do i = 1, NX
do j = 1, NY
@@ -84,33 +84,33 @@
end do
!
- !Create first file "mount1.h5" using default properties.
+ ! Create first file "mount1.h5" using default properties.
!
CALL h5fcreate_f(filename1, H5F_ACC_TRUNC_F, file1_id, error)
!
- !Create group "/G" inside file "mount1.h5".
+ ! Create group "/G" inside file "mount1.h5".
!
CALL h5gcreate_f(file1_id, "/G", gid, error)
!
- !close file and group identifiers.
+ ! Close file and group identifiers.
!
CALL h5gclose_f(gid, error)
CALL h5fclose_f(file1_id, error)
!
- !Create second file "mount2.h5" using default properties.
+ ! Create second file "mount2.h5" using default properties.
!
CALL h5fcreate_f(filename2, H5F_ACC_TRUNC_F, file2_id, error)
!
- !Create data space for the dataset.
+ ! Create data space for the dataset.
!
CALL h5screate_simple_f(RANK, dims, dataspace, error)
!
- !Create dataset "/D" inside file "mount2.h5".
+ ! Create dataset "/D" inside file "mount2.h5".
!
CALL h5dcreate_f(file2_id, "/D", H5T_NATIVE_INTEGER, dataspace, &
dset_id, error)
@@ -121,41 +121,41 @@
CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, data_in, error)
!
- !close file, dataset and dataspace identifiers.
+ ! Close file, dataset and dataspace identifiers.
!
CALL h5sclose_f(dataspace, error)
CALL h5dclose_f(dset_id, error)
CALL h5fclose_f(file2_id, error)
!
- !reopen both files.
+ ! Reopen both files.
!
CALL h5fopen_f (filename1, H5F_ACC_RDWR_F, file1_id, error)
CALL h5fopen_f (filename2, H5F_ACC_RDWR_F, file2_id, error)
!
- !mount the second file under the first file's "/G" group.
+ ! Mount the second file under the first file's "/G" group.
!
CALL h5fmount_f (file1_id, "/G", file2_id, error)
!
- !Access dataset D in the first file under /G/D name.
+ ! Access dataset D in the first file under /G/D name.
!
CALL h5dopen_f(file1_id, "/G/D", dset_id, error)
!
- !Get dataset's data type.
+ ! Get dataset's data type.
!
CALL h5dget_type_f(dset_id, dtype_id, error)
!
- !Read the dataset.
+ ! Read the dataset.
!
CALL h5dread_f(dset_id, dtype_id, data_out, error)
!
- !Print out the data.
+ ! Print out the data.
!
do i = 1, NX
print *, (data_out(i,j), j = 1, NY)
@@ -169,15 +169,19 @@
CALL h5tclose_f(dtype_id, error)
!
- !unmount the second file.
+ ! Unmount the second file.
!
CALL h5funmount_f(file1_id, "/G", error);
!
- !Close both files.
+ ! Close both files.
!
CALL h5fclose_f(file1_id, error)
CALL h5fclose_f(file2_id, error)
+ !
+ ! Close FORTRAN interface.
+ !
+ CALL h5close_fortran_f(error)
END PROGRAM MOUNTEXAMPLE
diff --git a/fortran/examples/refobjexample.f90 b/fortran/examples/refobjexample.f90
index 508ca3e..2258246 100644
--- a/fortran/examples/refobjexample.f90
+++ b/fortran/examples/refobjexample.f90
@@ -37,9 +37,9 @@
INTEGER, DIMENSION(5) :: data = (/1, 2, 3, 4, 5/)
INTEGER :: class, ref_size
!
- ! Initialize FORTRAN predefined datatypes
+ ! Initialize FORTRAN interface.
!
- CALL h5init_types_f(error)
+ CALL h5init_fortran_f(error)
!
! Create a file
!
@@ -132,6 +132,10 @@
CALL h5tclose_f(type_id, error)
CALL h5dclose_f(dsetr_id, error)
CALL h5fclose_f(file_id, error)
+ !
+ ! Close FORTRAN interface.
+ !
+ CALL h5close_fortran_f(error)
END PROGRAM OBJ_REFERENCES
diff --git a/fortran/examples/refregexample.f90 b/fortran/examples/refregexample.f90
index 298f60e..ba52a3a 100644
--- a/fortran/examples/refregexample.f90
+++ b/fortran/examples/refregexample.f90
@@ -40,9 +40,9 @@
coord = reshape((/1,1,2,7,1,9/), (/2,3/)) ! Coordinates of selected points
data = reshape ((/1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6/), (/2,9/))
!
- ! Initialize FORTRAN predefined datatypes.
+ ! Initialize FORTRAN interface.
!
- CALL h5init_types_f(error)
+ CALL h5init_fortran_f(error)
!
! Create a new file.
!
@@ -153,9 +153,9 @@
CALL h5dclose_f(dsetv_id, error)
CALL h5dclose_f(dsetr_id, error)
!
- ! Close FORTRAN predefined datatypes.
+ ! Close FORTRAN interface.
!
- CALL h5close_types_f(error)
+ CALL h5close_fortran_f(error)
END PROGRAM REG_REFERENCE
diff --git a/fortran/examples/rwdsetexample.f90 b/fortran/examples/rwdsetexample.f90
index 085b4e8..0fa299a 100644
--- a/fortran/examples/rwdsetexample.f90
+++ b/fortran/examples/rwdsetexample.f90
@@ -33,9 +33,9 @@
end do
!
- ! Initialize FORTRAN predefined datatypes
+ ! Initialize FORTRAN interface.
!
- CALL h5init_types_f(error)
+ CALL h5init_fortran_f(error)
!
! Open an existing file.
@@ -68,9 +68,9 @@
CALL h5fclose_f(file_id, error)
!
- ! Close FORTRAN predefined datatypes.
+ ! Close FORTRAN interface.
!
- CALL h5close_types_f(error)
+ CALL h5close_fortran_f(error)
END PROGRAM RWDSETEXAMPLE
diff --git a/fortran/examples/selectele.f90 b/fortran/examples/selectele.f90
index db91a77..6e99d1f 100644
--- a/fortran/examples/selectele.f90
+++ b/fortran/examples/selectele.f90
@@ -73,9 +73,9 @@
end do
!
- ! Initialize FORTRAN predefined datatypes
+ ! Initialize FORTRAN interface.
!
- CALL h5init_types_f(error)
+ CALL h5init_fortran_f(error)
!
! Create file1, file2 using default properties.
@@ -275,8 +275,8 @@
CALL h5fclose_f(file2_id, error)
!
- ! Close FORTRAN predefined datatypes.
+ ! Close FORTRAN interface.
!
- CALL h5close_types_f(error)
+ CALL h5close_fortran_f(error)
END PROGRAM SELECTEXAMPLE