diff --git a/dune/istl/superlu.hh b/dune/istl/superlu.hh index 3bd934f9e331b419f77539d88e8ddf199d644b20..ad564a2b44fa5c3e25bc0002fb56bed4c7247d17 100644 --- a/dune/istl/superlu.hh +++ b/dune/istl/superlu.hh @@ -14,6 +14,7 @@ #include "slu_ddefs.h" #else #include "dsp_defs.h" +#warning Support for SuperLU older than SuperLU 3.0 from August 2005 is deprecated. #endif #include "solvers.hh" #include "supermatrix.hh" @@ -348,7 +349,11 @@ namespace Dune double def0=d.two_norm(); */ + #if SUPERLU_MIN_VERSION_4_3 + options.IterRefine=SLU_DOUBLE; + #else options.IterRefine=DOUBLE; + #endif dgssvx(&options, &static_cast<SuperMatrix&>(mat), perm_c, perm_r, etree, &equed, R, C, &L, &U, work, lwork, &B, &X, &rpg, &rcond, &ferr, &berr, @@ -413,7 +418,11 @@ namespace Dune /* Initialize the statistics variables. */ StatInit(&stat); + #if SUPERLU_MIN_VERSION_4_3 + options.IterRefine=SLU_DOUBLE; + #else options.IterRefine=DOUBLE; + #endif dgssvx(&options, &static_cast<SuperMatrix&>(mat), perm_c, perm_r, etree, &equed, R, C, &L, &U, work, lwork, &B, &X, &rpg, &rcond, &ferr, &berr, diff --git a/m4/superlu.m4 b/m4/superlu.m4 index 160b9fe0f75c4024bdcec6656efe28732d1ecb2a..6a4008f5c6d3485e9614b5c7b2405c94b24b7c58 100644 --- a/m4/superlu.m4 +++ b/m4/superlu.m4 @@ -98,7 +98,7 @@ AC_DEFUN([_slu_search_default], # # Shell variables: # with_superlu -# "no", "yes (post 2005)" or "yes (pre 2005)" +# "no", "yes (version 4.3 or newer)", "yes (version 4.2 or older, post 2005)" or "yes (pre 2005)" # direct_SUPERLU_CPPFLAGS # direct_SUPERLU_LIBS # CPPFLAGS and LIBS necessary to link against SuperLU. This variable @@ -128,6 +128,9 @@ AC_DEFUN([_slu_search_default], # SUPERLU_POST_2005_VERSION # 1 or undefined. A post-2005 version of SuperLU uses the header # "slu_ddefs.h" while earlier versions use "dsp_defs.h". +# SUPERLU_MIN_VERSION_4_3 +# 1 or undefined. SuperLU version 4.3 or newer uses the symbol +# "SLU_DOUBLE" while earlier versions use "DOUBLE". # HAVE_MEM_USAGE_T_EXPANSIONS # 1 or undefined. Whether "mem_usage_t.expansions" was found in # "slu_ddefs.h" or "dsp_defs.h" as apropriate. @@ -261,6 +264,11 @@ AC_DEFUN([DUNE_PATH_SUPERLU],[ HAVE_SUPERLU="1" ]) fi + + # test whether SuperLU version is at least 4.3 + if test $HAVE_SUPERLU = "1" ; then + AC_CHECK_DECL([SLU_DOUBLE], [SUPERLU_MIN_VERSION_4_3="1"], [], [#include <$my_slu_header>]) + fi fi else # $with_superlu = no @@ -271,7 +279,11 @@ AC_DEFUN([DUNE_PATH_SUPERLU],[ AC_MSG_CHECKING([SuperLU]) if test x$HAVE_SUPERLU = x1 ; then if test "$my_slu_header" = "slu_ddefs.h"; then - with_superlu="yes (post 2005)" + if test x$SUPERLU_MIN_VERSION_4_3 = x1 ; then + with_superlu="yes (version 4.3 or newer)" + else + with_superlu="yes (version 4.2 or older, post 2005)" + fi else with_superlu="yes (pre 2005)" fi @@ -306,6 +318,9 @@ AC_DEFUN([DUNE_PATH_SUPERLU],[ AC_DEFINE([HAVE_SUPERLU], [ENABLE_SUPERLU], [Define to ENABLE_SUPERLU if SUPERLU is found]) if test "$my_slu_header" = "slu_ddefs.h"; then AC_DEFINE([SUPERLU_POST_2005_VERSION], 1, [define to 1 if there is a header slu_ddefs.h in SuperLU]) + if test x$SUPERLU_MIN_VERSION_4_3 = x1 ; then + AC_DEFINE([SUPERLU_MIN_VERSION_4_3], 1, [define to 1 if there SLU_DOUBLE imported by header slu_ddefs.h from SuperLU]) + fi fi fi