From 1c90281db5674c175cd375ab9e38a1cb66d1c729 Mon Sep 17 00:00:00 2001 From: Elena Pourmal Date: Tue, 10 Oct 2000 09:31:50 -0500 Subject: [svn-r2654] Purpose: Updated source code to use new APIs to write/read references Description and Solution: Write/read subrotine has extra parameter - size of the reference array. I modified the source to reflect this change. Platforms tested: Solaris 2.6 --- fortran/examples/refobjexample.f90 | 8 +++++--- fortran/examples/refregexample.f90 | 7 +++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/fortran/examples/refobjexample.f90 b/fortran/examples/refobjexample.f90 index 0050cbe..508ca3e 100644 --- a/fortran/examples/refobjexample.f90 +++ b/fortran/examples/refobjexample.f90 @@ -35,7 +35,7 @@ TYPE(hobj_ref_t_f), DIMENSION(4) :: ref TYPE(hobj_ref_t_f), DIMENSION(4) :: ref_out INTEGER, DIMENSION(5) :: data = (/1, 2, 3, 4, 5/) - INTEGER :: class + INTEGER :: class, ref_size ! ! Initialize FORTRAN predefined datatypes ! @@ -91,7 +91,8 @@ CALL h5rcreate_f(file_id, "/GROUP1/GROUP2", ref(2), error) CALL h5rcreate_f(file_id, dsetnamei, ref(3), error) CALL h5rcreate_f(file_id, "MyType", ref(4), error) - CALL h5dwrite_f(dsetr_id, H5T_STD_REF_OBJ, ref, error) + ref_size = size(ref) + CALL h5dwrite_f(dsetr_id, H5T_STD_REF_OBJ, ref, ref_size, error) ! ! Close the dataset ! @@ -100,7 +101,8 @@ ! Reopen the dataset with object references and read references to the buffer ! CALL h5dopen_f(file_id, dsetnamer,dsetr_id,error) - CALL h5dread_f(dsetr_id, H5T_STD_REF_OBJ, ref_out, error) + ref_size = size(ref_out) + CALL h5dread_f(dsetr_id, H5T_STD_REF_OBJ, ref_out, ref_size, error) ! ! Dereference the third reference. We know that it is a dataset. On practice ! one should use h5rget_object_type_f function to find out diff --git a/fortran/examples/refregexample.f90 b/fortran/examples/refregexample.f90 index 47ebaac..298f60e 100644 --- a/fortran/examples/refregexample.f90 +++ b/fortran/examples/refregexample.f90 @@ -36,6 +36,7 @@ INTEGER(HSSIZE_T) , DIMENSION(2,3) :: coord INTEGER(SIZE_T) ::num_points = 3 ! Number of selected points INTEGER :: i, j + INTEGER :: ref_size 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/)) ! @@ -92,7 +93,8 @@ ! ! Write dataset with the references. ! - CALL h5dwrite_f(dsetr_id, H5T_STD_REF_DSETREG, ref, error) + ref_size = size(ref) + CALL h5dwrite_f(dsetr_id, H5T_STD_REF_DSETREG, ref, ref_size, error) ! ! Close all objects. ! @@ -108,7 +110,8 @@ ! ! Read references to the dataset regions. ! - CALL h5dread_f(dsetr_id, H5T_STD_REF_DSETREG, ref_out, error) + ref_size = size(ref_out) + CALL h5dread_f(dsetr_id, H5T_STD_REF_DSETREG, ref_out, ref_size, error) ! ! Dereference the first reference. ! -- cgit v0.12