2
0
mirror of https://github.com/HDFGroup/hdf5.git synced 2025-03-19 16:50:46 +08:00

[svn-r452] Changed tests to use the new dataspace API calls. Still need to add tests for

point selections and strides.
This commit is contained in:
Quincey Koziol 1998-07-06 16:01:59 -05:00
parent 43f13aeca2
commit 650e88756c
8 changed files with 26 additions and 19 deletions

@ -85,7 +85,7 @@ writer (int wrt_n)
for (i=0; i<wrt_n; i++) {
hs_start[0] = randll (size2[0]);
HDfprintf (stdout, "#%03d 0x%016Hx\n", i, hs_start[0]);
H5Sset_hyperslab (space2, hs_start, hs_size, NULL);
H5Sselect_hyperslab (space2, H5S_SELECT_SET, hs_start, NULL, hs_size, NULL);
for (j=0; j<WRT_SIZE; j++) {
buf[j] = i+1;
}
@ -151,7 +151,7 @@ reader (const char *script_name)
HDfprintf (stdout, "#%03d 0x%016Hx", i, hs_offset[0]);
fflush (stdout);
H5Sset_hyperslab (fspace, hs_offset, hs_size, NULL);
H5Sselect_hyperslab (fspace, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL);
H5Dread (d2, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, buf);
/* Check */

@ -214,7 +214,7 @@ test_rowmaj (int op, hsize_t cache_size, hsize_t io_size)
hs_offset[1] = j;
hs_size[1] = MIN (io_size, CH_SIZE*DS_SIZE-j);
mem_space = H5Screate_simple (2, hs_size, hs_size);
H5Sset_hyperslab (file_space, hs_offset, hs_size, NULL);
H5Sselect_hyperslab (file_space, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL);
if (READ==op) {
H5Dread (dset, H5T_NATIVE_CHAR, mem_space, file_space,
@ -274,7 +274,7 @@ test_diag (int op, hsize_t cache_size, hsize_t io_size, hsize_t offset)
hs_offset[0] = hs_offset[1] = i;
hs_size[0] = hs_size[1] = MIN (io_size, CH_SIZE*DS_SIZE-i);
mem_space = H5Screate_simple (2, hs_size, hs_size);
H5Sset_hyperslab (file_space, hs_offset, hs_size, NULL);
H5Sselect_hyperslab (file_space, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL);
if (READ==op) {
H5Dread (dset, H5T_NATIVE_CHAR, mem_space, file_space,
H5P_DEFAULT, buf);

@ -420,9 +420,7 @@ STEP 8: Read middle third hyperslab into memory array.\n");
f_offset[1] = NY/3;
h_size[0] = 2*NX/3 - f_offset[0];
h_size[1] = 2*NY/3 - f_offset[1];
h_sample[0] = 1;
h_sample[1] = 1;
status = H5Sset_hyperslab (s8_f_sid, f_offset, h_size, h_sample);
status = H5Sselect_hyperslab (s8_f_sid, H5S_SELECT_SET, f_offset, NULL, h_size, NULL);
assert (status>=0);
/* Create memory data space */
@ -547,6 +545,7 @@ STEP 10: Read middle third of hyperslab into middle third of memory array\n\
}
}
#ifdef OLD_WAY
/*
*######################################################################
* Step 11: Write an array into the middle third of the dataset
@ -598,6 +597,7 @@ STEP 11: Write an array back to the middle third of the dataset to\n\
}
}
}
#endif /* OLD_WAY */

@ -582,7 +582,7 @@ test_compression(hid_t file)
points[hs_offset[0]+i][hs_offset[1]+j] = rand ();
}
}
H5Sset_hyperslab (space, hs_offset, hs_size, NULL);
H5Sselect_hyperslab (space, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL);
status = H5Dwrite (dataset, H5T_NATIVE_INT, space, space, xfer, points);
if (status<0) goto error;
@ -599,6 +599,8 @@ test_compression(hid_t file)
printf(" At index %lu,%lu\n",
(unsigned long)(hs_offset[0]+i),
(unsigned long)(hs_offset[1]+j));
printf(" At original: %d\n", (int)points[hs_offset[0]+i][hs_offset[1]+j]);
printf(" At returned: %d\n", (int)check[hs_offset[0]+i][hs_offset[1]+j]);
goto error;
}
}

