diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2016-04-15 16:11:52 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2016-04-15 16:11:52 (GMT) |
commit | 88dbe657cf1e0975e7a837b90d39e11566f7bfb3 (patch) | |
tree | 002c2e760ae699e17203b7f9f79019a3fb84bc6e /hl/fortran/src | |
parent | 257689f6b4511ed3031d08d638550aa2e864d294 (diff) | |
parent | 18e360b9fa7fdce30a25d62a7139b9e69c56bf01 (diff) | |
download | hdf5-inactive/multi_rd_wd_coll_io.zip hdf5-inactive/multi_rd_wd_coll_io.tar.gz hdf5-inactive/multi_rd_wd_coll_io.tar.bz2 |
[svn-r29709] another merge from trunk.inactive/multi_rd_wd_coll_io
Diffstat (limited to 'hl/fortran/src')
-rw-r--r-- | hl/fortran/src/H5LTf90proto.h | 32 | ||||
-rw-r--r-- | hl/fortran/src/H5LTff.F90 | 28 | ||||
-rw-r--r-- | hl/fortran/src/H5TBfc.c | 276 | ||||
-rw-r--r-- | hl/fortran/src/H5TBff.F90 | 182 | ||||
-rw-r--r-- | hl/fortran/src/hdf5_hl_fortrandll.def.in | 4 |
5 files changed, 411 insertions, 111 deletions
diff --git a/hl/fortran/src/H5LTf90proto.h b/hl/fortran/src/H5LTf90proto.h index 20d043e..77f941e 100644 --- a/hl/fortran/src/H5LTf90proto.h +++ b/hl/fortran/src/H5LTf90proto.h @@ -311,6 +311,38 @@ h5tbmake_table_c(size_t_f *namelen1, HDF5_HL_F90CSTUBDLL int_f +h5tbread_table_c(hid_t_f *loc_id, + _fcd name, + size_t_f *namelen, + hsize_t_f *nfields, + size_t_f *dst_size, + size_t_f *dst_offset, + size_t_f *dst_sizes, + void *dst_buf); + + +HDF5_HL_F90CSTUBDLL +int_f +h5tbmake_table_ptr_c(size_t_f *namelen1, + _fcd name1, + hid_t_f *loc_id, + size_t_f *namelen, + _fcd name, + hsize_t_f *nfields, + hsize_t_f *nrecords, + size_t_f *type_size, + size_t_f *field_offset, + hid_t_f *field_types, + hsize_t_f *chunk_size, + void *fill_data, + int_f *compress, + size_t_f *char_len_field_names, /* field_names lenghts */ + size_t_f *max_char_size_field_names, /* char len of fields */ + char *field_names, /* field_names */ + void *data); + +HDF5_HL_F90CSTUBDLL +int_f h5tbwrite_field_name_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, diff --git a/hl/fortran/src/H5LTff.F90 b/hl/fortran/src/H5LTff.F90 index d36d92c..18c36f0 100644 --- a/hl/fortran/src/H5LTff.F90 +++ b/hl/fortran/src/H5LTff.F90 @@ -110,7 +110,7 @@ MODULE H5LT_CONST CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(in) :: dtype ! flag indicating the datatype of the ! the buffer: ! R=Real, D=DOUBLE, I=Interger - INTEGER(size_t) :: SizeOf_buf ! Sizeof the buf datatype + INTEGER(size_t), INTENT(in) :: SizeOf_buf ! Sizeof the buf data type END FUNCTION h5ltget_attribute_c END INTERFACE @@ -1059,14 +1059,16 @@ CONTAINS CHARACTER(LEN=*), INTENT(in) :: dset_name ! name of the dataset CHARACTER(LEN=*), INTENT(in) :: attr_name ! name of the attribute TYPE(C_PTR) :: buf ! data buffer - CHARACTER(LEN=*), INTENT(in) :: buf_type ! + CHARACTER(LEN=*), INTENT(in) :: buf_type ! valid data types are: + ! CHARACTER, INTEGER or REAL + ! NOTE: only the first character matters and is case insensitive INTEGER(size_t), INTENT(in) :: size ! size of attribute array - INTEGER :: errcode ! error code - INTEGER(size_t) :: namelen ! name length - INTEGER(size_t) :: attrlen ! name length + INTEGER(size_t), INTENT(in) :: SizeOf_buf_type ! size of buf's data type + INTEGER, INTENT(out) :: errcode ! error code - CHARACTER(KIND=C_CHAR) :: buf_type_uppercase - INTEGER(size_t) :: SizeOf_buf_type + INTEGER(size_t) :: namelen ! name length + INTEGER(size_t) :: attrlen ! name length + CHARACTER(KIND=C_CHAR) :: buf_type_uppercase namelen = LEN(dset_name) attrlen = LEN(attr_name) @@ -1316,13 +1318,15 @@ CONTAINS INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier CHARACTER(LEN=*), INTENT(in) :: dset_name ! name of the dataset CHARACTER(LEN=*), INTENT(in) :: attr_name ! name of the attribute - INTEGER, INTENT(out) :: errcode ! error code - CHARACTER(LEN=*), INTENT(in) :: buf_type - TYPE(C_PTR) :: buf! data buffer + TYPE(C_PTR) :: buf ! data buffer + CHARACTER(LEN=*), INTENT(in) :: buf_type ! valid data types are: + ! CHARACTER, INTEGER or REAL + ! NOTE: only the first character matters and is case insensitive + INTEGER(size_t), INTENT(in) :: SizeOf_buf_type ! size of buf's data type + INTEGER, INTENT(out) :: errcode ! error code INTEGER(size_t) :: namelen ! name length - INTEGER(size_t) :: attrlen ! name length + INTEGER(size_t) :: attrlen ! attr length CHARACTER(KIND=C_CHAR) :: buf_type_uppercase - INTEGER(size_t) :: SizeOf_buf_type namelen = LEN(dset_name) attrlen = LEN(attr_name) diff --git a/hl/fortran/src/H5TBfc.c b/hl/fortran/src/H5TBfc.c index 99a7800..2bb7c3b 100644 --- a/hl/fortran/src/H5TBfc.c +++ b/hl/fortran/src/H5TBfc.c @@ -37,21 +37,12 @@ *------------------------------------------------------------------------- */ int_f -h5tbmake_table_c(size_t_f *namelen1, - _fcd name1, - hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - hsize_t_f *nfields, - hsize_t_f *nrecords, - size_t_f *type_size, - size_t_f *field_offset, - hid_t_f *field_types, - hsize_t_f *chunk_size, - int_f *compress, - size_t_f *char_len_field_names, /* field_names lenghts */ - size_t_f *max_char_size_field_names, /* char len of fields */ - char *field_names) /* field_names */ +h5tbmake_table_c(size_t_f *namelen1, _fcd name1, hid_t_f *loc_id, size_t_f *namelen, _fcd name, + hsize_t_f *nfields, hsize_t_f *nrecords, size_t_f *type_size, size_t_f *field_offset, + hid_t_f *field_types, hsize_t_f *chunk_size, int_f *compress, + size_t_f *char_len_field_names, /* field_names lenghts */ + size_t_f *max_char_size_field_names, /* char len of fields */ + char *field_names) /* field_names */ { char *c_name = NULL; char *c_name1 = NULL; @@ -101,7 +92,6 @@ h5tbmake_table_c(size_t_f *namelen1, HGOTO_DONE(FAIL) HDmemcpy(c_field_names[i], tmp_p, (size_t)char_len_field_names[i]); c_field_names[i][char_len_field_names[i]] = '\0'; - tmp_p = tmp_p + *max_char_size_field_names; } /* end for */ @@ -136,6 +126,177 @@ done: } /* end h5tbmake_table_c() */ /*------------------------------------------------------------------------- +* Function: h5tbmake_table_ptr_c +* +* Purpose: Call H5TBmake_table using F2003 features +* +* Return: Success: 0, Failure: -1 +* +* Programmer: M. Scot Breitenfeld +* +* Date: Sept. 10, 2015 +* +* Comments: +* +*------------------------------------------------------------------------- +*/ +int_f +h5tbmake_table_ptr_c(size_t_f *namelen1, _fcd name1, hid_t_f *loc_id, size_t_f *namelen, + _fcd name, hsize_t_f *nfields, hsize_t_f *nrecords, size_t_f *type_size, + size_t_f *field_offset, hid_t_f *field_types, hsize_t_f *chunk_size, + void *fill_data, int_f *compress, + size_t_f *char_len_field_names, /* field_names lenghts */ + size_t_f *max_char_size_field_names, /* char len of fields */ + char *field_names, + void *data) /* field_names */ +{ + char *c_name = NULL; + char *c_name1 = NULL; + hsize_t num_elem; + hsize_t i; + hsize_t c_nfields = (hsize_t)*nfields; + size_t *c_field_offset = NULL; + hid_t *c_field_types = NULL; + char **c_field_names = NULL; + char *tmp = NULL, *tmp_p; + int_f ret_value = 0; + + num_elem = (hsize_t)*nfields; + + /* + * convert FORTRAN name to C name + */ + if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + HGOTO_DONE(FAIL) + if(NULL == (c_name1 = (char *)HD5f2cstring(name1, (size_t)*namelen1))) + HGOTO_DONE(FAIL) + if(NULL == (c_field_offset = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields))) + HGOTO_DONE(FAIL) + if(NULL == (c_field_types = (hid_t *)HDmalloc(sizeof(hid_t) * (size_t)c_nfields))) + HGOTO_DONE(FAIL) + + for(i = 0; i < num_elem; i++) { + c_field_offset[i] = (size_t)field_offset[i]; + c_field_types[i] = field_types[i]; + } /* end for */ + + /* + * allocate array of character pointers + */ + if(NULL == (c_field_names = (char **)HDcalloc((size_t)num_elem, sizeof(char *)))) + HGOTO_DONE(FAIL) + + /* copy data to long C string */ + if(NULL == (tmp = (char *)HD5f2cstring(field_names, (size_t)*(max_char_size_field_names)*(size_t)num_elem))) + HGOTO_DONE(FAIL) + /* + * move data from temorary buffer + */ + tmp_p = tmp; + for(i = 0; i < num_elem; i++) { + if(NULL == (c_field_names[i] = (char *)HDmalloc((size_t)char_len_field_names[i] + 1))) + HGOTO_DONE(FAIL) + HDmemcpy(c_field_names[i], tmp_p, (size_t)char_len_field_names[i]); + c_field_names[i][char_len_field_names[i]] = '\0'; + tmp_p = tmp_p + *max_char_size_field_names; + } /* end for */ + + /* + * call H5TBmake_table function. + */ + if(H5TBmake_table(c_name1, (hid_t)*loc_id, c_name, c_nfields, (hsize_t)*nrecords, + (size_t)*type_size, (const char **)c_field_names, c_field_offset, c_field_types, + (hsize_t)*chunk_size, fill_data, *compress, data) < 0) + HGOTO_DONE(FAIL) + +done: + if(c_name) + HDfree(c_name); + if(c_name1) + HDfree(c_name1); + if(c_field_names) { + for(i = 0; i < num_elem; i++) { + if(c_field_names[i]) + HDfree(c_field_names[i]); + } /* end for */ + HDfree(c_field_names); + } /* end if */ + if(tmp) + HDfree(tmp); + if(c_field_offset) + HDfree(c_field_offset); + if(c_field_types) + HDfree(c_field_types); + + return ret_value; +} /* end h5tbmake_table_c() */ + + +/*------------------------------------------------------------------------- +* Function: h5tbread_table_c +* +* Purpose: Call H5TBread_table using F2003 features +* +* Return: Success: 0, Failure: -1 +* +* Programmer: M. Scot Breitenfeld +* +* Date: Sept. 14, 2015 +* +* Comments: +* +*------------------------------------------------------------------------- +*/ +int_f +h5tbread_table_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, hsize_t_f *nfields, + size_t_f *dst_size, size_t_f *dst_offset, size_t_f *dst_sizes, void *dst_buf) +{ + char *c_name = NULL; + size_t *c_dst_offset = NULL; + size_t *c_dst_sizes = NULL; + hsize_t c_nfields = (hsize_t)*nfields; + int_f ret_value = 0; + hsize_t i; + + /* + * convert FORTRAN name to C name + */ + if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + HGOTO_DONE(FAIL) + + if(NULL == (c_dst_offset = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields))) + HGOTO_DONE(FAIL) + if(NULL == (c_dst_sizes = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields))) + HGOTO_DONE(FAIL) + + for(i = 0; i < c_nfields; i++) { + c_dst_offset[i] = (size_t)dst_offset[i]; + c_dst_sizes[i] = (size_t)dst_sizes[i]; + } /* end for */ + + /* + * call H5TBread_table function. + */ + if(H5TBread_table( (hid_t)*loc_id, c_name, (size_t)*dst_size, c_dst_offset, + c_dst_sizes, dst_buf) < 0) + HGOTO_DONE(FAIL) + +done: + if(c_name) + HDfree(c_name); + + if(c_dst_offset) + HDfree(c_dst_offset); + if(c_dst_sizes) + HDfree(c_dst_sizes); + + return ret_value; +} /* end h5tbmake_table_c() */ + + + + +/*------------------------------------------------------------------------- * Function: h5tbwrite_field_name_c * * Purpose: Call H5TBwrite_fields_name @@ -151,15 +312,8 @@ done: *------------------------------------------------------------------------- */ int_f -h5tbwrite_field_name_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - size_t_f *namelen1, - _fcd field_name, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf) +h5tbwrite_field_name_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *namelen1, _fcd field_name, + hsize_t_f *start, hsize_t_f *nrecords, size_t_f *type_size, void *buf) { char *c_name = NULL; char *c_name1 = NULL; @@ -207,15 +361,8 @@ done: *------------------------------------------------------------------------- */ int_f -h5tbread_field_name_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - size_t_f *namelen1, - _fcd field_name, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf) +h5tbread_field_name_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *namelen1, _fcd field_name, + hsize_t_f *start, hsize_t_f *nrecords, size_t_f *type_size, void *buf) { char *c_name = NULL; char *c_name1 = NULL; @@ -262,14 +409,8 @@ done: *------------------------------------------------------------------------- */ int_f -h5tbwrite_field_index_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - int_f *field_index, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf) +h5tbwrite_field_index_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *field_index, hsize_t_f *start, + hsize_t_f *nrecords, size_t_f *type_size, void *buf) { char *c_name = NULL; size_t c_type_size = *type_size; @@ -313,14 +454,8 @@ done: *------------------------------------------------------------------------- */ int_f -h5tbread_field_index_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - int_f *field_index, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf) +h5tbread_field_index_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *field_index, hsize_t_f *start, + hsize_t_f *nrecords, size_t_f *type_size, void *buf) { char *c_name = NULL; size_t c_type_size = *type_size; @@ -363,14 +498,8 @@ done: *------------------------------------------------------------------------- */ int_f -h5tbinsert_field_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - size_t_f *namelen1, - _fcd field_name, - hid_t_f *field_type, - int_f *position, - void *buf) +h5tbinsert_field_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *namelen1, + _fcd field_name, hid_t_f *field_type, int_f *position, void *buf) { char *c_name = NULL; char *c_name1 = NULL; @@ -416,11 +545,8 @@ done: *------------------------------------------------------------------------- */ int_f -h5tbdelete_field_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - size_t_f *namelen1, - _fcd field_name) +h5tbdelete_field_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, + size_t_f *namelen1, _fcd field_name) { char *c_name = NULL; char *c_name1 = NULL; @@ -465,11 +591,8 @@ done: *------------------------------------------------------------------------- */ int_f -h5tbget_table_info_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - hsize_t_f *nfields, - hsize_t_f *nrecords) +h5tbget_table_info_c(hid_t_f *loc_id, size_t_f *namelen, + _fcd name, hsize_t_f *nfields, hsize_t_f *nrecords) { char *c_name = NULL; hsize_t c_nfields; @@ -515,17 +638,12 @@ done: *------------------------------------------------------------------------- */ int_f -h5tbget_field_info_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - hsize_t_f *nfields, - size_t_f *field_sizes, - size_t_f *field_offsets, - size_t_f *type_size, - size_t_f *namelen2, /* field_names lenghts */ - size_t_f *lenmax, /* character len max */ - _fcd field_names, /* field_names */ - size_t_f *maxlen_out) +h5tbget_field_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *nfields, + size_t_f *field_sizes, size_t_f *field_offsets, size_t_f *type_size, + size_t_f *namelen2, /* field_names lenghts */ + size_t_f *lenmax, /* character len max */ + _fcd field_names, /* field_names */ + size_t_f *maxlen_out) { char *c_name = NULL; diff --git a/hl/fortran/src/H5TBff.F90 b/hl/fortran/src/H5TBff.F90 index 448d607..266f74a 100644 --- a/hl/fortran/src/H5TBff.F90 +++ b/hl/fortran/src/H5TBff.F90 @@ -63,6 +63,11 @@ MODULE h5tb_CONST MODULE PROCEDURE h5tbinsert_field_f_string END INTERFACE + INTERFACE h5tbmake_table_f + MODULE PROCEDURE h5tbmake_table_f90 + MODULE PROCEDURE h5tbmake_table_ptr_f + END INTERFACE + INTERFACE INTEGER FUNCTION h5tbwrite_field_name_c(loc_id,namelen,dset_name,namelen1,field_name,& start,nrecords,type_size,buf) & @@ -163,7 +168,7 @@ MODULE h5tb_CONST CONTAINS !------------------------------------------------------------------------- -! Function: h5tbmake_table_f +! Function: h5tbmake_table_f90 ! ! Purpose: Make a table ! @@ -179,7 +184,7 @@ CONTAINS ! !------------------------------------------------------------------------- - SUBROUTINE h5tbmake_table_f(table_title,& + SUBROUTINE h5tbmake_table_f90(table_title,& loc_id,& dset_name,& nfields,& @@ -259,23 +264,162 @@ CONTAINS max_char_size_field_names = LEN(field_names(1)) - errcode = h5tbmake_table_c(namelen1,& - table_title,& - loc_id,& - namelen,& - dset_name,& - nfields,& - nrecords,& - type_size,& - field_offset,& - field_types,& - chunk_size,& - compress,& - char_len_field_names, & - max_char_size_field_names, & - field_names) - - END SUBROUTINE h5tbmake_table_f + errcode = h5tbmake_table_c(namelen1, table_title, loc_id, namelen, dset_name, nfields, nrecords,& + type_size, field_offset, field_types, chunk_size, compress, char_len_field_names, & + max_char_size_field_names, field_names) + + END SUBROUTINE h5tbmake_table_f90 + + SUBROUTINE h5tbmake_table_ptr_f(table_title,& + loc_id,& + dset_name,& + nfields,& + nrecords,& + type_size,& + field_names,& + field_offset,& + field_types,& + chunk_size,& + fill_data,& + compress,& + data,& + errcode ) + + USE ISO_C_BINDING + IMPLICIT NONE + CHARACTER(LEN=*), INTENT(in) :: table_title ! name of the dataset + INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier + CHARACTER(LEN=*), INTENT(in) :: dset_name ! name of the dataset + INTEGER(hsize_t), INTENT(in) :: nfields ! fields + INTEGER(hsize_t), INTENT(in) :: nrecords ! records + INTEGER(size_t), INTENT(in) :: type_size ! type size + CHARACTER(LEN=*), DIMENSION(1:nfields), INTENT(in) :: field_names ! field names + INTEGER(size_t), DIMENSION(1:nfields), INTENT(in) :: field_offset ! field offset + INTEGER(hid_t), DIMENSION(1:nfields), INTENT(in) :: field_types ! field types + INTEGER(hsize_t), INTENT(in) :: chunk_size ! chunk size + TYPE(C_PTR), INTENT(in) :: fill_data ! Fill values data + INTEGER, INTENT(in) :: compress ! compress + TYPE(C_PTR), INTENT(in) :: data ! Buffer with data to be written to the table + INTEGER(size_t) :: namelen ! name length + INTEGER(size_t) :: namelen1 ! name length + INTEGER :: errcode ! error code + INTEGER(size_t), DIMENSION(1:nfields) :: char_len_field_names ! field name lengths + INTEGER(size_t) :: max_char_size_field_names ! character len of field names + INTEGER(hsize_t) :: i ! general purpose integer + + INTERFACE + INTEGER FUNCTION h5tbmake_table_ptr_c(namelen1,& + table_title,& + loc_id,& + namelen,& + dset_name,& + nfields,& + nrecords,& + type_size,& + field_offset,& + field_types,& + chunk_size,& + fill_data,& + compress,& + char_len_field_names,& + max_char_size_field_names,& + field_names,& + data) & + BIND(C,NAME='h5tbmake_table_ptr_c') + IMPORT :: C_CHAR, C_PTR + IMPORT :: HID_T, SIZE_T, HSIZE_T + IMPLICIT NONE + CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(in) :: table_title ! name of the dataset + INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier + CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(in) :: dset_name ! name of the dataset + INTEGER(hsize_t), INTENT(in) :: nfields ! fields + INTEGER(hsize_t), INTENT(in) :: nrecords ! records + INTEGER(size_t), INTENT(in) :: type_size ! type size + CHARACTER(KIND=C_CHAR), DIMENSION(nfields), INTENT(in) :: field_names ! field names + INTEGER(size_t), DIMENSION(nfields), INTENT(in) :: field_offset ! field offset + INTEGER(hid_t), DIMENSION(nfields), INTENT(in) :: field_types ! field types + INTEGER(hsize_t), INTENT(in) :: chunk_size ! chunk size + TYPE(C_PTR), INTENT(in), VALUE :: fill_data ! Fill values data + INTEGER, INTENT(in) :: compress ! compress + INTEGER(size_t) :: namelen ! name length + INTEGER(size_t) :: namelen1 ! name length + INTEGER(size_t), DIMENSION(nfields) :: char_len_field_names ! field name's lengths + INTEGER(size_t) :: max_char_size_field_names ! character len of field names + TYPE(C_PTR), INTENT(in), VALUE :: data + END FUNCTION h5tbmake_table_ptr_c + END INTERFACE + + namelen = LEN(dset_name) + namelen1 = LEN(table_title) + + ! Find the size of each character string in the array + DO i = 1, nfields + char_len_field_names(i) = LEN_TRIM(field_names(i)) + END DO + + max_char_size_field_names = LEN(field_names(1)) + + errcode = h5tbmake_table_ptr_c(namelen1, table_title, loc_id, namelen, dset_name, nfields, nrecords,& + type_size, field_offset, field_types, chunk_size, fill_data, compress, char_len_field_names, & + max_char_size_field_names, field_names, data) + + END SUBROUTINE h5tbmake_table_ptr_f + + SUBROUTINE h5tbread_table_f(loc_id, table_name, nfields, dst_size, dst_offset, & + dst_sizes, dst_buf, errcode) + + USE ISO_C_BINDING + IMPLICIT NONE + INTEGER(hid_t), INTENT(in) :: loc_id ! An array containing the sizes of the fields + CHARACTER(LEN=*), INTENT(in) :: table_name ! The name of the dataset to read + INTEGER(hsize_t), INTENT(in) :: nfields ! number of fields + INTEGER(size_t), INTENT(in) :: dst_size ! The size of the structure type + INTEGER(size_t), DIMENSION(1:nfields), INTENT(in) :: dst_offset ! An array containing the offsets of the fields + INTEGER(size_t), DIMENSION(1:nfields), INTENT(in) :: dst_sizes ! An array containing the sizes of the fields + TYPE(C_PTR), INTENT(OUT) :: dst_buf ! Buffer with data + INTEGER :: errcode ! error code + + INTEGER(size_t) :: namelen ! name length + INTEGER(hsize_t) :: i ! general purpose integer + + INTERFACE + INTEGER FUNCTION h5tbread_table_c(loc_id,& + table_name,& + namelen,& + nfields,& + dst_size,& + dst_offset, & + dst_sizes, & + dst_buf) & + BIND(C,NAME='h5tbread_table_c') + IMPORT :: C_PTR + IMPORT :: HID_T, SIZE_T, HSIZE_T + IMPLICIT NONE + INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier + CHARACTER(LEN=1), INTENT(in) :: table_name ! name of the dataset + INTEGER(hsize_t), INTENT(in) :: nfields + INTEGER(size_t), INTENT(in) :: dst_size ! type size + INTEGER(size_t), DIMENSION(1:nfields), INTENT(in) :: dst_offset ! An array containing the sizes of the fields + INTEGER(size_t), DIMENSION(1:nfields), INTENT(in) :: dst_sizes ! An array containing the sizes of the fields + INTEGER(size_t) :: namelen ! name length + TYPE(C_PTR), VALUE :: dst_buf + + END FUNCTION h5tbread_table_c + END INTERFACE + + namelen = LEN(table_name) + + errcode = h5tbread_table_c(loc_id,& + table_name,& + namelen, & + nfields, & + dst_size,& + dst_offset, & + dst_sizes, & + dst_buf) + + + END SUBROUTINE h5tbread_table_f !------------------------------------------------------------------------- ! Function: h5tbwrite_field_name_f_int diff --git a/hl/fortran/src/hdf5_hl_fortrandll.def.in b/hl/fortran/src/hdf5_hl_fortrandll.def.in index 9a1231a..b48cae3 100644 --- a/hl/fortran/src/hdf5_hl_fortrandll.def.in +++ b/hl/fortran/src/hdf5_hl_fortrandll.def.in @@ -72,7 +72,9 @@ H5LT_CONST_mp_H5LTGET_ATTRIBUTE_NDIMS_F H5LT_CONST_mp_H5LTGET_ATTRIBUTE_INFO_F H5LT_CONST_mp_H5LTPATH_VALID_F ; H5TB -H5TB_CONST_mp_H5TBMAKE_TABLE_F +H5TB_CONST_mp_H5TBREAD_TABLE_F +H5TB_CONST_mp_H5TBMAKE_TABLE_F90 +H5TB_CONST_mp_H5TBMAKE_TABLE_PTR_F H5TB_CONST_mp_H5TBWRITE_FIELD_NAME_F_INT H5TB_CONST_mp_H5TBWRITE_FIELD_NAME_F_STRING H5TB_CONST_mp_H5TBREAD_FIELD_NAME_F_INT |