#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>
#ifndef H5_NO_NAMESPACE
#ifndef H5_NO_STD
using std::cout;
using std::endl;
#endif // H5_NO_STD
#endif
#include "H5Cpp.h"
#ifndef H5_NO_NAMESPACE
using namespace H5;
#endif
const H5std_string FILE_NAME( "SDS.h5" );
const H5std_string DATASET_NAME( "IntArray" );
const int NX_SUB = 3;
const int NY_SUB = 4;
const int NX = 7;
const int NY = 7;
const int NZ = 3;
const int RANK_OUT = 3;
int main (void)
{
int i, j, k;
int data_out[NX][NY][NZ ];
for (j = 0; j < NX; j++)
{
for (i = 0; i < NY; i++)
{
for (k = 0; k < NZ ; k++)
data_out[j][i][k] = 0;
}
}
try
{
H5File file( FILE_NAME, H5F_ACC_RDONLY );
DataSet dataset = file.openDataSet( DATASET_NAME );
if( type_class == H5T_INTEGER )
{
cout << "Data set has INTEGER type" << endl;
H5std_string order_string;
H5T_order_t order = intype.
getOrder( order_string );
cout << order_string << endl;
cout << "Data size is " << size << endl;
}
hsize_t dims_out[2];
cout << "rank " << rank << ", dimensions " <<
(unsigned long)(dims_out[0]) << " x " <<
(unsigned long)(dims_out[1]) << endl;
hsize_t offset[2];
hsize_t count[2];
offset[0] = 1;
offset[1] = 2;
count[0] = NX_SUB;
count[1] = NY_SUB;
hsize_t dimsm[3];
dimsm[0] = NX;
dimsm[1] = NY;
dimsm[2] = NZ ;
hsize_t offset_out[3];
hsize_t count_out[3];
offset_out[0] = 3;
offset_out[1] = 0;
offset_out[2] = 0;
count_out[0] = NX_SUB;
count_out[1] = NY_SUB;
count_out[2] = 1;
memspace.selectHyperslab( H5S_SELECT_SET, count_out, offset_out );
for (j = 0; j < NX; j++)
{
for (i = 0; i < NY; i++)
cout << data_out[j][i][0] << " ";
cout << endl;
}
}
{
return -1;
}
{
return -1;
}
{
return -1;
}
{
return -1;
}
return 0;
}