Skip to content
Snippets Groups Projects
Commit 64c019a5 authored by Elias Pipping's avatar Elias Pipping
Browse files

[Cleanup] Allow subdirectories in restart template

parent ce191f96
No related branches found
No related tags found
No related merge requests found
......@@ -213,6 +213,9 @@ int main(int argc, char *argv[]) {
auto const firstRestart = parset.get<size_t>("restarts.first");
auto const restartSpacing = parset.get<size_t>("restarts.spacing");
auto const restartTemplate = parset.get<std::string>("restarts.template");
auto const restartDirectory =
boost::filesystem::path(restartTemplate).parent_path();
if (firstRestart != 0)
DataIO::loadData(programState,
str(boost::format(restartTemplate) % firstRestart));
......@@ -282,9 +285,12 @@ int main(int argc, char *argv[]) {
specialVelocityWriter.write(velocity);
specialDisplacementWriter.write(displacement);
if (programState.timeStep % restartSpacing == 0)
if (programState.timeStep % restartSpacing == 0) {
if (!boost::filesystem::is_directory(restartDirectory))
boost::filesystem::create_directories(restartDirectory);
DataIO::writeData(programState, str(boost::format(restartTemplate) %
programState.timeStep));
}
if (parset.get<bool>("io.writeVTK")) {
ScalarVector stress;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment