Commit 6d0ba0fe authored by frey_m's avatar frey_m
Browse files

FieldWriter: do not hardcode output directory

parent 6ecb9e68
......@@ -674,6 +674,10 @@ std::string OpalData::getTitle() {
return p->itsTitle_m;
}
std::string OpalData::getOutputDirectory() const {
return "data";
}
std::string OpalData::getInputFn() {
return p->inputFn_m;
}
......
......@@ -182,6 +182,9 @@ public:
/// get the step where to restart
int getRestartStep();
/// get the name of the data directory
std::string getOutputDirectory() const;
/// get opals input filename
std::string getInputFn();
......
......@@ -40,7 +40,7 @@ void FieldWriter::dumpField(FieldType& field, std::string name,
INFOMSG("*** START DUMPING " + Util::toUpper(name) + " FIELD ***" << endl);
/* Save the files in the data/ directory of the simulation. The file
/* Save the files in the output directory of the simulation. The file
* name of vector fields is
*
* 'basename'-'name'_field-'******'.dat
......@@ -54,7 +54,8 @@ void FieldWriter::dumpField(FieldType& field, std::string name,
* 'name': field name (input argument of function)
* '******': step padded with zeros to 6 digits
*/
boost::filesystem::path file("data");
std::string dirname = OpalData::getInstance()->getOutputDirectory();
boost::filesystem::path file(dirname);
boost::format filename("%1%-%2%-%|3$06|.dat");
std::string basename = OpalData::getInstance()->getInputBasename();
filename % basename % (name + std::string("_") + type) % step;
......
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