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