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

[Cleanup] Abbreviate the namespace boost::fs

parent 9804a59e
No related branches found
No related tags found
No related merge requests found
...@@ -75,25 +75,25 @@ ...@@ -75,25 +75,25 @@
#include "vtk.hh" #include "vtk.hh"
size_t const dims = MY_DIM; size_t const dims = MY_DIM;
namespace fs = boost::filesystem;
void initPython(std::string dataDirectory) { void initPython(fs::path const &dataDirectory) {
Python::start(); Python::start();
Python::run("import sys"); Python::run("import sys");
Python::run(str(boost::format("sys.path.append('%s')") % dataDirectory)); Python::run(
str(boost::format("sys.path.append('%s')") % dataDirectory.string()));
} }
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
try { try {
auto const dataDirectory = auto const dataDirectory =
boost::filesystem::system_complete(boost::filesystem::path(argv[0])) fs::system_complete(fs::path(argv[0])).parent_path() /
.parent_path() / fs::path("sand-wedge-data");
boost::filesystem::path("sand-wedge-data");
Dune::ParameterTree parset; Dune::ParameterTree parset;
Dune::ParameterTreeParser::readINITree( Dune::ParameterTreeParser::readINITree(
(dataDirectory / boost::filesystem::path("parset.cfg")).string(), (dataDirectory / fs::path("parset.cfg")).string(), parset);
parset);
Dune::ParameterTreeParser::readOptions(argc, argv, parset); Dune::ParameterTreeParser::readOptions(argc, argv, parset);
MyGeometry::render(); MyGeometry::render();
...@@ -169,7 +169,7 @@ int main(int argc, char *argv[]) { ...@@ -169,7 +169,7 @@ int main(int argc, char *argv[]) {
using FunctionMap = SharedPointerMap<std::string, Function>; using FunctionMap = SharedPointerMap<std::string, Function>;
FunctionMap functions; FunctionMap functions;
{ {
initPython(dataDirectory.string()); initPython(dataDirectory);
Python::import("boundaryconditions") Python::import("boundaryconditions")
.get("Functions") .get("Functions")
.toC<typename FunctionMap::Base>(functions); .toC<typename FunctionMap::Base>(functions);
...@@ -213,8 +213,7 @@ int main(int argc, char *argv[]) { ...@@ -213,8 +213,7 @@ int main(int argc, char *argv[]) {
auto const firstRestart = parset.get<size_t>("restarts.first"); auto const firstRestart = parset.get<size_t>("restarts.first");
auto const restartSpacing = parset.get<size_t>("restarts.spacing"); auto const restartSpacing = parset.get<size_t>("restarts.spacing");
auto const restartTemplate = parset.get<std::string>("restarts.template"); auto const restartTemplate = parset.get<std::string>("restarts.template");
auto const restartDirectory = auto const restartDirectory = fs::path(restartTemplate).parent_path();
boost::filesystem::path(restartTemplate).parent_path();
if (firstRestart != 0) if (firstRestart != 0)
DataIO::loadData(programState, DataIO::loadData(programState,
...@@ -286,8 +285,8 @@ int main(int argc, char *argv[]) { ...@@ -286,8 +285,8 @@ int main(int argc, char *argv[]) {
specialDisplacementWriter.write(displacement); specialDisplacementWriter.write(displacement);
if (programState.timeStep % restartSpacing == 0) { if (programState.timeStep % restartSpacing == 0) {
if (!boost::filesystem::is_directory(restartDirectory)) if (!fs::is_directory(restartDirectory))
boost::filesystem::create_directories(restartDirectory); fs::create_directories(restartDirectory);
DataIO::writeData(programState, str(boost::format(restartTemplate) % DataIO::writeData(programState, str(boost::format(restartTemplate) %
programState.timeStep)); programState.timeStep));
} }
......
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