Commit b8ee885a authored by ext-calvo_p's avatar ext-calvo_p
Browse files

Resolve "Some regression tests broken"

parent 632549c9
......@@ -664,7 +664,7 @@ std::string OpalData::getInputBasename() {
void OpalData::checkAndAddOutputFileName(const std::string &outfn) {
if (p->outFiles_m.count(outfn) == 0) {
p->outFiles_m.insert(outfn);
} else {
} else if (!hasBunchAllocated()) {
throw OpalException(
"OpalData::checkAndAddOutputFileName",
"Duplicate file name for output, '" + outfn + "', detected");
......
......@@ -187,6 +187,10 @@ LossDataSink::LossDataSink(std::string outfn, bool hdf5Save, CollectionType coll
}
OpalData::getInstance()->checkAndAddOutputFileName(outputName_m);
if (OpalData::getInstance()->hasBunchAllocated()) {
OpalData::getInstance()->setOpenMode(OpalData::OPENMODE::APPEND);
}
}
LossDataSink::LossDataSink(const LossDataSink &rhs):
......@@ -336,7 +340,9 @@ void LossDataSink::save(unsigned int numSets, OpalData::OPENMODE openMode) {
}
CLOSE_FILE ();
H5file_m = 0;
} else {
fn_m = outputName_m + std::string(".loss");
*gmsg << level2 << "Save " << fn_m << endl;
if (openMode == OpalData::OPENMODE::WRITE || !fs::exists(fn_m)) {
......@@ -348,6 +354,7 @@ void LossDataSink::save(unsigned int numSets, OpalData::OPENMODE openMode) {
saveASCII();
closeASCII();
}
Ippl::Comm->barrier();
particles_m.clear();
......
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