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

[Input] Take parameters from CWD

This allows us to remove the last boost::filesystem dependency, and
thus all of boost. It seems to be a better idea than hardcoding the
path to the source directory (which might be unavailable later) anyway
parent d7b93bea
Branches
No related tags found
No related merge requests found
......@@ -18,8 +18,6 @@ include(DuneMacros)
# start a dune project with information from dune.module
dune_project()
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost REQUIRED system filesystem)
set(HDF5_USE_STATIC_LIBRARIES ON)
find_package(HDF5 COMPONENTS C REQUIRED)
......
......@@ -26,12 +26,6 @@ set(UGW_SOURCE_FILES
vtk.cc
)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/one-body-problem-data")
dune_symlink_to_source_files(FILES
"one-body-problem-data/parset.cfg"
"one-body-problem-data/parset-2D.cfg"
"one-body-problem-data/parset-3D.cfg")
foreach(_dim 2 3)
set(_sw_target one-body-problem-${_dim}D)
set(_ugw_target uniform-grid-writer-${_dim}D)
......@@ -41,10 +35,6 @@ foreach(_dim 2 3)
add_dune_ug_flags(${_sw_target})
add_dune_ug_flags(${_ugw_target})
set_property(TARGET ${_sw_target} APPEND PROPERTY INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIRS})
target_link_libraries(${_sw_target} ${Boost_FILESYSTEM_LIBRARY})
target_link_libraries(${_sw_target} ${Boost_SYSTEM_LIBRARY})
set_property(TARGET ${_sw_target} APPEND PROPERTY INCLUDE_DIRECTORIES ${HDF5_INCLUDE_DIR})
target_link_libraries(${_sw_target} ${HDF5_LIBRARIES})
......
......@@ -12,9 +12,6 @@
#include <iostream>
#include <iomanip>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
#include <dune/common/bitsetvector.hh>
#include <dune/common/exceptions.hh>
#include <dune/common/fmatrix.hh>
......@@ -28,6 +25,7 @@
#include <dune/istl/bvector.hh>
#include <dune/fufem/boundarypatch.hh>
#include <dune/fufem/formatstring.hh>
#include <dune/solvers/norms/energynorm.hh>
#include <dune/solvers/solvers/loopsolver.hh>
......@@ -62,31 +60,19 @@
#include "vtk.hh"
size_t const dims = MY_DIM;
namespace fs = boost::filesystem;
Dune::ParameterTree getParameters(int argc, char *argv[],
fs::path const &dataDirectory) {
Dune::ParameterTree getParameters(int argc, char *argv[]) {
Dune::ParameterTree parset;
std::string sharedParsetName("parset.cfg");
fs::path sharedParsetPath(dataDirectory / fs::path(sharedParsetName));
Dune::ParameterTreeParser::readINITree(sharedParsetPath.string(), parset);
std::string individualParsetName =
Dune::Fufem::formatString("parset-%dD.cfg", dims);
fs::path individualParsetPath(dataDirectory / fs::path(individualParsetName));
Dune::ParameterTreeParser::readINITree(individualParsetPath.string(), parset);
Dune::ParameterTreeParser::readINITree("one-body-problem.cfg", parset);
Dune::ParameterTreeParser::readINITree(
Dune::Fufem::formatString("one-body-problem-%dD.cfg", dims), parset);
Dune::ParameterTreeParser::readOptions(argc, argv, parset);
return parset;
}
int main(int argc, char *argv[]) {
try {
auto const dataDirectory =
fs::system_complete(fs::path(argv[0])).parent_path() /
fs::path("one-body-problem-data");
auto const parset = getParameters(argc, argv, dataDirectory);
auto const parset = getParameters(argc, argv);
MyGeometry::render();
MyGeometry::write();
......@@ -187,7 +173,6 @@ 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 = fs::path(restartTemplate).parent_path();
HDF5File ioFile("output.h5");
if (firstRestart != 0)
......
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment