本文整理汇总了C++中DSetCreatPropList::getChunk方法的典型用法代码示例。如果您正苦于以下问题:C++ DSetCreatPropList::getChunk方法的具体用法?C++ DSetCreatPropList::getChunk怎么用?C++ DSetCreatPropList::getChunk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DSetCreatPropList
的用法示例。
在下文中一共展示了DSetCreatPropList::getChunk方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
HDF5RecordingData::HDF5RecordingData(DataSet* data)
{
DataSpace dSpace;
DSetCreatPropList prop;
ScopedPointer<DataSet> dataSet = data;
hsize_t dims[3], chunk[3];
dSpace = dataSet->getSpace();
prop = dataSet->getCreatePlist();
dimension = dSpace.getSimpleExtentDims(dims);
prop.getChunk(dimension,chunk);
this->size[0] = dims[0];
if (dimension > 1)
this->size[1] = dims[1];
else
this->size[1] = 1;
if (dimension > 1)
this->size[2] = dims[2];
else
this->size[2] = 1;
this->xChunkSize = chunk[0];
this->xPos = dims[0];
this->dSet = dataSet;
this->rowXPos.clear();
this->rowXPos.insertMultiple(0,0,this->size[1]);
}
示例2: main
//.........这里部分代码省略.........
*/
filespace.selectHyperslab( H5S_SELECT_SET, count, offset );
dataset.read( column, PredType::NATIVE_INT, mspace2, filespace );
cout << endl;
cout << "Third column: " << endl;
for (i = 0; i < 10; i++)
cout << column[i] << endl;
/*
* Third column:
* 1
* 1
* 1
* 0
* 0
* 0
* 0
* 0
* 0
* 0
*/
/*
* Get creation properties list.
*/
DSetCreatPropList cparms = dataset.getCreatePlist();
/*
* Check if dataset is chunked.
*/
hsize_t chunk_dims[2];
int rank_chunk;
if( H5D_CHUNKED == cparms.getLayout() )
{
/*
* Get chunking information: rank and dimensions
*/
rank_chunk = cparms.getChunk( 2, chunk_dims);
cout << "chunk rank " << rank_chunk << "dimensions "
<< (unsigned long)(chunk_dims[0]) << " x "
<< (unsigned long)(chunk_dims[1]) << endl;
/*
* Define the memory space to read a chunk.
*/
DataSpace mspace3( rank_chunk, chunk_dims );
/*
* Define chunk in the file (hyperslab) to read.
*/
offset[0] = 2;
offset[1] = 0;
count[0] = chunk_dims[0];
count[1] = chunk_dims[1];
filespace.selectHyperslab( H5S_SELECT_SET, count, offset );
/*
* Read chunk back and display.
*/
int chunk_out[2][5]; // buffer for chunk to be read
dataset.read( chunk_out, PredType::NATIVE_INT, mspace3, filespace );
cout << endl;
cout << "Chunk:" << endl;
for (j = 0; j < chunk_dims[0]; j++)
{
for (i = 0; i < chunk_dims[1]; i++)
cout << chunk_out[j][i] << " ";
cout << endl;
}
/*
* Chunk:
* 1 1 1 0 0
* 2 0 0 0 0
*/
}
} // end of try block
// catch failure caused by the H5File operations
catch( FileIException error )
{
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSet operations
catch( DataSetIException error )
{
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSpace operations
catch( DataSpaceIException error )
{
error.printErrorStack();
return -1;
}
return 0;
}