Commit fd28d632 authored by kraus's avatar kraus

replace SHA1 hash with UUID; small optimization run ran without problems.

parent dbd4b470
......@@ -86,6 +86,7 @@ namespace {
AMR_YT_DUMP_FREQ,
#endif
MEMORYDUMP,
USEUUID,
SIZE
};
}
......@@ -237,11 +238,11 @@ Option::Option():
itsAttr[VERSION] = Attributes::makeReal
("VERSION", "Version of OPAL for which input file was written", 10000);
#ifdef ENABLE_AMR
itsAttr[AMR] = Attributes::makeBool
("AMR", "Use adaptive mesh refinement.", amr);
itsAttr[AMR_YT_DUMP_FREQ] = Attributes::makeReal("AMR_YT_DUMP_FREQ",
"The frequency to dump grid "
"and particle data "
......@@ -249,7 +250,10 @@ Option::Option():
#endif
itsAttr[MEMORYDUMP] = Attributes::makeBool
("MEMORYDUMP", "If true, write memory to SDDS file", memoryDump);
itsAttr[USEUUID] = Attributes::makeBool
("USEUUID", "If true, uses UUID to create unique directory names", useUUID);
registerOwnership(AttributeHandler::STATEMENT);
FileStream::setEcho(echo);
......@@ -297,6 +301,7 @@ Option::Option(const std::string &name, Option *parent):
Attributes::setReal(itsAttr[AMR_YT_DUMP_FREQ], amrYtDumpFreq);
#endif
Attributes::setBool(itsAttr[MEMORYDUMP], memoryDump);
Attributes::setBool(itsAttr[USEUUID], useUUID);
}
......@@ -327,13 +332,13 @@ void Option::execute() {
amrYtDumpFreq = Attributes::getReal(itsAttr[AMR_YT_DUMP_FREQ]);
#endif
memoryDump = Attributes::getBool(itsAttr[MEMORYDUMP]);
if ( memoryDump ) {
IpplMemoryUsage::IpplMemory_p memory = IpplMemoryUsage::getInstance(
IpplMemoryUsage::Unit::GB, false);
memory->sample();
}
seed = Attributes::getReal(itsAttr[SEED]);
/// note: rangen is used only for the random number generator in the OPAL language
......@@ -343,7 +348,7 @@ void Option::execute() {
rangen.init55(time(0));
else
rangen.init55(seed);
IpplInfo::Info->on(info);
IpplInfo::Warn->on(warn);
......@@ -447,13 +452,15 @@ void Option::execute() {
} else {
cloTuneOnly = false;
}
// Set message flags.
FileStream::setEcho(echo);
if(Attributes::getBool(itsAttr[TELL])) {
*gmsg << "\nCurrent settings of options:\n" << *this << endl;
}
useUUID = Attributes::getBool(itsAttr[USEUUID]);
}
void Option::handlePsDumpFrame(const std::string &dumpFrame) {
......@@ -481,4 +488,4 @@ std::string DumpFrameToString(DumpFrame df) {
default:
return std::string("GLOBAL");
}
}
}
\ No newline at end of file
......@@ -90,13 +90,15 @@ namespace Options {
// opal version of input file
int version = 10000;
#ifdef ENABLE_AMR
bool amr = false;
/// The frequency to dump AMR grid data and particles into file
int amrYtDumpFreq = 10;
#endif
bool memoryDump = false;
}
bool useUUID = false;
}
\ No newline at end of file
......@@ -139,15 +139,17 @@ namespace Options {
/// opal version of input file
extern int version;
#ifdef ENABLE_AMR
extern bool amr;
/// The frequency to dump AMR grid data and particles into file
extern int amrYtDumpFreq;
#endif
extern bool memoryDump;
extern bool useUUID;
}
#endif // OPAL_Options_HH
\ No newline at end of file
......@@ -15,7 +15,8 @@
#include "Util/SDDSReader.h"
#include "Util/SDDSParser/SDDSParserException.h"
#include "Util/OptPilotException.h"
#include "Util/HashNameGenerator.h"
// #include "Util/HashNameGenerator.h"
#include "Util/UUIDNameGenerator.h"
#include "Expression/SumErrSq.h"
#include "Expression/FromFile.h"
......@@ -93,7 +94,13 @@ OpalSimulation::OpalSimulation(Expressions::Named_t objectives,
// hash the dictionary to get a short unique directory name for temporary
// simulation data
std::string hash = HashNameGenerator::generate(dict);
std::string hash = UUIDNameGenerator::generate(dict);
// if (Options::useUUID) {
// hash = UUIDNameGenerator::generate(dict);
// } else {
// hash = HashNameGenerator::generate(dict);
// }
std::ostringstream tmp;
tmp.precision(15);
......@@ -488,4 +495,4 @@ void OpalSimulation::cleanUp() {
} catch(...) {
std::cout << "Can't remove directory '" << simulationDirName_ << "'" << std::endl;
}
}
}
\ No newline at end of file
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