hdf5 basic works

This commit is contained in:
Dhanya Maliakal 2017-05-12 14:33:01 +02:00
parent f53770a2fc
commit b7291dffb9
2 changed files with 13 additions and 7 deletions

View File

@ -355,9 +355,9 @@ public:
*/ */
static int CreateDataFile(int ind, bool owenable, string fname, bool frindexenable, static int CreateDataFile(int ind, bool owenable, string fname, bool frindexenable,
uint64_t fnum, uint64_t nDimx, uint32_t nDimy, uint32_t nDimz, uint64_t fnum, uint64_t nDimx, uint32_t nDimy, uint32_t nDimz,
DataType dtype, H5File*& fd, DataSpace* dspace, DataSet* dset, DataType dtype, H5File*& fd, DataSpace*& dspace, DataSet*& dset,
double version, uint64_t maxchunkedimages, double version, uint64_t maxchunkedimages,
DataSpace* dspace_para, DataSet* dset_para[]) DataSpace*& dspace_para, DataSet* dset_para[])
{ {
try { try {
Exception::dontPrint(); //to handle errors Exception::dontPrint(); //to handle errors

View File

@ -100,6 +100,8 @@ int HDF5File::CreateFile(uint64_t fnum) {
return FAIL; return FAIL;
} }
pthread_mutex_unlock(&Mutex); pthread_mutex_unlock(&Mutex);
if (dataspace == NULL)
cprintf(RED,"Got nothing!\n");
printf("%d HDF5 File: %s\n", index, currentFileName.c_str()); printf("%d HDF5 File: %s\n", index, currentFileName.c_str());
return OK; return OK;
} }
@ -168,18 +170,22 @@ int HDF5File::CreateMasterFile(bool en, uint32_t size,
void HDF5File::EndofAcquisition(uint64_t numf) { void HDF5File::EndofAcquisition(uint64_t numf) {
//not created before //not created before
if (!virtualfd) { if (!virtualfd) {
//create virtual file only if more than 1 file or more than 1 detector(more than 1 file)
if (((numFilesinAcquisition > 1) ||(numDetY*numDetX) > 1)) //only one file and one sub image
CreateVirtualFile(numf); if (((numFilesinAcquisition == 1) && (numDetY*numDetX) == 1)) {
//link current file in master file
else {
//dataset name //dataset name
ostringstream osfn; ostringstream osfn;
osfn << "/data"; osfn << "/data";
if (*frameIndexEnable) osfn << "_f" << setfill('0') << setw(12) << 0; if (*frameIndexEnable) osfn << "_f" << setfill('0') << setw(12) << 0;
string dsetname = osfn.str(); string dsetname = osfn.str();
pthread_mutex_lock(&Mutex);
HDF5FileStatic::LinkVirtualInMaster(masterFileName, currentFileName, dsetname); HDF5FileStatic::LinkVirtualInMaster(masterFileName, currentFileName, dsetname);
pthread_mutex_unlock(&Mutex);
} }
//link current file in master file
else
CreateVirtualFile(numf);
} }
numFilesinAcquisition = 0; numFilesinAcquisition = 0;
} }