summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElena Pourmal <epourmal@hdfgroup.org>2015-02-25 04:19:41 (GMT)
committerElena Pourmal <epourmal@hdfgroup.org>2015-02-25 04:19:41 (GMT)
commit99a3f4d8d4ee1ec3f61a377c1a96a3fe35e9990a (patch)
tree78c194e22fe4ecd057f1f13c8562b91e824696fb
parent2ca5b16a9fd79d240d5e4ebe4689033c6c7182ad (diff)
downloadhdf5-99a3f4d8d4ee1ec3f61a377c1a96a3fe35e9990a.zip
hdf5-99a3f4d8d4ee1ec3f61a377c1a96a3fe35e9990a.tar.gz
hdf5-99a3f4d8d4ee1ec3f61a377c1a96a3fe35e9990a.tar.bz2
[svn-r26297] Changed example and h5dump according to suggestions at today's code review VDS-176.
BNF has been updated too. Now h5dump displays VDS like this: HDF5 "vds.h5" { GROUP "/" { DATASET "VDS" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } STORAGE_LAYOUT { VIRTUAL { HYPERSLAB { (0,0)-(0,5) }; a.h5; A; ALL; HYPERSLAB { (1,0)-(1,5) }; b.h5; B; ALL; HYPERSLAB { (2,0)-(2,5) }; c.h5; C; ALL; } } } FILTERS { ....... I just commented the code with "EIP" and didn't delete to simplify the review with Allen tomorrow. Tested on jam
-rw-r--r--examples/CMakeLists.txt1
-rw-r--r--examples/h5_vds.c31
-rw-r--r--tools/lib/h5tools.h3
-rw-r--r--tools/lib/h5tools_dump.c22
-rw-r--r--tools/lib/h5tools_str.c2
5 files changed, 32 insertions, 27 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index da8174b..b7c9c63 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -34,6 +34,7 @@ set (examples
h5_extlink
h5_elink_unix2win
h5_shared_mesg
+ h5_vds
)
foreach (example ${examples})
diff --git a/examples/h5_vds.c b/examples/h5_vds.c
index 4c8e1dd..dea2ee6 100644
--- a/examples/h5_vds.c
+++ b/examples/h5_vds.c
@@ -47,8 +47,8 @@ main (void)
hid_t file, space, src_space, vspace, dset; /* Handles */
hid_t dcpl;
herr_t status;
- hsize_t vdsdims[2] = {VDSDIM0, VDSDIM1}, /* Datasets dimension */
- dims[1] = {DIM0},
+ hsize_t vdsdims[2] = {VDSDIM0, VDSDIM1}, /* Virtual satasets dimension */
+ dims[1] = {DIM0}, /* Source datasets dimensions */
start[2], /* Hyperslab parameters */
stride[2],
count[2],
@@ -89,12 +89,12 @@ main (void)
status = H5Dclose (dset);
status = H5Fclose (file);
}
+
/* Create file in which virtual dataset will be stored. */
file = H5Fcreate (FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Create VDS dataspace. */
space = H5Screate_simple (RANK2, vdsdims, NULL);
- src_space = H5Screate_simple (RANK1, dims, NULL);
/* Set VDS creation property. */
dcpl = H5Pcreate (H5P_DATASET_CREATE);
@@ -110,16 +110,16 @@ main (void)
/*
* Build the mappings.
- *
- * Select the first, the second and the third rows and map each row to the data in the
- * corresponding source datasets.
+ * Selections in the source datasets are H5S_ALL.
+ * In the virtual dataset we select the first, the second and the third rows
+ * and map each row to the data in the corresponding source dataset.
*/
+ src_space = H5Screate_simple (RANK1, dims, NULL);
for (i = 0; i < 3; i++) {
start[0] = (hsize_t)i;
/* Select i-th row in the virtual dataset; selection in the source datasets is the same. */
status = H5Sselect_hyperslab (space, H5S_SELECT_SET, start, NULL, count, block);
status = H5Pset_virtual (dcpl, space, SRC_FILE[i], SRC_DATASET[i], src_space);
- status = H5Sselect_none (space);
}
/* Create a virtual dataset. */
@@ -176,14 +176,12 @@ main (void)
status = H5Sget_select_hyper_blocklist (vspace, (hsize_t)0, nblocks, buf);
for (l=0; l<nblocks; l++) {
printf("(");
- for (k=0; k<RANK2-1; k++) printf("%d,", (int)buf[k]);
- printf("%d", (int)buf[k]);
- printf(") - ");
- printf("(");
- for (k=0; k<RANK2-1; k++) printf("%d,", (int)buf[RANK2+k]);
- printf("%d", (int)buf[RANK2+k]);
- printf(")");
- printf ("\n");
+ for (k=0; k<RANK2-1; k++)
+ printf("%d,", (int)buf[k]);
+ printf("%d ) - (", (int)buf[k]);
+ for (k=0; k<RANK2-1; k++)
+ printf("%d,", (int)buf[RANK2+k]);
+ printf("%d)\n", (int)buf[RANK2+k]);
}
}
/* Get source file name. */
@@ -204,8 +202,7 @@ main (void)
/* Make sure it is ALL selection and then print the coordinates. */
if(H5Sget_select_type(src_space) == H5S_SEL_ALL) {
- printf("(0) - (%d)", DIM0-1);
- printf ("\n");
+ printf("(0) - (%d) \n", DIM0-1);
}
H5Sclose(vspace);
H5Sclose(src_space);
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index 6dc93fd..9e1fd55 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -94,7 +94,10 @@
#define PACKED_OFFSET "OFFSET"
#define PACKED_LENGTH "LENGTH"
#define VDS_VIRTUAL "VIRTUAL"
+/* EIP
#define VDS_MAPPING "MAPPING"
+*/
+/* It looks like two definitions below are not used */
#define VDS_HYPERSLAB "HYPERSLAB_SELECTION"
#define VDS_POINT "POINT_SELECTION"
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index d2d895b..3b7b313 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -2866,25 +2866,25 @@ h5tools_print_virtual_selection(h5tools_str_t *buffer, const h5tool_format_t *in
h5tools_str_append(buffer, "%s ", h5tools_dump_header_format->virtualselectionbegin);
switch(H5Sget_select_type(vspace)) {
case H5S_SEL_NONE: /* Nothing selected */
- h5tools_str_append(buffer, "H5S_NONE");
+ h5tools_str_append(buffer, "NONE");
break;
case H5S_SEL_POINTS: /* Sequence of points selected */
- h5tools_str_append(buffer, "POINT_SELECTION %s ", h5tools_dump_header_format->virtualselectionblockbegin);
+ h5tools_str_append(buffer, "POINT %s ", h5tools_dump_header_format->virtualselectionblockbegin);
h5tools_str_dump_space_points(buffer, vspace, info);
- h5tools_str_append(buffer, "%s", h5tools_dump_header_format->virtualselectionblockend);
+ h5tools_str_append(buffer, "% s", h5tools_dump_header_format->virtualselectionblockend);
break;
case H5S_SEL_HYPERSLABS: /* "New-style" hyperslab selection defined */
- h5tools_str_append(buffer, "HYPERSLAB_SELECTION %s ", h5tools_dump_header_format->virtualselectionblockbegin);
+ h5tools_str_append(buffer, "HYPERSLAB %s ", h5tools_dump_header_format->virtualselectionblockbegin);
h5tools_str_dump_space_blocks(buffer, vspace, info);
- h5tools_str_append(buffer, "%s", h5tools_dump_header_format->virtualselectionblockend);
+ h5tools_str_append(buffer, "% s", h5tools_dump_header_format->virtualselectionblockend);
break;
case H5S_SEL_ALL: /* Entire extent selected */
- h5tools_str_append(buffer, "H5S_ALL");
+ h5tools_str_append(buffer, "ALL");
break;
default:
h5tools_str_append(buffer, "Unknown Selection");
}
- h5tools_str_append(buffer, " %s", h5tools_dump_header_format->virtualselectionend);
+ h5tools_str_append(buffer, "%s", h5tools_dump_header_format->virtualselectionend);
}
@@ -3173,13 +3173,15 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
ctx->indent_level++;
ctx->need_prefix = TRUE;
- h5tools_simple_prefix(stream, info, ctx, curr_pos, 0);
-
+/* EIP h5tools_simple_prefix(stream, info, ctx, curr_pos, 0);
+*/
h5tools_str_reset(&buffer);
+/* EIP
h5tools_str_append(&buffer, "%s %s", VDS_MAPPING, BEGIN);
h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
ctx->indent_level++;
+*/
for(next = 0; next < (unsigned)vmaps; next++) {
hid_t virtual_vspace = H5Pget_virtual_vspace(dcpl_id, next);
hid_t virtual_srcspace = H5Pget_virtual_srcspace(dcpl_id, next);
@@ -3221,7 +3223,9 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
h5tools_print_virtual_selection(&buffer, info, virtual_srcspace, dcpl_id, next);
h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
}
+/* EIP
ctx->indent_level--;
+*/
ctx->need_prefix = TRUE;
h5tools_simple_prefix(stream, info, ctx, curr_pos, 0);
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 45424f6..d0ecc6e 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -469,7 +469,7 @@ h5tools_str_dump_space_blocks(h5tools_str_t *str, hid_t rspace,
h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : ")-(",
ptdata[i * 2 * ndims + j + ndims]);
- h5tools_str_append(str, ")");
+ h5tools_str_append(str, ") ");
}
HDfree(ptdata);