#include <iostream>
#include <string>
using std::cout;
using std::endl;
#include <string>
#include "H5Cpp.h"
const H5std_string FILE_NAME("SDSextendible.h5");
const H5std_string DATASET_NAME("ExtendibleArray");
const int NX = 10;
const int NY = 5;
const int RANK = 2;
int
main(void)
{
try {
hsize_t dims[2] = {3, 3};
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
DataSpace mspace1(RANK, dims, maxdims);
H5File file(FILE_NAME, H5F_ACC_TRUNC);
DSetCreatPropList cparms;
hsize_t chunk_dims[2] = {2, 5};
cparms.setChunk(RANK, chunk_dims);
int fill_val = 0;
hsize_t size[2];
size[0] = 3;
size[1] = 3;
dataset.extend(size);
DataSpace fspace1 = dataset.getSpace();
hsize_t offset[2];
offset[0] = 0;
offset[1] = 0;
hsize_t dims1[2] = {3, 3};
fspace1.selectHyperslab(H5S_SELECT_SET, dims1, offset);
int data1[3][3] = {{1, 1, 1},
{1, 1, 1},
{1, 1, 1}};
hsize_t dims2[2] = {7, 1};
dims[0] = dims1[0] + dims2[0];
size[0] = dims[0];
size[1] = dims[1];
dataset.extend(size);
DataSpace fspace2 = dataset.getSpace();
offset[0] = 3;
offset[1] = 0;
fspace2.selectHyperslab(H5S_SELECT_SET, dims2, offset);
DataSpace mspace2(RANK, dims2);
int data2[7] = {2, 2, 2, 2, 2, 2, 2};
hsize_t dims3[2] = {2, 2};
dims[1] = dims1[1] + dims3[1];
size[0] = dims[0];
size[1] = dims[1];
dataset.extend(size);
DataSpace fspace3 = dataset.getSpace();
offset[0] = 0;
offset[1] = 3;
fspace3.selectHyperslab(H5S_SELECT_SET, dims3, offset);
DataSpace mspace3(RANK, dims3);
int data3[2][2] = {{3, 3}, {3, 3}};
int i, j;
int data_out[NX][NY];
for (i = 0; i < NX; i++) {
for (j = 0; j < NY; j++)
data_out[i][j] = 0;
}
for (i = 0; i < NX; i++) {
for (j = 0; j < NY; j++)
cout << data_out[i][j] << " ";
cout << endl;
}
}
catch (FileIException error) {
error.printErrorStack();
return -1;
}
catch (DataSetIException error) {
error.printErrorStack();
return -1;
}
catch (DataSpaceIException error) {
error.printErrorStack();
return -1;
}
catch (DataTypeIException error) {
error.printErrorStack();
return -1;
}
return 0;
}
static void dontPrint()
Turns off the automatic error printing from the C library.
Definition: H5Exception.cpp:161
static const PredType & NATIVE_INT
Definition: H5PredType.h:151
Definition: H5AbstractDs.cpp:34