本文整理汇总了C++中H5File::openDataSet方法的典型用法代码示例。如果您正苦于以下问题:C++ H5File::openDataSet方法的具体用法?C++ H5File::openDataSet怎么用?C++ H5File::openDataSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类H5File
的用法示例。
在下文中一共展示了H5File::openDataSet方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestCompress
int TestCompress()
{
unsigned int flags = 0;
unsigned int config = 0;
size_t cd_nelemts = 0;
TESTING("compression")
#ifdef H5_HAVE_FILTER_DEFLATE
try {
/* Create packet table with compression. */
FL_PacketTable wrapper(fileID, "/compressTest", H5T_NATIVE_CHAR, 100, 8);
/* Create an HDF5 C++ file object */
H5File file;
file.setId(fileID);
/* Make sure that the deflate filter is set by opening the packet table
* as a dataset and getting its creation property list */
DataSet dsetID = file.openDataSet("/compressTest");
DSetCreatPropList dcplID = dsetID.getCreatePlist();
dcplID.getFilterById(H5Z_FILTER_DEFLATE, flags, cd_nelemts, NULL, 0, NULL, config);
} catch (Exception e) {
H5_FAILED();
return 1;
}
PASSED();
#else
SKIPPED();
puts(" deflate filter not enabled");
#endif /* H5_HAVE_FILTER_DEFLATE */
return 0;
}
示例2: h5DummyRead
//'@title Function for dummy read
//'
//'@param chunkName the name of the chunk to be read back
//'@param filePath the path to the h5 file
//'@return int 0
// [[Rcpp::export]]
int h5DummyRead(std::string chunkName, std::string filePath)
{
// Open the file in Read/Write Mode, H5F_ACC_RDONLY
H5File *file = new H5File(filePath, H5F_ACC_RDONLY);
// Opening the data set
DataSet dataset = file->openDataSet((H5std_string)chunkName);
// Opening the data space
DataSpace dataspace = dataset.getSpace();
// Get the number of dimensions
int ndim = dataspace.getSimpleExtentNdims();
// Create a dimension object to be filled with the dimensions of the data set
hsize_t dims[ndim];
// Fill the dimension of the dataset
dataspace.getSimpleExtentDims(dims, NULL);
// Create the return data
SEXP data;
// Allocating a matrix of the right size and dimension
data = PROTECT(Rf_allocMatrix(REALSXP, dims[0], dims[1]));
// Filling the matrix with data form the dataspace
dataset.read(REAL(data), PredType::NATIVE_DOUBLE, dataspace);
UNPROTECT(1);
dataset.close();
file->close();
return 0;
}
示例3: ch5ChunkSel
// Function to return a selected part of a data frame as a list
List ch5ChunkSel(string chunkName, CharacterVector selCols, string filePath)
{
// Open the file in Read/Write Mode, H5F_ACC_RDONLY
H5File *file = new H5File(filePath, H5F_ACC_RDONLY);
// Opening the data set
DataSet dataset = file->openDataSet((H5std_string)chunkName);
// Opening the data space
DataSpace dataspace = dataset.getSpace();
// Get the number of dimensions
int ndim = dataspace.getSimpleExtentNdims();
// Create a dimension object to be filled with the dimensions of the data set
hsize_t dims[ndim];
// Fill the dimension of the dataset
dataspace.getSimpleExtentDims(dims, NULL);
// Create the return data
// Filling the matrix with data form the dataspace
SEXP data;
// Allocating a matrix of the right size and dimension
data = PROTECT(Rf_allocMatrix(REALSXP, dims[0], dims[1]));
// Filling the matrix with data form the dataspace
dataset.read(REAL(data), PredType::NATIVE_DOUBLE, dataspace);
UNPROTECT(1);
// converting the R object to a numeric matrix
NumericMatrix M = as<NumericMatrix>(data);
CharacterVector colNames = ch5ReadCharVector("ColumnNames", filePath);
CharacterVector colClasses = ch5ReadCharVector("ColumnClasses", filePath);
// Create the output
List DF;
string colName;
string colClass;
NumericVector vec;
CharacterVector levels;
int n = selCols.size();
IntegerVector sel(n);
int selN;
// First we need to find which of the columns has been selected
sel = match(selCols, colNames);
for(int i = 0; i < n; i++)
{
colName = selCols[i];
selN = sel[i] - 1;
colClass = colClasses[selN];
if(colClass != "factor")
{
DF[colName] = M(_, selN);
}else{
vec = M(_, selN);
levels = (CharacterVector)ch5ReadFactor(colName, filePath);
DF[colName] = cCreateFactor(vec, levels);
}
}
dataset.close();
file->close();
return DF;
}
示例4: h5ReadDoubleMat3
//'@title Legacy function to return a data frame chunk as a list
//'
//'@description Experimental function not intended for use at all
//'
//'@param chunkName the name of the chunk to be read
//'@param filePath the path to the h5 file
//'@return List of the data frame chunk
// [[Rcpp::export]]
SEXP h5ReadDoubleMat3(std::string chunkName, std::string filePath)
{
// Open the file in Read/Write Mode, H5F_ACC_RDONLY
H5File *file = new H5File(filePath, H5F_ACC_RDONLY);
// Opening the data set
DataSet dataset = file->openDataSet((H5std_string)chunkName);
// Opening the data space
DataSpace dataspace = dataset.getSpace();
// Get the number of dimensions
int ndim = dataspace.getSimpleExtentNdims();
// Create a dimension object to be filled with the dimensions of the data set
hsize_t dims[ndim];
// Fill the dimension of the dataset
dataspace.getSimpleExtentDims(dims, NULL);
// Create the return data
// Filling the matrix with data form the dataspace
//double (*buf)[dims[1]]*[dims[0]] = malloc(dims[1]]*[dims[0] * sizeof *buf);
//buf[dims[1]][dims[0]] = 0.0;
double **buf = (double**) calloc (dims[1]*dims[0], sizeof(double));
buf[dims[1]][dims[0]] = 0.0;
//double buf[dims[1]][dims[0]];
dataset.read(buf, PredType::NATIVE_DOUBLE, dataspace);
// Attempt tp append the contents to a list
List out;
NumericVector vec(dims[0]);
NumericMatrix M(dims[0], dims[1]);
CharacterVector colNames = ch5ReadCharVector("ColumnNames", filePath);
CharacterVector colClasses = ch5ReadCharVector("ColumnClasses", filePath);
string colName;
for(int i = 0; i < dims[1]; i++)
{
NumericVector vec(dims[0]);
for(int j = 0; j < dims[0]; j++)
{
M(j,i) = buf[i][j];
vec(j) = buf[i][j];
}
colName = colNames[i];
if(colClasses[i] == "factor")
{
CharacterVector levels;
levels = h5ReadFactor(colName, filePath);
IntegerVector fact(vec.size());
fact = cCreateFactor(vec, levels);
out[colName] = fact;
}else{
out[colName] = vec;
}
}
free(buf);
dataset.close(); //nn
file->close();
return wrap(out);
}
示例5: read_feature_size
void read_feature_size(H5File h5f, Size &size_out, const char *name)
{
DataSet dataset = h5f.openDataSet(name);
DataSpace dspace = dataset.getSpace();
assert (dspace.getSimpleExtentNdims() == 2);
hsize_t dims[2];
dspace.getSimpleExtentDims(dims);
size_out.height = dims[0];
size_out.width = dims[1];
}
示例6: h5ReadDoubleMat2
//'@title Legacy function to return a data frame chunk as a list
//'
//'@description Experimental function not intended for use at all
//'
//'@param chunkName the name of the chunk to be read
//'@param filePath the path to the h5 file
//'@return List of the data frame chunk
// [[Rcpp::export]]
SEXP h5ReadDoubleMat2(std::string chunkName, std::string filePath)
{
// Open the file in Read/Write Mode, H5F_ACC_RDONLY
H5File *file = new H5File(filePath, H5F_ACC_RDONLY);
// Opening the data set
DataSet dataset = file->openDataSet((H5std_string)chunkName);
// Opening the data space
DataSpace dataspace = dataset.getSpace();
// Get the number of dimensions
int ndim = dataspace.getSimpleExtentNdims();
// Create a dimension object to be filled with the dimensions of the data set
hsize_t dims[ndim];
// Fill the dimension of the dataset
dataspace.getSimpleExtentDims(dims, NULL);
// Create the return data
// Filling the matrix with data form the dataspace
SEXP data;
// Allocating a matrix of the right size and dimension
data = PROTECT(Rf_allocMatrix(REALSXP, dims[0], dims[1]));
// Filling the matrix with data form the dataspace
dataset.read(REAL(data), PredType::NATIVE_DOUBLE, dataspace);
UNPROTECT(1);
// converting the R object to a numeric matrix
NumericMatrix M = as<NumericMatrix>(data);
List out;
NumericVector vec(dims[0]);
CharacterVector colNames = ch5ReadCharVector("ColumnNames", filePath);
CharacterVector colClasses = ch5ReadCharVector("ColumnClasses", filePath);
string colName;
for(int i = 0; i < dims[1]; i++)
{
NumericVector vec(dims[0]);
for(int j = 0; j < dims[0]; j++)
{
vec(j) = M(j,i);
}
colName = colNames[i];
if(colClasses[i] == "factor")
{
CharacterVector levels;
levels = ch5ReadFactor(colName, filePath);
IntegerVector fact(vec.size());
fact = cCreateFactor(vec, levels);
out[colName] = fact;
}else{
out[colName] = vec;
}
}
dataset.close(); //nn
file->close();
// Returning the data
return wrap(out);
}
示例7: readScalar
Scalar readScalar(H5File &file, string DSitem){
DataSet item = file.openDataSet(DSitem);
DataSpace dsp = item.getSpace();
// assert(dsp.getSimpleExtentNdims() == 0);
// hsize_t dims[1];
// int ndims = dsp.getSimpleExtentDims(dims, NULL);
Scalar value(0);
PredType type = getPredType<Scalar>();
item.read(&value, type);
return value;
}
示例8: read_hdf5_image
void read_hdf5_image(H5File h5f, Mat &image_out, const char *name, const Rect &roi=Rect(0,0,0,0))
{
DataSet dataset = h5f.openDataSet(name);
DataSpace dspace = dataset.getSpace();
assert (dspace.getSimpleExtentNdims() == 2);
hsize_t dims[2];
dspace.getSimpleExtentDims(dims);
if ((roi.width == 0) && (roi.height == 0)) {
image_out.create(dims[0], dims[1], CV_32F);
dspace.selectAll();
} else {
image_out.create(roi.height, roi.width, CV_32F);
hsize_t _offset[2], _size[2];
_offset[0] = roi.y; _offset[1] = roi.x;
_size[0] = roi.height; _size[1] = roi.width;
dspace.selectHyperslab(H5S_SELECT_SET, _size, _offset);
}
DataSpace imspace;
float *imdata;
if (image_out.isContinuous()) {
dims[0] = image_out.size().height; dims[1] = image_out.size().width;
imspace = DataSpace(2, dims);
imspace.selectAll();
imdata = image_out.ptr<float>();
} else {
// we are working with an ROI
assert (image_out.isSubmatrix());
Size parent_size; Point parent_ofs;
image_out.locateROI(parent_size, parent_ofs);
hsize_t parent_count[2];
parent_count[0] = parent_size.height; parent_count[1] = parent_size.width;
imspace.setExtentSimple(2, parent_count);
hsize_t im_offset[2], im_size[2];
im_offset[0] = parent_ofs.y; im_offset[1] = parent_ofs.x;
im_size[0] = image_out.size().height; im_size[1] = image_out.size().width;
imspace.selectHyperslab(H5S_SELECT_SET, im_size, im_offset);
imdata = image_out.ptr<float>() - parent_ofs.x - parent_ofs.y * parent_size.width;
}
dataset.read(imdata, PredType::NATIVE_FLOAT, imspace, dspace);
}
示例9: read_scalar_dset
/* Helper routine for test_vl_rewrite() */
static void read_scalar_dset(H5File& file, DataType& type, DataSpace& space,
char *name, char *data)
{
char *data_read;
DataSet dset;
try {
dset = file.openDataSet(name);
dset.read(&data_read, type, space, space);
dset.close();
if(HDstrcmp(data, data_read))
TestErrPrintf("Expected %s for dataset %s but read %s\n", data, name, data_read);
HDfree(data_read);
} // end try
catch (FileIException ferr) {
throw;
}
catch (DataSetIException derr) {
throw;
}
}
示例10: main
int main(void)
{
/* First structure and dataset*/
typedef struct s1_t {
int a;
float b;
double c;
} s1_t;
/* Second structure (subset of s1_t) and dataset*/
typedef struct s2_t {
double c;
int a;
} s2_t;
// Try block to detect exceptions raised by any of the calls inside it
try
{
/*
* Initialize the data
*/
int i;
s1_t s1[LENGTH];
for (i = 0; i< LENGTH; i++)
{
s1[i].a = i;
s1[i].b = i*i;
s1[i].c = 1./(i+1);
}
/*
* Turn off the auto-printing when failure occurs so that we can
* handle the errors appropriately
*/
Exception::dontPrint();
/*
* Create the data space.
*/
hsize_t dim[] = {LENGTH}; /* Dataspace dimensions */
DataSpace space( RANK, dim );
/*
* Create the file.
*/
H5File* file = new H5File( FILE_NAME, H5F_ACC_TRUNC );
/*
* Create the memory datatype.
*/
CompType mtype1( sizeof(s1_t) );
mtype1.insertMember( MEMBER1, HOFFSET(s1_t, a), PredType::NATIVE_INT);
mtype1.insertMember( MEMBER3, HOFFSET(s1_t, c), PredType::NATIVE_DOUBLE);
mtype1.insertMember( MEMBER2, HOFFSET(s1_t, b), PredType::NATIVE_FLOAT);
/*
* Create the dataset.
*/
DataSet* dataset;
dataset = new DataSet(file->createDataSet(DATASET_NAME, mtype1, space));
/*
* Write data to the dataset;
*/
dataset->write( s1, mtype1 );
/*
* Release resources
*/
delete dataset;
delete file;
/*
* Open the file and the dataset.
*/
file = new H5File( FILE_NAME, H5F_ACC_RDONLY );
dataset = new DataSet (file->openDataSet( DATASET_NAME ));
/*
* Create a datatype for s2
*/
CompType mtype2( sizeof(s2_t) );
mtype2.insertMember( MEMBER3, HOFFSET(s2_t, c), PredType::NATIVE_DOUBLE);
mtype2.insertMember( MEMBER1, HOFFSET(s2_t, a), PredType::NATIVE_INT);
/*
* Read two fields c and a from s1 dataset. Fields in the file
* are found by their names "c_name" and "a_name".
*/
s2_t s2[LENGTH];
dataset->read( s2, mtype2 );
/*
* Display the fields
*/
cout << endl << "Field c : " << endl;
for( i = 0; i < LENGTH; i++)
cout << s2[i].c << " ";
cout << endl;
//.........这里部分代码省略.........
示例11: test_create
/*-------------------------------------------------------------------------
* Function: test_create
*
* Purpose: Attempts to create a dataset.
*
* Return: Success: 0
*
* Failure: -1
*
* Programmer: Binh-Minh Ribler (using C version)
* Friday, January 5, 2001
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static herr_t
test_create( H5File& file)
{
SUBTEST("create, open, close");
// Setting this to NULL for cleaning up in failure situations
DataSet *dataset = NULL;
try {
// Create a data space
hsize_t dims[2];
dims[0] = 256;
dims[1] = 512;
DataSpace space (2, dims, NULL);
// Create a dataset using the default dataset creation properties.
// We're not sure what they are, so we won't check.
dataset = new DataSet (file.createDataSet
(DSET_DEFAULT_NAME, PredType::NATIVE_DOUBLE, space));
// Add a comment to the dataset
file.setComment (DSET_DEFAULT_NAME, "This is a dataset");
// Close the dataset
delete dataset;
dataset = NULL;
// Try creating a dataset that already exists. This should fail since a
// dataset can only be created once. If an exception is not thrown for
// this action by createDataSet, then throw an invalid action exception.
try {
dataset = new DataSet (file.createDataSet
(DSET_DEFAULT_NAME, PredType::NATIVE_DOUBLE, space));
// continuation here, that means no exception has been thrown
throw InvalidActionException("H5File::createDataSet", "Library allowed overwrite of existing dataset");
}
catch (FileIException E) // catching invalid creating dataset
{} // do nothing, exception expected
// Open the dataset we created above and then close it. This is one
// way to open an existing dataset for accessing.
dataset = new DataSet (file.openDataSet (DSET_DEFAULT_NAME));
// Get and verify the name of this dataset, using
// H5std_string getObjName()
H5std_string ds_name = dataset->getObjName();
verify_val(ds_name, DSET_DEFAULT_NAME_PATH, "DataSet::getObjName", __LINE__, __FILE__);
// Get and verify the comment from this dataset, using
// H5std_string getComment(const H5std_string& name, <buf_size=0, by default>)
H5std_string comment = file.getComment(DSET_DEFAULT_NAME);
verify_val(comment, "This is a dataset", "DataSet::getComment", __LINE__, __FILE__);
// Close the dataset when accessing is completed
delete dataset;
// This is another way to open an existing dataset for accessing.
DataSet another_dataset(file.openDataSet (DSET_DEFAULT_NAME));
// Try opening a non-existent dataset. This should fail so if an
// exception is not thrown for this action by openDataSet, then
// display failure information and throw an exception.
try {
dataset = new DataSet (file.openDataSet( "does_not_exist" ));
// continuation here, that means no exception has been thrown
throw InvalidActionException("H5File::openDataSet", "Attempted to open a non-existent dataset");
}
catch (FileIException E ) // catching creating non-existent dataset
{} // do nothing, exception expected
// Create a new dataset that uses chunked storage instead of the default
// layout.
DSetCreatPropList create_parms;
hsize_t csize[2];
csize[0] = 5;
csize[1] = 100;
create_parms.setChunk( 2, csize );
dataset = new DataSet (file.createDataSet
(DSET_CHUNKED_NAME, PredType::NATIVE_DOUBLE, space, create_parms));
// Note: this one has no error message in C when failure occurs?
//.........这里部分代码省略.........
示例12: Exception
/*-------------------------------------------------------------------------
* Function: test_multiopen
*
* Purpose: Tests that a bug no longer exists. If a dataset is opened
* twice and one of the handles is used to extend the dataset,
* then the other handle should return the new size when
* queried.
*
* Return: Success: 0
*
* Failure: -1
*
* Programmer: Binh-Minh Ribler (using C version)
* Saturday, February 17, 2001
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static herr_t
test_multiopen (H5File& file)
{
SUBTEST("Multi-open with extending");
DataSpace* space = NULL;
try {
// Create a dataset creation property list
DSetCreatPropList dcpl;
// Set chunk size to given size
hsize_t cur_size[1] = {10};
dcpl.setChunk (1, cur_size);
// Create a simple data space with unlimited size
static hsize_t max_size[1] = {H5S_UNLIMITED};
space = new DataSpace (1, cur_size, max_size);
// Create first dataset
DataSet dset1 = file.createDataSet ("multiopen", PredType::NATIVE_INT, *space, dcpl);
// Open again the first dataset from the file to another DataSet object.
DataSet dset2 = file.openDataSet ("multiopen");
// Relieve the dataspace
delete space;
space = NULL;
// Extend the dimensionality of the first dataset
cur_size[0] = 20;
dset1.extend (cur_size);
// Get the size from the second handle
space = new DataSpace (dset2.getSpace());
hsize_t tmp_size[1];
space->getSimpleExtentDims (tmp_size);
if (cur_size[0]!=tmp_size[0])
{
cerr << " Got " << (int)tmp_size[0] << " instead of "
<< (int)cur_size[0] << "!" << endl;
throw Exception("test_multiopen", "Failed in multi-open with extending");
}
// clean up and return with success
delete space;
PASSED();
return 0;
} // end try block
// catch all dataset, file, space, and plist exceptions
catch (Exception E)
{
cerr << " FAILED" << endl;
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
// clean up and return with failure
if (space != NULL)
delete space;
return -1;
}
} // test_multiopen
示例13: h5ModelFrame
//' @title Fast model frame for activeReg
//'
//' @description Function returns a scaled down model frame essentially returning list with no NA values.
//' Each item in the list represents a column in the data frame.
//'
//' @param chunkName character name of the chunk to be read
//' @param selCols character vector of columns to select
//' @param filePath character path to file where chunk is to be read from
//' @return list representing a data frame with no NA values.
//[[Rcpp::export]]
SEXP h5ModelFrame(std::string chunkName, SEXP selCols_, std::string filePath)
{
// Quick conversion of the SEXP column selection to character vector
CharacterVector selCols(selCols_);
// Open the file in Read/Write Mode, H5F_ACC_RDONLY
H5File *file = new H5File(filePath, H5F_ACC_RDONLY);
// Opening the data set
DataSet dataset = file->openDataSet((H5std_string)chunkName);
// Opening the data space
DataSpace dataspace = dataset.getSpace();
// Get the number of dimensions
int ndim = dataspace.getSimpleExtentNdims();
// Create a dimension object to be filled with the dimensions of the data set
hsize_t dims[ndim];
// Fill the dimension of the dataset
dataspace.getSimpleExtentDims(dims, NULL);
// Create the return data
// Filling the matrix with data form the dataspace
SEXP data;
// Allocating a matrix of the right size and dimension
data = PROTECT(Rf_allocMatrix(REALSXP, dims[0], dims[1]));
// Filling the matrix with data form the dataspace
dataset.read(REAL(data), PredType::NATIVE_DOUBLE, dataspace);
UNPROTECT(1);
// Convert the R object to a numeric matrix
NumericMatrix M__(data);
CharacterVector colNames = ch5ReadCharVector("ColumnNames", filePath);
CharacterVector colClasses = ch5ReadCharVector("ColumnClasses", filePath);
// Create the output
List DF;
string colName;
string colClass;
NumericVector vect;
CharacterVector levels;
int n = selCols.size();
IntegerVector sel(n);
int selN;
NumericMatrix M_(M__.nrow(), n);
// Find which of the columns has been selected
sel = match(selCols, colNames);
// Copy the correct matrix columns
for(int i = 0; i < n; i++)
{
selN = sel[i] - 1;
M_(_, i) = M__(_, selN);
}
// Number of rows in the matrix
int nr = M_.nrow();
int goodRow;
NumericVector goodRows(nr);
int badRow;
for(int i = 0; i < nr; i++)
{
badRow = sum(is_na(M_(i, _)));
if(badRow >= 1)
{
goodRows[i] = 0;
}else{
goodRows[i] = 1;
}
}
//goodRows = goodRows*-1 + 1;
NumericMatrix M(sum(goodRows), n);
int j = 0;
// Remove NA rows
for(int i = 0; i < nr; i++)
{
goodRow = goodRows[i];
if(goodRow == 1)
{
M(j, _) = M_(i, _);
j++;
}
}
// Compile the list
for(int i = 0; i < n; i++)
{
colName = selCols[i];
selN = sel[i] - 1;
colClass = colClasses[selN];
if(colClass != "factor")
{
DF[colName] = M(_, i);
}else{
vect = M(_, i);
levels = (CharacterVector)ch5ReadFactor(colName, filePath);
DF[colName] = cCreateFactor(vect, levels);
}
}
//.........这里部分代码省略.........
示例14: main
//.........这里部分代码省略.........
/*
* Write new selection of points to the dataset.
*/
int values[] = {53, 59, 61, 67}; /* New values to be written */
dataset->write( values, PredType::NATIVE_INT, mspace2, fspace );
/*
* File dataset should look like this:
* 53 1 2 0 3 4 0 5 6 0 7 8
* 0 9 10 0 11 12 0 13 14 0 15 16
* 0 17 18 0 19 20 0 21 22 0 23 24
* 0 0 0 59 0 61 0 0 0 0 0 0
* 0 25 26 0 27 28 0 29 30 0 31 32
* 0 33 34 0 35 36 67 37 38 0 39 40
* 0 41 42 0 43 44 0 45 46 0 47 48
* 0 0 0 0 0 0 0 0 0 0 0 0
*
*/
/*
* Close the dataset and the file.
*/
delete dataset;
delete file;
/*
* Open the file.
*/
file = new H5File( FILE_NAME, H5F_ACC_RDONLY );
/*
* Open the dataset.
*/
dataset = new DataSet( file->openDataSet( DATASET_NAME ));
/*
* Get dataspace of the dataset.
*/
fspace = dataset->getSpace();
/*
* Select first hyperslab for the dataset in the file. The following
* elements are selected:
* 10 0 11 12
* 18 0 19 20
* 0 59 0 61
*
*/
start[0] = 1; start[1] = 2;
block[0] = 1; block[1] = 1;
stride[0] = 1; stride[1] = 1;
count[0] = 3; count[1] = 4;
fspace.selectHyperslab(H5S_SELECT_SET, count, start, stride, block);
/*
* Add second selected hyperslab to the selection.
* The following elements are selected:
* 19 20 0 21 22
* 0 61 0 0 0
* 27 28 0 29 30
* 35 36 67 37 38
* 43 44 0 45 46
* 0 0 0 0 0
* Note that two hyperslabs overlap. Common elements are:
* 19 20
* 0 61