2003-04-01 01:59:04 +08:00
|
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
2007-02-07 22:56:24 +08:00
|
|
|
|
* Copyright by The HDF Group. *
|
2003-04-01 01:59:04 +08:00
|
|
|
|
* Copyright by the Board of Trustees of the University of Illinois. *
|
|
|
|
|
* All rights reserved. *
|
|
|
|
|
* *
|
|
|
|
|
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
|
|
|
|
* terms governing use, modification, and redistribution, is contained in *
|
|
|
|
|
* the files COPYING and Copyright.html. COPYING can be found at the root *
|
|
|
|
|
* of the source code distribution tree; Copyright.html can be found at the *
|
|
|
|
|
* root level of an installed copy of the electronic HDF5 document set and *
|
|
|
|
|
* is linked from the top-level documents page. It can also be found at *
|
2007-02-07 22:56:24 +08:00
|
|
|
|
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
|
|
|
|
|
* access to either file, you may request a copy from help@hdfgroup.org. *
|
2003-04-01 01:59:04 +08:00
|
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
1998-10-14 06:42:24 +08:00
|
|
|
|
|
|
|
|
|
/***********************************************************
|
|
|
|
|
*
|
|
|
|
|
* Test program: trefer
|
|
|
|
|
*
|
|
|
|
|
* Test the Reference functionality
|
|
|
|
|
*
|
|
|
|
|
*************************************************************/
|
|
|
|
|
|
2001-04-04 02:09:16 +08:00
|
|
|
|
#include "testhdf5.h"
|
1998-10-14 06:42:24 +08:00
|
|
|
|
|
2001-04-04 02:09:16 +08:00
|
|
|
|
#include "hdf5.h"
|
1998-10-14 06:42:24 +08:00
|
|
|
|
|
1999-06-07 23:05:02 +08:00
|
|
|
|
#define FILE1 "trefer1.h5"
|
|
|
|
|
#define FILE2 "trefer2.h5"
|
2000-10-18 04:46:57 +08:00
|
|
|
|
#define FILE3 "trefer3.h5"
|
1998-10-14 06:42:24 +08:00
|
|
|
|
|
|
|
|
|
/* 1-D dataset with fixed dimensions */
|
|
|
|
|
#define SPACE1_RANK 1
|
|
|
|
|
#define SPACE1_DIM1 4
|
|
|
|
|
|
1998-11-13 08:28:58 +08:00
|
|
|
|
/* 2-D dataset with fixed dimensions */
|
|
|
|
|
#define SPACE2_RANK 2
|
|
|
|
|
#define SPACE2_DIM1 10
|
|
|
|
|
#define SPACE2_DIM2 10
|
|
|
|
|
|
2002-06-10 23:19:19 +08:00
|
|
|
|
/* Larger 1-D dataset with fixed dimensions */
|
|
|
|
|
#define SPACE3_RANK 1
|
|
|
|
|
#define SPACE3_DIM1 100
|
|
|
|
|
|
1998-11-13 08:28:58 +08:00
|
|
|
|
/* Element selection information */
|
|
|
|
|
#define POINT1_NPOINTS 10
|
|
|
|
|
|
1999-03-18 09:30:10 +08:00
|
|
|
|
/* Compound datatype */
|
|
|
|
|
typedef struct s1_t {
|
|
|
|
|
unsigned int a;
|
|
|
|
|
unsigned int b;
|
|
|
|
|
float c;
|
|
|
|
|
} s1_t;
|
|
|
|
|
|
2005-07-31 02:53:01 +08:00
|
|
|
|
#define GROUPNAME "/group"
|
|
|
|
|
#define GROUPNAME2 "group2"
|
2005-08-11 04:28:32 +08:00
|
|
|
|
#define GROUPNAME3 "group3"
|
2005-07-31 02:53:01 +08:00
|
|
|
|
#define DSETNAME "/dset"
|
2005-08-21 00:32:55 +08:00
|
|
|
|
#define DSETNAME2 "dset2"
|
2005-07-31 02:53:01 +08:00
|
|
|
|
#define NAME_SIZE 16
|
|
|
|
|
|
1999-03-18 09:30:10 +08:00
|
|
|
|
|
2010-04-28 23:31:00 +08:00
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_reference_params(): Test basic H5R (reference) parameters
|
|
|
|
|
** for correct processing
|
|
|
|
|
**
|
|
|
|
|
****************************************************************/
|
|
|
|
|
static void
|
|
|
|
|
test_reference_params(void)
|
|
|
|
|
{
|
|
|
|
|
hid_t fid1; /* HDF5 File IDs */
|
|
|
|
|
hid_t dataset, /* Dataset ID */
|
|
|
|
|
dset2; /* Dereferenced dataset ID */
|
|
|
|
|
hid_t group; /* Group ID */
|
|
|
|
|
hid_t sid1; /* Dataspace ID */
|
|
|
|
|
hid_t tid1; /* Datatype ID */
|
2011-07-19 05:23:02 +08:00
|
|
|
|
hid_t dapl_id; /* Dataset access property list */
|
2010-04-28 23:31:00 +08:00
|
|
|
|
hsize_t dims1[] = {SPACE1_DIM1};
|
|
|
|
|
hobj_ref_t *wbuf, /* buffer to write to disk */
|
|
|
|
|
*rbuf, /* buffer read from disk */
|
|
|
|
|
*tbuf; /* temp. buffer read from disk */
|
|
|
|
|
unsigned *tu32; /* Temporary pointer to uint32 data */
|
2010-08-13 05:11:00 +08:00
|
|
|
|
int i; /* counting variables */
|
|
|
|
|
const char *write_comment = "Foo!"; /* Comments for group */
|
2014-08-12 03:13:45 +08:00
|
|
|
|
hid_t ret_id; /* Generic hid_t return value */
|
2016-08-13 17:23:53 +08:00
|
|
|
|
ssize_t name_size; /* Size of reference name */
|
2010-04-28 23:31:00 +08:00
|
|
|
|
herr_t ret; /* Generic return value */
|
|
|
|
|
|
|
|
|
|
/* Output message about test being performed */
|
|
|
|
|
MESSAGE(5, ("Testing Reference Parameters\n"));
|
|
|
|
|
|
|
|
|
|
/* Allocate write & read buffers */
|
2013-10-31 12:20:36 +08:00
|
|
|
|
wbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
|
|
|
|
|
rbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
|
|
|
|
|
tbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
|
2010-04-28 23:31:00 +08:00
|
|
|
|
|
|
|
|
|
/* Create file */
|
|
|
|
|
fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(fid1, FAIL, "H5Fcreate");
|
|
|
|
|
|
|
|
|
|
/* Create dataspace for datasets */
|
|
|
|
|
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
|
|
|
|
|
CHECK(sid1, FAIL, "H5Screate_simple");
|
|
|
|
|
|
2011-07-19 05:23:02 +08:00
|
|
|
|
/* Create dataset access property list */
|
|
|
|
|
dapl_id = H5Pcreate(H5P_DATASET_ACCESS);
|
|
|
|
|
CHECK(dapl_id, FAIL, "H5Pcreate");
|
|
|
|
|
|
2010-04-28 23:31:00 +08:00
|
|
|
|
/* Create a group */
|
|
|
|
|
group = H5Gcreate2(fid1, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(group, FAIL, "H5Gcreate2");
|
|
|
|
|
|
|
|
|
|
/* Set group's comment */
|
|
|
|
|
ret = H5Oset_comment(group, write_comment);
|
|
|
|
|
CHECK(ret, FAIL, "H5Oset_comment");
|
|
|
|
|
|
|
|
|
|
/* Create a dataset (inside Group1) */
|
|
|
|
|
dataset = H5Dcreate2(group, "Dataset1", H5T_NATIVE_UINT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(dataset, FAIL, "H5Dcreate2");
|
|
|
|
|
|
|
|
|
|
for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
|
2016-08-13 17:23:53 +08:00
|
|
|
|
*tu32++ = (unsigned)i * 3;
|
2010-04-28 23:31:00 +08:00
|
|
|
|
|
|
|
|
|
/* Write selection to disk */
|
|
|
|
|
ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dwrite");
|
|
|
|
|
|
|
|
|
|
/* Close Dataset */
|
|
|
|
|
ret = H5Dclose(dataset);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
|
|
/* Create another dataset (inside Group1) */
|
|
|
|
|
dataset = H5Dcreate2(group, "Dataset2", H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(dataset, FAIL, "H5Dcreate2");
|
|
|
|
|
|
|
|
|
|
/* Close Dataset */
|
|
|
|
|
ret = H5Dclose(dataset);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
|
|
/* Create a datatype to refer to */
|
|
|
|
|
tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
|
|
|
|
|
CHECK(tid1, FAIL, "H5Tcreate");
|
|
|
|
|
|
|
|
|
|
/* Insert fields */
|
|
|
|
|
ret = H5Tinsert(tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
|
|
|
|
|
CHECK(ret, FAIL, "H5Tinsert");
|
|
|
|
|
|
|
|
|
|
ret = H5Tinsert(tid1, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT);
|
|
|
|
|
CHECK(ret, FAIL, "H5Tinsert");
|
|
|
|
|
|
|
|
|
|
ret = H5Tinsert(tid1, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT);
|
|
|
|
|
CHECK(ret, FAIL, "H5Tinsert");
|
|
|
|
|
|
|
|
|
|
/* Save datatype for later */
|
|
|
|
|
ret = H5Tcommit2(group, "Datatype1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(ret, FAIL, "H5Tcommit2");
|
|
|
|
|
|
|
|
|
|
/* Close datatype */
|
|
|
|
|
ret = H5Tclose(tid1);
|
|
|
|
|
CHECK(ret, FAIL, "H5Tclose");
|
|
|
|
|
|
|
|
|
|
/* Close group */
|
|
|
|
|
ret = H5Gclose(group);
|
|
|
|
|
CHECK(ret, FAIL, "H5Gclose");
|
|
|
|
|
|
|
|
|
|
/* Create a dataset */
|
|
|
|
|
dataset = H5Dcreate2(fid1, "Dataset3", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dcreate2");
|
|
|
|
|
|
|
|
|
|
/* Test parameters to H5Rcreate */
|
2014-07-31 04:55:14 +08:00
|
|
|
|
ret = H5Rcreate(NULL, fid1, "/Group1/Dataset1", H5R_OBJECT, (hid_t)-1);
|
2010-04-28 23:31:00 +08:00
|
|
|
|
VERIFY(ret, FAIL, "H5Rcreate ref");
|
2014-07-31 04:55:14 +08:00
|
|
|
|
ret = H5Rcreate(&wbuf[0], (hid_t)-1, "/Group1/Dataset1", H5R_OBJECT, (hid_t)-1);
|
2010-04-28 23:31:00 +08:00
|
|
|
|
VERIFY(ret, FAIL, "H5Rcreate loc_id");
|
2014-07-31 04:55:14 +08:00
|
|
|
|
ret = H5Rcreate(&wbuf[0], fid1, NULL, H5R_OBJECT, (hid_t)-1);
|
2010-04-28 23:31:00 +08:00
|
|
|
|
VERIFY(ret, FAIL, "H5Rcreate name");
|
2014-07-31 04:55:14 +08:00
|
|
|
|
ret = H5Rcreate(&wbuf[0], fid1, "", H5R_OBJECT, (hid_t)-1);
|
2010-04-28 23:31:00 +08:00
|
|
|
|
VERIFY(ret, FAIL, "H5Rcreate null name");
|
2014-07-31 04:55:14 +08:00
|
|
|
|
ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_MAXTYPE, (hid_t)-1);
|
2010-04-28 23:31:00 +08:00
|
|
|
|
VERIFY(ret, FAIL, "H5Rcreate type");
|
2014-07-31 04:55:14 +08:00
|
|
|
|
ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_DATASET_REGION, (hid_t)-1);
|
2010-04-28 23:31:00 +08:00
|
|
|
|
VERIFY(ret, FAIL, "H5Rcreate region space");
|
2014-07-31 04:55:14 +08:00
|
|
|
|
ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_MAXTYPE, (hid_t)0);
|
2010-04-28 23:31:00 +08:00
|
|
|
|
VERIFY(ret, FAIL, "H5Rcreate space");
|
|
|
|
|
|
|
|
|
|
/* Test parameters to H5Rdereference */
|
2014-07-31 04:55:14 +08:00
|
|
|
|
dset2 = H5Rdereference2((hid_t)-1, H5P_DEFAULT, H5R_OBJECT, &rbuf[0]);
|
2011-07-19 07:12:28 +08:00
|
|
|
|
VERIFY(dset2, FAIL, "H5Rdereference2 loc_id");
|
2014-07-31 04:55:14 +08:00
|
|
|
|
dset2 = H5Rdereference2(dataset, (hid_t)-1, H5R_OBJECT, &rbuf[0]);
|
2011-07-20 04:20:01 +08:00
|
|
|
|
VERIFY(dset2, FAIL, "H5Rdereference2 oapl_id");
|
2011-07-19 05:23:02 +08:00
|
|
|
|
dset2 = H5Rdereference2(dataset, dapl_id, H5R_OBJECT, NULL);
|
2011-07-19 07:12:28 +08:00
|
|
|
|
VERIFY(dset2, FAIL, "H5Rdereference2 ref");
|
2011-07-19 05:23:02 +08:00
|
|
|
|
dset2 = H5Rdereference2(dataset, dapl_id, H5R_MAXTYPE, &rbuf[0]);
|
2011-07-19 07:12:28 +08:00
|
|
|
|
VERIFY(dset2, FAIL, "H5Rdereference2 type");
|
2010-04-28 23:31:00 +08:00
|
|
|
|
|
2010-04-29 21:07:55 +08:00
|
|
|
|
/* Test parameters to H5Rget_obj_type2 */
|
2014-07-31 04:55:14 +08:00
|
|
|
|
ret = H5Rget_obj_type2((hid_t)-1, H5R_OBJECT, &rbuf[0], NULL);
|
2010-04-29 21:07:55 +08:00
|
|
|
|
VERIFY(ret, FAIL, "H5Rget_obj_type2 loc_id");
|
|
|
|
|
ret = H5Rget_obj_type2(fid1, H5R_OBJECT, NULL, NULL);
|
|
|
|
|
VERIFY(ret, FAIL, "H5Rget_obj_type2 ref");
|
|
|
|
|
ret = H5Rget_obj_type2(fid1, H5R_MAXTYPE, &rbuf[0], NULL);
|
|
|
|
|
VERIFY(ret, FAIL, "H5Rget_obj_type2 type");
|
2010-04-28 23:31:00 +08:00
|
|
|
|
|
|
|
|
|
/* Test parameters to H5Rget_name */
|
2014-07-31 04:55:14 +08:00
|
|
|
|
name_size = H5Rget_name((hid_t)-1, H5R_DATASET_REGION, &rbuf[0], NULL, 0);
|
2010-04-28 23:31:00 +08:00
|
|
|
|
VERIFY(name_size, FAIL, "H5Rget_name loc_id");
|
|
|
|
|
name_size = H5Rget_name(fid1, H5R_DATASET_REGION, NULL, NULL, 0);
|
2014-02-04 23:11:20 +08:00
|
|
|
|
VERIFY(name_size, FAIL, "H5Rget_name ref");
|
2010-04-28 23:31:00 +08:00
|
|
|
|
name_size = H5Rget_name(fid1, H5R_MAXTYPE, &rbuf[0], NULL, 0);
|
2014-02-04 23:11:20 +08:00
|
|
|
|
VERIFY(name_size, FAIL, "H5Rget_name type");
|
2010-04-28 23:31:00 +08:00
|
|
|
|
|
|
|
|
|
/* Test parameters to H5Rget_region */
|
2014-08-12 03:13:45 +08:00
|
|
|
|
ret_id = H5Rget_region((hid_t)-1, H5R_OBJECT, &rbuf[0]);
|
|
|
|
|
VERIFY(ret_id, FAIL, "H5Rget_region loc_id");
|
|
|
|
|
ret_id = H5Rget_region(fid1, H5R_OBJECT, NULL);
|
|
|
|
|
VERIFY(ret_id, FAIL, "H5Rget_region ref");
|
|
|
|
|
ret_id = H5Rget_region(fid1, H5R_OBJECT, &rbuf[0]);
|
|
|
|
|
VERIFY(ret_id, FAIL, "H5Rget_region type");
|
2010-04-28 23:31:00 +08:00
|
|
|
|
|
|
|
|
|
/* Close disk dataspace */
|
|
|
|
|
ret = H5Sclose(sid1);
|
|
|
|
|
CHECK(ret, FAIL, "H5Sclose");
|
|
|
|
|
|
2011-07-19 05:23:02 +08:00
|
|
|
|
/* Close dataset access property list */
|
|
|
|
|
ret = H5Pclose(dapl_id);
|
|
|
|
|
CHECK(ret, FAIL, "H5Pclose");
|
|
|
|
|
|
2010-04-28 23:31:00 +08:00
|
|
|
|
/* Close Dataset */
|
|
|
|
|
ret = H5Dclose(dataset);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
|
|
/* Close file */
|
|
|
|
|
ret = H5Fclose(fid1);
|
|
|
|
|
CHECK(ret, FAIL, "H5Fclose");
|
|
|
|
|
|
|
|
|
|
/* Free memory buffers */
|
2013-10-31 12:20:36 +08:00
|
|
|
|
HDfree(wbuf);
|
|
|
|
|
HDfree(rbuf);
|
|
|
|
|
HDfree(tbuf);
|
2010-04-28 23:31:00 +08:00
|
|
|
|
} /* test_reference_obj() */
|
|
|
|
|
|
1998-10-14 06:42:24 +08:00
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_reference_obj(): Test basic H5R (reference) object reference code.
|
|
|
|
|
** Tests references to various kinds of objects
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
1998-10-14 06:42:24 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static void
|
1998-10-14 06:42:24 +08:00
|
|
|
|
test_reference_obj(void)
|
|
|
|
|
{
|
2011-07-19 05:23:02 +08:00
|
|
|
|
hid_t fid1; /* HDF5 File IDs */
|
|
|
|
|
hid_t dataset, /* Dataset ID */
|
|
|
|
|
dset2; /* Dereferenced dataset ID */
|
1998-10-14 06:42:24 +08:00
|
|
|
|
hid_t group; /* Group ID */
|
|
|
|
|
hid_t sid1; /* Dataspace ID */
|
1999-03-18 09:30:10 +08:00
|
|
|
|
hid_t tid1; /* Datatype ID */
|
1998-10-14 06:42:24 +08:00
|
|
|
|
hsize_t dims1[] = {SPACE1_DIM1};
|
2011-07-19 05:23:02 +08:00
|
|
|
|
hid_t dapl_id; /* Dataset access property list */
|
|
|
|
|
hobj_ref_t *wbuf, /* buffer to write to disk */
|
|
|
|
|
*rbuf, /* buffer read from disk */
|
|
|
|
|
*tbuf; /* temp. buffer read from disk */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
hobj_ref_t nvrbuf[3]={0,101,1000000000}; /* buffer with non-valid refs */
|
2011-07-19 05:23:02 +08:00
|
|
|
|
unsigned *tu32; /* Temporary pointer to uint32 data */
|
|
|
|
|
int i, j; /* counting variables */
|
1999-03-18 08:07:55 +08:00
|
|
|
|
const char *write_comment="Foo!"; /* Comments for group */
|
|
|
|
|
char read_comment[10];
|
2011-07-19 05:23:02 +08:00
|
|
|
|
H5O_type_t obj_type; /* Object type */
|
2016-08-13 17:23:53 +08:00
|
|
|
|
ssize_t size; /* Comment length */
|
2011-07-19 05:23:02 +08:00
|
|
|
|
herr_t ret; /* Generic return value */
|
1998-10-14 06:42:24 +08:00
|
|
|
|
|
|
|
|
|
/* Output message about test being performed */
|
|
|
|
|
MESSAGE(5, ("Testing Object Reference Functions\n"));
|
|
|
|
|
|
|
|
|
|
/* Allocate write & read buffers */
|
2013-10-31 12:20:36 +08:00
|
|
|
|
wbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
|
|
|
|
|
rbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
|
|
|
|
|
tbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
|
1998-10-14 06:42:24 +08:00
|
|
|
|
|
|
|
|
|
/* Create file */
|
1999-06-07 23:05:02 +08:00
|
|
|
|
fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
1998-10-14 06:42:24 +08:00
|
|
|
|
CHECK(fid1, FAIL, "H5Fcreate");
|
|
|
|
|
|
|
|
|
|
/* Create dataspace for datasets */
|
|
|
|
|
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
|
|
|
|
|
CHECK(sid1, FAIL, "H5Screate_simple");
|
|
|
|
|
|
2011-07-19 05:23:02 +08:00
|
|
|
|
/* Create dataset access property list */
|
|
|
|
|
dapl_id = H5Pcreate(H5P_DATASET_ACCESS);
|
|
|
|
|
CHECK(dapl_id, FAIL, "H5Pcreate");
|
|
|
|
|
|
1998-10-14 06:42:24 +08:00
|
|
|
|
/* Create a group */
|
2007-08-24 04:25:25 +08:00
|
|
|
|
group = H5Gcreate2(fid1, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(group, FAIL, "H5Gcreate2");
|
1998-10-14 06:42:24 +08:00
|
|
|
|
|
1999-03-18 08:07:55 +08:00
|
|
|
|
/* Set group's comment */
|
[svn-r14229] Description:
Change H5O[gs]et_comment to H5O[gs]et_comment_by_name and re-add simpler
forms of H5O[gs]et_comment.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-02 02:24:08 +08:00
|
|
|
|
ret = H5Oset_comment(group, write_comment);
|
2007-08-30 21:55:10 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Oset_comment");
|
1998-10-14 06:42:24 +08:00
|
|
|
|
|
1999-03-18 08:07:55 +08:00
|
|
|
|
/* Create a dataset (inside Group1) */
|
[svn-r14199] Description:
Add H5Dcreate to API versioned routines, replacing internal usage with
H5Dcreate2
Fix thread-safe error stack initialization for API versioned error
stack printing routines.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-12 00:24:11 +08:00
|
|
|
|
dataset = H5Dcreate2(group, "Dataset1", H5T_NATIVE_UINT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(dataset, FAIL, "H5Dcreate2");
|
1998-10-14 06:42:24 +08:00
|
|
|
|
|
2007-09-14 09:52:38 +08:00
|
|
|
|
for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
|
2016-08-13 17:23:53 +08:00
|
|
|
|
*tu32++ = (unsigned)i * 3;
|
1998-10-14 06:42:24 +08:00
|
|
|
|
|
|
|
|
|
/* Write selection to disk */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
|
1998-10-14 06:42:24 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Dwrite");
|
|
|
|
|
|
|
|
|
|
/* Close Dataset */
|
|
|
|
|
ret = H5Dclose(dataset);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
1999-03-18 08:07:55 +08:00
|
|
|
|
/* Create another dataset (inside Group1) */
|
[svn-r14199] Description:
Add H5Dcreate to API versioned routines, replacing internal usage with
H5Dcreate2
Fix thread-safe error stack initialization for API versioned error
stack printing routines.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-12 00:24:11 +08:00
|
|
|
|
dataset = H5Dcreate2(group, "Dataset2", H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(dataset, FAIL, "H5Dcreate2");
|
1998-10-14 06:42:24 +08:00
|
|
|
|
|
|
|
|
|
/* Close Dataset */
|
|
|
|
|
ret = H5Dclose(dataset);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
1999-03-18 09:30:10 +08:00
|
|
|
|
/* Create a datatype to refer to */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
|
1999-03-18 09:30:10 +08:00
|
|
|
|
CHECK(tid1, FAIL, "H5Tcreate");
|
|
|
|
|
|
|
|
|
|
/* Insert fields */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Tinsert(tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
|
1999-03-18 09:30:10 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Tinsert");
|
|
|
|
|
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Tinsert(tid1, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT);
|
1999-03-18 09:30:10 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Tinsert");
|
|
|
|
|
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Tinsert(tid1, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT);
|
1999-03-18 09:30:10 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Tinsert");
|
|
|
|
|
|
|
|
|
|
/* Save datatype for later */
|
[svn-r14156] Description:
Add API versioning to H5Tcommit()
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
AIX/32 5.3 (copper) w/FORTRAN, w/parallel, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-09-26 10:50:31 +08:00
|
|
|
|
ret = H5Tcommit2(group, "Datatype1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(ret, FAIL, "H5Tcommit2");
|
1999-03-18 09:30:10 +08:00
|
|
|
|
|
|
|
|
|
/* Close datatype */
|
|
|
|
|
ret = H5Tclose(tid1);
|
|
|
|
|
CHECK(ret, FAIL, "H5Tclose");
|
|
|
|
|
|
1999-03-18 08:07:55 +08:00
|
|
|
|
/* Close group */
|
|
|
|
|
ret = H5Gclose(group);
|
|
|
|
|
CHECK(ret, FAIL, "H5Gclose");
|
|
|
|
|
|
1998-10-14 06:42:24 +08:00
|
|
|
|
/* Create a dataset */
|
[svn-r14199] Description:
Add H5Dcreate to API versioned routines, replacing internal usage with
H5Dcreate2
Fix thread-safe error stack initialization for API versioned error
stack printing routines.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-12 00:24:11 +08:00
|
|
|
|
dataset = H5Dcreate2(fid1, "Dataset3", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dcreate2");
|
1998-10-14 06:42:24 +08:00
|
|
|
|
|
1999-03-18 09:30:10 +08:00
|
|
|
|
/* Create reference to dataset */
|
2014-07-31 04:55:14 +08:00
|
|
|
|
ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_OBJECT, (hid_t)-1);
|
1998-10-14 06:42:24 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Rcreate");
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &wbuf[0], &obj_type);
|
|
|
|
|
CHECK(ret, FAIL, "H5Rget_obj_type2");
|
|
|
|
|
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
|
1998-10-14 06:42:24 +08:00
|
|
|
|
|
1999-03-18 09:30:10 +08:00
|
|
|
|
/* Create reference to dataset */
|
2014-07-31 04:55:14 +08:00
|
|
|
|
ret = H5Rcreate(&wbuf[1], fid1, "/Group1/Dataset2", H5R_OBJECT, (hid_t)-1);
|
1998-10-14 06:42:24 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Rcreate");
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &wbuf[1], &obj_type);
|
|
|
|
|
CHECK(ret, FAIL, "H5Rget_obj_type2");
|
|
|
|
|
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
|
1998-10-14 06:42:24 +08:00
|
|
|
|
|
1999-03-18 09:30:10 +08:00
|
|
|
|
/* Create reference to group */
|
2014-07-31 04:55:14 +08:00
|
|
|
|
ret = H5Rcreate(&wbuf[2], fid1, "/Group1", H5R_OBJECT, (hid_t)-1);
|
1998-10-14 06:42:24 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Rcreate");
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &wbuf[2], &obj_type);
|
|
|
|
|
CHECK(ret, FAIL, "H5Rget_obj_type2");
|
|
|
|
|
VERIFY(obj_type, H5O_TYPE_GROUP, "H5Rget_obj_type2");
|
1999-03-18 09:30:10 +08:00
|
|
|
|
|
|
|
|
|
/* Create reference to named datatype */
|
2014-07-31 04:55:14 +08:00
|
|
|
|
ret = H5Rcreate(&wbuf[3], fid1, "/Group1/Datatype1", H5R_OBJECT, (hid_t)-1);
|
1999-03-18 09:30:10 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Rcreate");
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &wbuf[3], &obj_type);
|
|
|
|
|
CHECK(ret, FAIL, "H5Rget_obj_type2");
|
|
|
|
|
VERIFY(obj_type, H5O_TYPE_NAMED_DATATYPE, "H5Rget_obj_type2");
|
1998-10-14 06:42:24 +08:00
|
|
|
|
|
|
|
|
|
/* Write selection to disk */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Dwrite(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
|
1998-10-14 06:42:24 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Dwrite");
|
|
|
|
|
|
|
|
|
|
/* Close disk dataspace */
|
|
|
|
|
ret = H5Sclose(sid1);
|
|
|
|
|
CHECK(ret, FAIL, "H5Sclose");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
1998-10-14 06:42:24 +08:00
|
|
|
|
/* Close Dataset */
|
|
|
|
|
ret = H5Dclose(dataset);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
|
|
/* Close file */
|
|
|
|
|
ret = H5Fclose(fid1);
|
|
|
|
|
CHECK(ret, FAIL, "H5Fclose");
|
|
|
|
|
|
|
|
|
|
/* Re-open the file */
|
1999-06-07 23:05:02 +08:00
|
|
|
|
fid1 = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT);
|
1998-10-14 06:42:24 +08:00
|
|
|
|
CHECK(fid1, FAIL, "H5Fopen");
|
|
|
|
|
|
|
|
|
|
/* Open the dataset */
|
[svn-r14193] Description:
Make H5Dopen versioned and change all internal usage to use H5Dopen2
Add simple regression test for H5Dopen1
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-09 03:59:36 +08:00
|
|
|
|
dataset = H5Dopen2(fid1, "/Dataset3", H5P_DEFAULT);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dopen2");
|
1998-10-14 06:42:24 +08:00
|
|
|
|
|
|
|
|
|
/* Read selection from disk */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Dread(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
|
1998-10-14 06:42:24 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Dread");
|
|
|
|
|
|
1999-03-18 08:07:55 +08:00
|
|
|
|
/* Open dataset object */
|
2011-07-19 05:23:02 +08:00
|
|
|
|
dset2 = H5Rdereference2(dataset, dapl_id, H5R_OBJECT, &rbuf[0]);
|
2011-07-19 07:12:28 +08:00
|
|
|
|
CHECK(dset2, FAIL, "H5Rdereference2");
|
1998-10-14 06:42:24 +08:00
|
|
|
|
|
|
|
|
|
/* Check information in referenced dataset */
|
1998-10-20 06:25:03 +08:00
|
|
|
|
sid1 = H5Dget_space(dset2);
|
|
|
|
|
CHECK(sid1, FAIL, "H5Dget_space");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = (int)H5Sget_simple_extent_npoints(sid1);
|
1998-10-20 06:25:03 +08:00
|
|
|
|
VERIFY(ret, 4, "H5Sget_simple_extent_npoints");
|
1998-10-14 06:42:24 +08:00
|
|
|
|
|
|
|
|
|
/* Read from disk */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Dread(dset2, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, tbuf);
|
1998-10-14 06:42:24 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Dread");
|
|
|
|
|
|
2007-09-14 09:52:38 +08:00
|
|
|
|
for(tu32 = (unsigned *)tbuf, i = 0; i < SPACE1_DIM1; i++, tu32++)
|
1998-11-19 02:40:09 +08:00
|
|
|
|
VERIFY(*tu32, (uint32_t)(i*3), "Data");
|
1998-10-14 06:42:24 +08:00
|
|
|
|
|
1998-10-20 06:25:03 +08:00
|
|
|
|
/* Close dereferenced Dataset */
|
|
|
|
|
ret = H5Dclose(dset2);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
2011-07-19 05:23:02 +08:00
|
|
|
|
/* Open group object. GAPL isn't supported yet. But it's harmless to pass in */
|
2011-07-19 07:12:28 +08:00
|
|
|
|
group = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &rbuf[2]);
|
|
|
|
|
CHECK(group, FAIL, "H5Rdereference2");
|
1999-03-18 08:07:55 +08:00
|
|
|
|
|
|
|
|
|
/* Get group's comment */
|
2016-08-13 17:23:53 +08:00
|
|
|
|
size = H5Oget_comment(group, read_comment, (size_t)10);
|
|
|
|
|
CHECK(size, FAIL, "H5Oget_comment");
|
1999-03-18 08:07:55 +08:00
|
|
|
|
|
|
|
|
|
/* Check for correct comment value */
|
2006-10-31 04:00:57 +08:00
|
|
|
|
if(HDstrcmp(write_comment, read_comment) != 0)
|
2004-01-10 09:41:13 +08:00
|
|
|
|
TestErrPrintf("Error! Incorrect group comment, wanted: %s, got: %s\n",write_comment,read_comment);
|
1999-03-18 08:07:55 +08:00
|
|
|
|
|
|
|
|
|
/* Close group */
|
|
|
|
|
ret = H5Gclose(group);
|
|
|
|
|
CHECK(ret, FAIL, "H5Gclose");
|
|
|
|
|
|
2011-07-19 05:23:02 +08:00
|
|
|
|
/* Open datatype object. TAPL isn't supported yet. But it's harmless to pass in */
|
2011-07-19 07:12:28 +08:00
|
|
|
|
tid1 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &rbuf[3]);
|
|
|
|
|
CHECK(tid1, FAIL, "H5Rdereference2");
|
1999-03-18 09:30:10 +08:00
|
|
|
|
|
|
|
|
|
/* Verify correct datatype */
|
|
|
|
|
{
|
|
|
|
|
H5T_class_t tclass;
|
|
|
|
|
|
2007-09-14 09:52:38 +08:00
|
|
|
|
tclass = H5Tget_class(tid1);
|
1999-03-18 09:30:10 +08:00
|
|
|
|
VERIFY(tclass, H5T_COMPOUND, "H5Tget_class");
|
|
|
|
|
|
|
|
|
|
ret= H5Tget_nmembers(tid1);
|
|
|
|
|
VERIFY(ret, 3, "H5Tget_nmembers");
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-15 07:29:25 +08:00
|
|
|
|
/* Attempting to retrieve type of object using non-valid refs */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
for(j = 0; j < 3; j++) {
|
|
|
|
|
H5E_BEGIN_TRY {
|
|
|
|
|
ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &nvrbuf[j], &obj_type);
|
|
|
|
|
} H5E_END_TRY;
|
|
|
|
|
VERIFY(ret, FAIL, "H5Rget_obj_type2");
|
|
|
|
|
} /* end for */
|
2007-03-15 07:29:25 +08:00
|
|
|
|
|
1999-03-18 09:30:10 +08:00
|
|
|
|
/* Close datatype */
|
|
|
|
|
ret = H5Tclose(tid1);
|
|
|
|
|
CHECK(ret, FAIL, "H5Tclose");
|
|
|
|
|
|
1998-10-14 06:42:24 +08:00
|
|
|
|
/* Close Dataset */
|
|
|
|
|
ret = H5Dclose(dataset);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
2011-07-19 05:23:02 +08:00
|
|
|
|
/* Close dataset access property list */
|
|
|
|
|
ret = H5Pclose(dapl_id);
|
|
|
|
|
CHECK(ret, FAIL, "H5Pclose");
|
|
|
|
|
|
1998-10-14 06:42:24 +08:00
|
|
|
|
/* Close file */
|
|
|
|
|
ret = H5Fclose(fid1);
|
|
|
|
|
CHECK(ret, FAIL, "H5Fclose");
|
|
|
|
|
|
|
|
|
|
/* Free memory buffers */
|
2013-10-31 12:20:36 +08:00
|
|
|
|
HDfree(wbuf);
|
|
|
|
|
HDfree(rbuf);
|
|
|
|
|
HDfree(tbuf);
|
1998-10-14 06:42:24 +08:00
|
|
|
|
} /* test_reference_obj() */
|
|
|
|
|
|
1998-11-13 08:28:58 +08:00
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_reference_region(): Test basic H5R (reference) object reference code.
|
|
|
|
|
** Tests references to various kinds of objects
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
1998-11-13 08:28:58 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static void
|
1998-11-13 08:28:58 +08:00
|
|
|
|
test_reference_region(void)
|
|
|
|
|
{
|
2004-12-29 22:26:20 +08:00
|
|
|
|
hid_t fid1; /* HDF5 File IDs */
|
|
|
|
|
hid_t dset1, /* Dataset ID */
|
|
|
|
|
dset2; /* Dereferenced dataset ID */
|
|
|
|
|
hid_t sid1, /* Dataspace ID #1 */
|
|
|
|
|
sid2; /* Dataspace ID #2 */
|
2011-07-19 05:23:02 +08:00
|
|
|
|
hid_t dapl_id; /* Dataset access property list */
|
2004-12-29 22:26:20 +08:00
|
|
|
|
hsize_t dims1[] = {SPACE1_DIM1},
|
1998-11-13 08:28:58 +08:00
|
|
|
|
dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
|
2004-12-29 22:26:20 +08:00
|
|
|
|
hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
|
|
|
|
|
hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
|
|
|
|
|
hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
|
|
|
|
|
hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
|
|
|
|
|
hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
|
|
|
|
|
hsize_t * coords; /* Coordinate buffer */
|
|
|
|
|
hsize_t low[SPACE2_RANK]; /* Selection bounds */
|
|
|
|
|
hsize_t high[SPACE2_RANK]; /* Selection bounds */
|
|
|
|
|
hdset_reg_ref_t *wbuf, /* buffer to write to disk */
|
1998-11-13 08:28:58 +08:00
|
|
|
|
*rbuf; /* buffer read from disk */
|
2015-08-04 11:00:45 +08:00
|
|
|
|
hdset_reg_ref_t nvrbuf[3]={{0},{101},{255}}; /* buffer with non-valid refs */
|
1998-11-19 02:40:09 +08:00
|
|
|
|
uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
|
1998-11-13 08:28:58 +08:00
|
|
|
|
*drbuf; /* Buffer for reading numeric data from disk */
|
1998-11-19 02:40:09 +08:00
|
|
|
|
uint8_t *tu8; /* Temporary pointer to uint8 data */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
H5O_type_t obj_type; /* Type of object */
|
2007-03-15 07:29:25 +08:00
|
|
|
|
int i, j; /* counting variables */
|
2015-08-22 03:57:29 +08:00
|
|
|
|
hssize_t hssize_ret; /* hssize_t return value */
|
|
|
|
|
htri_t tri_ret; /* htri_t return value */
|
2004-12-29 22:26:20 +08:00
|
|
|
|
herr_t ret; /* Generic return value */
|
2015-03-06 05:42:42 +08:00
|
|
|
|
haddr_t addr = HADDR_UNDEF; /* test for undefined reference */
|
|
|
|
|
hid_t dset_NA; /* Dataset id for undefined reference */
|
|
|
|
|
hid_t space_NA; /* Dataspace id for undefined reference */
|
|
|
|
|
hsize_t dims_NA[1] = {1}; /* Dims array for undefined reference */
|
|
|
|
|
hdset_reg_ref_t wdata_NA[1], /* Write buffer */
|
|
|
|
|
rdata_NA[1]; /* Read buffer */
|
1998-11-13 08:28:58 +08:00
|
|
|
|
|
|
|
|
|
/* Output message about test being performed */
|
|
|
|
|
MESSAGE(5, ("Testing Dataset Region Reference Functions\n"));
|
|
|
|
|
|
|
|
|
|
/* Allocate write & read buffers */
|
2010-08-13 05:11:00 +08:00
|
|
|
|
wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
|
|
|
|
|
rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
|
|
|
|
|
dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
|
|
|
|
|
drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
|
1998-11-13 08:28:58 +08:00
|
|
|
|
|
|
|
|
|
/* Create file */
|
1999-06-07 23:05:02 +08:00
|
|
|
|
fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
1998-11-13 08:28:58 +08:00
|
|
|
|
CHECK(fid1, FAIL, "H5Fcreate");
|
|
|
|
|
|
|
|
|
|
/* Create dataspace for datasets */
|
|
|
|
|
sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL);
|
|
|
|
|
CHECK(sid2, FAIL, "H5Screate_simple");
|
|
|
|
|
|
2011-07-19 05:23:02 +08:00
|
|
|
|
/* Create dataset access property list */
|
|
|
|
|
dapl_id = H5Pcreate(H5P_DATASET_ACCESS);
|
|
|
|
|
CHECK(dapl_id, FAIL, "H5Pcreate");
|
|
|
|
|
|
1998-11-13 08:28:58 +08:00
|
|
|
|
/* Create a dataset */
|
[svn-r14199] Description:
Add H5Dcreate to API versioned routines, replacing internal usage with
H5Dcreate2
Fix thread-safe error stack initialization for API versioned error
stack printing routines.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-12 00:24:11 +08:00
|
|
|
|
dset2 = H5Dcreate2(fid1, "Dataset2", H5T_STD_U8LE, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(dset2, FAIL, "H5Dcreate2");
|
1998-11-13 08:28:58 +08:00
|
|
|
|
|
2007-09-14 09:52:38 +08:00
|
|
|
|
for(tu8 = dwbuf, i = 0; i < (SPACE2_DIM1 * SPACE2_DIM2); i++)
|
2016-08-13 17:23:53 +08:00
|
|
|
|
*tu8++ = (uint8_t)(i * 3);
|
1998-11-13 08:28:58 +08:00
|
|
|
|
|
|
|
|
|
/* Write selection to disk */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Dwrite(dset2, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf);
|
1998-11-13 08:28:58 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Dwrite");
|
|
|
|
|
|
|
|
|
|
/* Close Dataset */
|
|
|
|
|
ret = H5Dclose(dset2);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
|
|
/* Create dataspace for the reference dataset */
|
|
|
|
|
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
|
|
|
|
|
CHECK(sid1, FAIL, "H5Screate_simple");
|
|
|
|
|
|
|
|
|
|
/* Create a dataset */
|
[svn-r14199] Description:
Add H5Dcreate to API versioned routines, replacing internal usage with
H5Dcreate2
Fix thread-safe error stack initialization for API versioned error
stack printing routines.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-12 00:24:11 +08:00
|
|
|
|
dset1 = H5Dcreate2(fid1, "Dataset1", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dcreate2");
|
1998-11-13 08:28:58 +08:00
|
|
|
|
|
|
|
|
|
/* Create references */
|
|
|
|
|
|
|
|
|
|
/* Select 6x6 hyperslab for first reference */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
start[0] = 2; start[1] = 2;
|
|
|
|
|
stride[0] = 1; stride[1] = 1;
|
|
|
|
|
count[0] = 1; count[1] = 1;
|
|
|
|
|
block[0] = 6; block[1] = 6;
|
|
|
|
|
ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
|
1998-11-13 08:28:58 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Sselect_hyperslab");
|
|
|
|
|
|
2001-11-28 00:29:13 +08:00
|
|
|
|
ret = (int)H5Sget_select_npoints(sid2);
|
1999-03-11 07:50:25 +08:00
|
|
|
|
VERIFY(ret, 36, "H5Sget_select_npoints");
|
|
|
|
|
|
1998-11-13 08:28:58 +08:00
|
|
|
|
/* Store first dataset region */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Rcreate(&wbuf[0], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
|
1998-11-13 08:28:58 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Rcreate");
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf[0], &obj_type);
|
|
|
|
|
CHECK(ret, FAIL, "H5Rget_obj_type2");
|
|
|
|
|
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
|
1998-11-13 08:28:58 +08:00
|
|
|
|
|
|
|
|
|
/* Select sequence of ten points for second reference */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
coord1[0][0] = 6; coord1[0][1] = 9;
|
|
|
|
|
coord1[1][0] = 2; coord1[1][1] = 2;
|
|
|
|
|
coord1[2][0] = 8; coord1[2][1] = 4;
|
|
|
|
|
coord1[3][0] = 1; coord1[3][1] = 6;
|
|
|
|
|
coord1[4][0] = 2; coord1[4][1] = 8;
|
|
|
|
|
coord1[5][0] = 3; coord1[5][1] = 2;
|
|
|
|
|
coord1[6][0] = 0; coord1[6][1] = 4;
|
|
|
|
|
coord1[7][0] = 9; coord1[7][1] = 0;
|
|
|
|
|
coord1[8][0] = 7; coord1[8][1] = 1;
|
|
|
|
|
coord1[9][0] = 3; coord1[9][1] = 3;
|
[svn-r15800] Description:
Bring file free space branch changes through r15795 into trunk, which
includes a fair bit of code cleanup & rearrangement along with a couple of
bug fixes also.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-07 12:17:35 +08:00
|
|
|
|
ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
|
1998-11-13 08:28:58 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Sselect_elements");
|
|
|
|
|
|
2001-11-28 00:29:13 +08:00
|
|
|
|
ret = (int)H5Sget_select_npoints(sid2);
|
1999-03-11 07:50:25 +08:00
|
|
|
|
VERIFY(ret, 10, "H5Sget_select_npoints");
|
|
|
|
|
|
1998-11-13 08:28:58 +08:00
|
|
|
|
/* Store second dataset region */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Rcreate(&wbuf[1], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
|
1998-11-13 08:28:58 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Rcreate");
|
|
|
|
|
|
2015-08-22 03:57:29 +08:00
|
|
|
|
/* Select unlimited hyperslab for third reference */
|
|
|
|
|
start[0] = 1; start[1] = 8;
|
|
|
|
|
stride[0] = 4; stride[1] = 1;
|
|
|
|
|
count[0] = H5S_UNLIMITED; count[1] = 1;
|
|
|
|
|
block[0] = 2; block[1] = 2;
|
|
|
|
|
ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
|
|
|
|
|
CHECK(ret, FAIL, "H5Sselect_hyperslab");
|
|
|
|
|
|
|
|
|
|
hssize_ret = H5Sget_select_npoints(sid2);
|
|
|
|
|
VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints");
|
|
|
|
|
|
|
|
|
|
/* Store third dataset region */
|
|
|
|
|
ret = H5Rcreate(&wbuf[2], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
|
|
|
|
|
CHECK(ret, FAIL, "H5Rcreate");
|
|
|
|
|
ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf[0], &obj_type);
|
|
|
|
|
CHECK(ret, FAIL, "H5Rget_obj_type2");
|
|
|
|
|
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
|
|
|
|
|
|
1998-11-13 08:28:58 +08:00
|
|
|
|
/* Write selection to disk */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Dwrite(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
|
1998-11-13 08:28:58 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Dwrite");
|
|
|
|
|
|
2015-03-06 05:42:42 +08:00
|
|
|
|
/*
|
|
|
|
|
* Store a dataset region reference which will not get written to disk
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* Create reference to an element in dset1 */
|
|
|
|
|
ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)1, (const hsize_t *)coord1);
|
|
|
|
|
CHECK(ret, FAIL, "H5Sselect_elements");
|
|
|
|
|
ret = H5Rcreate(&wdata_NA[0], fid1, "/Dataset1", H5R_DATASET_REGION, sid2);
|
|
|
|
|
CHECK(ret, FAIL, "H5Rcreate");
|
|
|
|
|
|
|
|
|
|
/* Create the dataspace of the region references */
|
|
|
|
|
space_NA = H5Screate_simple(1, dims_NA, NULL);
|
|
|
|
|
CHECK(space_NA, FAIL, "H5Screate_simple");
|
|
|
|
|
|
|
|
|
|
/* Create the dataset and write the region references to it */
|
2015-03-09 01:06:02 +08:00
|
|
|
|
dset_NA = H5Dcreate2(fid1, "DS_NA", H5T_STD_REF_DSETREG, space_NA, H5P_DEFAULT,
|
2015-03-06 05:42:42 +08:00
|
|
|
|
H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(dset_NA, FAIL, "H5Dcreate");
|
|
|
|
|
|
|
|
|
|
/* Close and release resources for undefined region reference tests */
|
|
|
|
|
ret = H5Dclose(dset_NA);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
ret = H5Sclose(space_NA);
|
|
|
|
|
CHECK(ret, FAIL, "H5Sclose");
|
|
|
|
|
|
1998-11-13 08:28:58 +08:00
|
|
|
|
/* Close disk dataspace */
|
|
|
|
|
ret = H5Sclose(sid1);
|
|
|
|
|
CHECK(ret, FAIL, "H5Sclose");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
1998-11-13 08:28:58 +08:00
|
|
|
|
/* Close Dataset */
|
|
|
|
|
ret = H5Dclose(dset1);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
|
|
/* Close uint8 dataset dataspace */
|
|
|
|
|
ret = H5Sclose(sid2);
|
|
|
|
|
CHECK(ret, FAIL, "H5Sclose");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
1998-11-13 08:28:58 +08:00
|
|
|
|
/* Close file */
|
|
|
|
|
ret = H5Fclose(fid1);
|
|
|
|
|
CHECK(ret, FAIL, "H5Fclose");
|
|
|
|
|
|
|
|
|
|
/* Re-open the file */
|
1999-06-07 23:05:02 +08:00
|
|
|
|
fid1 = H5Fopen(FILE2, H5F_ACC_RDWR, H5P_DEFAULT);
|
1998-11-13 08:28:58 +08:00
|
|
|
|
CHECK(fid1, FAIL, "H5Fopen");
|
|
|
|
|
|
2015-03-06 05:42:42 +08:00
|
|
|
|
/*
|
|
|
|
|
* Start the test of an undefined reference
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* Open the dataset of the undefined references */
|
|
|
|
|
dset_NA = H5Dopen2(fid1, "DS_NA", H5P_DEFAULT);
|
|
|
|
|
CHECK(dset_NA, FAIL, "H5Dopen2");
|
|
|
|
|
|
|
|
|
|
/* Read the data */
|
|
|
|
|
ret = H5Dread(dset_NA, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata_NA);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dread");
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Dereference an undefined reference (should fail)
|
|
|
|
|
*/
|
|
|
|
|
H5E_BEGIN_TRY {
|
|
|
|
|
dset2 = H5Rdereference2(dset_NA, H5P_DEFAULT, H5R_DATASET_REGION, &rdata_NA[0]);
|
|
|
|
|
} H5E_END_TRY;
|
|
|
|
|
VERIFY(dset2, FAIL, "H5Rdereference2");
|
|
|
|
|
|
|
|
|
|
/* Close and release resources. */
|
|
|
|
|
ret = H5Dclose(dset_NA);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
|
|
/* This close should fail since H5Rdereference2 never created
|
|
|
|
|
* the id of the referenced object. */
|
|
|
|
|
H5E_BEGIN_TRY {
|
|
|
|
|
ret = H5Dclose(dset2);
|
|
|
|
|
} H5E_END_TRY;
|
|
|
|
|
VERIFY(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* End the test of an undefined reference
|
|
|
|
|
*/
|
|
|
|
|
|
1998-11-13 08:28:58 +08:00
|
|
|
|
/* Open the dataset */
|
[svn-r14193] Description:
Make H5Dopen versioned and change all internal usage to use H5Dopen2
Add simple regression test for H5Dopen1
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-09 03:59:36 +08:00
|
|
|
|
dset1 = H5Dopen2(fid1, "/Dataset1", H5P_DEFAULT);
|
|
|
|
|
CHECK(dset1, FAIL, "H5Dopen2");
|
1998-11-13 08:28:58 +08:00
|
|
|
|
|
|
|
|
|
/* Read selection from disk */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Dread(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
|
1998-11-13 08:28:58 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Dread");
|
|
|
|
|
|
2015-03-06 05:42:42 +08:00
|
|
|
|
/* Try to read an unaddressed dataset */
|
|
|
|
|
dset2 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, &addr);
|
|
|
|
|
VERIFY(dset2, FAIL, "H5Rdereference2 haddr_undef");
|
|
|
|
|
|
1998-11-13 08:28:58 +08:00
|
|
|
|
/* Try to open objects */
|
2011-07-19 05:23:02 +08:00
|
|
|
|
dset2 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, &rbuf[0]);
|
2011-07-19 07:12:28 +08:00
|
|
|
|
CHECK(dset2, FAIL, "H5Rdereference2");
|
1998-11-13 08:28:58 +08:00
|
|
|
|
|
2007-09-14 09:52:38 +08:00
|
|
|
|
/* Check what H5Rget_obj_type2 function returns */
|
|
|
|
|
ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &rbuf[0], &obj_type);
|
|
|
|
|
CHECK(ret, FAIL, "H5Rget_obj_type2");
|
|
|
|
|
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
|
2000-11-11 08:12:21 +08:00
|
|
|
|
|
1998-11-13 08:28:58 +08:00
|
|
|
|
/* Check information in referenced dataset */
|
|
|
|
|
sid1 = H5Dget_space(dset2);
|
|
|
|
|
CHECK(sid1, FAIL, "H5Dget_space");
|
|
|
|
|
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = (int)H5Sget_simple_extent_npoints(sid1);
|
1999-03-11 07:50:25 +08:00
|
|
|
|
VERIFY(ret, 100, "H5Sget_simple_extent_npoints");
|
1998-11-13 08:28:58 +08:00
|
|
|
|
|
|
|
|
|
/* Read from disk */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Dread(dset2, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, drbuf);
|
1998-11-13 08:28:58 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Dread");
|
|
|
|
|
|
2007-09-14 09:52:38 +08:00
|
|
|
|
for(tu8 = (uint8_t *)drbuf, i = 0; i < (SPACE2_DIM1 * SPACE2_DIM2); i++, tu8++)
|
|
|
|
|
VERIFY(*tu8, (uint8_t)(i * 3), "Data");
|
1999-03-11 07:50:25 +08:00
|
|
|
|
|
|
|
|
|
/* Get the hyperslab selection */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
sid2 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[0]);
|
1999-03-11 07:50:25 +08:00
|
|
|
|
CHECK(sid2, FAIL, "H5Rget_region");
|
|
|
|
|
|
|
|
|
|
/* Verify correct hyperslab selected */
|
2001-11-28 00:29:13 +08:00
|
|
|
|
ret = (int)H5Sget_select_npoints(sid2);
|
1999-03-11 07:50:25 +08:00
|
|
|
|
VERIFY(ret, 36, "H5Sget_select_npoints");
|
2001-11-28 00:29:13 +08:00
|
|
|
|
ret = (int)H5Sget_select_hyper_nblocks(sid2);
|
1999-03-11 07:50:25 +08:00
|
|
|
|
VERIFY(ret, 1, "H5Sget_select_hyper_nblocks");
|
2016-08-13 17:23:53 +08:00
|
|
|
|
coords = (hsize_t *)HDmalloc((size_t)ret * SPACE2_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Sget_select_hyper_blocklist(sid2, (hsize_t)0, (hsize_t)ret, coords);
|
1999-03-11 07:50:25 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist");
|
|
|
|
|
VERIFY(coords[0], 2, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[1], 2, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[2], 7, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[3], 7, "Hyperslab Coordinates");
|
|
|
|
|
HDfree(coords);
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Sget_select_bounds(sid2, low, high);
|
1999-03-11 07:50:25 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Sget_select_bounds");
|
|
|
|
|
VERIFY(low[0], 2, "Selection Bounds");
|
|
|
|
|
VERIFY(low[1], 2, "Selection Bounds");
|
|
|
|
|
VERIFY(high[0], 7, "Selection Bounds");
|
|
|
|
|
VERIFY(high[1], 7, "Selection Bounds");
|
|
|
|
|
|
|
|
|
|
/* Close region space */
|
|
|
|
|
ret = H5Sclose(sid2);
|
|
|
|
|
CHECK(ret, FAIL, "H5Sclose");
|
|
|
|
|
|
|
|
|
|
/* Get the element selection */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
sid2 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[1]);
|
1999-03-11 07:50:25 +08:00
|
|
|
|
CHECK(sid2, FAIL, "H5Rget_region");
|
|
|
|
|
|
|
|
|
|
/* Verify correct elements selected */
|
2001-11-28 00:29:13 +08:00
|
|
|
|
ret = (int)H5Sget_select_npoints(sid2);
|
1999-03-11 07:50:25 +08:00
|
|
|
|
VERIFY(ret, 10, "H5Sget_select_npoints");
|
2001-11-28 00:29:13 +08:00
|
|
|
|
ret = (int)H5Sget_select_elem_npoints(sid2);
|
1999-03-11 07:50:25 +08:00
|
|
|
|
VERIFY(ret, 10, "H5Sget_select_elem_npoints");
|
2016-08-13 17:23:53 +08:00
|
|
|
|
coords = (hsize_t *)HDmalloc((size_t)ret * SPACE2_RANK * sizeof(hsize_t)); /* allocate space for the element points */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Sget_select_elem_pointlist(sid2, (hsize_t)0, (hsize_t)ret, coords);
|
1999-03-11 07:50:25 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Sget_select_elem_pointlist");
|
2004-12-29 22:26:20 +08:00
|
|
|
|
VERIFY(coords[0], coord1[0][0], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[1], coord1[0][1], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[2], coord1[1][0], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[3], coord1[1][1], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[4], coord1[2][0], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[5], coord1[2][1], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[6], coord1[3][0], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[7], coord1[3][1], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[8], coord1[4][0], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[9], coord1[4][1], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[10], coord1[5][0], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[11], coord1[5][1], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[12], coord1[6][0], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[13], coord1[6][1], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[14], coord1[7][0], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[15], coord1[7][1], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[16], coord1[8][0], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[17], coord1[8][1], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[18], coord1[9][0], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[19], coord1[9][1], "Element Coordinates");
|
1999-03-11 07:50:25 +08:00
|
|
|
|
HDfree(coords);
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Sget_select_bounds(sid2, low, high);
|
1999-03-11 07:50:25 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Sget_select_bounds");
|
|
|
|
|
VERIFY(low[0], 0, "Selection Bounds");
|
|
|
|
|
VERIFY(low[1], 0, "Selection Bounds");
|
|
|
|
|
VERIFY(high[0], 9, "Selection Bounds");
|
|
|
|
|
VERIFY(high[1], 9, "Selection Bounds");
|
|
|
|
|
|
|
|
|
|
/* Close region space */
|
|
|
|
|
ret = H5Sclose(sid2);
|
|
|
|
|
CHECK(ret, FAIL, "H5Sclose");
|
1998-11-13 08:28:58 +08:00
|
|
|
|
|
2015-08-22 03:57:29 +08:00
|
|
|
|
/* Get the unlimited selection */
|
|
|
|
|
sid2 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[2]);
|
|
|
|
|
CHECK(sid2, FAIL, "H5Rget_region");
|
|
|
|
|
|
|
|
|
|
/* Verify correct hyperslab selected */
|
|
|
|
|
hssize_ret = H5Sget_select_npoints(sid2);
|
|
|
|
|
VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints");
|
|
|
|
|
tri_ret = H5Sis_regular_hyperslab(sid2);
|
|
|
|
|
CHECK(tri_ret, FAIL, "H5Sis_regular_hyperslab");
|
|
|
|
|
VERIFY(tri_ret, TRUE, "H5Sis_regular_hyperslab Result");
|
|
|
|
|
ret = H5Sget_regular_hyperslab(sid2, start, stride, count, block);
|
|
|
|
|
CHECK(ret, FAIL, "H5Sget_regular_hyperslab");
|
|
|
|
|
VERIFY(start[0], (hsize_t)1, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(start[1], (hsize_t)8, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(stride[0], (hsize_t)4, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(stride[1], (hsize_t)1, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(count[0], H5S_UNLIMITED, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(count[1], (hsize_t)1, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(block[0], (hsize_t)2, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(block[1], (hsize_t)2, "Hyperslab Coordinates");
|
|
|
|
|
|
|
|
|
|
/* Close region space */
|
|
|
|
|
ret = H5Sclose(sid2);
|
|
|
|
|
CHECK(ret, FAIL, "H5Sclose");
|
|
|
|
|
|
1999-03-11 07:50:25 +08:00
|
|
|
|
/* Close first space */
|
|
|
|
|
ret = H5Sclose(sid1);
|
|
|
|
|
CHECK(ret, FAIL, "H5Sclose");
|
1998-12-01 03:44:30 +08:00
|
|
|
|
|
1998-11-13 08:28:58 +08:00
|
|
|
|
/* Close dereferenced Dataset */
|
|
|
|
|
ret = H5Dclose(dset2);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
2007-03-15 07:29:25 +08:00
|
|
|
|
/* Attempting to retrieve type of object using non-valid refs */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
for(j = 0; j < 3; j++) {
|
|
|
|
|
H5E_BEGIN_TRY {
|
|
|
|
|
ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &nvrbuf[j], &obj_type);
|
|
|
|
|
} H5E_END_TRY;
|
|
|
|
|
VERIFY(ret, FAIL, "H5Rget_obj_type2");
|
|
|
|
|
} /* end for */
|
2007-03-15 07:29:25 +08:00
|
|
|
|
|
1998-11-13 08:28:58 +08:00
|
|
|
|
/* Close Dataset */
|
1998-12-01 03:44:30 +08:00
|
|
|
|
ret = H5Dclose(dset1);
|
1998-11-13 08:28:58 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
2011-07-19 05:23:02 +08:00
|
|
|
|
/* Close dataset access property list */
|
|
|
|
|
ret = H5Pclose(dapl_id);
|
|
|
|
|
CHECK(ret, FAIL, "H5Pclose");
|
|
|
|
|
|
1998-11-13 08:28:58 +08:00
|
|
|
|
/* Close file */
|
|
|
|
|
ret = H5Fclose(fid1);
|
|
|
|
|
CHECK(ret, FAIL, "H5Fclose");
|
|
|
|
|
|
|
|
|
|
/* Free memory buffers */
|
2013-10-31 12:20:36 +08:00
|
|
|
|
HDfree(wbuf);
|
|
|
|
|
HDfree(rbuf);
|
|
|
|
|
HDfree(dwbuf);
|
|
|
|
|
HDfree(drbuf);
|
1998-11-13 08:28:58 +08:00
|
|
|
|
} /* test_reference_region() */
|
|
|
|
|
|
2002-06-10 23:19:19 +08:00
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_reference_region_1D(): Test H5R (reference) object reference code.
|
|
|
|
|
** Tests 1-D references to various kinds of objects
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2002-06-10 23:19:19 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static void
|
2002-06-10 23:19:19 +08:00
|
|
|
|
test_reference_region_1D(void)
|
|
|
|
|
{
|
|
|
|
|
hid_t fid1; /* HDF5 File IDs */
|
|
|
|
|
hid_t dset1, /* Dataset ID */
|
|
|
|
|
dset3; /* Dereferenced dataset ID */
|
|
|
|
|
hid_t sid1, /* Dataspace ID #1 */
|
|
|
|
|
sid3; /* Dataspace ID #3 */
|
2011-07-19 05:23:02 +08:00
|
|
|
|
hid_t dapl_id; /* Dataset access property list */
|
2002-06-10 23:19:19 +08:00
|
|
|
|
hsize_t dims1[] = {SPACE1_DIM1},
|
|
|
|
|
dims3[] = {SPACE3_DIM1};
|
2004-12-29 22:26:20 +08:00
|
|
|
|
hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */
|
2002-06-10 23:19:19 +08:00
|
|
|
|
hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */
|
|
|
|
|
hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */
|
|
|
|
|
hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */
|
2004-12-29 22:26:20 +08:00
|
|
|
|
hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
|
2002-06-10 23:19:19 +08:00
|
|
|
|
hsize_t * coords; /* Coordinate buffer */
|
2004-12-29 22:26:20 +08:00
|
|
|
|
hsize_t low[SPACE3_RANK]; /* Selection bounds */
|
|
|
|
|
hsize_t high[SPACE3_RANK]; /* Selection bounds */
|
2002-06-10 23:19:19 +08:00
|
|
|
|
hdset_reg_ref_t *wbuf, /* buffer to write to disk */
|
|
|
|
|
*rbuf; /* buffer read from disk */
|
|
|
|
|
uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
|
|
|
|
|
*drbuf; /* Buffer for reading numeric data from disk */
|
|
|
|
|
uint8_t *tu8; /* Temporary pointer to uint8 data */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
H5O_type_t obj_type; /* Object type */
|
2002-06-10 23:19:19 +08:00
|
|
|
|
int i; /* counting variables */
|
|
|
|
|
herr_t ret; /* Generic return value */
|
|
|
|
|
|
|
|
|
|
/* Output message about test being performed */
|
|
|
|
|
MESSAGE(5, ("Testing 1-D Dataset Region Reference Functions\n"));
|
|
|
|
|
|
|
|
|
|
/* Allocate write & read buffers */
|
2010-08-13 05:11:00 +08:00
|
|
|
|
wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
|
|
|
|
|
rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
|
|
|
|
|
dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE3_DIM1);
|
|
|
|
|
drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1);
|
2002-06-10 23:19:19 +08:00
|
|
|
|
|
|
|
|
|
/* Create file */
|
|
|
|
|
fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(fid1, FAIL, "H5Fcreate");
|
|
|
|
|
|
|
|
|
|
/* Create dataspace for datasets */
|
|
|
|
|
sid3 = H5Screate_simple(SPACE3_RANK, dims3, NULL);
|
|
|
|
|
CHECK(sid3, FAIL, "H5Screate_simple");
|
|
|
|
|
|
2011-07-19 05:23:02 +08:00
|
|
|
|
/* Create dataset access property list */
|
|
|
|
|
dapl_id = H5Pcreate(H5P_DATASET_ACCESS);
|
|
|
|
|
CHECK(dapl_id, FAIL, "H5Pcreate");
|
|
|
|
|
|
2002-06-10 23:19:19 +08:00
|
|
|
|
/* Create a dataset */
|
[svn-r14199] Description:
Add H5Dcreate to API versioned routines, replacing internal usage with
H5Dcreate2
Fix thread-safe error stack initialization for API versioned error
stack printing routines.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-12 00:24:11 +08:00
|
|
|
|
dset3 = H5Dcreate2(fid1, "Dataset2", H5T_STD_U8LE, sid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(dset3, FAIL, "H5Dcreate2");
|
2002-06-10 23:19:19 +08:00
|
|
|
|
|
2007-09-14 09:52:38 +08:00
|
|
|
|
for(tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++)
|
2016-08-13 17:23:53 +08:00
|
|
|
|
*tu8++ = (uint8_t)(i * 3);
|
2002-06-10 23:19:19 +08:00
|
|
|
|
|
|
|
|
|
/* Write selection to disk */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Dwrite(dset3, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf);
|
2002-06-10 23:19:19 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Dwrite");
|
|
|
|
|
|
|
|
|
|
/* Close Dataset */
|
|
|
|
|
ret = H5Dclose(dset3);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
|
|
/* Create dataspace for the reference dataset */
|
|
|
|
|
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
|
|
|
|
|
CHECK(sid1, FAIL, "H5Screate_simple");
|
|
|
|
|
|
|
|
|
|
/* Create a dataset */
|
[svn-r14199] Description:
Add H5Dcreate to API versioned routines, replacing internal usage with
H5Dcreate2
Fix thread-safe error stack initialization for API versioned error
stack printing routines.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-12 00:24:11 +08:00
|
|
|
|
dset1 = H5Dcreate2(fid1, "Dataset1", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dcreate2");
|
2002-06-10 23:19:19 +08:00
|
|
|
|
|
|
|
|
|
/* Create references */
|
|
|
|
|
|
|
|
|
|
/* Select 15 2x1 hyperslabs for first reference */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
start[0] = 2;
|
|
|
|
|
stride[0] = 5;
|
|
|
|
|
count[0] = 15;
|
|
|
|
|
block[0] = 2;
|
|
|
|
|
ret = H5Sselect_hyperslab(sid3, H5S_SELECT_SET, start, stride, count, block);
|
2002-06-10 23:19:19 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Sselect_hyperslab");
|
|
|
|
|
|
|
|
|
|
ret = (int)H5Sget_select_npoints(sid3);
|
|
|
|
|
VERIFY(ret, 30, "H5Sget_select_npoints");
|
|
|
|
|
|
|
|
|
|
/* Store first dataset region */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Rcreate(&wbuf[0], fid1, "/Dataset2", H5R_DATASET_REGION, sid3);
|
2002-06-10 23:19:19 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Rcreate");
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf[0], &obj_type);
|
|
|
|
|
CHECK(ret, FAIL, "H5Rget_obj_type2");
|
|
|
|
|
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
|
2002-06-10 23:19:19 +08:00
|
|
|
|
|
|
|
|
|
/* Select sequence of ten points for second reference */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
coord1[0][0] = 16;
|
|
|
|
|
coord1[1][0] = 22;
|
|
|
|
|
coord1[2][0] = 38;
|
|
|
|
|
coord1[3][0] = 41;
|
|
|
|
|
coord1[4][0] = 52;
|
|
|
|
|
coord1[5][0] = 63;
|
|
|
|
|
coord1[6][0] = 70;
|
|
|
|
|
coord1[7][0] = 89;
|
|
|
|
|
coord1[8][0] = 97;
|
|
|
|
|
coord1[9][0] = 03;
|
[svn-r15800] Description:
Bring file free space branch changes through r15795 into trunk, which
includes a fair bit of code cleanup & rearrangement along with a couple of
bug fixes also.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-07 12:17:35 +08:00
|
|
|
|
ret = H5Sselect_elements(sid3, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
|
2002-06-10 23:19:19 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Sselect_elements");
|
|
|
|
|
|
|
|
|
|
ret = (int)H5Sget_select_npoints(sid3);
|
|
|
|
|
VERIFY(ret, 10, "H5Sget_select_npoints");
|
|
|
|
|
|
|
|
|
|
/* Store second dataset region */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Rcreate(&wbuf[1], fid1, "/Dataset2", H5R_DATASET_REGION, sid3);
|
2002-06-10 23:19:19 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Rcreate");
|
|
|
|
|
|
|
|
|
|
/* Write selection to disk */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Dwrite(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
|
2002-06-10 23:19:19 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Dwrite");
|
|
|
|
|
|
|
|
|
|
/* Close disk dataspace */
|
|
|
|
|
ret = H5Sclose(sid1);
|
|
|
|
|
CHECK(ret, FAIL, "H5Sclose");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2002-06-10 23:19:19 +08:00
|
|
|
|
/* Close Dataset */
|
|
|
|
|
ret = H5Dclose(dset1);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
|
|
/* Close uint8 dataset dataspace */
|
|
|
|
|
ret = H5Sclose(sid3);
|
|
|
|
|
CHECK(ret, FAIL, "H5Sclose");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2002-06-10 23:19:19 +08:00
|
|
|
|
/* Close file */
|
|
|
|
|
ret = H5Fclose(fid1);
|
|
|
|
|
CHECK(ret, FAIL, "H5Fclose");
|
|
|
|
|
|
|
|
|
|
/* Re-open the file */
|
|
|
|
|
fid1 = H5Fopen(FILE2, H5F_ACC_RDWR, H5P_DEFAULT);
|
|
|
|
|
CHECK(fid1, FAIL, "H5Fopen");
|
|
|
|
|
|
|
|
|
|
/* Open the dataset */
|
[svn-r14193] Description:
Make H5Dopen versioned and change all internal usage to use H5Dopen2
Add simple regression test for H5Dopen1
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-09 03:59:36 +08:00
|
|
|
|
dset1 = H5Dopen2(fid1, "/Dataset1", H5P_DEFAULT);
|
|
|
|
|
CHECK(dset1, FAIL, "H5Dopen2");
|
2002-06-10 23:19:19 +08:00
|
|
|
|
|
|
|
|
|
/* Read selection from disk */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Dread(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
|
2002-06-10 23:19:19 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Dread");
|
|
|
|
|
|
|
|
|
|
/* Try to open objects */
|
2011-07-19 05:23:02 +08:00
|
|
|
|
dset3 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, &rbuf[0]);
|
2011-07-19 07:12:28 +08:00
|
|
|
|
CHECK(dset3, FAIL, "H5Rdereference2");
|
2002-06-10 23:19:19 +08:00
|
|
|
|
|
2007-09-14 09:52:38 +08:00
|
|
|
|
/* Check what H5Rget_obj_type2 function returns */
|
|
|
|
|
ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &rbuf[0], &obj_type);
|
|
|
|
|
CHECK(ret, FAIL, "H5Rget_obj_type2");
|
|
|
|
|
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
|
2002-06-10 23:19:19 +08:00
|
|
|
|
|
|
|
|
|
/* Check information in referenced dataset */
|
|
|
|
|
sid1 = H5Dget_space(dset3);
|
|
|
|
|
CHECK(sid1, FAIL, "H5Dget_space");
|
|
|
|
|
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = (int)H5Sget_simple_extent_npoints(sid1);
|
2002-06-10 23:19:19 +08:00
|
|
|
|
VERIFY(ret, 100, "H5Sget_simple_extent_npoints");
|
|
|
|
|
|
|
|
|
|
/* Read from disk */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Dread(dset3, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, drbuf);
|
2002-06-10 23:19:19 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Dread");
|
|
|
|
|
|
2007-09-14 09:52:38 +08:00
|
|
|
|
for(tu8 = (uint8_t *)drbuf, i = 0; i < SPACE3_DIM1; i++, tu8++)
|
|
|
|
|
VERIFY(*tu8, (uint8_t)(i * 3), "Data");
|
2002-06-10 23:19:19 +08:00
|
|
|
|
|
|
|
|
|
/* Get the hyperslab selection */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
sid3 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[0]);
|
2002-06-10 23:19:19 +08:00
|
|
|
|
CHECK(sid3, FAIL, "H5Rget_region");
|
|
|
|
|
|
|
|
|
|
/* Verify correct hyperslab selected */
|
|
|
|
|
ret = (int)H5Sget_select_npoints(sid3);
|
|
|
|
|
VERIFY(ret, 30, "H5Sget_select_npoints");
|
|
|
|
|
ret = (int)H5Sget_select_hyper_nblocks(sid3);
|
|
|
|
|
VERIFY(ret, 15, "H5Sget_select_hyper_nblocks");
|
2016-08-13 17:23:53 +08:00
|
|
|
|
coords = (hsize_t *)HDmalloc((size_t)ret * SPACE3_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Sget_select_hyper_blocklist(sid3, (hsize_t)0, (hsize_t)ret, coords);
|
2002-06-10 23:19:19 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist");
|
2007-09-14 09:52:38 +08:00
|
|
|
|
VERIFY(coords[0], 2, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[1], 3, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[2], 7, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[3], 8, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[4], 12, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[5], 13, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[6], 17, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[7], 18, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[8], 22, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[9], 23, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[10], 27, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[11], 28, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[12], 32, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[13], 33, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[14], 37, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[15], 38, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[16], 42, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[17], 43, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[18], 47, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[19], 48, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[20], 52, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[21], 53, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[22], 57, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[23], 58, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[24], 62, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[25], 63, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[26], 67, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[27], 68, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[28], 72, "Hyperslab Coordinates");
|
|
|
|
|
VERIFY(coords[29], 73, "Hyperslab Coordinates");
|
2002-06-10 23:19:19 +08:00
|
|
|
|
HDfree(coords);
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Sget_select_bounds(sid3, low, high);
|
2002-06-10 23:19:19 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Sget_select_bounds");
|
|
|
|
|
VERIFY(low[0], 2, "Selection Bounds");
|
|
|
|
|
VERIFY(high[0], 73, "Selection Bounds");
|
|
|
|
|
|
|
|
|
|
/* Close region space */
|
|
|
|
|
ret = H5Sclose(sid3);
|
|
|
|
|
CHECK(ret, FAIL, "H5Sclose");
|
|
|
|
|
|
|
|
|
|
/* Get the element selection */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
sid3 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[1]);
|
2002-06-10 23:19:19 +08:00
|
|
|
|
CHECK(sid3, FAIL, "H5Rget_region");
|
|
|
|
|
|
|
|
|
|
/* Verify correct elements selected */
|
|
|
|
|
ret = (int)H5Sget_select_npoints(sid3);
|
|
|
|
|
VERIFY(ret, 10, "H5Sget_select_npoints");
|
|
|
|
|
ret = (int)H5Sget_select_elem_npoints(sid3);
|
|
|
|
|
VERIFY(ret, 10, "H5Sget_select_elem_npoints");
|
2016-08-13 17:23:53 +08:00
|
|
|
|
coords = (hsize_t *)HDmalloc((size_t)ret * SPACE3_RANK * sizeof(hsize_t)); /* allocate space for the element points */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Sget_select_elem_pointlist(sid3, (hsize_t)0, (hsize_t)ret, coords);
|
2002-06-10 23:19:19 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Sget_select_elem_pointlist");
|
2004-12-29 22:26:20 +08:00
|
|
|
|
VERIFY(coords[0], coord1[0][0], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[1], coord1[1][0], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[2], coord1[2][0], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[3], coord1[3][0], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[4], coord1[4][0], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[5], coord1[5][0], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[6], coord1[6][0], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[7], coord1[7][0], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[8], coord1[8][0], "Element Coordinates");
|
|
|
|
|
VERIFY(coords[9], coord1[9][0], "Element Coordinates");
|
2002-06-10 23:19:19 +08:00
|
|
|
|
HDfree(coords);
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Sget_select_bounds(sid3, low, high);
|
2002-06-10 23:19:19 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Sget_select_bounds");
|
|
|
|
|
VERIFY(low[0], 3, "Selection Bounds");
|
|
|
|
|
VERIFY(high[0], 97, "Selection Bounds");
|
|
|
|
|
|
|
|
|
|
/* Close region space */
|
|
|
|
|
ret = H5Sclose(sid3);
|
|
|
|
|
CHECK(ret, FAIL, "H5Sclose");
|
|
|
|
|
|
|
|
|
|
/* Close first space */
|
|
|
|
|
ret = H5Sclose(sid1);
|
|
|
|
|
CHECK(ret, FAIL, "H5Sclose");
|
|
|
|
|
|
|
|
|
|
/* Close dereferenced Dataset */
|
|
|
|
|
ret = H5Dclose(dset3);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
|
|
/* Close Dataset */
|
|
|
|
|
ret = H5Dclose(dset1);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
2011-07-19 05:23:02 +08:00
|
|
|
|
/* Close dataset access property list */
|
|
|
|
|
ret = H5Pclose(dapl_id);
|
|
|
|
|
CHECK(ret, FAIL, "H5Pclose");
|
|
|
|
|
|
2002-06-10 23:19:19 +08:00
|
|
|
|
/* Close file */
|
|
|
|
|
ret = H5Fclose(fid1);
|
|
|
|
|
CHECK(ret, FAIL, "H5Fclose");
|
|
|
|
|
|
|
|
|
|
/* Free memory buffers */
|
2013-10-31 12:20:36 +08:00
|
|
|
|
HDfree(wbuf);
|
|
|
|
|
HDfree(rbuf);
|
|
|
|
|
HDfree(dwbuf);
|
|
|
|
|
HDfree(drbuf);
|
2002-06-10 23:19:19 +08:00
|
|
|
|
} /* test_reference_region_1D() */
|
|
|
|
|
|
2000-10-18 04:46:57 +08:00
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_reference_obj_deleted(): Test H5R (reference) object reference code.
|
|
|
|
|
** Tests for correct failures for deleted and non-existent objects
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2000-10-18 04:46:57 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static void
|
2000-10-18 04:46:57 +08:00
|
|
|
|
test_reference_obj_deleted(void)
|
|
|
|
|
{
|
|
|
|
|
hid_t fid1; /* HDF5 File IDs */
|
|
|
|
|
hid_t dataset, /* Dataset ID */
|
|
|
|
|
dset2; /* Dereferenced dataset ID */
|
|
|
|
|
hid_t sid1; /* Dataspace ID */
|
|
|
|
|
hobj_ref_t oref; /* Object Reference to test */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
H5O_type_t obj_type; /* Object type */
|
2015-03-06 05:42:42 +08:00
|
|
|
|
haddr_t addr = HADDR_UNDEF; /* test for undefined reference */
|
2000-10-18 04:46:57 +08:00
|
|
|
|
herr_t ret; /* Generic return value */
|
|
|
|
|
|
|
|
|
|
/* Create file */
|
|
|
|
|
fid1 = H5Fcreate(FILE3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(fid1, FAIL, "H5Fcreate");
|
|
|
|
|
|
|
|
|
|
/* Create scalar dataspace for datasets */
|
|
|
|
|
sid1 = H5Screate_simple(0, NULL, NULL);
|
|
|
|
|
CHECK(sid1, FAIL, "H5Screate_simple");
|
|
|
|
|
|
|
|
|
|
/* Create a dataset to reference (deleted later) */
|
[svn-r14199] Description:
Add H5Dcreate to API versioned routines, replacing internal usage with
H5Dcreate2
Fix thread-safe error stack initialization for API versioned error
stack printing routines.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-12 00:24:11 +08:00
|
|
|
|
dataset = H5Dcreate2(fid1, "Dataset1", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(dataset, FAIL, "H5Dcreate2");
|
2000-10-18 04:46:57 +08:00
|
|
|
|
|
|
|
|
|
/* Close Dataset */
|
|
|
|
|
ret = H5Dclose(dataset);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
|
|
/* Create a dataset */
|
[svn-r14199] Description:
Add H5Dcreate to API versioned routines, replacing internal usage with
H5Dcreate2
Fix thread-safe error stack initialization for API versioned error
stack printing routines.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-12 00:24:11 +08:00
|
|
|
|
dataset = H5Dcreate2(fid1, "Dataset2", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(dataset, FAIL, "H5Dcreate2");
|
2000-10-18 04:46:57 +08:00
|
|
|
|
|
|
|
|
|
/* Create reference to dataset */
|
2014-07-31 04:55:14 +08:00
|
|
|
|
ret = H5Rcreate(&oref, fid1, "/Dataset1", H5R_OBJECT, (hid_t)-1);
|
2000-10-18 04:46:57 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Rcreate");
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &oref, &obj_type);
|
|
|
|
|
CHECK(ret, FAIL, "H5Rget_obj_type2");
|
|
|
|
|
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
|
2000-10-18 04:46:57 +08:00
|
|
|
|
|
|
|
|
|
/* Write selection to disk */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
ret = H5Dwrite(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, &oref);
|
2000-10-18 04:46:57 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Dwrite");
|
|
|
|
|
|
|
|
|
|
/* Close Dataset */
|
|
|
|
|
ret = H5Dclose(dataset);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
|
|
/* Delete referenced dataset */
|
2007-08-30 04:44:19 +08:00
|
|
|
|
ret = H5Ldelete(fid1, "/Dataset1", H5P_DEFAULT);
|
|
|
|
|
CHECK(ret, FAIL, "H5Ldelete");
|
2000-10-18 04:46:57 +08:00
|
|
|
|
|
|
|
|
|
/* Close disk dataspace */
|
|
|
|
|
ret = H5Sclose(sid1);
|
|
|
|
|
CHECK(ret, FAIL, "H5Sclose");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2000-10-18 04:46:57 +08:00
|
|
|
|
/* Close file */
|
|
|
|
|
ret = H5Fclose(fid1);
|
|
|
|
|
CHECK(ret, FAIL, "H5Fclose");
|
|
|
|
|
|
|
|
|
|
/* Re-open the file */
|
|
|
|
|
fid1 = H5Fopen(FILE3, H5F_ACC_RDWR, H5P_DEFAULT);
|
|
|
|
|
CHECK(fid1, FAIL, "H5Fopen");
|
|
|
|
|
|
|
|
|
|
/* Open the dataset */
|
[svn-r14193] Description:
Make H5Dopen versioned and change all internal usage to use H5Dopen2
Add simple regression test for H5Dopen1
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-09 03:59:36 +08:00
|
|
|
|
dataset = H5Dopen2(fid1, "/Dataset2", H5P_DEFAULT);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dopen2");
|
2000-10-18 04:46:57 +08:00
|
|
|
|
|
2015-03-06 05:42:42 +08:00
|
|
|
|
/* Open undefined reference */
|
|
|
|
|
dset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &addr);
|
|
|
|
|
VERIFY(dset2, FAIL, "H5Rdereference2");
|
|
|
|
|
|
2000-10-18 04:46:57 +08:00
|
|
|
|
/* Read selection from disk */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
HDmemset(&oref, 0, sizeof(hobj_ref_t));
|
|
|
|
|
ret = H5Dread(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, &oref);
|
2000-10-18 04:46:57 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Dread");
|
|
|
|
|
|
|
|
|
|
/* Open deleted dataset object */
|
2011-07-19 07:12:28 +08:00
|
|
|
|
dset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &oref);
|
|
|
|
|
VERIFY(dset2, FAIL, "H5Rdereference2");
|
2000-10-18 04:46:57 +08:00
|
|
|
|
|
|
|
|
|
/* Open nonsense reference */
|
2007-09-14 09:52:38 +08:00
|
|
|
|
HDmemset(&oref, 0, sizeof(hobj_ref_t));
|
2011-07-19 07:12:28 +08:00
|
|
|
|
dset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &oref);
|
|
|
|
|
VERIFY(dset2, FAIL, "H5Rdereference2");
|
2000-10-18 04:46:57 +08:00
|
|
|
|
|
|
|
|
|
/* Close Dataset */
|
|
|
|
|
ret = H5Dclose(dataset);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
|
|
/* Close file */
|
|
|
|
|
ret = H5Fclose(fid1);
|
|
|
|
|
CHECK(ret, FAIL, "H5Fclose");
|
|
|
|
|
} /* test_reference_obj_deleted() */
|
|
|
|
|
|
2005-08-11 04:28:32 +08:00
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_deref_iter_op(): Iterator callback for test_reference_group_iterate()
|
|
|
|
|
** test.
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2005-08-11 04:28:32 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static herr_t
|
2015-06-02 03:38:09 +08:00
|
|
|
|
test_deref_iter_op(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_UNUSED *info,
|
2007-08-31 04:03:37 +08:00
|
|
|
|
void *op_data)
|
2005-08-11 04:28:32 +08:00
|
|
|
|
{
|
|
|
|
|
int *count = (int *)op_data; /* Pointer to name counter */
|
|
|
|
|
herr_t ret_value;
|
|
|
|
|
|
|
|
|
|
/* Simple check for correct names */
|
|
|
|
|
if(*count == 0) {
|
2005-08-21 00:32:55 +08:00
|
|
|
|
if(HDstrcmp(name, DSETNAME2) == 0)
|
2005-08-11 04:28:32 +08:00
|
|
|
|
ret_value = 0;
|
|
|
|
|
else
|
|
|
|
|
ret_value = -1;
|
|
|
|
|
} /* end if */
|
|
|
|
|
else if(*count == 1) {
|
2005-08-21 00:32:55 +08:00
|
|
|
|
if(HDstrcmp(name, GROUPNAME2) == 0)
|
|
|
|
|
ret_value = 0;
|
|
|
|
|
else
|
|
|
|
|
ret_value = -1;
|
|
|
|
|
} /* end if */
|
|
|
|
|
else if(*count == 2) {
|
2005-08-11 04:28:32 +08:00
|
|
|
|
if(HDstrcmp(name, GROUPNAME3) == 0)
|
|
|
|
|
ret_value = 0;
|
|
|
|
|
else
|
|
|
|
|
ret_value = -1;
|
|
|
|
|
} /* end if */
|
|
|
|
|
else
|
|
|
|
|
ret_value = -1;
|
|
|
|
|
|
|
|
|
|
(*count)++;
|
|
|
|
|
|
|
|
|
|
return(ret_value);
|
|
|
|
|
} /* end test_deref_iter_op() */
|
|
|
|
|
|
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
2005-08-14 03:27:39 +08:00
|
|
|
|
** test_reference_group(): Test H5R (reference) object reference code.
|
|
|
|
|
** Tests for correct behavior of various routines on dereferenced group
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2005-08-11 04:28:32 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static void
|
2005-08-14 03:27:39 +08:00
|
|
|
|
test_reference_group(void)
|
2005-08-11 04:28:32 +08:00
|
|
|
|
{
|
|
|
|
|
hid_t fid = -1; /* File ID */
|
|
|
|
|
hid_t gid = -1, gid2 = -1; /* Group IDs */
|
|
|
|
|
hid_t did; /* Dataset ID */
|
|
|
|
|
hid_t sid; /* Dataspace ID */
|
|
|
|
|
hobj_ref_t wref; /* Reference to write */
|
|
|
|
|
hobj_ref_t rref; /* Reference to read */
|
2007-09-06 23:54:22 +08:00
|
|
|
|
H5G_info_t ginfo; /* Group info struct */
|
2005-08-14 03:27:39 +08:00
|
|
|
|
char objname[NAME_SIZE]; /* Buffer to store name */
|
2007-09-14 02:26:12 +08:00
|
|
|
|
H5O_info_t oinfo; /* Object info struct */
|
2005-08-11 04:28:32 +08:00
|
|
|
|
int count = 0; /* Count within iterated group */
|
2016-08-13 17:23:53 +08:00
|
|
|
|
ssize_t size; /* Name length */
|
2005-08-11 04:28:32 +08:00
|
|
|
|
herr_t ret;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2005-08-11 04:28:32 +08:00
|
|
|
|
/* Create file with a group and a dataset containing an object reference to the group */
|
|
|
|
|
fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(fid, FAIL, "H5Fcreate");
|
|
|
|
|
|
2005-08-21 00:32:55 +08:00
|
|
|
|
/* Create dataspace to use for dataset */
|
|
|
|
|
sid = H5Screate(H5S_SCALAR);
|
|
|
|
|
CHECK(sid, FAIL, "H5Screate");
|
|
|
|
|
|
2005-08-11 04:28:32 +08:00
|
|
|
|
/* Create group to refer to */
|
2007-08-24 04:25:25 +08:00
|
|
|
|
gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(gid, FAIL, "H5Gcreate2");
|
2005-08-11 04:28:32 +08:00
|
|
|
|
|
|
|
|
|
/* Create nested groups */
|
2007-08-24 04:25:25 +08:00
|
|
|
|
gid2 = H5Gcreate2(gid, GROUPNAME2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(gid2, FAIL, "H5Gcreate2");
|
2005-08-11 04:28:32 +08:00
|
|
|
|
ret = H5Gclose(gid2);
|
|
|
|
|
CHECK(ret, FAIL, "H5Gclose");
|
|
|
|
|
|
2007-08-24 04:25:25 +08:00
|
|
|
|
gid2 = H5Gcreate2(gid, GROUPNAME3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(gid2, FAIL, "H5Gcreate2");
|
2005-08-11 04:28:32 +08:00
|
|
|
|
ret = H5Gclose(gid2);
|
|
|
|
|
CHECK(ret, FAIL, "H5Gclose");
|
|
|
|
|
|
2005-08-21 00:32:55 +08:00
|
|
|
|
/* Create bottom dataset */
|
[svn-r14199] Description:
Add H5Dcreate to API versioned routines, replacing internal usage with
H5Dcreate2
Fix thread-safe error stack initialization for API versioned error
stack printing routines.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-12 00:24:11 +08:00
|
|
|
|
did = H5Dcreate2(gid, DSETNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
2005-08-21 00:32:55 +08:00
|
|
|
|
assert(did > 0);
|
|
|
|
|
ret = H5Dclose(did);
|
|
|
|
|
assert(ret >= 0);
|
|
|
|
|
|
2005-08-11 04:28:32 +08:00
|
|
|
|
ret = H5Gclose(gid);
|
|
|
|
|
CHECK(ret, FAIL, "H5Gclose");
|
|
|
|
|
|
|
|
|
|
/* Create dataset */
|
[svn-r14199] Description:
Add H5Dcreate to API versioned routines, replacing internal usage with
H5Dcreate2
Fix thread-safe error stack initialization for API versioned error
stack printing routines.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-12 00:24:11 +08:00
|
|
|
|
did = H5Dcreate2(fid, DSETNAME, H5T_STD_REF_OBJ, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(did, FAIL, "H5Dcreate2");
|
2005-08-11 04:28:32 +08:00
|
|
|
|
|
|
|
|
|
/* Create reference to group */
|
2014-07-31 04:55:14 +08:00
|
|
|
|
ret = H5Rcreate(&wref, fid, GROUPNAME, H5R_OBJECT, (hid_t)-1);
|
2005-08-11 04:28:32 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Rcreate");
|
|
|
|
|
|
|
|
|
|
/* Write reference to disk */
|
|
|
|
|
ret = H5Dwrite(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wref);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dwrite");
|
|
|
|
|
|
|
|
|
|
/* Close objects */
|
|
|
|
|
ret = H5Dclose(did);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
ret = H5Sclose(sid);
|
|
|
|
|
CHECK(ret, FAIL, "H5Sclose");
|
|
|
|
|
ret = H5Fclose(fid);
|
|
|
|
|
CHECK(ret, FAIL, "H5Fclose");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Re-open file */
|
2005-08-14 03:27:39 +08:00
|
|
|
|
fid = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT);
|
2005-08-11 04:28:32 +08:00
|
|
|
|
CHECK(fid, FAIL, "H5Fopen");
|
|
|
|
|
|
|
|
|
|
/* Re-open dataset */
|
[svn-r14193] Description:
Make H5Dopen versioned and change all internal usage to use H5Dopen2
Add simple regression test for H5Dopen1
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-09 03:59:36 +08:00
|
|
|
|
did = H5Dopen2(fid, DSETNAME, H5P_DEFAULT);
|
|
|
|
|
CHECK(did, FAIL, "H5Dopen2");
|
2005-08-11 04:28:32 +08:00
|
|
|
|
|
|
|
|
|
/* Read in the reference */
|
|
|
|
|
ret = H5Dread(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rref);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dread");
|
|
|
|
|
|
|
|
|
|
/* Dereference to get the group */
|
2011-07-19 07:12:28 +08:00
|
|
|
|
gid = H5Rdereference2(did, H5P_DEFAULT, H5R_OBJECT, &rref);
|
|
|
|
|
CHECK(gid, FAIL, "H5Rdereference2");
|
2005-08-11 04:28:32 +08:00
|
|
|
|
|
|
|
|
|
/* Iterate through objects in dereferenced group */
|
[svn-r14224] Description:
Change H5Literate -> H5Literate_by_name and add simpler form of
H5Literate, to bring this routine into alignment with the other new API
routines.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-31 06:56:15 +08:00
|
|
|
|
ret = H5Literate(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_deref_iter_op, &count);
|
2007-08-31 04:03:37 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Literate");
|
2005-08-11 04:28:32 +08:00
|
|
|
|
|
2005-08-14 03:27:39 +08:00
|
|
|
|
/* Various queries on the group opened */
|
[svn-r14223] Description:
Change existing H5Gget_info -> H5Gget_info_by_name and add new version
of H5Gget_info, with simpler parameters, to better match new API routines.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-31 05:57:50 +08:00
|
|
|
|
ret = H5Gget_info(gid, &ginfo);
|
2007-09-06 23:54:22 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Gget_info");
|
|
|
|
|
VERIFY(ginfo.nlinks, 3, "H5Gget_info");
|
2005-08-14 03:27:39 +08:00
|
|
|
|
|
2016-08-13 17:23:53 +08:00
|
|
|
|
size = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, objname, (size_t)NAME_SIZE, H5P_DEFAULT);
|
|
|
|
|
CHECK(size, FAIL, "H5Lget_name_by_idx");
|
2007-09-14 01:04:36 +08:00
|
|
|
|
VERIFY_STR(objname, DSETNAME2, "H5Lget_name_by_idx");
|
2005-08-14 03:27:39 +08:00
|
|
|
|
|
2007-09-14 02:26:12 +08:00
|
|
|
|
ret = H5Oget_info_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5P_DEFAULT);
|
|
|
|
|
CHECK(ret, FAIL, "H5Oget_info_by_idx");
|
|
|
|
|
VERIFY(oinfo.type, H5O_TYPE_DATASET, "H5Oget_info_by_idx");
|
2005-08-14 03:27:39 +08:00
|
|
|
|
|
|
|
|
|
/* Unlink one of the objects in the dereferenced group */
|
2007-08-30 04:44:19 +08:00
|
|
|
|
ret = H5Ldelete(gid, GROUPNAME2, H5P_DEFAULT);
|
|
|
|
|
CHECK(ret, FAIL, "H5Ldelete");
|
2005-08-14 03:27:39 +08:00
|
|
|
|
|
2005-08-21 00:32:55 +08:00
|
|
|
|
/* Delete dataset object in dereferenced group (with other dataset still open) */
|
2007-08-30 04:44:19 +08:00
|
|
|
|
ret = H5Ldelete(gid, DSETNAME2, H5P_DEFAULT);
|
|
|
|
|
CHECK(ret, FAIL, "H5Ldelete");
|
2005-08-21 00:32:55 +08:00
|
|
|
|
|
2005-08-11 04:28:32 +08:00
|
|
|
|
/* Close objects */
|
|
|
|
|
ret = H5Dclose(did);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
ret = H5Gclose(gid);
|
|
|
|
|
CHECK(ret, FAIL, "H5Gclose");
|
|
|
|
|
ret = H5Fclose(fid);
|
|
|
|
|
CHECK(ret, FAIL, "H5Fclose");
|
2005-08-14 03:27:39 +08:00
|
|
|
|
} /* test_reference_group() */
|
2005-08-11 04:28:32 +08:00
|
|
|
|
|
2007-09-25 21:31:31 +08:00
|
|
|
|
#ifndef H5_NO_DEPRECATED_SYMBOLS
|
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_reference_compat(): Test basic H5R (reference) object reference code.
|
|
|
|
|
** Tests deprecated API routines
|
|
|
|
|
**
|
|
|
|
|
****************************************************************/
|
|
|
|
|
static void
|
|
|
|
|
test_reference_compat(void)
|
|
|
|
|
{
|
|
|
|
|
hid_t fid1; /* HDF5 File IDs */
|
2011-07-19 05:23:02 +08:00
|
|
|
|
hid_t dataset, dset2; /* Dataset ID */
|
|
|
|
|
hid_t group, group2; /* Group ID */
|
2007-09-25 21:31:31 +08:00
|
|
|
|
hid_t sid1, /* Dataspace IDs */
|
|
|
|
|
sid2;
|
2011-07-19 05:23:02 +08:00
|
|
|
|
hid_t tid1, tid2; /* Datatype ID */
|
2007-09-25 21:31:31 +08:00
|
|
|
|
hsize_t dims1[] = {SPACE1_DIM1},
|
|
|
|
|
dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
|
|
|
|
|
hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
|
|
|
|
|
hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
|
|
|
|
|
hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
|
|
|
|
|
hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
|
|
|
|
|
hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
|
|
|
|
|
hobj_ref_t *wbuf_obj, /* Buffer to write to disk */
|
|
|
|
|
*rbuf_obj; /* Buffer read from disk */
|
|
|
|
|
hdset_reg_ref_t *wbuf_reg, /* Buffer to write to disk */
|
|
|
|
|
*rbuf_reg; /* Buffer read from disk */
|
|
|
|
|
H5G_obj_t obj_type; /* Object type */
|
|
|
|
|
herr_t ret; /* Generic return value */
|
|
|
|
|
|
|
|
|
|
/* Output message about test being performed */
|
|
|
|
|
MESSAGE(5, ("Testing Deprecated Object Reference Functions\n"));
|
|
|
|
|
|
|
|
|
|
/* Allocate write & read buffers */
|
2010-08-13 05:11:00 +08:00
|
|
|
|
wbuf_obj = (hobj_ref_t *)HDcalloc(sizeof(hobj_ref_t), SPACE1_DIM1);
|
|
|
|
|
rbuf_obj = (hobj_ref_t *)HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
|
|
|
|
|
wbuf_reg = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
|
|
|
|
|
rbuf_reg = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
|
2007-09-25 21:31:31 +08:00
|
|
|
|
|
|
|
|
|
/* Create file */
|
|
|
|
|
fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(fid1, FAIL, "H5Fcreate");
|
|
|
|
|
|
|
|
|
|
/* Create dataspace for datasets */
|
|
|
|
|
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
|
|
|
|
|
CHECK(sid1, FAIL, "H5Screate_simple");
|
|
|
|
|
|
|
|
|
|
/* Create another dataspace for datasets */
|
|
|
|
|
sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL);
|
|
|
|
|
CHECK(sid2, FAIL, "H5Screate_simple");
|
|
|
|
|
|
|
|
|
|
/* Create a group */
|
|
|
|
|
group = H5Gcreate2(fid1, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(group, FAIL, "H5Gcreate2");
|
|
|
|
|
|
|
|
|
|
/* Create a dataset (inside Group1) */
|
[svn-r14199] Description:
Add H5Dcreate to API versioned routines, replacing internal usage with
H5Dcreate2
Fix thread-safe error stack initialization for API versioned error
stack printing routines.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-12 00:24:11 +08:00
|
|
|
|
dataset = H5Dcreate2(group, "Dataset1", H5T_NATIVE_UINT, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(dataset, FAIL, "H5Dcreate2");
|
2007-09-25 21:31:31 +08:00
|
|
|
|
|
|
|
|
|
/* Close Dataset */
|
|
|
|
|
ret = H5Dclose(dataset);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
|
|
/* Create another dataset (inside Group1) */
|
[svn-r14199] Description:
Add H5Dcreate to API versioned routines, replacing internal usage with
H5Dcreate2
Fix thread-safe error stack initialization for API versioned error
stack printing routines.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-12 00:24:11 +08:00
|
|
|
|
dataset = H5Dcreate2(group, "Dataset2", H5T_NATIVE_UCHAR, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(dataset, FAIL, "H5Dcreate2");
|
2007-09-25 21:31:31 +08:00
|
|
|
|
|
|
|
|
|
/* Close Dataset */
|
|
|
|
|
ret = H5Dclose(dataset);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
|
|
/* Create a datatype to refer to */
|
|
|
|
|
tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
|
|
|
|
|
CHECK(tid1, FAIL, "H5Tcreate");
|
|
|
|
|
|
|
|
|
|
/* Insert fields */
|
|
|
|
|
ret = H5Tinsert(tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
|
|
|
|
|
CHECK(ret, FAIL, "H5Tinsert");
|
|
|
|
|
|
|
|
|
|
ret = H5Tinsert(tid1, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT);
|
|
|
|
|
CHECK(ret, FAIL, "H5Tinsert");
|
|
|
|
|
|
|
|
|
|
ret = H5Tinsert(tid1, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT);
|
|
|
|
|
CHECK(ret, FAIL, "H5Tinsert");
|
|
|
|
|
|
|
|
|
|
/* Save datatype for later */
|
[svn-r14156] Description:
Add API versioning to H5Tcommit()
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
AIX/32 5.3 (copper) w/FORTRAN, w/parallel, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-09-26 10:50:31 +08:00
|
|
|
|
ret = H5Tcommit2(group, "Datatype1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(ret, FAIL, "H5Tcommit2");
|
2007-09-25 21:31:31 +08:00
|
|
|
|
|
|
|
|
|
/* Close datatype */
|
|
|
|
|
ret = H5Tclose(tid1);
|
|
|
|
|
CHECK(ret, FAIL, "H5Tclose");
|
|
|
|
|
|
|
|
|
|
/* Close group */
|
|
|
|
|
ret = H5Gclose(group);
|
|
|
|
|
CHECK(ret, FAIL, "H5Gclose");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Create a dataset with object reference datatype */
|
[svn-r14199] Description:
Add H5Dcreate to API versioned routines, replacing internal usage with
H5Dcreate2
Fix thread-safe error stack initialization for API versioned error
stack printing routines.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-12 00:24:11 +08:00
|
|
|
|
dataset = H5Dcreate2(fid1, "Dataset3", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dcreate2");
|
2007-09-25 21:31:31 +08:00
|
|
|
|
|
|
|
|
|
/* Create reference to dataset */
|
2014-07-31 04:55:14 +08:00
|
|
|
|
ret = H5Rcreate(&wbuf_obj[0], fid1, "/Group1/Dataset1", H5R_OBJECT, (hid_t)-1);
|
2007-09-25 21:31:31 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Rcreate");
|
|
|
|
|
|
|
|
|
|
/* Create reference to dataset */
|
2014-07-31 04:55:14 +08:00
|
|
|
|
ret = H5Rcreate(&wbuf_obj[1], fid1, "/Group1/Dataset2", H5R_OBJECT, (hid_t)-1);
|
2007-09-25 21:31:31 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Rcreate");
|
|
|
|
|
|
|
|
|
|
/* Create reference to group */
|
2014-07-31 04:55:14 +08:00
|
|
|
|
ret = H5Rcreate(&wbuf_obj[2], fid1, "/Group1", H5R_OBJECT, (hid_t)-1);
|
2007-09-25 21:31:31 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Rcreate");
|
|
|
|
|
|
|
|
|
|
/* Create reference to named datatype */
|
2014-07-31 04:55:14 +08:00
|
|
|
|
ret = H5Rcreate(&wbuf_obj[3], fid1, "/Group1/Datatype1", H5R_OBJECT, (hid_t)-1);
|
2007-09-25 21:31:31 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Rcreate");
|
|
|
|
|
|
|
|
|
|
/* Write references to disk */
|
|
|
|
|
ret = H5Dwrite(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf_obj);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dwrite");
|
|
|
|
|
|
|
|
|
|
/* Close Dataset */
|
|
|
|
|
ret = H5Dclose(dataset);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Create a dataset with region reference datatype */
|
[svn-r14199] Description:
Add H5Dcreate to API versioned routines, replacing internal usage with
H5Dcreate2
Fix thread-safe error stack initialization for API versioned error
stack printing routines.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-12 00:24:11 +08:00
|
|
|
|
dataset = H5Dcreate2(fid1, "Dataset4", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dcreate2");
|
2007-09-25 21:31:31 +08:00
|
|
|
|
|
|
|
|
|
/* Select 6x6 hyperslab for first reference */
|
|
|
|
|
start[0] = 2; start[1] = 2;
|
|
|
|
|
stride[0] = 1; stride[1] = 1;
|
|
|
|
|
count[0] = 1; count[1] = 1;
|
|
|
|
|
block[0] = 6; block[1] = 6;
|
|
|
|
|
ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
|
|
|
|
|
CHECK(ret, FAIL, "H5Sselect_hyperslab");
|
|
|
|
|
|
|
|
|
|
/* Create first dataset region */
|
|
|
|
|
ret = H5Rcreate(&wbuf_reg[0], fid1, "/Group1/Dataset1", H5R_DATASET_REGION, sid2);
|
|
|
|
|
CHECK(ret, FAIL, "H5Rcreate");
|
|
|
|
|
|
|
|
|
|
/* Select sequence of ten points for second reference */
|
|
|
|
|
coord1[0][0] = 6; coord1[0][1] = 9;
|
|
|
|
|
coord1[1][0] = 2; coord1[1][1] = 2;
|
|
|
|
|
coord1[2][0] = 8; coord1[2][1] = 4;
|
|
|
|
|
coord1[3][0] = 1; coord1[3][1] = 6;
|
|
|
|
|
coord1[4][0] = 2; coord1[4][1] = 8;
|
|
|
|
|
coord1[5][0] = 3; coord1[5][1] = 2;
|
|
|
|
|
coord1[6][0] = 0; coord1[6][1] = 4;
|
|
|
|
|
coord1[7][0] = 9; coord1[7][1] = 0;
|
|
|
|
|
coord1[8][0] = 7; coord1[8][1] = 1;
|
|
|
|
|
coord1[9][0] = 3; coord1[9][1] = 3;
|
[svn-r15800] Description:
Bring file free space branch changes through r15795 into trunk, which
includes a fair bit of code cleanup & rearrangement along with a couple of
bug fixes also.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-07 12:17:35 +08:00
|
|
|
|
ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
|
2007-09-25 21:31:31 +08:00
|
|
|
|
CHECK(ret, FAIL, "H5Sselect_elements");
|
|
|
|
|
|
|
|
|
|
/* Create second dataset region */
|
|
|
|
|
ret = H5Rcreate(&wbuf_reg[1], fid1, "/Group1/Dataset2", H5R_DATASET_REGION, sid2);
|
|
|
|
|
CHECK(ret, FAIL, "H5Rcreate");
|
|
|
|
|
|
|
|
|
|
/* Write selection to disk */
|
|
|
|
|
ret = H5Dwrite(dataset, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf_reg);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dwrite");
|
|
|
|
|
|
|
|
|
|
/* Close Dataset */
|
|
|
|
|
ret = H5Dclose(dataset);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Close disk dataspaces */
|
|
|
|
|
ret = H5Sclose(sid1);
|
|
|
|
|
CHECK(ret, FAIL, "H5Sclose");
|
|
|
|
|
ret = H5Sclose(sid2);
|
|
|
|
|
CHECK(ret, FAIL, "H5Sclose");
|
|
|
|
|
|
|
|
|
|
/* Close file */
|
|
|
|
|
ret = H5Fclose(fid1);
|
|
|
|
|
CHECK(ret, FAIL, "H5Fclose");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Re-open the file */
|
|
|
|
|
fid1 = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT);
|
|
|
|
|
CHECK(fid1, FAIL, "H5Fopen");
|
|
|
|
|
|
|
|
|
|
/* Open the object reference dataset */
|
[svn-r14193] Description:
Make H5Dopen versioned and change all internal usage to use H5Dopen2
Add simple regression test for H5Dopen1
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-09 03:59:36 +08:00
|
|
|
|
dataset = H5Dopen2(fid1, "/Dataset3", H5P_DEFAULT);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dopen2");
|
2007-09-25 21:31:31 +08:00
|
|
|
|
|
|
|
|
|
/* Read selection from disk */
|
|
|
|
|
ret = H5Dread(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_obj);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dread");
|
|
|
|
|
|
|
|
|
|
/* Verify type of objects pointed at */
|
|
|
|
|
obj_type = H5Rget_obj_type1(dataset, H5R_OBJECT, &rbuf_obj[0]);
|
|
|
|
|
CHECK(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
|
|
|
|
|
VERIFY(obj_type, H5G_DATASET, "H5Rget_obj_type1");
|
|
|
|
|
|
|
|
|
|
obj_type = H5Rget_obj_type1(dataset, H5R_OBJECT, &rbuf_obj[1]);
|
|
|
|
|
CHECK(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
|
|
|
|
|
VERIFY(obj_type, H5G_DATASET, "H5Rget_obj_type1");
|
|
|
|
|
|
|
|
|
|
obj_type = H5Rget_obj_type1(dataset, H5R_OBJECT, &rbuf_obj[2]);
|
|
|
|
|
CHECK(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
|
|
|
|
|
VERIFY(obj_type, H5G_GROUP, "H5Rget_obj_type1");
|
|
|
|
|
|
|
|
|
|
obj_type = H5Rget_obj_type1(dataset, H5R_OBJECT, &rbuf_obj[3]);
|
|
|
|
|
CHECK(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
|
|
|
|
|
VERIFY(obj_type, H5G_TYPE, "H5Rget_obj_type1");
|
|
|
|
|
|
2011-07-19 05:23:02 +08:00
|
|
|
|
|
|
|
|
|
/* Make sure the referenced objects can be opened */
|
|
|
|
|
dset2 = H5Rdereference1(dataset, H5R_OBJECT, &rbuf_obj[0]);
|
|
|
|
|
CHECK(dset2, FAIL, "H5Rdereference1");
|
|
|
|
|
|
|
|
|
|
ret = H5Dclose(dset2);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
|
|
dset2 = H5Rdereference1(dataset, H5R_OBJECT, &rbuf_obj[1]);
|
|
|
|
|
CHECK(dset2, FAIL, "H5Rdereference1");
|
|
|
|
|
|
|
|
|
|
ret = H5Dclose(dset2);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
|
|
group2 = H5Rdereference1(dataset, H5R_OBJECT, &rbuf_obj[2]);
|
|
|
|
|
CHECK(group2, FAIL, "H5Rdereference1");
|
|
|
|
|
|
|
|
|
|
ret = H5Gclose(group2);
|
|
|
|
|
CHECK(ret, FAIL, "H5Gclose");
|
|
|
|
|
|
|
|
|
|
tid2 = H5Rdereference1(dataset, H5R_OBJECT, &rbuf_obj[3]);
|
|
|
|
|
CHECK(tid2, FAIL, "H5Rdereference1");
|
|
|
|
|
|
|
|
|
|
ret = H5Tclose(tid2);
|
|
|
|
|
CHECK(ret, FAIL, "H5Tclose");
|
|
|
|
|
|
2007-09-25 21:31:31 +08:00
|
|
|
|
/* Close Dataset */
|
|
|
|
|
ret = H5Dclose(dataset);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Open the dataset region reference dataset */
|
[svn-r14193] Description:
Make H5Dopen versioned and change all internal usage to use H5Dopen2
Add simple regression test for H5Dopen1
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-09 03:59:36 +08:00
|
|
|
|
dataset = H5Dopen2(fid1, "/Dataset4", H5P_DEFAULT);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dopen2");
|
2007-09-25 21:31:31 +08:00
|
|
|
|
|
|
|
|
|
/* Read selection from disk */
|
|
|
|
|
ret = H5Dread(dataset, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_reg);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dread");
|
|
|
|
|
|
|
|
|
|
/* Verify type of objects pointed at */
|
|
|
|
|
obj_type = H5Rget_obj_type1(dataset, H5R_DATASET_REGION, &rbuf_reg[0]);
|
|
|
|
|
CHECK(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
|
|
|
|
|
VERIFY(obj_type, H5G_DATASET, "H5Rget_obj_type1");
|
|
|
|
|
|
|
|
|
|
obj_type = H5Rget_obj_type1(dataset, H5R_DATASET_REGION, &rbuf_reg[1]);
|
|
|
|
|
CHECK(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
|
|
|
|
|
VERIFY(obj_type, H5G_DATASET, "H5Rget_obj_type1");
|
|
|
|
|
|
|
|
|
|
obj_type = H5Rget_obj_type1(dataset, H5R_DATASET_REGION, &rbuf_reg[2]);
|
|
|
|
|
VERIFY(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
|
|
|
|
|
|
|
|
|
|
obj_type = H5Rget_obj_type1(dataset, H5R_DATASET_REGION, &rbuf_reg[3]);
|
|
|
|
|
VERIFY(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
|
|
|
|
|
|
2011-07-19 05:23:02 +08:00
|
|
|
|
/* Make sure the referenced objects can be opened */
|
|
|
|
|
dset2 = H5Rdereference1(dataset, H5R_DATASET_REGION, &rbuf_reg[0]);
|
|
|
|
|
CHECK(dset2, FAIL, "H5Rdereference1");
|
|
|
|
|
|
|
|
|
|
ret = H5Dclose(dset2);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
|
|
dset2 = H5Rdereference1(dataset, H5R_DATASET_REGION, &rbuf_reg[1]);
|
|
|
|
|
CHECK(dset2, FAIL, "H5Rdereference1");
|
|
|
|
|
|
|
|
|
|
ret = H5Dclose(dset2);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
2007-09-25 21:31:31 +08:00
|
|
|
|
/* Close Dataset */
|
|
|
|
|
ret = H5Dclose(dataset);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
|
|
/* Close file */
|
|
|
|
|
ret = H5Fclose(fid1);
|
|
|
|
|
CHECK(ret, FAIL, "H5Fclose");
|
|
|
|
|
|
|
|
|
|
/* Free memory buffers */
|
|
|
|
|
HDfree(wbuf_obj);
|
|
|
|
|
HDfree(rbuf_obj);
|
|
|
|
|
HDfree(wbuf_reg);
|
|
|
|
|
HDfree(rbuf_reg);
|
|
|
|
|
} /* test_reference_compat() */
|
|
|
|
|
#endif /* H5_NO_DEPRECATED_SYMBOLS */
|
|
|
|
|
|
1998-10-14 06:42:24 +08:00
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_reference(): Main H5R reference testing routine.
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
1998-10-14 06:42:24 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
void
|
1998-10-14 06:42:24 +08:00
|
|
|
|
test_reference(void)
|
|
|
|
|
{
|
|
|
|
|
/* Output message about test being performed */
|
|
|
|
|
MESSAGE(5, ("Testing References\n"));
|
|
|
|
|
|
2010-04-28 23:31:00 +08:00
|
|
|
|
test_reference_params(); /* Test for correct parameter checking */
|
1998-11-13 08:28:58 +08:00
|
|
|
|
test_reference_obj(); /* Test basic H5R object reference code */
|
|
|
|
|
test_reference_region(); /* Test basic H5R dataset region reference code */
|
2002-06-10 23:19:19 +08:00
|
|
|
|
test_reference_region_1D(); /* Test H5R dataset region reference code for 1-D datasets */
|
2000-10-18 04:46:57 +08:00
|
|
|
|
test_reference_obj_deleted(); /* Test H5R object reference code for deleted objects */
|
2005-08-14 03:27:39 +08:00
|
|
|
|
test_reference_group(); /* Test operations on dereferenced groups */
|
2007-09-25 21:31:31 +08:00
|
|
|
|
#ifndef H5_NO_DEPRECATED_SYMBOLS
|
|
|
|
|
test_reference_compat(); /* Test operations with old API routines */
|
|
|
|
|
#endif /* H5_NO_DEPRECATED_SYMBOLS */
|
1998-10-14 06:42:24 +08:00
|
|
|
|
|
|
|
|
|
} /* test_reference() */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: cleanup_reference
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Cleanup temporary test files
|
|
|
|
|
*
|
|
|
|
|
* Return: none
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
|
* September 8, 1998
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
cleanup_reference(void)
|
|
|
|
|
{
|
1999-06-07 23:05:02 +08:00
|
|
|
|
remove(FILE1);
|
|
|
|
|
remove(FILE2);
|
2000-10-18 04:46:57 +08:00
|
|
|
|
remove(FILE3);
|
1998-10-14 06:42:24 +08:00
|
|
|
|
}
|
|
|
|
|
|