資源簡介
hdf5-1.10.5源碼安裝包,下載比較困難,方便大家學習。
代碼片段和文件信息
/*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*
?*?Copyright?by?The?HDF?Group.???????????????????????????????????????????????*
?*?Copyright?by?the?Board?of?Trustees?of?the?University?of?Illinois.?????????*
?*?All?rights?reserved.??????????????????????????????????????????????????????*
?*???????????????????????????????????????????????????????????????????????????*
?*?This?file?is?part?of?HDF5.??The?full?HDF5?copyright?notice?including?????*
?*?terms?governing?use?modification?and?redistribution?is?contained?in????*
?*?the?COPYING?file?which?can?be?found?at?the?root?of?the?source?code???????*
?*?distribution?tree?or?in?https://support.hdfgroup.org/ftp/HDF5/releases.??*
?*?If?you?do?not?have?access?to?either?file?you?may?request?a?copy?from?????*
?*?help@hdfgroup.org.????????????????????????????????????????????????????????*
?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*/
/*
?*???This?example?shows?how?to?read?data?from?a?chunked?dataset.
?*???We?will?read?from?the?file?created?by?extend.cpp
?*/
#ifdef?OLD_HEADER_FILENAME
#include?
#else
#include?
#endif
using?std::cout;
using?std::endl;
#include?
#include?“H5Cpp.h“
using?namespace?H5;
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;
const?int??????RANKC?=?1;
int?main?(void)
{
????hsize_t i?j;
????//?Try?block?to?detect?exceptions?raised?by?any?of?the?calls?inside?it
????try
????{
/*
?*?Turn?off?the?auto-printing?when?failure?occurs?so?that?we?can
?*?handle?the?errors?appropriately
?*/
Exception::dontPrint();
/*
?*?Open?the?file?and?the?dataset.
?*/
H5File?file(?FILE_NAME?H5F_ACC_RDONLY?);
DataSet?dataset?=?file.openDataSet(?DATASET_NAME?);
/*
?*?Get?filespace?for?rank?and?dimension
?*/
DataSpace?filespace?=?dataset.getSpace();
/*
?*?Get?number?of?dimensions?in?the?file?dataspace
?*/
int?rank?=?filespace.getSimpleExtentNdims();
/*
?*?Get?and?print?the?dimension?sizes?of?the?file?dataspace
?*/
hsize_t?dims[2];? //?dataset?dimensions
rank?=?filespace.getSimpleExtentDims(?dims?);
cout?<“dataset?rank?=?“?< ?????<(unsigned?long)(dims[0])?<“?x?“
?????<(unsigned?long)(dims[1])?<
/*
?*?Define?the?memory?space?to?read?dataset.
?*/
DataSpace?mspace1(RANK?dims);
/*
?*?Read?dataset?back?and?display.
?*/
int?data_out[NX][NY];??//?buffer?for?dataset?to?be?read
dataset.read(?data_out?PredType::NATIVE_INT?mspace1?filespace?);
cout?<“\n“;
cout?<“Dataset:?\n“;
for?(j?=?0;?j? {
????for?(i?=?0;?i? cout?< ????cout?< }
/*
?* ????dataset?rank?2?dimensions?10?x?5
?* ????chunk?rank?2?dimensions?2?x?5
?* ????Dataset:
?* ????1?1?1?3?3
?* ????1?1?1?3?3
?* ????1?1?1?0?0
?* ????2?0?0?0?0
?* ????2?0?0?0?0
?* ????2?0?0?0?0
?* ???
- 上一篇:數字控制系統:設計、辨識和實現
- 下一篇:JFVideoEncrypt
評論
共有 條評論