From 111d24399359c13b4efcc93dd062275b9ea98433 Mon Sep 17 00:00:00 2001 From: Simon Praetorius <simon.praetorius@tu-dresden.de> Date: Mon, 22 Oct 2018 23:07:29 -0400 Subject: [PATCH] remove necessity to always have an initfile --- src/amdis/AMDiS.cpp | 9 +++++---- src/amdis/ProblemStat.hpp | 5 +---- test/CMakeLists.txt | 6 ++---- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/amdis/AMDiS.cpp b/src/amdis/AMDiS.cpp index 6800a721..5965d68b 100644 --- a/src/amdis/AMDiS.cpp +++ b/src/amdis/AMDiS.cpp @@ -9,15 +9,16 @@ namespace AMDiS Dune::MPIHelper& init(int& argc, char**& argv, std::string const& initFileName) { // Maybe initialize MPI - Dune::MPIHelper& mpiHelper = Dune::MPIHelper::instance(argc, argv); + static Dune::MPIHelper& mpiHelper = Dune::MPIHelper::instance(argc, argv); Parameters::clearData(); - if (initFileName == "") { - test_exit(argc > 1, "No init file specified!\n"); + if (initFileName.empty() && argc > 1) { Parameters::init(argv[1]); - } else { + } else if (!initFileName.empty()) { Parameters::init(initFileName); + } else { + warning("No initfile specified. Using default values for all parameters."); } return mpiHelper; diff --git a/src/amdis/ProblemStat.hpp b/src/amdis/ProblemStat.hpp index 74eb5c10..20c212d6 100644 --- a/src/amdis/ProblemStat.hpp +++ b/src/amdis/ProblemStat.hpp @@ -280,10 +280,7 @@ namespace AMDiS void createGrid() { - gridName_ = ""; Parameters::get(name_ + "->mesh", gridName_); - test_exit(!gridName_.empty(), "No grid name specified for '{}->mesh'!", name_); - grid_ = MeshCreator<Grid>::create(gridName_); msg("Create grid:"); @@ -367,7 +364,7 @@ namespace AMDiS int nGrids = 1; /// Name of the grid - std::string gridName_ = "none"; + std::string gridName_ = "mesh"; /// FE spaces of this problem. std::shared_ptr<GlobalBasis> globalBasis_; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a18847f2..2f101a35 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -12,8 +12,7 @@ dune_add_test(SOURCES DOFVectorTest.cpp LINK_LIBRARIES amdis) dune_add_test(SOURCES ExpressionsTest.cpp - LINK_LIBRARIES amdis - CMD_ARGS "${CMAKE_SOURCE_DIR}/examples/init/ellipt.dat.2d") + LINK_LIBRARIES amdis) dune_add_test(SOURCES FieldMatVecTest.cpp LINK_LIBRARIES amdis) @@ -25,8 +24,7 @@ dune_add_test(SOURCES FilesystemTest.cpp LINK_LIBRARIES amdis) dune_add_test(SOURCES MarkerTest.cpp - LINK_LIBRARIES amdis - CMD_ARGS "${CMAKE_SOURCE_DIR}/examples/init/marker.dat.2d") + LINK_LIBRARIES amdis) dune_add_test(SOURCES MultiTypeVectorTest.cpp LINK_LIBRARIES amdis) -- GitLab