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