Commit 43937be1 authored by Andreas Adelmann's avatar Andreas Adelmann
Browse files

Merge commit 'refs/merge-requests/1' of gitorious.psi.ch:opal/src into merge-requests/1

parents e0cf1208 554462e8
*~
/CMakeCache.txt
/Makefile
/build
......
......@@ -6,7 +6,8 @@
LossDataSink::LossDataSink(std::string elem, bool hdf5Save):
element_m(elem),
h5hut_mode_m(hdf5Save)
h5hut_mode_m(hdf5Save),
H5file_m(NULL)
{
x_m.clear();
y_m.clear();
......@@ -21,7 +22,8 @@ LossDataSink::LossDataSink(std::string elem, bool hdf5Save):
LossDataSink::LossDataSink(const LossDataSink &rsh):
element_m(rsh.element_m),
h5hut_mode_m(rsh.h5hut_mode_m)
h5hut_mode_m(rsh.h5hut_mode_m),
H5file_m(rsh.H5file_m)
{
x_m.clear();
y_m.clear();
......@@ -39,6 +41,14 @@ LossDataSink::LossDataSink() {
}
LossDataSink::~LossDataSink() {
h5_int64_t rc;
if(H5file_m) {
rc = H5CloseFile(H5file_m);
H5file_m = NULL;
if(rc != H5_SUCCESS)
ERRORMSG("H5 rc= " << rc << " element " << element_m << " in " << __FILE__ << " @ line " << __LINE__ << endl);
}
Ippl::Comm->barrier();
}
void LossDataSink::openH5() {
......@@ -152,6 +162,7 @@ void LossDataSink::save() {
writeHeaderH5();
saveH5();
H5CloseFile(H5file_m);
H5file_m = NULL;
Ippl::Comm->barrier();
}
else {
......
......@@ -28,7 +28,8 @@ using namespace std;
DataSink::DataSink() :
lossWrCounter_m(0),
doHDF5_m(true)
doHDF5_m(true),
H5file_m(NULL)
{
/// Constructor steps:
/// Get timers from IPPL.
......@@ -73,7 +74,8 @@ DataSink::DataSink() :
}
DataSink::DataSink(int restartStep) :
lossWrCounter_m(0)
lossWrCounter_m(0),
H5file_m(NULL)
{
doHDF5_m = Options::enableHDF5;
if (!doHDF5_m) {
......@@ -154,6 +156,7 @@ DataSink::~DataSink() {
h5_int64_t rc;
if(H5file_m) {
rc = H5CloseFile(H5file_m);
H5file_m = NULL;
if(rc != H5_SUCCESS)
ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
}
......@@ -2704,6 +2707,7 @@ void DataSink::storeOneBunch(const PartBunch &beam, const string fn_appendix) {
ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
rc = H5CloseFile(H5file);
H5file = NULL;
if(rc != H5_SUCCESS)
ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
Ippl::Comm->barrier();
......@@ -2822,6 +2826,7 @@ bool DataSink::readOneBunch(PartBunch &beam, const string fn_appendix, const siz
Ippl::Comm->barrier();
rc = H5CloseFile(H5file);
H5file = NULL;
if(rc != H5_SUCCESS)
ERRORMSG("H5 rc= " << rc << " in " << __FILE__ << " @ line " << __LINE__ << endl);
// update statistics parameters of PartBunch
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment