#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
using std::cout;
using std::endl;
#include <string>
#include "H5Cpp.h"
using namespace H5;
const H5std_string FILE_NAME( "Select.h5" );
const H5std_string DATASET_NAME( "Matrix in file" );
const int MSPACE1_RANK = 1;
const int MSPACE1_DIM = 50;
const int MSPACE2_RANK = 1;
const int MSPACE2_DIM = 4;
const int FSPACE_RANK = 2;
const int FSPACE_DIM1 = 8;
const int FSPACE_DIM2 = 12;
const int MSPACE_RANK = 2;
const int MSPACE_DIM1 = 8;
const int MSPACE_DIM2 = 9;
const int NPOINTS = 4;
int main (void)
{
int i,j;
try
{
int fillvalue = 0;
hsize_t fdim[] = {FSPACE_DIM1, FSPACE_DIM2};
hsize_t start[2];
hsize_t stride[2];
hsize_t count[2];
hsize_t block[2];
start[0] = 0; start[1] = 1;
stride[0] = 4; stride[1] = 3;
count[0] = 2; count[1] = 4;
block[0] = 3; block[1] = 2;
fspace.selectHyperslab( H5S_SELECT_SET, count, start, stride, block);
hsize_t dim1[] = {MSPACE1_DIM};
start[0] = 1;
stride[0] = 1;
count[0] = 48;
block[0] = 1;
mspace1.selectHyperslab( H5S_SELECT_SET, count, start, stride, block);
int vector[MSPACE1_DIM];
vector[0] = vector[MSPACE1_DIM - 1] = -1;
for (i = 1; i < MSPACE1_DIM - 1; i++)
vector[i] = i;
fspace.selectNone();
hsize_t dim2[] = {MSPACE2_DIM};
hsize_t coord[NPOINTS][FSPACE_RANK];
coord[0][0] = 0; coord[0][1] = 0;
coord[1][0] = 3; coord[1][1] = 3;
coord[2][0] = 3; coord[2][1] = 5;
coord[3][0] = 5; coord[3][1] = 6;
fspace.selectElements( H5S_SELECT_SET, NPOINTS, (const hsize_t *)coord);
int values[] = {53, 59, 61, 67};
delete dataset;
delete file;
file =
new H5File( FILE_NAME, H5F_ACC_RDONLY );
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);
start[0] = 2; start[1] = 4;
block[0] = 1; block[1] = 1;
stride[0] = 1; stride[1] = 1;
count[0] = 6; count[1] = 5;
fspace.selectHyperslab(H5S_SELECT_OR, count, start, stride, block);
hsize_t mdim[] = {MSPACE_DIM1, MSPACE_DIM2};
start[0] = 0; start[1] = 0;
block[0] = 1; block[1] = 1;
stride[0] = 1; stride[1] = 1;
count[0] = 3; count[1] = 4;
mspace.selectHyperslab(H5S_SELECT_SET, count, start, stride, block);
start[0] = 1; start[1] = 2;
block[0] = 1; block[1] = 1;
stride[0] = 1; stride[1] = 1;
count[0] = 6; count[1] = 5;
mspace.selectHyperslab(H5S_SELECT_OR, count, start, stride, block);
int matrix_out[MSPACE_DIM1][MSPACE_DIM2];
for (i = 0; i < MSPACE_DIM1; i++)
for (j = 0; j < MSPACE_DIM2; j++)
matrix_out[i][j] = 0;
for (i=0; i < MSPACE_DIM1; i++)
{
for(j=0; j < MSPACE_DIM2; j++)
cout << matrix_out[i][j] << " ";
cout << endl;
}
delete dataset;
delete file;
}
{
return -1;
}
{
return -1;
}
{
return -1;
}
return 0;
}