From 8305b6f5ab80d861342a4c373aa8f3d5f34e22f1 Mon Sep 17 00:00:00 2001 From: Simon Praetorius <simon.praetorius@tu-dresden.de> Date: Wed, 13 Mar 2019 17:28:46 +0100 Subject: [PATCH] repaired eigen backend and added dune install script --- CMakeLists.txt | 6 ++-- README.md | 9 ++++- bin/install_all_dune_modules.sh | 34 +++++++++++++++++++ .../linearalgebra/eigen/SolverConfig.hpp | 2 +- .../linearalgebra/eigen/SolverCreator.hpp | 14 ++++---- 5 files changed, 54 insertions(+), 11 deletions(-) create mode 100755 bin/install_all_dune_modules.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index ae4d0162..de09ca6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(amdis CXX VERSION 0.2) +project(amdis LANGUAGES CXX VERSION 0.2) #find dune-common and set the module path find_package(dune-common REQUIRED) @@ -26,7 +26,9 @@ target_link_libraries(amdis fmt) option(ENABLE_ALL_WARNINGS "enable all meaningful warnings" OFF) if (ENABLE_ALL_WARNINGS) - target_compile_options(amdis PUBLIC "-Wall" "-Wextra" "-pedantic" "-Wnon-virtual-dtor" "-Wold-style-cast" "-Wcast-align" "-Woverloaded-virtual" "-Wpedantic" "-Wconversion") + target_compile_options(amdis PUBLIC "-Wall" "-Wextra" "-pedantic" "-Wnon-virtual-dtor" + "-Wold-style-cast" "-Wcast-align" "-Woverloaded-virtual" + "-Wpedantic" "-Wconversion") endif (ENABLE_ALL_WARNINGS) # finalize the dune project, e.g. generating config.h etc. diff --git a/README.md b/README.md index 85344c1e..e5970dde 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,14 @@ The `dunecontrol` script searches for the required (See the file `dune.module` for an up-to-date list of dependencies). The dune modules can be obtained from https://gitlab.dune-project.org and need to be found in a subdirectory of `DUNE_CONTROL_PATH`. See also https://dune-project.org/doc/installation -for details about the installation of dune modules. +for details about the installation of dune modules. You can use the script + +``` +bin/install_all_dune_modules.sh DOWNLOAD_DIR +``` + +to clone all dune repositories into `DOWNLOAD_DIR` and provide a simple way using `dunecontrol` +to install all of them at once. Additionally the following optional libraries can be used: - [MTL4](https://gitlab.math.tu-dresden.de/spraetor/mtl4) (use this fork to get up-to-date changes) diff --git a/bin/install_all_dune_modules.sh b/bin/install_all_dune_modules.sh new file mode 100755 index 00000000..c28675ab --- /dev/null +++ b/bin/install_all_dune_modules.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +if [ $# -lt 1 ]; then + echo "usage: $0 DOWNLOAD_DIR" + exit 1 +fi + +DOWNLOAD_DIR="$1" + +mkdir -p ${DOWNLOAD_DIR}/dune +cd ${DOWNLOAD_DIR}/dune + +CORE_MODULES=("dune-common" "dune-geometry" "dune-grid" "dune-istl" "dune-localfunctions") +STAGING_MODULES=("dune-functions" "dune-typetree" "dune-uggrid") +EXTENSIONS_MODULES=("dune-alugrid" "dune-spgrid" "dune-foamgrid") + +for MOD in ${CORE_MODULES[*]}; do + git clone https://gitlab.dune-project.org/core/${MOD}.git --branch releases/2.6 --single-branch +done + +for MOD in ${STAGING_MODULES[*]}; do + git clone https://gitlab.dune-project.org/staging/${MOD}.git --branch releases/2.6 --single-branch +done + +for MOD in ${EXTENSIONS_MODULES[*]}; do + git clone https://gitlab.dune-project.org/extensions/${MOD}.git --branch releases/2.6 --single-branch +done + +echo "" +echo "==============================================================" +echo "To build all dune modules run the commands... " +echo " DUNE_CONTROL_PATH=${DOWNLOAD_DIR}/dune dunecontrol configure" +echo " DUNE_CONTROL_PATH=${DOWNLOAD_DIR}/dune dunecontrol make -j4 " +echo "==============================================================" \ No newline at end of file diff --git a/src/amdis/linearalgebra/eigen/SolverConfig.hpp b/src/amdis/linearalgebra/eigen/SolverConfig.hpp index 3296aba7..cbc1b43e 100644 --- a/src/amdis/linearalgebra/eigen/SolverConfig.hpp +++ b/src/amdis/linearalgebra/eigen/SolverConfig.hpp @@ -72,7 +72,7 @@ namespace AMDiS static void init(std::string const& prefix, Eigen::UmfPackLU<M>& solver) { DUNE_UNUSED auto& control = solver.umfpackControl(); - // here, umfpack parameters could be initialized + // TODO: initialized umfpack parameters } }; #endif diff --git a/src/amdis/linearalgebra/eigen/SolverCreator.hpp b/src/amdis/linearalgebra/eigen/SolverCreator.hpp index 1e92827c..4110f9ef 100644 --- a/src/amdis/linearalgebra/eigen/SolverCreator.hpp +++ b/src/amdis/linearalgebra/eigen/SolverCreator.hpp @@ -30,7 +30,7 @@ namespace AMDiS using SolverBase = LinearSolverInterface<Matrix, VectorX, VectorB>; using Scalar = typename Matrix::Scalar; - std::unique_ptr<SolverBase> createWithString(std::string const& prefix) override + std::unique_ptr<SolverBase> createWithString(std::string prefix) override { // get creator string for preconditioner std::string precon = "no"; @@ -40,12 +40,12 @@ namespace AMDiS precon == "jacobi") { auto creator = SolverCreator<Eigen::DiagonalPreconditioner<Scalar>>{}; - return creator.create(prefix); + return creator.createWithString(prefix); } else if (precon == "ilu") { auto creator = SolverCreator<Eigen::IncompleteLUT<Scalar>>{}; - return creator.create(prefix); + return creator.createWithString(prefix); } else if (precon == "ic") { @@ -53,7 +53,7 @@ namespace AMDiS } else { auto creator = SolverCreator<Eigen::IdentityPreconditioner>{}; - return creator.create(prefix); + return creator.createWithString(prefix); } } @@ -62,18 +62,18 @@ namespace AMDiS using IncompleteCholesky = SolverCreator<Eigen::IncompleteCholesky<Scalar, Eigen::Lower|Eigen::Upper, Ordering>>; - std::unique_ptr<SolverBase> createIncompleteCholesky(std::string const& prefix) const + std::unique_ptr<SolverBase> createIncompleteCholesky(std::string prefix) const { std::string ordering = "amd"; Parameters::get(prefix + "->precon->ordering", ordering); if (ordering == "amd") { using AMD = Eigen::AMDOrdering<typename Matrix::StorageIndex>; - return IncompleteCholesky<AMD>{}.create(prefix); + return IncompleteCholesky<AMD>{}.createWithString(prefix); } else { using NATURAL = Eigen::NaturalOrdering<typename Matrix::StorageIndex>; - return IncompleteCholesky<NATURAL>{}.create(prefix); + return IncompleteCholesky<NATURAL>{}.createWithString(prefix); } } }; -- GitLab