@ -107,7 +107,7 @@ main (void)
/* Select a hyperslab */
file_space = H5Dget_space (dataset);
assert (file_space>=0);
status = H5Sset_hyperslab (file_space, offset, dims, NULL);
status = H5Sselect_hyperslab (file_space, H5S_SELECT_SET, offset, NULL, dims, NULL);
assert (status>=0);
/* Write to the hyperslab */
@ -130,7 +130,7 @@ main (void)
offset[0] = i * NX/2;
offset[1] = j * NY/2;
assert (file_space>=0);
status = H5Sset_hyperslab (file_space, offset, half_dims, NULL);
status = H5Sselect_hyperslab (file_space, H5S_SELECT_SET, offset, NULL, half_dims, NULL);
assert (status>=0);
/* Read */
@ -155,5 +155,3 @@ main (void)
return 0;
}

@ -599,7 +599,7 @@ test_2 (void)
hs_space = H5Scopy (space);
assert (hs_space>=0);
status = H5Sset_hyperslab (hs_space, &hs_start, &hs_count, NULL);
status = H5Sselect_hyperslab (hs_space, H5S_SELECT_SET, &hs_start, NULL, &hs_count, NULL);
assert (status>=0);
memset (whole, 0, sizeof(whole));
@ -751,7 +751,7 @@ test_3 (void)
for (i=0; i<hs_count; i++) {
whole[i] = 100+i;
}
status = H5Sset_hyperslab (file_space, &hs_start, &hs_count, NULL);
status = H5Sselect_hyperslab (file_space, H5S_SELECT_SET, &hs_start, NULL, &hs_count, NULL);
assert (status>=0);
status = H5Dwrite (dset, H5T_NATIVE_INT, mem_space, file_space,
H5P_DEFAULT, whole);

@ -318,7 +318,7 @@ main (void)
assert (size[0]>20 && size[1]>20);
start[0] = start[1] = 10;
count[0] = count[1] = size[0]-20;
status = H5Sset_hyperslab (file_space, start, count, NULL);
status = H5Sselect_hyperslab (file_space, H5S_SELECT_SET, start, NULL, count, NULL);
assert (status>=0);
synchronize ();
#ifdef HAVE_GETRUSAGE

@ -47,6 +47,10 @@ static char RcsId[] = "$Revision$";
#define SPACE2_DIM2 15
#define SPACE2_DIM3 13
#define SPACE2_DIM4 23
#define SPACE2_MAX1 H5S_UNLIMITED
#define SPACE2_MAX2 15
#define SPACE2_MAX3 13
#define SPACE2_MAX4 23
/* Scalar dataset with simple datatype */
#define SPACE3_NAME "Scalar1"
@ -83,9 +87,10 @@ test_h5s_basic(void)
hid_t sid1, sid2; /* Dataspace ID */
unsigned rank; /* Logical rank of dataspace */
hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2, SPACE2_DIM3,
SPACE2_DIM4};
hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2, SPACE2_DIM3, SPACE2_DIM4};
hsize_t max2[] = {SPACE2_MAX1, SPACE2_MAX2, SPACE2_MAX3, SPACE2_MAX4};
hsize_t tdims[4]; /* Dimension array to test with */
hsize_t tmax[4];
size_t n; /* Number of dataspace elements */
herr_t ret; /* Generic return value */
@ -112,7 +117,7 @@ test_h5s_basic(void)
VERIFY(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(unsigned)), 0,
"H5Sget_ldims");
sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL);
sid2 = H5Screate_simple(SPACE2_RANK, dims2, max2);
CHECK(sid2, FAIL, "H5Screate_simple");
n = H5Sget_npoints(sid2);
@ -124,10 +129,12 @@ test_h5s_basic(void)
CHECK(rank, UFAIL, "H5Sget_lrank");
VERIFY(rank, SPACE2_RANK, "H5Sget_lrank");
ret = H5Sget_dims(sid2, tdims, NULL);
ret = H5Sget_dims(sid2, tdims, tmax);
CHECK(ret, FAIL, "H5Sget_ldims");
VERIFY(HDmemcmp(tdims, dims2, SPACE2_RANK * sizeof(unsigned)), 0,
"H5Sget_ldims");
VERIFY(HDmemcmp(tmax, max2, SPACE2_RANK * sizeof(unsigned)), 0,
"H5Sget_ldims");
ret = H5Sclose(sid1);
CHECK(ret, FAIL, "H5Sclose");