summaryrefslogtreecommitdiffstats
path: root/tools/misc
diff options
context:
space:
mode:
Diffstat (limited to 'tools/misc')
-rw-r--r--tools/misc/CMakeLists.txt3
-rw-r--r--tools/misc/Makefile.am2
-rw-r--r--tools/misc/vds/CMakeLists.txt28
-rw-r--r--tools/misc/vds/Makefile.am38
-rw-r--r--tools/misc/vds/UC_1.h150
-rw-r--r--tools/misc/vds/UC_1_one_dim_gen.c239
-rw-r--r--tools/misc/vds/UC_2.h151
-rw-r--r--tools/misc/vds/UC_2_two_dims_gen.c230
-rw-r--r--tools/misc/vds/UC_3.h78
-rw-r--r--tools/misc/vds/UC_3_gaps_gen.c255
-rw-r--r--tools/misc/vds/UC_4.h86
-rw-r--r--tools/misc/vds/UC_4_printf_gen.c219
-rw-r--r--tools/misc/vds/UC_5.h83
-rw-r--r--tools/misc/vds/UC_5_stride_gen.c243
-rw-r--r--tools/misc/vds/UC_common.h41
15 files changed, 1846 insertions, 0 deletions
diff --git a/tools/misc/CMakeLists.txt b/tools/misc/CMakeLists.txt
index d53cdc8..088dbdf 100644
--- a/tools/misc/CMakeLists.txt
+++ b/tools/misc/CMakeLists.txt
@@ -52,6 +52,9 @@ if (BUILD_TESTING)
target_link_libraries (h5repart_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
set_target_properties (h5repart_gentest PROPERTIES FOLDER generator/tools)
#add_test (NAME h5repart_gentest COMMAND $<TARGET_FILE:h5repart_gentest>)
+
+ add_subdirectory (${HDF5_TOOLS_MISC_SOURCE_DIR}/vds)
+
endif (HDF5_BUILD_GENERATORS)
add_executable (h5repart_test ${HDF5_TOOLS_MISC_SOURCE_DIR}/repart_test.c)
diff --git a/tools/misc/Makefile.am b/tools/misc/Makefile.am
index 53b1872..fdfe8f7 100644
--- a/tools/misc/Makefile.am
+++ b/tools/misc/Makefile.am
@@ -20,6 +20,8 @@
include $(top_srcdir)/config/commence.am
+SUBDIRS=vds
+
# Include src directory
AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
diff --git a/tools/misc/vds/CMakeLists.txt b/tools/misc/vds/CMakeLists.txt
new file mode 100644
index 0000000..dcf883c
--- /dev/null
+++ b/tools/misc/vds/CMakeLists.txt
@@ -0,0 +1,28 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF5_TOOLS_MISC_VDS)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib)
+
+MACRO (ADD_H5_GENERATOR genfile)
+ add_executable (${genfile} ${HDF5_TOOLS_MISC_VDS_SOURCE_DIR}/${genfile}.c)
+ TARGET_NAMING (${genfile} STATIC)
+ TARGET_C_PROPERTIES (${genfile} STATIC " " " ")
+ target_link_libraries (${genfile} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ set_target_properties (${genfile} PROPERTIES FOLDER generator/tools)
+ENDMACRO (ADD_H5_GENERATOR genfile)
+
+# generator executables
+set (H5_GENERATORS
+ UC_1_one_dim_gen
+ UC_2_two_dims_gen
+ UC_3_gaps_gen
+ UC_4_printf_gen
+ UC_5_stride_gen
+)
+
+foreach (gen ${H5_GENERATORS})
+ ADD_H5_GENERATOR (${gen})
+endforeach (gen ${H5_GENERATORS})
diff --git a/tools/misc/vds/Makefile.am b/tools/misc/vds/Makefile.am
new file mode 100644
index 0000000..f1ef80c
--- /dev/null
+++ b/tools/misc/vds/Makefile.am
@@ -0,0 +1,38 @@
+#
+# Copyright by The HDF Group.
+# 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
+# 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.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+#
+# HDF5 Library Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+# Include src directory
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+
+#test scripts and programs
+TEST_PROG=UC_1_one_dim_gen UC_2_two_dims_gen UC_3_gaps_gen UC_4_printf_gen \
+ UC_5_stride_gen
+
+check_PROGRAMS=$(TEST_PROG)
+
+# Temporary files.
+CHECK_CLEANFILES+=*.h5
+
+# All programs rely on hdf5 library and h5tools library
+LDADD=$(LIBH5TOOLS) $(LIBHDF5)
+
+include $(top_srcdir)/config/conclude.am
diff --git a/tools/misc/vds/UC_1.h b/tools/misc/vds/UC_1.h
new file mode 100644
index 0000000..29df72b
--- /dev/null
+++ b/tools/misc/vds/UC_1.h
@@ -0,0 +1,150 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * 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 *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef UC_1_H
+#define UC_1_H
+
+#include "hdf5.h"
+
+#include "UC_common.h"
+
+/*
+ * Definitions for VDS use case 1
+ *
+ * Datasets have a single unlimited dimension and two fixed dimensions. They
+ * are mapped along a single dimension in the VDS with no gaps between them.
+ */
+
+/* virtual dataset <---> source dataset mapping and sizes
+
+ ***************** --+
+ * A * K
+ ***************** --+
+ * * |
+ * B * N
+ * * |
+ ***************** --+
+ * C *
+ *****************
+ * *
+ * D *
+ * *
+ *****************
+ * E *
+ *****************
+ * *
+ * F *
+ * *
+ *****************
+
+ | |
+ +-------M-------+
+
+
+ dim[0]
+ /
+ /
+ /
+ -----> dim[2]
+ |
+ |
+ |
+ dim[1]
+
+ */
+
+
+#define UC_1_N_SOURCES 6
+
+/* Dataset dimensions */
+#define UC_1_SM_HEIGHT 2 /* K */
+#define UC_1_LG_HEIGHT 4 /* N */
+#define UC_1_SM_LG_HEIGHT 6 /* SM_HEIGHT + LG_HEIGHT */
+#define UC_1_FULL_HEIGHT 18 /* (3 * K) + (3 * N) */
+#define UC_1_HALF_HEIGHT 9
+#define UC_1_WIDTH 8 /* M */
+#define UC_1_HALF_WIDTH 4
+
+#define UC_1_N_MAX_PLANES H5S_UNLIMITED /* max number of planes */
+#define UC_1_N_TEST_PLANES 5 /* number of planes we write */
+
+/* Dataset datatypes */
+#define UC_1_SOURCE_DATATYPE H5T_STD_I32LE
+#define UC_1_VDS_DATATYPE H5T_STD_I32LE
+
+/* Starting size of datasets, both source and VDS */
+static hsize_t UC_1_DIMS[UC_1_N_SOURCES][RANK] = {
+ {0, UC_1_SM_HEIGHT, UC_1_WIDTH},
+ {0, UC_1_LG_HEIGHT, UC_1_WIDTH},
+ {0, UC_1_SM_HEIGHT, UC_1_WIDTH},
+ {0, UC_1_LG_HEIGHT, UC_1_WIDTH},
+ {0, UC_1_SM_HEIGHT, UC_1_WIDTH},
+ {0, UC_1_LG_HEIGHT, UC_1_WIDTH}
+};
+static hsize_t UC_1_VDS_DIMS[RANK] = {0, UC_1_FULL_HEIGHT, UC_1_WIDTH};
+
+/* Maximum size of datasets, both source and VDS */
+static hsize_t UC_1_MAX_DIMS[UC_1_N_SOURCES][RANK] = {
+ {UC_1_N_MAX_PLANES, UC_1_SM_HEIGHT, UC_1_WIDTH},
+ {UC_1_N_MAX_PLANES, UC_1_LG_HEIGHT, UC_1_WIDTH},
+ {UC_1_N_MAX_PLANES, UC_1_SM_HEIGHT, UC_1_WIDTH},
+ {UC_1_N_MAX_PLANES, UC_1_LG_HEIGHT, UC_1_WIDTH},
+ {UC_1_N_MAX_PLANES, UC_1_SM_HEIGHT, UC_1_WIDTH},
+ {UC_1_N_MAX_PLANES, UC_1_LG_HEIGHT, UC_1_WIDTH}
+};
+static hsize_t UC_1_VDS_MAX_DIMS[RANK] = {UC_1_N_MAX_PLANES, UC_1_FULL_HEIGHT, UC_1_WIDTH};
+
+/* Planes */
+static hsize_t UC_1_PLANES[UC_1_N_SOURCES][RANK] = {
+ {1, UC_1_SM_HEIGHT, UC_1_WIDTH},
+ {1, UC_1_LG_HEIGHT, UC_1_WIDTH},
+ {1, UC_1_SM_HEIGHT, UC_1_WIDTH},
+ {1, UC_1_LG_HEIGHT, UC_1_WIDTH},
+ {1, UC_1_SM_HEIGHT, UC_1_WIDTH},
+ {1, UC_1_LG_HEIGHT, UC_1_WIDTH}
+};
+static hsize_t UC_1_VDS_PLANE[RANK] = {1, UC_1_FULL_HEIGHT, UC_1_WIDTH};
+
+/* File names for source datasets */
+static char UC_1_FILE_NAMES[UC_1_N_SOURCES][NAME_LEN] = {
+ {"1_a.h5"},
+ {"1_b.h5"},
+ {"1_c.h5"},
+ {"1_d.h5"},
+ {"1_e.h5"},
+ {"1_f.h5"}
+};
+
+/* VDS file name */
+static char UC_1_VDS_FILE_NAME[NAME_LEN] = "1_vds.h5";
+
+/* Dataset names */
+static char UC_1_SOURCE_DSET_NAME[NAME_LEN] = "source_dset";
+static char UC_1_SOURCE_DSET_PATH[NAME_LEN] = "/source_dset";
+static char UC_1_VDS_DSET_NAME[NAME_LEN] = "vds_dset";
+
+/* Fill values */
+static hsize_t UC_1_FILL_VALUES[UC_1_N_SOURCES] = {
+ -1,
+ -2,
+ -3,
+ -4,
+ -5,
+ -6
+};
+static int UC_1_VDS_FILL_VALUE = -9;
+
+#endif /* UC_1_H */
+
diff --git a/tools/misc/vds/UC_1_one_dim_gen.c b/tools/misc/vds/UC_1_one_dim_gen.c
new file mode 100644
index 0000000..a78268b
--- /dev/null
+++ b/tools/misc/vds/UC_1_one_dim_gen.c
@@ -0,0 +1,239 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * 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 *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * File/dataset generator for VDS use case 1
+ *
+ * See the header file for a description.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "hdf5.h"
+
+#include "UC_common.h"
+#include "UC_1.h"
+
+
+int
+main(int argc, char *argv[])
+{
+ hid_t src_sid = -1; /* source dataset's dataspace ID */
+ hid_t src_dcplid = -1; /* source dataset property list ID */
+
+ hid_t vds_sid = -1; /* VDS dataspace ID */
+ hid_t vds_dcplid = -1; /* VDS dataset property list ID */
+
+ hid_t fid = -1; /* HDF5 file ID */
+ hid_t did = -1; /* dataset ID */
+ hid_t msid = -1; /* memory dataspace ID */
+ hid_t fsid = -1; /* file dataspace ID */
+
+ hsize_t extent[RANK]; /* dataset extents */
+ hsize_t start[RANK]; /* starting point for hyperslab */
+ int map_start = -1; /* starting point in the VDS map */
+
+ int *buffer = NULL; /* data buffer */
+ hsize_t count = 0; /* number of elements in a plane */
+ int n_planes = -1; /* number of planes to write */
+ int value = -1; /* value written to datasets */
+
+ int i; /* iterator */
+ int j; /* iterator */
+ int k; /* iterator */
+
+
+ /* Start by creating the virtual dataset (VDS) dataspace and creation
+ * property list. The individual source datasets are then created
+ * and the VDS map (stored in the VDS property list) is updated.
+ */
+
+ /* Create VDS dcpl */
+ if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ UC_ERROR
+ if(H5Pset_fill_value(vds_dcplid, UC_1_VDS_DATATYPE,
+ &UC_1_VDS_FILL_VALUE) < 0)
+ UC_ERROR
+
+ /* Create VDS dataspace */
+ if((vds_sid = H5Screate_simple(RANK, UC_1_VDS_DIMS,
+ UC_1_VDS_MAX_DIMS)) < 0)
+ UC_ERROR
+
+ /************************************
+ * Create source files and datasets *
+ ************************************/
+
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ map_start = 0;
+
+ for(i = 0; i < UC_1_N_SOURCES; i++) {
+
+ /* Create source dataset dcpl */
+ if((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ UC_ERROR
+ if(H5Pset_chunk(src_dcplid, RANK, UC_1_PLANES[i]) < 0)
+ UC_ERROR
+ if(H5Pset_fill_value(src_dcplid, UC_1_SOURCE_DATATYPE,
+ &UC_1_FILL_VALUES[i]) < 0)
+ UC_ERROR
+ if(0 != i % 2)
+ if(H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0)
+ UC_ERROR
+
+ /* Create source file, dataspace, and dataset */
+ if((fid = H5Fcreate(UC_1_FILE_NAMES[i], H5F_ACC_TRUNC,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ UC_ERROR
+ if((src_sid = H5Screate_simple(RANK, UC_1_DIMS[i],
+ UC_1_MAX_DIMS[i])) < 0)
+ UC_ERROR
+ if((did = H5Dcreate2(fid, UC_1_SOURCE_DSET_NAME,
+ UC_1_SOURCE_DATATYPE, src_sid,
+ H5P_DEFAULT, src_dcplid, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* Set the dataset's extent (will eventually vary with i) */
+ extent[0] = UC_1_N_TEST_PLANES;
+ extent[1] = UC_1_PLANES[i][1];
+ extent[2] = UC_1_PLANES[i][2];
+ if(H5Dset_extent(did, extent) < 0)
+ UC_ERROR
+
+ /* Create a data buffer that represents a plane */
+ count = UC_1_PLANES[i][1] * UC_1_PLANES[i][2];
+ if(NULL == (buffer = (int *)malloc(count * sizeof(int))))
+ UC_ERROR
+
+ /* Create the memory dataspace */
+ if((msid = H5Screate_simple(RANK, UC_1_PLANES[i], NULL)) < 0)
+ UC_ERROR
+
+ /* Get the file dataspace */
+ if((fsid = H5Dget_space(did)) < 0)
+ UC_ERROR
+
+ /* Write planes to the dataset, number will eventually vary with i */
+ n_planes = UC_1_N_TEST_PLANES;
+ for(j = 0; j < n_planes; j++) {
+
+ value = ((i + 1) * 10) + j;
+ for(k = 0; k < count; k++)
+ buffer[k] = value;
+
+ start[0] = j;
+ start[1] = 0;
+ start[2] = 0;
+ if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_1_PLANES[i], NULL) < 0)
+ UC_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0)
+ UC_ERROR
+
+ } /* end for */
+
+ /* set up hyperslabs for source and destination datasets */
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL,
+ UC_1_MAX_DIMS[i], NULL) < 0)
+ UC_ERROR
+ start[0] = 0;
+ start[1] = map_start;
+ start[2] = 0;
+ if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, start, NULL,
+ UC_1_MAX_DIMS[i], NULL) < 0)
+ UC_ERROR
+ map_start += UC_1_PLANES[i][1];
+
+ /* Add VDS mapping */
+ if(H5Pset_virtual(vds_dcplid, vds_sid, UC_1_FILE_NAMES[i],
+ UC_1_SOURCE_DSET_PATH, src_sid) < 0)
+ UC_ERROR
+
+ /* close */
+ if(H5Sclose(src_sid) < 0)
+ UC_ERROR
+ if(H5Pclose(src_dcplid) < 0)
+ UC_ERROR
+ if(H5Sclose(msid) < 0)
+ UC_ERROR
+ if(H5Sclose(fsid) < 0)
+ UC_ERROR
+ if(H5Dclose(did) < 0)
+ UC_ERROR
+ if(H5Fclose(fid) < 0)
+ UC_ERROR
+ free(buffer);
+
+ } /* end for */
+
+
+ /*******************
+ * Create VDS file *
+ *******************/
+
+ /* file */
+ if((fid = H5Fcreate(UC_1_VDS_FILE_NAME, H5F_ACC_TRUNC,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* dataset */
+ if((did = H5Dcreate2(fid, UC_1_VDS_DSET_NAME, UC_1_VDS_DATATYPE, vds_sid,
+ H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* close */
+ if(H5Pclose(vds_dcplid) < 0)
+ UC_ERROR
+ if(H5Sclose(vds_sid) < 0)
+ UC_ERROR
+ if(H5Dclose(did) < 0)
+ UC_ERROR
+ if(H5Fclose(fid) < 0)
+ UC_ERROR
+
+ return EXIT_SUCCESS;
+
+error:
+
+ H5E_BEGIN_TRY {
+ if(src_sid >= 0)
+ (void)H5Sclose(src_sid);
+ if(src_dcplid >= 0)
+ (void)H5Pclose(src_dcplid);
+ if(vds_sid >= 0)
+ (void)H5Sclose(vds_sid);
+ if(vds_dcplid >= 0)
+ (void)H5Pclose(vds_dcplid);
+ if(fid >= 0)
+ (void)H5Fclose(fid);
+ if(did >= 0)
+ (void)H5Dclose(did);
+ if(msid >= 0)
+ (void)H5Sclose(msid);
+ if(fsid >= 0)
+ (void)H5Sclose(fsid);
+ if(buffer != NULL)
+ free(buffer);
+ } H5E_END_TRY
+
+ return EXIT_FAILURE;
+
+} /* end main */
+
diff --git a/tools/misc/vds/UC_2.h b/tools/misc/vds/UC_2.h
new file mode 100644
index 0000000..3e4e4fd
--- /dev/null
+++ b/tools/misc/vds/UC_2.h
@@ -0,0 +1,151 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * 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 *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef UC_2_H
+#define UC_2_H
+
+#include "hdf5.h"
+
+/*
+ * Definitions for VDS use case 2
+ *
+ * Datasets have a single unlimited dimension and two fixed dimensions. They
+ * are mapped along two dimensions in the VDS with no gaps between them.
+ */
+
+/* virtual dataset <---> source dataset mapping and sizes
+
+ **********************************
+ * A * *
+ ***************** D *
+ * * *
+ * B * *
+ * ******************
+ ***************** E *
+ * C * *
+ **********************************
+
+
+ dim[0]
+ /
+ /
+ /
+ -----> dim[2]
+ |
+ |
+ |
+ dim[1]
+
+ */
+
+#define UC_2_N_SOURCES 5
+
+/* Dataset dimensions */
+#define UC_2_A_HEIGHT 2
+#define UC_2_B_HEIGHT 4
+#define UC_2_AB_HEIGHT 6 /* For hyperslab start position */
+#define UC_2_C_HEIGHT 2
+#define UC_2_D_HEIGHT 5
+#define UC_2_E_HEIGHT 3
+#define UC_2_FULL_HEIGHT 8 /* A+B+C and D+E */
+#define UC_2_WIDTH 7
+#define UC_2_FULL_WIDTH 14 /* 2*width */
+
+#define UC_2_N_PLANES_IN_SERIES 3 /* number of planes in a series of sub-images */
+#define UC_2_N_MAX_PLANES H5S_UNLIMITED /* max number of planes */
+#define UC_2_N_TEST_PLANES 6 /* number of planes we write */
+
+/* Dataset datatypes */
+#define UC_2_SOURCE_DATATYPE H5T_STD_I32LE
+#define UC_2_VDS_DATATYPE H5T_STD_I32LE
+
+/* Starting size of datasets, both source and VDS */
+static hsize_t UC_2_DIMS[UC_2_N_SOURCES][RANK] = {
+ {0, UC_2_A_HEIGHT, UC_2_WIDTH},
+ {0, UC_2_B_HEIGHT, UC_2_WIDTH},
+ {0, UC_2_C_HEIGHT, UC_2_WIDTH},
+ {0, UC_2_D_HEIGHT, UC_2_WIDTH},
+ {0, UC_2_E_HEIGHT, UC_2_WIDTH}
+};
+static hsize_t UC_2_VDS_DIMS[RANK] = {0, UC_2_FULL_HEIGHT, UC_2_FULL_WIDTH};
+
+/* Maximum size of datasets, both source and VDS */
+static hsize_t UC_2_MAX_DIMS[UC_2_N_SOURCES][RANK] = {
+ {UC_2_N_MAX_PLANES, UC_2_A_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_MAX_PLANES, UC_2_B_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_MAX_PLANES, UC_2_C_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_MAX_PLANES, UC_2_D_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_MAX_PLANES, UC_2_E_HEIGHT, UC_2_WIDTH}
+};
+static hsize_t UC_2_VDS_MAX_DIMS[RANK] = {UC_2_N_MAX_PLANES, UC_2_FULL_HEIGHT, UC_2_FULL_WIDTH};
+
+/* Positions of source datasets in the VDS */
+static hsize_t UC_2_POSITIONS[UC_2_N_SOURCES][RANK] = {
+ /* A */ {0, 0, 0},
+ /* B */ {0, UC_2_A_HEIGHT, 0},
+ /* C */ {0, UC_2_AB_HEIGHT, 0},
+ /* D */ {0, 0, UC_2_WIDTH},
+ /* E */ {0, UC_2_D_HEIGHT, UC_2_WIDTH}
+};
+
+/* Planes */
+static hsize_t UC_2_PLANES[UC_2_N_SOURCES][RANK] = {
+ {1, UC_2_A_HEIGHT, UC_2_WIDTH},
+ {1, UC_2_B_HEIGHT, UC_2_WIDTH},
+ {1, UC_2_C_HEIGHT, UC_2_WIDTH},
+ {1, UC_2_D_HEIGHT, UC_2_WIDTH},
+ {1, UC_2_E_HEIGHT, UC_2_WIDTH}
+};
+static hsize_t UC_2_VDS_SUB_IMAGE[RANK] = {1, UC_2_FULL_HEIGHT, UC_2_WIDTH};
+static hsize_t UC_2_VDS_PLANE[RANK] = {1, UC_2_FULL_HEIGHT, UC_2_FULL_WIDTH};
+
+/* Chunk dimensions */
+static hsize_t UC_2_CHUNK_DIMS[UC_2_N_SOURCES][RANK] = {
+ {UC_2_N_PLANES_IN_SERIES, UC_2_A_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_PLANES_IN_SERIES, UC_2_B_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_PLANES_IN_SERIES, UC_2_C_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_PLANES_IN_SERIES, UC_2_D_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_PLANES_IN_SERIES, UC_2_E_HEIGHT, UC_2_WIDTH}
+};
+
+/* File names for source datasets */
+static char UC_2_FILE_NAMES[UC_2_N_SOURCES][NAME_LEN] = {
+ {"2_a.h5"},
+ {"2_b.h5"},
+ {"2_c.h5"},
+ {"2_d.h5"},
+ {"2_e.h5"}
+};
+
+/* VDS file name */
+#define UC_2_VDS_FILE_NAME "2_vds.h5"
+
+/* Dataset names */
+#define UC_2_SOURCE_DSET_NAME "source_dset"
+#define UC_2_SOURCE_DSET_PATH "/source_dset"
+#define UC_2_VDS_DSET_NAME "vds_dset"
+
+/* Fill values */
+static hsize_t UC_2_FILL_VALUES[UC_2_N_SOURCES] = {
+ -1,
+ -2,
+ -3,
+ -4,
+ -5
+};
+static int UC_2_VDS_FILL_VALUE = -9;
+
+#endif /* UC_2_H */
+
diff --git a/tools/misc/vds/UC_2_two_dims_gen.c b/tools/misc/vds/UC_2_two_dims_gen.c
new file mode 100644
index 0000000..b5fd319
--- /dev/null
+++ b/tools/misc/vds/UC_2_two_dims_gen.c
@@ -0,0 +1,230 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * 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 *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * File/dataset generator for VDS use case 2
+ *
+ * See the header file for a description.
+ */
+
+
+#include <stdlib.h>
+
+#include "hdf5.h"
+
+#include "UC_common.h"
+#include "UC_2.h"
+
+int
+main(int argc, char *argv[])
+{
+ hid_t src_sid = -1; /* source dataset's dataspace ID */
+ hid_t src_dcplid = -1; /* source dataset property list ID */
+
+ hid_t vds_sid = -1; /* VDS dataspace ID */
+ hid_t vds_dcplid = -1; /* VDS dataset property list ID */
+
+ hid_t fid = -1; /* HDF5 file ID */
+ hid_t did = -1; /* dataset ID */
+ hid_t msid = -1; /* memory dataspace ID */
+ hid_t fsid = -1; /* file dataspace ID */
+
+ hsize_t start[RANK]; /* starting point for hyperslab */
+ hsize_t extent[RANK]; /* dataset extents */
+
+ int *buffer = NULL; /* data buffer */
+ int value = -1; /* value written to datasets */
+ hsize_t count = 0; /* number of elements in a plane */
+ int n_planes = -1; /* number of planes to write */
+
+ int i; /* iterator */
+ int j; /* iterator */
+ int k; /* iterator */
+
+
+ /* Start by creating the virtual dataset (VDS) dataspace and creation
+ * property list. The individual source datasets are then created
+ * and the VDS map (stored in the VDS property list) is updated.
+ */
+
+ /* Create VDS dcpl */
+ if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ UC_ERROR
+ if(H5Pset_fill_value(vds_dcplid, UC_2_VDS_DATATYPE,
+ &UC_2_VDS_FILL_VALUE) < 0)
+ UC_ERROR
+
+ /* Create VDS dataspace */
+ if((vds_sid = H5Screate_simple(RANK, UC_2_VDS_DIMS,
+ UC_2_VDS_MAX_DIMS)) < 0)
+ UC_ERROR
+
+ /************************************
+ * Create source files and datasets *
+ ************************************/
+
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+
+ for(i = 0; i < UC_2_N_SOURCES; i++) {
+
+ /* source dataset dcpl */
+ if((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ UC_ERROR
+ if(H5Pset_chunk(src_dcplid, RANK, UC_2_CHUNK_DIMS[i]) < 0)
+ UC_ERROR
+ if(H5Pset_fill_value(src_dcplid, UC_2_SOURCE_DATATYPE,
+ &UC_2_FILL_VALUES[i]) < 0)
+ UC_ERROR
+ if(H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0)
+ UC_ERROR
+
+ /* Create source file, dataspace, and dataset */
+ if((fid = H5Fcreate(UC_2_FILE_NAMES[i], H5F_ACC_TRUNC,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ UC_ERROR
+ if((src_sid = H5Screate_simple(RANK, UC_2_DIMS[i],
+ UC_2_MAX_DIMS[i])) < 0)
+ UC_ERROR
+ if((did = H5Dcreate2(fid, UC_2_SOURCE_DSET_NAME,
+ UC_2_SOURCE_DATATYPE, src_sid,
+ H5P_DEFAULT, src_dcplid, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* Set the dataset's extent (will eventually vary with i) */
+ extent[0] = UC_2_N_TEST_PLANES;
+ extent[1] = UC_2_PLANES[i][1];
+ extent[2] = UC_2_PLANES[i][2];
+ if(H5Dset_extent(did, extent) < 0)
+ UC_ERROR
+
+ /* Create a data buffer that represents a plane */
+ count = UC_2_PLANES[i][1] * UC_2_PLANES[i][2];
+ if(NULL == (buffer = (int *)malloc(count * sizeof(int))))
+ UC_ERROR
+
+ /* Create the memory dataspace */
+ if((msid = H5Screate_simple(RANK, UC_2_PLANES[i], NULL)) < 0)
+ UC_ERROR
+
+ /* Get the file dataspace */
+ if((fsid = H5Dget_space(did)) < 0)
+ UC_ERROR
+
+ /* Write planes to the dataset, number will eventually vary with i */
+ n_planes = UC_2_N_TEST_PLANES;
+ for(j = 0; j < n_planes; j++) {
+
+ value = ((i + 1) * 10) + j;
+ for(k = 0; k < count; k++)
+ buffer[k] = value;
+
+ start[0] = j;
+ start[1] = 0;
+ start[2] = 0;
+ if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_2_PLANES[i], NULL) < 0)
+ UC_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0)
+ UC_ERROR
+
+ } /* end for */
+
+ /* set up hyperslabs for source and destination datasets */
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL,
+ UC_2_MAX_DIMS[i], NULL) < 0)
+ UC_ERROR
+ if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, UC_2_POSITIONS[i], NULL,
+ UC_2_MAX_DIMS[i], NULL) < 0)
+ UC_ERROR
+
+ /* Add VDS mapping */
+ if(H5Pset_virtual(vds_dcplid, vds_sid, UC_2_FILE_NAMES[i],
+ UC_2_SOURCE_DSET_PATH, src_sid) < 0)
+ UC_ERROR
+
+ /* close */
+ if(H5Sclose(msid) < 0)
+ UC_ERROR
+ if(H5Sclose(fsid) < 0)
+ UC_ERROR
+ if(H5Sclose(src_sid) < 0)
+ UC_ERROR
+ if(H5Pclose(src_dcplid) < 0)
+ UC_ERROR
+ if(H5Dclose(did) < 0)
+ UC_ERROR
+ if(H5Fclose(fid) < 0)
+ UC_ERROR
+ free(buffer);
+
+ } /* end for */
+
+ /*******************************
+ * Create VDS file and dataset *
+ *******************************/
+
+ /* file */
+ if((fid = H5Fcreate(UC_2_VDS_FILE_NAME, H5F_ACC_TRUNC,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* dataset */
+ if((did = H5Dcreate2(fid, UC_2_VDS_DSET_NAME, UC_2_VDS_DATATYPE, vds_sid,
+ H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* close */
+ if(H5Pclose(vds_dcplid) < 0)
+ UC_ERROR
+ if(H5Sclose(vds_sid) < 0)
+ UC_ERROR
+ if(H5Dclose(did) < 0)
+ UC_ERROR
+ if(H5Fclose(fid) < 0)
+ UC_ERROR
+
+ return EXIT_SUCCESS;
+
+error:
+
+ H5E_BEGIN_TRY {
+ if(src_sid >= 0)
+ (void)H5Sclose(src_sid);
+ if(src_dcplid >= 0)
+ (void)H5Pclose(src_dcplid);
+ if(vds_sid >= 0)
+ (void)H5Sclose(vds_sid);
+ if(vds_dcplid >= 0)
+ (void)H5Pclose(vds_dcplid);
+ if(fid >= 0)
+ (void)H5Fclose(fid);
+ if(did >= 0)
+ (void)H5Dclose(did);
+ if(msid >= 0)
+ (void)H5Sclose(msid);
+ if(fsid >= 0)
+ (void)H5Sclose(fsid);
+ if(buffer != NULL)
+ free(buffer);
+ } H5E_END_TRY
+
+ return EXIT_FAILURE;
+
+} /* end main() */
+
diff --git a/tools/misc/vds/UC_3.h b/tools/misc/vds/UC_3.h
new file mode 100644
index 0000000..a27c3cf
--- /dev/null
+++ b/tools/misc/vds/UC_3.h
@@ -0,0 +1,78 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * 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 *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef UC_3_H
+#define UC_3_H
+
+#include "hdf5.h"
+
+#include "UC_1.h"
+#include "UC_2.h"
+
+/*
+ * Definitions for VDS use case 3
+ *
+ * Datasets have a single unlimited dimension and one or two fixed
+ * dimensions (they are reused from use cases 1 and 2). In this use case,
+ * the datasets are mapped in the VDS with gaps between them.
+ */
+
+/* VDS dimensions
+ * Height and width are large enough to encompass the
+ * mapped source datasets with gaps.
+ */
+#define UC_31_VDS_HEIGHT 25 /* full height + 7 (gaps of 1) */
+#define UC_31_VDS_WIDTH 8 /* full width + 0 (no gaps) */
+#define UC_32_VDS_HEIGHT 13 /* full height + 5 */
+#define UC_32_VDS_WIDTH 19 /* full width + 5 */
+#define UC_31_GAP 1
+
+/* VDS datatypes */
+#define UC_31_VDS_DATATYPE H5T_STD_I32LE
+#define UC_32_VDS_DATATYPE H5T_STD_I32LE
+
+/* Starting size of virtual datasets */
+static hsize_t UC_31_VDS_DIMS[RANK] = {0, UC_31_VDS_HEIGHT, UC_31_VDS_WIDTH};
+static hsize_t UC_32_VDS_DIMS[RANK] = {0, UC_32_VDS_HEIGHT, UC_32_VDS_WIDTH};
+
+/* Maximum size of virtual datasets */
+static hsize_t UC_31_VDS_MAX_DIMS[RANK] = {UC_1_N_MAX_PLANES, UC_31_VDS_HEIGHT, UC_31_VDS_WIDTH};
+static hsize_t UC_32_VDS_MAX_DIMS[RANK] = {UC_2_N_MAX_PLANES, UC_32_VDS_HEIGHT, UC_32_VDS_WIDTH};
+
+/* Positions of mapped source datasets */
+static hsize_t UC_32_POSITIONS[UC_2_N_SOURCES][RANK] = {
+ /* A */ {0, 1, 1},
+ /* B */ {0, 4, 0},
+ /* C */ {0, 11, 4},
+ /* D */ {0, 1, 9},
+ /* E */ {0, 8, 12}
+};
+
+/* Planes */
+static hsize_t UC_31_VDS_PLANE[RANK] = {1, UC_31_VDS_HEIGHT, UC_31_VDS_WIDTH};
+static hsize_t UC_32_VDS_PLANE[RANK] = {1, UC_32_VDS_HEIGHT, UC_32_VDS_WIDTH};
+
+/* VDS file names */
+#define UC_31_VDS_FILE_NAME "3_1_vds.h5"
+#define UC_32_VDS_FILE_NAME "3_2_vds.h5"
+
+/* Dataset name */
+#define UC_3_VDS_DSET_NAME "vds_dset"
+
+/* Fill value */
+static int UC_3_VDS_FILL_VALUE = -9;
+
+#endif /* UC_3_H */
+
diff --git a/tools/misc/vds/UC_3_gaps_gen.c b/tools/misc/vds/UC_3_gaps_gen.c
new file mode 100644
index 0000000..1f150c1
--- /dev/null
+++ b/tools/misc/vds/UC_3_gaps_gen.c
@@ -0,0 +1,255 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * 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 *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * File/dataset generator for VDS use case 3
+ *
+ * See the header file for a description.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <hdf5.h>
+
+#include "UC_common.h"
+#include "UC_3.h"
+
+/* Create the VDS that uses use case 1 files */
+herr_t
+create_3_1_vds(void)
+{
+ hid_t src_sid = -1; /* source dataset's dataspace ID */
+ hid_t vds_sid = -1; /* VDS dataspace ID */
+ hid_t vds_dcplid = -1; /* VDS dataset property list ID */
+
+ hid_t fid = -1; /* HDF5 file ID */
+ hid_t did = -1; /* dataset ID */
+
+ hsize_t start[RANK]; /* source starting point for hyperslab */
+ hsize_t position[RANK]; /* vds mapping positions */
+
+ int i; /* iterator */
+
+ /* Create VDS dcpl */
+ if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ UC_ERROR
+ if(H5Pset_fill_value(vds_dcplid, UC_31_VDS_DATATYPE,
+ &UC_3_VDS_FILL_VALUE) < 0)
+ UC_ERROR
+
+ /* Create VDS dataspace */
+ if((vds_sid = H5Screate_simple(RANK, UC_31_VDS_DIMS,
+ UC_31_VDS_MAX_DIMS)) < 0)
+ UC_ERROR
+
+ /* Set starting positions */
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+
+ position[0] = 0;
+ position[1] = UC_31_GAP;
+ position[2] = 0;
+
+ /******************************
+ * Create source-VDS mappings *
+ ******************************/
+ for(i = 0; i < UC_1_N_SOURCES; i++) {
+
+ if((src_sid = H5Screate_simple(RANK, UC_1_DIMS[i],
+ UC_1_MAX_DIMS[i])) < 0)
+ UC_ERROR
+
+ /* set up hyperslabs for source and destination datasets */
+ if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL,
+ UC_1_MAX_DIMS[i], NULL) < 0)
+ UC_ERROR
+ if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, position,
+ NULL, UC_1_MAX_DIMS[i], NULL) < 0)
+ UC_ERROR
+ position[1] += UC_1_DIMS[i][1] + UC_31_GAP;
+
+ /* Add VDS mapping */
+ if(H5Pset_virtual(vds_dcplid, vds_sid, UC_1_FILE_NAMES[i],
+ UC_1_SOURCE_DSET_PATH, src_sid) < 0)
+ UC_ERROR
+ if(H5Sclose(src_sid) < 0)
+ UC_ERROR
+
+ } /* end for */
+
+ /*******************************
+ * Create VDS file and dataset *
+ *******************************/
+
+ /* file */
+ if((fid = H5Fcreate(UC_31_VDS_FILE_NAME, H5F_ACC_TRUNC,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* dataset */
+ if((did = H5Dcreate2(fid, UC_3_VDS_DSET_NAME, UC_31_VDS_DATATYPE, vds_sid,
+ H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* close */
+ if(H5Pclose(vds_dcplid) < 0)
+ UC_ERROR
+ if(H5Sclose(vds_sid) < 0)
+ UC_ERROR
+ if(H5Dclose(did) < 0)
+ UC_ERROR
+ if(H5Fclose(fid) < 0)
+ UC_ERROR
+
+ return 0;
+
+error:
+
+ H5E_BEGIN_TRY {
+ if(vds_sid >= 0)
+ (void)H5Sclose(vds_sid);
+ if(vds_dcplid >= 0)
+ (void)H5Pclose(vds_dcplid);
+ if(fid >= 0)
+ (void)H5Fclose(fid);
+ if(did >= 0)
+ (void)H5Dclose(did);
+ } H5E_END_TRY
+
+ return -1;
+
+} /* end create_3_1_vds() */
+
+/* Create the VDS that uses use case 2 files */
+herr_t
+create_3_2_vds(void)
+{
+ hid_t src_sid = -1; /* source dataset's dataspace ID */
+ hid_t vds_sid = -1; /* VDS dataspace ID */
+ hid_t vds_dcplid = -1; /* VDS dataset property list ID */
+
+ hid_t fid = -1; /* HDF5 file ID */
+ hid_t did = -1; /* dataset ID */
+
+ hsize_t start[RANK]; /* source starting point for hyperslab */
+
+ int i; /* iterator */
+
+ /* Create VDS dcpl */
+ if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ UC_ERROR
+ if(H5Pset_fill_value(vds_dcplid, UC_32_VDS_DATATYPE,
+ &UC_3_VDS_FILL_VALUE) < 0)
+ UC_ERROR
+
+ /* Create VDS dataspace */
+ if((vds_sid = H5Screate_simple(RANK, UC_32_VDS_DIMS,
+ UC_32_VDS_MAX_DIMS)) < 0)
+ UC_ERROR
+
+ /* Set starting positions */
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+
+ /******************************
+ * Create source-VDS mappings *
+ ******************************/
+ for(i = 0; i < UC_2_N_SOURCES; i++) {
+
+ if((src_sid = H5Screate_simple(RANK, UC_2_DIMS[i],
+ UC_2_MAX_DIMS[i])) < 0)
+ UC_ERROR
+
+ /* set up hyperslabs for source and destination datasets */
+ if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL,
+ UC_2_MAX_DIMS[i], NULL) < 0)
+ UC_ERROR
+ if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, UC_32_POSITIONS[i],
+ NULL, UC_2_MAX_DIMS[i], NULL) < 0)
+ UC_ERROR
+
+ /* Add VDS mapping */
+ if(H5Pset_virtual(vds_dcplid, vds_sid, UC_2_FILE_NAMES[i],
+ UC_2_SOURCE_DSET_PATH, src_sid) < 0)
+ UC_ERROR
+ if(H5Sclose(src_sid) < 0)
+ UC_ERROR
+
+ } /* end for */
+
+ /*******************************
+ * Create VDS file and dataset *
+ *******************************/
+
+ /* file */
+ if((fid = H5Fcreate(UC_32_VDS_FILE_NAME, H5F_ACC_TRUNC,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* dataset */
+ if((did = H5Dcreate2(fid, UC_3_VDS_DSET_NAME, UC_32_VDS_DATATYPE, vds_sid,
+ H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* close */
+ if(H5Pclose(vds_dcplid) < 0)
+ UC_ERROR
+ if(H5Sclose(vds_sid) < 0)
+ UC_ERROR
+ if(H5Dclose(did) < 0)
+ UC_ERROR
+ if(H5Fclose(fid) < 0)
+ UC_ERROR
+
+ return 0;
+
+error:
+
+ H5E_BEGIN_TRY {
+ if(vds_sid >= 0)
+ (void)H5Sclose(vds_sid);
+ if(vds_dcplid >= 0)
+ (void)H5Pclose(vds_dcplid);
+ if(fid >= 0)
+ (void)H5Fclose(fid);
+ if(did >= 0)
+ (void)H5Dclose(did);
+ } H5E_END_TRY
+
+ return -1;
+
+} /* end create_3_2_vds() */
+
+int
+main(int argc, char *argv[])
+{
+
+ if(create_3_1_vds() < 0)
+ UC_ERROR
+
+ if(create_3_2_vds() < 0)
+ UC_ERROR
+
+ return EXIT_SUCCESS;
+
+error:
+
+ return EXIT_FAILURE;
+
+} /* end main() */
+
diff --git a/tools/misc/vds/UC_4.h b/tools/misc/vds/UC_4.h
new file mode 100644
index 0000000..ce74e63
--- /dev/null
+++ b/tools/misc/vds/UC_4.h
@@ -0,0 +1,86 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * 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 *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef UC_4_H
+#define UC_4_H
+
+#include "hdf5.h"
+
+#include "UC_common.h"
+
+/*
+ * Definitions for VDS use case 4
+ *
+ * Source datasets have three fixed dimensions. In this use case, the
+ * datasets are mapped consecutively in the VDS along a single dimension with
+ * no gaps between them. Datasets are automatically loaded using a
+ * printf-like format string for the file name.
+ */
+
+/* virtual dataset <---> source dataset mapping and sizes */
+
+#define UC_4_N_SOURCES 3
+
+/* Dataset dimensions */
+#define UC_4_SRC_PLANES 3
+#define UC_4_HEIGHT 4
+#define UC_4_WIDTH 4
+
+/* max number of planes for VDS (sources are finite) */
+#define UC_4_VDS_MAX_PLANES H5S_UNLIMITED
+#define UC_4_N_TEST_PLANES 9 /* number of planes in the VDS */
+
+/* Dataset datatypes */
+#define UC_4_SOURCE_DATATYPE H5T_STD_I32LE
+#define UC_4_VDS_DATATYPE H5T_STD_I32LE
+
+/* Starting size of datasets, both source and VDS */
+static hsize_t UC_4_SOURCE_DIMS[RANK] = {0, UC_4_HEIGHT, UC_4_WIDTH};
+static hsize_t UC_4_VDS_DIMS[RANK] = {0, UC_4_HEIGHT, UC_4_WIDTH};
+
+/* Max size of datasets, both source and VDS */
+static hsize_t UC_4_SOURCE_MAX_DIMS[RANK] = {UC_4_SRC_PLANES, UC_4_HEIGHT, UC_4_WIDTH};
+static hsize_t UC_4_VDS_MAX_DIMS[RANK] = {UC_4_VDS_MAX_PLANES, UC_4_HEIGHT, UC_4_WIDTH};
+
+/* Planes (both source and VDS) */
+static hsize_t UC_4_PLANE[RANK] = {1, UC_4_HEIGHT, UC_4_WIDTH};
+
+/* File names for source datasets */
+static char UC_4_FILE_NAMES[UC_4_N_SOURCES][NAME_LEN] = {
+ {"4_0.h5"},
+ {"4_1.h5"},
+ {"4_2.h5"}
+};
+static char UC_4_MAPPING_FILE_NAME[NAME_LEN] = "4_%b.h5";
+
+/* VDS file name */
+static char UC_4_VDS_FILE_NAME[NAME_LEN] = "4_vds.h5";
+
+/* Dataset names */
+static char UC_4_SOURCE_DSET_NAME[NAME_LEN] = "source_dset";
+static char UC_4_SOURCE_DSET_PATH[NAME_LEN] = "/source_dset";
+static char UC_4_VDS_DSET_NAME[NAME_LEN] = "vds_dset";
+
+/* Fill values */
+static hsize_t UC_4_FILL_VALUES[UC_4_N_SOURCES] = {
+ -1,
+ -2,
+ -3
+};
+static int UC_4_VDS_FILL_VALUE = -9;
+
+#endif /* UC_4_H */
+
+
diff --git a/tools/misc/vds/UC_4_printf_gen.c b/tools/misc/vds/UC_4_printf_gen.c
new file mode 100644
index 0000000..c8e111a
--- /dev/null
+++ b/tools/misc/vds/UC_4_printf_gen.c
@@ -0,0 +1,219 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * 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 *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * File/dataset generator for VDS use case 4
+ *
+ * See the header file for a description.
+ */
+
+#include <stdlib.h>
+
+#include <hdf5.h>
+
+#include "UC_common.h"
+#include "UC_4.h"
+
+int
+main(int argc, char *argv[])
+{
+ hid_t src_sid = -1; /* source dataset's dataspace ID */
+ hid_t src_dcplid = -1; /* source dataset property list ID */
+
+ hid_t vds_sid = -1; /* VDS dataspace ID */
+ hid_t vds_dcplid = -1; /* VDS dataset property list ID */
+
+ hid_t fid = -1; /* HDF5 file ID */
+ hid_t did = -1; /* dataset ID */
+ hid_t msid = -1; /* memory dataspace ID */
+ hid_t fsid = -1; /* file dataspace ID */
+
+ /* Hyperslab arrays */
+ hsize_t start[RANK] = {0, 0, 0};
+ hsize_t count[RANK] = {H5S_UNLIMITED, 1, 1};
+
+ int *buffer = NULL; /* data buffer */
+ int value = -1; /* value written to datasets */
+
+ hsize_t n = 0; /* number of elements in a plane */
+
+ int i; /* iterator */
+ int j; /* iterator */
+ int k; /* iterator */
+
+ /************************************
+ * Create source files and datasets *
+ ************************************/
+
+ /* Create source dataspace ID */
+ if((src_sid = H5Screate_simple(RANK, UC_4_SOURCE_DIMS,
+ UC_4_SOURCE_MAX_DIMS)) < 0)
+ UC_ERROR
+ if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL,
+ UC_4_SOURCE_MAX_DIMS, NULL) < 0)
+ UC_ERROR
+
+ /* Create source files and datasets */
+ for(i = 0; i < UC_4_N_SOURCES; i++) {
+
+ /* source dataset dcpl */
+ if((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ UC_ERROR
+ if(H5Pset_chunk(src_dcplid, RANK, UC_4_PLANE) < 0)
+ UC_ERROR
+ if(H5Pset_fill_value(src_dcplid, UC_4_SOURCE_DATATYPE,
+ &UC_4_FILL_VALUES[i]) < 0)
+ UC_ERROR
+ if(H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0)
+ UC_ERROR
+
+ /* Create source file and dataset */
+ if((fid = H5Fcreate(UC_4_FILE_NAMES[i], H5F_ACC_TRUNC,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ UC_ERROR
+ if((did = H5Dcreate2(fid, UC_4_SOURCE_DSET_NAME,
+ UC_4_SOURCE_DATATYPE, src_sid,
+ H5P_DEFAULT, src_dcplid, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* Set the dataset's extent */
+ if(H5Dset_extent(did, UC_4_SOURCE_MAX_DIMS) < 0)
+ UC_ERROR
+
+ /* Create a data buffer that represents a plane */
+ n = UC_4_PLANE[1] * UC_4_PLANE[2];
+ if(NULL == (buffer = (int *)malloc(n * sizeof(int))))
+ UC_ERROR
+
+ /* Create the memory dataspace */
+ if((msid = H5Screate_simple(RANK, UC_4_PLANE, NULL)) < 0)
+ UC_ERROR
+
+ /* Get the file dataspace */
+ if((fsid = H5Dget_space(did)) < 0)
+ UC_ERROR
+
+ /* Write planes to the dataset */
+ for(j = 0; j < UC_4_SRC_PLANES; j++) {
+
+ value = ((i + 1) * 10) + j;
+ for(k = 0; k < n; k++)
+ buffer[k] = value;
+
+ start[0] = j;
+ start[1] = 0;
+ start[2] = 0;
+ if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_4_PLANE, NULL) < 0)
+ UC_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0)
+ UC_ERROR
+
+ } /* end for */
+
+ /* close */
+ if(H5Sclose(msid) < 0)
+ UC_ERROR
+ if(H5Sclose(fsid) < 0)
+ UC_ERROR
+ if(H5Pclose(src_dcplid) < 0)
+ UC_ERROR
+ if(H5Dclose(did) < 0)
+ UC_ERROR
+ if(H5Fclose(fid) < 0)
+ UC_ERROR
+ free(buffer);
+
+ } /* end for */
+
+ /*******************
+ * Create VDS file *
+ *******************/
+
+ /* Create file */
+ if((fid = H5Fcreate(UC_4_VDS_FILE_NAME, H5F_ACC_TRUNC,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* Create VDS dcpl */
+ if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ UC_ERROR
+ if(H5Pset_fill_value(vds_dcplid, UC_4_VDS_DATATYPE,
+ &UC_4_VDS_FILL_VALUE) < 0)
+ UC_ERROR
+
+ /* Create VDS dataspace */
+ if((vds_sid = H5Screate_simple(RANK, UC_4_VDS_DIMS,
+ UC_4_VDS_MAX_DIMS)) < 0)
+ UC_ERROR
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, start,
+ UC_4_SOURCE_MAX_DIMS, count, UC_4_SOURCE_MAX_DIMS) < 0)
+ UC_ERROR
+
+ /* Add VDS mapping - The mapped file name uses a printf-like
+ * naming scheme that automatically maps new files.
+ */
+ if(H5Pset_virtual(vds_dcplid, vds_sid, UC_4_MAPPING_FILE_NAME,
+ UC_4_SOURCE_DSET_PATH, src_sid) < 0)
+ UC_ERROR
+
+ /* Create dataset */
+ if((did = H5Dcreate2(fid, UC_4_VDS_DSET_NAME, UC_4_VDS_DATATYPE, vds_sid,
+ H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* close */
+ if(H5Sclose(src_sid) < 0)
+ UC_ERROR
+ if(H5Pclose(vds_dcplid) < 0)
+ UC_ERROR
+ if(H5Sclose(vds_sid) < 0)
+ UC_ERROR
+ if(H5Dclose(did) < 0)
+ UC_ERROR
+ if(H5Fclose(fid) < 0)
+ UC_ERROR
+
+ return EXIT_SUCCESS;
+
+error:
+
+ H5E_BEGIN_TRY {
+ if(src_sid >= 0)
+ (void)H5Sclose(src_sid);
+ if(src_dcplid >= 0)
+ (void)H5Pclose(src_dcplid);
+ if(vds_sid >= 0)
+ (void)H5Sclose(vds_sid);
+ if(vds_dcplid >= 0)
+ (void)H5Pclose(vds_dcplid);
+ if(fid >= 0)
+ (void)H5Fclose(fid);
+ if(did >= 0)
+ (void)H5Dclose(did);
+ if(msid >= 0)
+ (void)H5Sclose(msid);
+ if(fsid >= 0)
+ (void)H5Sclose(fsid);
+ if(buffer != NULL)
+ free(buffer);
+ } H5E_END_TRY
+
+ return EXIT_FAILURE;
+
+} /* end main() */
+
diff --git a/tools/misc/vds/UC_5.h b/tools/misc/vds/UC_5.h
new file mode 100644
index 0000000..b22b177
--- /dev/null
+++ b/tools/misc/vds/UC_5.h
@@ -0,0 +1,83 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * 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 *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef UC_5_H
+#define UC_5_H
+
+#include <hdf5.h>
+
+#include "UC_common.h"
+
+/*
+ * Definitions for VDS use case 5
+ *
+ * Source datasets have one unlimited dimension and two fixed dimensions. In
+ * this use case, the datasets are mapped in the VDS so that alternating
+ * planes in the source are interleaved in the VDS.
+ */
+
+/* virtual dataset <---> source dataset mapping and sizes */
+
+#define UC_5_N_SOURCES 3
+
+/* Dataset dimensions */
+#define UC_5_SRC_PLANES 3
+#define UC_5_HEIGHT 4
+#define UC_5_WIDTH 4
+
+/* max number of planes for datasets */
+#define UC_5_MAX_PLANES H5S_UNLIMITED
+#define UC_5_N_TEST_PLANES 9 /* number of planes in VDS */
+
+/* Dataset datatypes */
+#define UC_5_SOURCE_DATATYPE H5T_STD_I32LE
+#define UC_5_VDS_DATATYPE H5T_STD_I32LE
+
+/* Starting size of datasets, both source and VDS */
+static hsize_t UC_5_SOURCE_DIMS[RANK] = {0, UC_5_HEIGHT, UC_5_WIDTH};
+static hsize_t UC_5_VDS_DIMS[RANK] = {0, UC_5_HEIGHT, UC_5_WIDTH};
+
+/* Max size of datasets, both source and VDS */
+static hsize_t UC_5_SOURCE_MAX_DIMS[RANK] = {UC_5_MAX_PLANES, UC_5_HEIGHT, UC_5_WIDTH};
+static hsize_t UC_5_VDS_MAX_DIMS[RANK] = {UC_5_MAX_PLANES, UC_5_HEIGHT, UC_5_WIDTH};
+
+/* Planes (both source and VDS) */
+static hsize_t UC_5_PLANE[RANK] = {1, UC_5_HEIGHT, UC_5_WIDTH};
+
+/* File names for source datasets */
+static char UC_5_FILE_NAMES[UC_5_N_SOURCES][NAME_LEN] = {
+ {"5_a.h5"},
+ {"5_b.h5"},
+ {"5_c.h5"}
+};
+
+/* VDS file name */
+static char UC_5_VDS_FILE_NAME[NAME_LEN] = "5_vds.h5";
+
+/* Dataset names */
+static char UC_5_SOURCE_DSET_NAME[NAME_LEN] = "source_dset";
+static char UC_5_SOURCE_DSET_PATH[NAME_LEN] = "/source_dset";
+static char UC_5_VDS_DSET_NAME[NAME_LEN] = "vds_dset";
+
+/* Fill values */
+static hsize_t UC_5_FILL_VALUES[UC_5_N_SOURCES] = {
+ -1,
+ -2,
+ -3
+};
+static int UC_5_VDS_FILL_VALUE = -9;
+
+#endif /* UC_5_H */
+
diff --git a/tools/misc/vds/UC_5_stride_gen.c b/tools/misc/vds/UC_5_stride_gen.c
new file mode 100644
index 0000000..984aadc
--- /dev/null
+++ b/tools/misc/vds/UC_5_stride_gen.c
@@ -0,0 +1,243 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * 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 *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * File/dataset generator for VDS use case 5
+ *
+ * See the header file for a description.
+ */
+
+#include <stdlib.h>
+
+#include <hdf5.h>
+
+#include "UC_common.h"
+#include "UC_5.h"
+
+int
+main(int argc, char *argv[])
+{
+ hid_t src_sid = -1; /* source dataset's dataspace ID */
+ hid_t src_dcplid = -1; /* source dataset property list ID */
+
+ hid_t vds_sid = -1; /* VDS dataspace ID */
+ hid_t vds_dcplid = -1; /* VDS dataset property list ID */
+
+ hid_t fid = -1; /* HDF5 file ID */
+ hid_t did = -1; /* dataset ID */
+ hid_t msid = -1; /* memory dataspace ID */
+ hid_t fsid = -1; /* file dataspace ID */
+
+ hsize_t extent[RANK]; /* source dataset extents */
+ hsize_t start[RANK]; /* starting point for hyperslab */
+ hsize_t stride[RANK]; /* hypserslab stride */
+ hsize_t count[RANK]; /* hypserslab count */
+ int map_start = -1; /* starting point in the VDS map */
+
+ int *buffer = NULL; /* data buffer */
+ int value = -1; /* value written to datasets */
+
+ hsize_t n = 0; /* number of elements in a plane */
+
+ int i; /* iterator */
+ int j; /* iterator */
+ int k; /* iterator */
+
+ /* Start by creating the virtual dataset (VDS) dataspace and creation
+ * property list. The individual source datasets are then created
+ * and the VDS map (stored in the VDS property list) is updated.
+ */
+
+ /* Create VDS dcpl */
+ if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ UC_ERROR
+ if(H5Pset_fill_value(vds_dcplid, UC_5_VDS_DATATYPE,
+ &UC_5_VDS_FILL_VALUE) < 0)
+ UC_ERROR
+
+ /* Create VDS dataspace */
+ if((vds_sid = H5Screate_simple(RANK, UC_5_VDS_DIMS,
+ UC_5_VDS_MAX_DIMS)) < 0)
+ UC_ERROR
+
+ /*********************************
+ * Map source files and datasets *
+ *********************************/
+
+ /* Hyperslab array setup */
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ map_start = 0;
+
+ stride[0] = UC_5_N_SOURCES;
+ stride[1] = 1;
+ stride[2] = 1;
+
+ count[0] = H5S_UNLIMITED;
+ count[1] = 1;
+ count[2] = 1;
+
+ extent[0] = UC_5_SRC_PLANES;
+ extent[1] = UC_5_HEIGHT;
+ extent[2] = UC_5_WIDTH;
+
+ for(i = 0; i < UC_5_N_SOURCES; i++) {
+
+ /* source dataset dcpl */
+ if((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ UC_ERROR
+ if(H5Pset_chunk(src_dcplid, RANK, UC_5_PLANE) < 0)
+ UC_ERROR
+ if(H5Pset_fill_value(src_dcplid, UC_5_SOURCE_DATATYPE,
+ &UC_5_FILL_VALUES[i]) < 0)
+ UC_ERROR
+ if(H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0)
+ UC_ERROR
+
+ /* Create source file, dataspace, and dataset */
+ if((fid = H5Fcreate(UC_5_FILE_NAMES[i], H5F_ACC_TRUNC,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ UC_ERROR
+ if((src_sid = H5Screate_simple(RANK, UC_5_SOURCE_DIMS,
+ UC_5_SOURCE_MAX_DIMS)) < 0)
+ UC_ERROR
+ if((did = H5Dcreate2(fid, UC_5_SOURCE_DSET_NAME,
+ UC_5_SOURCE_DATATYPE, src_sid,
+ H5P_DEFAULT, src_dcplid, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* Set the dataset's extent */
+ if(H5Dset_extent(did, extent) < 0)
+ UC_ERROR
+
+ /* Create a data buffer that represents a plane */
+ n = UC_5_PLANE[1] * UC_5_PLANE[2];
+ if(NULL == (buffer = (int *)malloc(n * sizeof(int))))
+ UC_ERROR
+
+ /* Create the memory dataspace */
+ if((msid = H5Screate_simple(RANK, UC_5_PLANE, NULL)) < 0)
+ UC_ERROR
+
+ /* Get the file dataspace */
+ if((fsid = H5Dget_space(did)) < 0)
+ UC_ERROR
+
+ /* Write planes to the dataset */
+ for(j = 0; j < UC_5_SRC_PLANES; j++) {
+
+ value = ((i + 1) * 10) + j;
+ for(k = 0; k < n; k++)
+ buffer[k] = value;
+
+ start[0] = j;
+ start[1] = 0;
+ start[2] = 0;
+ if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_5_PLANE, NULL) < 0)
+ UC_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0)
+ UC_ERROR
+
+ } /* end for */
+
+ /* set up hyperslabs for source and destination datasets */
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL,
+ UC_5_SOURCE_MAX_DIMS, NULL) < 0)
+ UC_ERROR
+ start[0] = map_start;
+ if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, start, stride,
+ count, UC_5_PLANE) < 0)
+ UC_ERROR
+ map_start += 1;
+
+ /* Add VDS mapping */
+ if(H5Pset_virtual(vds_dcplid, vds_sid, UC_5_FILE_NAMES[i],
+ UC_5_SOURCE_DSET_PATH, src_sid) < 0)
+ UC_ERROR
+
+ /* close */
+ if(H5Sclose(msid) < 0)
+ UC_ERROR
+ if(H5Sclose(fsid) < 0)
+ UC_ERROR
+ if(H5Sclose(src_sid) < 0)
+ UC_ERROR
+ if(H5Pclose(src_dcplid) < 0)
+ UC_ERROR
+ if(H5Dclose(did) < 0)
+ UC_ERROR
+ if(H5Fclose(fid) < 0)
+ UC_ERROR
+ free(buffer);
+
+ } /* end for */
+
+ /*******************
+ * Create VDS file *
+ *******************/
+
+ /* file */
+ if((fid = H5Fcreate(UC_5_VDS_FILE_NAME, H5F_ACC_TRUNC,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* dataset */
+ if((did = H5Dcreate2(fid, UC_5_VDS_DSET_NAME, UC_5_VDS_DATATYPE, vds_sid,
+ H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* close */
+ if(H5Pclose(vds_dcplid) < 0)
+ UC_ERROR
+ if(H5Sclose(vds_sid) < 0)
+ UC_ERROR
+ if(H5Dclose(did) < 0)
+ UC_ERROR
+ if(H5Fclose(fid) < 0)
+ UC_ERROR
+
+ return EXIT_SUCCESS;
+
+error:
+
+ H5E_BEGIN_TRY {
+ if(src_sid >= 0)
+ (void)H5Sclose(src_sid);
+ if(src_dcplid >= 0)
+ (void)H5Pclose(src_dcplid);
+ if(vds_sid >= 0)
+ (void)H5Sclose(vds_sid);
+ if(vds_dcplid >= 0)
+ (void)H5Pclose(vds_dcplid);
+ if(fid >= 0)
+ (void)H5Fclose(fid);
+ if(did >= 0)
+ (void)H5Dclose(did);
+ if(msid >= 0)
+ (void)H5Sclose(msid);
+ if(fsid >= 0)
+ (void)H5Sclose(fsid);
+ if(buffer != NULL)
+ free(buffer);
+ } H5E_END_TRY
+
+ return EXIT_FAILURE;
+
+} /* end main() */
+
diff --git a/tools/misc/vds/UC_common.h b/tools/misc/vds/UC_common.h
new file mode 100644
index 0000000..0e61016
--- /dev/null
+++ b/tools/misc/vds/UC_common.h
@@ -0,0 +1,41 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * 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 *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef USE_CASE_COMMON_H
+#define USE_CASE_COMMON_H
+
+/******************************************
+ * Symbols used across multiple use cases *
+ ******************************************/
+
+/* All datasets are 3D */
+#define RANK 3
+
+/* Lengths of string identifiers (file, dataset names, etc.) */
+#define NAME_LEN 32
+
+/* Compression level */
+#define COMPRESSION_LEVEL 7
+
+/* Booleans */
+#define TRUE 1
+#define FALSE 0
+
+/* Testing macros */
+#define AT() printf (" at %s:%d in %s()...\n", __FILE__, __LINE__, __func__);
+#define UC_ERROR {puts("*ERROR*"); fflush(stdout); AT(); goto error;}
+
+#endif /* USE_CASE_COMMON_H */
+