summaryrefslogtreecommitdiffstats
path: root/fortran/src/H5Rf.c
diff options
context:
space:
mode:
authorElena Pourmal <epourmal@hdfgroup.org>2000-10-10 04:13:14 (GMT)
committerElena Pourmal <epourmal@hdfgroup.org>2000-10-10 04:13:14 (GMT)
commit02092cd24e8cb79c66903d5556515bd755deeeeb (patch)
treebf4cc467138236ae3dbf8d531e1ef4ae4eaee60a /fortran/src/H5Rf.c
parenta1e44979edfe671a6c7f8278a8798d9a834476c3 (diff)
downloadhdf5-02092cd24e8cb79c66903d5556515bd755deeeeb.zip
hdf5-02092cd24e8cb79c66903d5556515bd755deeeeb.tar.gz
hdf5-02092cd24e8cb79c66903d5556515bd755deeeeb.tar.bz2
[svn-r2648]
Purpose: Reimplemented references to the objects and dataset regions. Description: Previous implementation was not portable. This implementation should work on UNIX workstations and Crays, but is very inefficient since it uses memcpy to repack Fortran buffers with references to C buffers and vice versa. Solution: I used fortran derived datatype with integer fields. h5dwrite_f and h5dread_f have extra parameter when references are written or read. This parameter describes size of the buffer that holds references. Platforms tested: J90 and Solaris 2.6 H5Pf.c Some of the functions do not exist now in the development branch. Commented those out, so one does not need to apply patch in order to build Fortran Library.
Diffstat (limited to 'fortran/src/H5Rf.c')
-rw-r--r--fortran/src/H5Rf.c72
1 files changed, 17 insertions, 55 deletions
diff --git a/fortran/src/H5Rf.c b/fortran/src/H5Rf.c
index 16e0f4a..ecfd46c 100644
--- a/fortran/src/H5Rf.c
+++ b/fortran/src/H5Rf.c
@@ -13,7 +13,7 @@
* Modifications:
*---------------------------------------------------------------------------*/
int_f
-nh5rcreate_object_c (_fcd ref, hid_t_f *loc_id, _fcd name, int_f *namelen)
+nh5rcreate_object_c (int_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen)
{
int ret_value = -1;
hid_t c_loc_id;
@@ -35,18 +35,14 @@ nh5rcreate_object_c (_fcd ref, hid_t_f *loc_id, _fcd name, int_f *namelen)
*/
c_loc_id = *loc_id;
ret_value_c = H5Rcreate(&ref_c, c_loc_id, c_name, H5R_OBJECT, -1);
+
HDfree(c_name);
- if (ret_value_c >= 0) {
- for(i=0; i < H5R_OBJ_REF_BUF_SIZE; i++)
- {
-#if defined(_UNICOS)
- ref.c_pointer[i]=ref_c.oid[i];
-#else
- ref[i]=ref_c.oid[i];
-#endif
- }
+ if (ret_value_c >= 0) {
+ HDmemcpy(ref, ref_c.oid, H5R_OBJ_REF_BUF_SIZE);
ret_value = 0;
}
+
+ ret_value = 0;
return ret_value;
}
@@ -65,7 +61,7 @@ nh5rcreate_object_c (_fcd ref, hid_t_f *loc_id, _fcd name, int_f *namelen)
* Modifications:
*---------------------------------------------------------------------------*/
int_f
-nh5rcreate_region_c (_fcd ref, hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *space_id)
+nh5rcreate_region_c (int_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *space_id)
{
int ret_value = -1;
hid_t c_loc_id;
@@ -89,16 +85,10 @@ nh5rcreate_region_c (_fcd ref, hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t
c_loc_id = *loc_id;
c_space_id = *space_id;
ret_value_c = H5Rcreate(&ref_c, c_loc_id, c_name, H5R_DATASET_REGION, c_space_id);
+
HDfree(c_name);
if (ret_value_c >= 0) {
- for(i=0; i < H5R_DSET_REG_REF_BUF_SIZE; i++)
- {
-#if defined(_UNICOS)
- ref.c_pointer[i]=ref_c.heapid[i];
-#else
- ref[i]=ref_c.heapid[i];
-#endif
- }
+ HDmemcpy (ref, ref_c.heapid, H5R_DSET_REG_REF_BUF_SIZE);
ret_value = 0;
}
return ret_value;
@@ -116,7 +106,7 @@ nh5rcreate_region_c (_fcd ref, hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t
* Modifications:
*---------------------------------------------------------------------------*/
int_f
-nh5rdereference_region_c (hid_t_f *dset_id, _fcd ref, hid_t_f *obj_id)
+nh5rdereference_region_c (hid_t_f *dset_id, int_f *ref, hid_t_f *obj_id)
{
int ret_value = -1;
hid_t c_dset_id;
@@ -124,14 +114,7 @@ nh5rdereference_region_c (hid_t_f *dset_id, _fcd ref, hid_t_f *obj_id)
hid_t c_obj_id;
int i;
- for(i=0; i < H5R_DSET_REG_REF_BUF_SIZE; i++) {
-
-#if defined(_UNICOS)
- ref_c.heapid[i]=ref.c_pointer[i];
-#else
- ref_c.heapid[i]=ref[i];
-#endif
- }
+ HDmemcpy (ref_c.heapid, ref, H5R_DSET_REG_REF_BUF_SIZE);
/*
* Call H5Rdereference function.
@@ -157,7 +140,7 @@ nh5rdereference_region_c (hid_t_f *dset_id, _fcd ref, hid_t_f *obj_id)
* Modifications:
*---------------------------------------------------------------------------*/
int_f
-nh5rdereference_object_c (hid_t_f *dset_id, _fcd ref, hid_t_f *obj_id)
+nh5rdereference_object_c (hid_t_f *dset_id, int_f *ref, hid_t_f *obj_id)
{
int ret_value = -1;
hid_t c_dset_id;
@@ -165,14 +148,7 @@ nh5rdereference_object_c (hid_t_f *dset_id, _fcd ref, hid_t_f *obj_id)
hobj_ref_t ref_c;
int i;
- for(i=0; i < H5R_OBJ_REF_BUF_SIZE; i++) {
-
-#if defined(_UNICOS)
- ref_c.oid[i]=ref.c_pointer[i];
-#else
- ref_c.oid[i]=ref[i];
-#endif
- }
+ HDmemcpy (ref_c.oid, ref, H5R_OBJ_REF_BUF_SIZE);
/*
* Call H5Rdereference function.
@@ -197,7 +173,7 @@ nh5rdereference_object_c (hid_t_f *dset_id, _fcd ref, hid_t_f *obj_id)
* Modifications:
*---------------------------------------------------------------------------*/
int_f
-nh5rget_region_region_c (hid_t_f *dset_id, _fcd ref, hid_t_f *space_id)
+nh5rget_region_region_c (hid_t_f *dset_id, int_f *ref, hid_t_f *space_id)
{
int ret_value = -1;
hid_t c_dset_id;
@@ -205,14 +181,7 @@ nh5rget_region_region_c (hid_t_f *dset_id, _fcd ref, hid_t_f *space_id)
hdset_reg_ref_t ref_c;
int i;
- for(i=0; i < H5R_DSET_REG_REF_BUF_SIZE; i++) {
-
-#if defined(_UNICOS)
- ref_c.heapid[i]=ref.c_pointer[i];
-#else
- ref_c.heapid[i]=ref[i];
-#endif
- }
+ HDmemcpy (ref_c.heapid, ref, H5R_DSET_REG_REF_BUF_SIZE);
/*
* Call H5Rget_region function.
@@ -238,7 +207,7 @@ nh5rget_region_region_c (hid_t_f *dset_id, _fcd ref, hid_t_f *space_id)
* Modifications:
*---------------------------------------------------------------------------*/
int_f
-nh5rget_object_type_obj_c (hid_t_f *dset_id, _fcd ref, int_f *obj_type)
+nh5rget_object_type_obj_c (hid_t_f *dset_id, int_f *ref, int_f *obj_type)
{
int ret_value = -1;
hid_t c_dset_id;
@@ -246,14 +215,7 @@ nh5rget_object_type_obj_c (hid_t_f *dset_id, _fcd ref, int_f *obj_type)
hobj_ref_t ref_c;
int i;
- for(i=0; i < H5R_OBJ_REF_BUF_SIZE; i++) {
-
-#if defined(_UNICOS)
- ref_c.oid[i]=ref.c_pointer[i];
-#else
- ref_c.oid[i]=ref[i];
-#endif
- }
+ HDmemcpy (ref_c.oid, ref, H5R_OBJ_REF_BUF_SIZE);
/*
* Call H5Rget_object_type function.