From e9081ee06cb322043e4c425c03c3609a894cc7cb Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving <arne.morten.kvarving@sintef.no> Date: Thu, 12 May 2016 13:57:52 +0200 Subject: [PATCH] added: support superlu 5 API for solver routine changed. Since there is no versioning in SuperLU we have to do a probe to detect the new library. --- cmake/modules/FindSuperLU.cmake | 20 ++++++++++++++++++-- config.h.cmake | 3 +++ dune/istl/superlu.hh | 7 +++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/cmake/modules/FindSuperLU.cmake b/cmake/modules/FindSuperLU.cmake index df205773..f4a90b25 100644 --- a/cmake/modules/FindSuperLU.cmake +++ b/cmake/modules/FindSuperLU.cmake @@ -90,15 +90,31 @@ int main(void) return SLU_DOUBLE; }" SUPERLU_MIN_VERSION_4_3) + +CHECK_C_SOURCE_COMPILES(" +#include <slu_ddefs.h> +int main(void) +{ + dgssvx(NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, + NULL, 1, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL); +}" +SUPERLU_MIN_VERSION_5) + cmake_pop_check_state() -if(SUPERLU_MIN_VERSION_4_3) +if(SUPERLU_MIN_VERSION_5) + set(SUPERLU_WITH_VERSION "SuperLU >= 5.0" CACHE STRING + "Human readable string containing SuperLU version information.") +elseif(SUPERLU_MIN_VERSION_4_3) set(SUPERLU_WITH_VERSION "SuperLU >= 4.3" CACHE STRING "Human readable string containing SuperLU version information.") else() set(SUPERLU_WITH_VERSION "SuperLU <= 4.2 and >= 4.0" CACHE STRING "Human readable string containing SuperLU version information.") -endif(SUPERLU_MIN_VERSION_4_3) +endif() # behave like a CMake module is supposed to behave include(FindPackageHandleStandardArgs) diff --git a/config.h.cmake b/config.h.cmake index e1542aff..29df279a 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -40,6 +40,9 @@ /* define to 1 if SuperLU header slu_ddefs.h contains SLU_DOUBLE */ #cmakedefine SUPERLU_MIN_VERSION_4_3 @SUPERLU_MIN_VERSION_4_3@ +/* define to 1 if SuperLU dgssvx takes a GlobalLU_t parameter */ +#cmakedefine SUPERLU_MIN_VERSION_5 @SUPERLU_MIN_VERSION_5@ + /* Define to the version of dune-istl */ #define DUNE_ISTL_VERSION "${DUNE_ISTL_VERSION}" diff --git a/dune/istl/superlu.hh b/dune/istl/superlu.hh index a018f8b0..e148e222 100644 --- a/dune/istl/superlu.hh +++ b/dune/istl/superlu.hh @@ -146,9 +146,16 @@ namespace Dune double *rpg, double *rcond, double *ferr, double *berr, mem_usage_t *memusage, SuperLUStat_t *stat, int *info) { +#if SUPERLU_MIN_VER_5 + GlobalLU_t gLU; + dgssvx(options, mat, perm_c, perm_r, etree, equed, R, C, + L, U, work, lwork, B, X, rpg, rcond, ferr, berr, + &gLU, memusage, stat, info); +#else dgssvx(options, mat, perm_c, perm_r, etree, equed, R, C, L, U, work, lwork, B, X, rpg, rcond, ferr, berr, memusage, stat, info); +#endif } }; -- GitLab