diff options
author | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2008-09-24 16:26:32 (GMT) |
---|---|---|
committer | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2008-09-24 16:26:32 (GMT) |
commit | 8866806873cd1ff5a1cc1bbbd59d186aa8065cca (patch) | |
tree | 33b7a4219c5e08c6b1cdf8561334d4a701d22fcd /fortran | |
parent | acf7dd2c744555b30b10f0915b713eadeda45571 (diff) | |
download | hdf5-8866806873cd1ff5a1cc1bbbd59d186aa8065cca.zip hdf5-8866806873cd1ff5a1cc1bbbd59d186aa8065cca.tar.gz hdf5-8866806873cd1ff5a1cc1bbbd59d186aa8065cca.tar.bz2 |
[svn-r15690] Description:
In nH5Sget_select_bounds_c swapped array bounds to account for C and Fortran reversed array notation.
Diffstat (limited to 'fortran')
-rw-r--r-- | fortran/src/H5Sf.c | 8 | ||||
-rw-r--r-- | fortran/src/H5Sff.f90 | 133 |
2 files changed, 70 insertions, 71 deletions
diff --git a/fortran/src/H5Sf.c b/fortran/src/H5Sf.c index 7b37756..82e760c 100644 --- a/fortran/src/H5Sf.c +++ b/fortran/src/H5Sf.c @@ -274,7 +274,9 @@ nh5sget_select_hyper_blocklist_c( hid_t_f *space_id ,hsize_t_f * startblock, * Returns: 0 on success, -1 on failure * Programmer: Xiangyang Su * Wednesday, November 17, 1999 - * Modifications: + * Modifications: swapped array bounds to account for C and Fortran reversed + * matrix notation. + * M.S. Breitenfeld *---------------------------------------------------------------------------*/ int_f @@ -298,8 +300,8 @@ nh5sget_select_bounds_c( hid_t_f *space_id , hsize_t_f * start, hsize_t_f * end) ret_value = H5Sget_select_bounds(c_space_id, c_start, c_end); for(i = 0; i < rank; i++) { - start[i] = (hsize_t_f)(c_start[i]+1); - end[i] = (hsize_t_f)(c_end[i]+1); + start[i] = (hsize_t_f)(c_start[rank-i-1]+1); + end[i] = (hsize_t_f)(c_end[rank-i-1]+1); } if (ret_value >= 0 ) ret_value = 0; diff --git a/fortran/src/H5Sff.f90 b/fortran/src/H5Sff.f90 index 003b946..17c8012 100644 --- a/fortran/src/H5Sff.f90 +++ b/fortran/src/H5Sff.f90 @@ -386,35 +386,32 @@ ! Comment: !---------------------------------------------------------------------- - SUBROUTINE h5sget_select_bounds_f(space_id, start, end, hdferr) - IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier - INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: start - !Starting coordinates of the bounding box. - INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: end - !Ending coordinates of the bounding box, - !i.e., the coordinates of the diagonally - !opposite corner - INTEGER, INTENT(OUT) :: hdferr ! Error code - -! INTEGER, EXTERNAL :: h5sget_select_bounds_c -! MS FORTRAN needs explicit interface for C functions called here. -! - INTERFACE - INTEGER FUNCTION h5sget_select_bounds_c(space_id, start, end) - USE H5GLOBAL - !DEC$ IF DEFINED(HDF5F90_WINDOWS) -!DEC$ ATTRIBUTES C,reference,decorate,alias:'H5SGET_SELECT_BOUNDS_C'::h5sget_select_bounds_c - !DEC$ ENDIF - INTEGER(HID_T), INTENT(IN) :: space_id - INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: start - INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: end - END FUNCTION h5sget_select_bounds_c - END INTERFACE + SUBROUTINE h5sget_select_bounds_f(space_id, start, END, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier + INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: start + ! Starting coordinates of the bounding box. + INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: END + !Ending coordinates of the bounding box, + !i.e., the coordinates of the diagonally + !opposite corner + INTEGER, INTENT(OUT) :: hdferr ! Error code - hdferr = h5sget_select_bounds_c(space_id, start, end) + INTERFACE + INTEGER FUNCTION h5sget_select_bounds_c(space_id, start, END) + USE H5GLOBAL + !DEC$ IF DEFINED(HDF5F90_WINDOWS) + !DEC$ ATTRIBUTES C,reference,decorate,alias:'H5SGET_SELECT_BOUNDS_C'::h5sget_select_bounds_c + !DEC$ ENDIF + INTEGER(HID_T), INTENT(IN) :: space_id + INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: start + INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: END + END FUNCTION h5sget_select_bounds_c + END INTERFACE + + hdferr = h5sget_select_bounds_c(space_id, start, END) - END SUBROUTINE h5sget_select_bounds_f + END SUBROUTINE h5sget_select_bounds_f !---------------------------------------------------------------------- ! Name: h5sget_select_elem_npoints_f @@ -557,49 +554,49 @@ ! ! Comment: !---------------------------------------------------------------------- - SUBROUTINE h5sselect_elements_f(space_id, operator, rank, & - num_elements, coord, hdferr) - IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier - INTEGER, INTENT(IN) :: operator ! Flag, valid values are: - ! H5S_SELECT_SET_F (0) - ! H5S_SELECT_OR_F (1) - INTEGER, INTENT(IN) :: rank ! Number of dataspace dimensions - INTEGER(SIZE_T), INTENT(IN) :: num_elements ! Number of elements to be - ! selected - INTEGER(HSIZE_T), & - DIMENSION(rank,num_elements), INTENT(IN) :: coord + SUBROUTINE h5sselect_elements_f(space_id, OPERATOR, rank, & + num_elements, coord, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier + INTEGER, INTENT(IN) :: OPERATOR ! Flag, valid values are: + ! H5S_SELECT_SET_F (0) + ! H5S_SELECT_OR_F (1) + INTEGER, INTENT(IN) :: rank ! Number of dataspace dimensions + INTEGER(SIZE_T), INTENT(IN) :: num_elements ! Number of elements to be + ! selected + INTEGER(HSIZE_T), & + DIMENSION(rank,num_elements), INTENT(IN) :: coord ! Array with the coordinates ! of the selected elements ! coord(rank, num_elements) - INTEGER, INTENT(OUT) :: hdferr ! Error code - INTEGER(HSIZE_T), ALLOCATABLE, DIMENSION(:,:) :: c_coord - INTEGER :: error, i,j - - INTERFACE - INTEGER FUNCTION h5sselect_elements_c(space_id, operator,& - num_elements,c_c_coord) - USE H5GLOBAL - !DEC$ IF DEFINED(HDF5F90_WINDOWS) - !DEC$ ATTRIBUTES C,reference,decorate,alias:'H5SSELECT_ELEMENTS_C'::h5sselect_elements_c - !DEC$ ENDIF - INTEGER(HID_T), INTENT(IN) :: space_id - INTEGER, INTENT(IN) :: operator - INTEGER(SIZE_T), INTENT(IN) :: num_elements - INTEGER(HSIZE_T),DIMENSION(*) :: c_c_coord - END FUNCTION h5sselect_elements_c - END INTERFACE - - ALLOCATE(c_coord(rank,num_elements), stat = error) - IF (error.NE. 0) THEN - hdferr = -1 - RETURN - ENDIF - DO i = 1, rank - c_coord(i,:) = coord(rank-i+1, :) - 1 - ENDDO - hdferr = h5sselect_elements_c(space_id, OPERATOR, num_elements, c_coord) + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HSIZE_T), ALLOCATABLE, DIMENSION(:,:) :: c_coord + INTEGER :: error, i,j + INTERFACE + INTEGER FUNCTION h5sselect_elements_c(space_id, OPERATOR,& + num_elements,c_c_coord) + USE H5GLOBAL + !DEC$ IF DEFINED(HDF5F90_WINDOWS) + !DEC$ ATTRIBUTES C,reference,decorate,alias:'H5SSELECT_ELEMENTS_C'::h5sselect_elements_c + !DEC$ ENDIF + INTEGER(HID_T), INTENT(IN) :: space_id + INTEGER, INTENT(IN) :: OPERATOR + INTEGER(SIZE_T), INTENT(IN) :: num_elements + INTEGER(HSIZE_T),DIMENSION(*) :: c_c_coord + END FUNCTION h5sselect_elements_c + END INTERFACE + + ALLOCATE(c_coord(rank,num_elements), stat = error) + IF (error.NE. 0) THEN + hdferr = -1 + RETURN + ENDIF + DO i = 1, rank + c_coord(i,:) = coord(rank-i+1, :) - 1 + ENDDO + hdferr = h5sselect_elements_c(space_id, OPERATOR, num_elements, c_coord) + ! ALLOCATE(c_coord(num_elements,rank), stat = error) ! IF (error.NE. 0) THEN ! hdferr = -1 @@ -610,9 +607,9 @@ ! hdferr = h5sselect_elements_c(space_id, OPERATOR, INT(rank,size_t), c_coord) - DEALLOCATE(c_coord) + DEALLOCATE(c_coord) - END SUBROUTINE h5sselect_elements_f + END SUBROUTINE h5sselect_elements_f !---------------------------------------------------------------------- ! Name: h5sselect_all_f |