mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-28 09:10:01 +02:00
made some groups and force closing
This commit is contained in:
parent
cdcb413241
commit
ae48a0e251
@ -645,7 +645,7 @@ private:
|
|||||||
DataSpace *hdf5_dataspaceId[MAX_NUMBER_OF_WRITER_THREADS];
|
DataSpace *hdf5_dataspaceId[MAX_NUMBER_OF_WRITER_THREADS];
|
||||||
DataSet *hdf5_datasetId[MAX_NUMBER_OF_WRITER_THREADS];
|
DataSet *hdf5_datasetId[MAX_NUMBER_OF_WRITER_THREADS];
|
||||||
H5File *hdf5_fileId[MAX_NUMBER_OF_WRITER_THREADS];
|
H5File *hdf5_fileId[MAX_NUMBER_OF_WRITER_THREADS];
|
||||||
hid_t hdf5_datatype;
|
DataType hdf5_datatype;
|
||||||
#endif
|
#endif
|
||||||
//***acquisition indices/count parameters***
|
//***acquisition indices/count parameters***
|
||||||
/** Frame Number of First Frame of an entire Acquisition (including all scans) */
|
/** Frame Number of First Frame of an entire Acquisition (including all scans) */
|
||||||
|
@ -160,7 +160,7 @@ void UDPStandardImplementation::initializeMembers(){
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
hdf5_datatype = H5T_STD_U16LE;
|
hdf5_datatype = PredType::STD_U16LE;
|
||||||
#endif
|
#endif
|
||||||
maxFramesPerFile = 0;
|
maxFramesPerFile = 0;
|
||||||
fileCreateSuccess = false;
|
fileCreateSuccess = false;
|
||||||
@ -648,9 +648,9 @@ int UDPStandardImplementation::setDynamicRange(const uint32_t i){
|
|||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
switch(dynamicRange){
|
switch(dynamicRange){
|
||||||
case 4:
|
case 4:
|
||||||
case 8: hdf5_datatype = H5T_STD_U8LE; break;
|
case 8: hdf5_datatype = PredType::STD_U8LE; break;
|
||||||
case 16: hdf5_datatype = H5T_STD_U16LE; break;
|
case 16: hdf5_datatype = PredType::STD_U16LE; break;
|
||||||
case 32: hdf5_datatype = H5T_STD_U32LE; break;
|
case 32: hdf5_datatype = PredType::STD_U32LE; break;
|
||||||
default: cprintf(BG_RED,"unknown dynamic range\n");
|
default: cprintf(BG_RED,"unknown dynamic range\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1718,10 +1718,27 @@ int UDPStandardImplementation::createNewFile(int ithread){
|
|||||||
try{
|
try{
|
||||||
Exception::dontPrint(); //to handle errors
|
Exception::dontPrint(); //to handle errors
|
||||||
//creating file
|
//creating file
|
||||||
|
FileAccPropList flist;
|
||||||
|
flist.setFcloseDegree(H5F_CLOSE_STRONG);
|
||||||
if(!overwriteEnable)
|
if(!overwriteEnable)
|
||||||
hdf5_fileId[ithread] = new H5File( completeFileName[ithread], H5F_ACC_EXCL );
|
hdf5_fileId[ithread] = new H5File( completeFileName[ithread], H5F_ACC_EXCL, NULL,flist );
|
||||||
else
|
else
|
||||||
hdf5_fileId[ithread] = new H5File( completeFileName[ithread], H5F_ACC_TRUNC );
|
hdf5_fileId[ithread] = new H5File( completeFileName[ithread], H5F_ACC_TRUNC, NULL, flist );
|
||||||
|
|
||||||
|
//Create a group in the file
|
||||||
|
Group group1( hdf5_fileId[ithread]->createGroup( "entry" ));
|
||||||
|
Group group2(group1.createGroup("instrument"));
|
||||||
|
Group group3(group2.createGroup("detector"));
|
||||||
|
Group group4(group1.createGroup("data"));
|
||||||
|
Group group5(group1.createGroup("sample"));
|
||||||
|
|
||||||
|
//group4.link(H5G_LINK_HARD,"/entry/data","/entry/instrument/detector/data");
|
||||||
|
group1.close();
|
||||||
|
group2.close();
|
||||||
|
group3.close();
|
||||||
|
group4.close();
|
||||||
|
group5.close();
|
||||||
|
|
||||||
//create property list for a dataset and set up fill values
|
//create property list for a dataset and set up fill values
|
||||||
int fillvalue = -1;
|
int fillvalue = -1;
|
||||||
DSetCreatPropList plist;
|
DSetCreatPropList plist;
|
||||||
@ -1731,9 +1748,14 @@ int UDPStandardImplementation::createNewFile(int ithread){
|
|||||||
if(dynamicRange == 4)
|
if(dynamicRange == 4)
|
||||||
srcdims[1] = NX/2;
|
srcdims[1] = NX/2;
|
||||||
hdf5_dataspaceId[ithread] = new DataSpace (3,srcdims);
|
hdf5_dataspaceId[ithread] = new DataSpace (3,srcdims);
|
||||||
|
|
||||||
|
|
||||||
|
char dsetname[100];
|
||||||
|
sprintf(dsetname, "/entry/data/data_%06lld", (long long int)currentFrameNumber[ithread]+1);
|
||||||
|
|
||||||
//Create dataset and write it into the file
|
//Create dataset and write it into the file
|
||||||
hdf5_datasetId[ithread] = new DataSet (hdf5_fileId[ithread]->createDataSet(
|
hdf5_datasetId[ithread] = new DataSet (hdf5_fileId[ithread]->createDataSet(
|
||||||
"Data", hdf5_datatype, *hdf5_dataspaceId[ithread], plist));
|
dsetname, hdf5_datatype, *hdf5_dataspaceId[ithread], plist));
|
||||||
|
|
||||||
//create the data space for the attribute
|
//create the data space for the attribute
|
||||||
hsize_t dims = 1;
|
hsize_t dims = 1;
|
||||||
@ -3066,7 +3088,7 @@ void UDPStandardImplementation::handleCompleteFramesOnly(int ithread, char* wbuf
|
|||||||
)){
|
)){
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(tempframenumber && (tempframenumber%maxFramesPerFile) == 0)
|
if(fileFormatType == BINARY && tempframenumber && (tempframenumber%maxFramesPerFile) == 0)
|
||||||
createNewFile(ithread);
|
createNewFile(ithread);
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
|
|
||||||
@ -3087,6 +3109,7 @@ void UDPStandardImplementation::handleCompleteFramesOnly(int ithread, char* wbuf
|
|||||||
hdf5_dataspaceId[ithread]->selectHyperslab( H5S_SELECT_SET, count, start);
|
hdf5_dataspaceId[ithread]->selectHyperslab( H5S_SELECT_SET, count, start);
|
||||||
DataSpace memspace(2,dims2);
|
DataSpace memspace(2,dims2);
|
||||||
hdf5_datasetId[ithread]->write(wbuffer + fifoBufferHeaderSize, hdf5_datatype, memspace, *hdf5_dataspaceId[ithread]);
|
hdf5_datasetId[ithread]->write(wbuffer + fifoBufferHeaderSize, hdf5_datatype, memspace, *hdf5_dataspaceId[ithread]);
|
||||||
|
memspace.close();
|
||||||
}
|
}
|
||||||
catch(Exception error){
|
catch(Exception error){
|
||||||
cprintf(RED,"Error in writing to file in thread %d\n",ithread);
|
cprintf(RED,"Error in writing to file in thread %d\n",ithread);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user