From: Julian Andrej Date: Mon, 11 Dec 2017 12:12:47 +0000 (+0100) Subject: add check if sundials has idas X-Git-Tag: v9.0.0-rc1~612^2~4 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e205bcb5b0979015270ec4c929769462d28ab8f;p=dealii.git add check if sundials has idas Check if sundials has idas enabled and switch out header files correspondingly. This ensures that only IDA or IDAS libs are linked, since they can not coexist. --- diff --git a/cmake/modules/FindSUNDIALS.cmake b/cmake/modules/FindSUNDIALS.cmake index bddb8c8d51..30fe2f8eca 100644 --- a/cmake/modules/FindSUNDIALS.cmake +++ b/cmake/modules/FindSUNDIALS.cmake @@ -18,7 +18,7 @@ # # This module exports # -# SUNDIALS_LIB_IDA +# SUNDIALS_LIB_IDA(S) # SUNDIALS_LIB_ARKODE # SUNDIALS_LIB_KINSOL # SUNDIALS_LIB_PAR @@ -38,11 +38,22 @@ SET(SUNDIALS_DIR "" CACHE PATH "An optional hint to a SUNDIALS_DIR installation") SET_IF_EMPTY(SUNDIALS_DIR "$ENV{SUNDIALS_DIR}") -DEAL_II_FIND_LIBRARY(SUNDIALS_LIB_IDA NAMES sundials_ida +DEAL_II_FIND_LIBRARY(SUNDIALS_LIB_IDAS NAMES sundials_idas HINTS ${SUNDIALS_DIR} PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib ) +IF(SUNDIALS_LIB_IDAS MATCHES "-NOTFOUND") + DEAL_II_FIND_LIBRARY(SUNDIALS_LIB_IDA NAMES sundials_ida + HINTS ${SUNDIALS_DIR} + PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib + ) + SET(SUNDIALS_IDA_TYPE "IDA") +ELSE() + ADD_DEFINITIONS(-DDEAL_II_WITH_SUNDIALS_IDAS) + SET(SUNDIALS_IDA_TYPE "IDAS") +ENDIF() + DEAL_II_FIND_LIBRARY(SUNDIALS_LIB_ARKODE NAMES sundials_arkode HINTS ${SUNDIALS_DIR} PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib @@ -81,23 +92,23 @@ IF(DEAL_II_WITH_MPI) SET(_sundials_additional_libs SUNDIALS_LIB_PAR) DEAL_II_PACKAGE_HANDLE(SUNDIALS LIBRARIES REQUIRED - SUNDIALS_LIB_IDA SUNDIALS_LIB_ARKODE SUNDIALS_LIB_KINSOL SUNDIALS_LIB_SER SUNDIALS_LIB_PAR + SUNDIALS_LIB_${SUNDIALS_IDA_TYPE} SUNDIALS_LIB_ARKODE SUNDIALS_LIB_KINSOL SUNDIALS_LIB_SER SUNDIALS_LIB_PAR ${_sundials_additional_libs} INCLUDE_DIRS REQUIRED SUNDIALS_INCLUDE_DIR USER_INCLUDE_DIRS REQUIRED SUNDIALS_INCLUDE_DIR CLEAR - SUNDIALS_LIB_IDA SUNDIALS_LIB_ARKODE SUNDIALS_LIB_KINSOL + SUNDIALS_LIB_${SUNDIALS_IDA_TYPE} SUNDIALS_LIB_ARKODE SUNDIALS_LIB_KINSOL SUNDIALS_LIB_SER SUNDIALS_LIB_PAR ) ELSE() DEAL_II_PACKAGE_HANDLE(SUNDIALS LIBRARIES REQUIRED - SUNDIALS_LIB_IDA SUNDIALS_LIB_ARKODE SUNDIALS_LIB_KINSOL SUNDIALS_LIB_SER + SUNDIALS_LIB_${SUNDIALS_IDA_TYPE} SUNDIALS_LIB_ARKODE SUNDIALS_LIB_KINSOL SUNDIALS_LIB_SER ${_sundials_additional_libs} INCLUDE_DIRS REQUIRED SUNDIALS_INCLUDE_DIR USER_INCLUDE_DIRS REQUIRED SUNDIALS_INCLUDE_DIR CLEAR - SUNDIALS_LIB_IDA SUNDIALS_LIB_ARKODE SUNDIALS_LIB_KINSOL + SUNDIALS_LIB_${SUNDIALS_IDA_TYPE} SUNDIALS_LIB_ARKODE SUNDIALS_LIB_KINSOL SUNDIALS_LIB_SER ) diff --git a/include/deal.II/sundials/ida.h b/include/deal.II/sundials/ida.h index 5441c4675f..1ebbe34bb0 100644 --- a/include/deal.II/sundials/ida.h +++ b/include/deal.II/sundials/ida.h @@ -32,9 +32,12 @@ #include #include - +#ifdef DEAL_II_WITH_SUNDIALS_IDAS +#include +#else #include -#include +#endif + #include #if DEAL_II_SUNDIALS_VERSION_LT(3,0,0) # include diff --git a/source/sundials/ida.cc b/source/sundials/ida.cc index cd887d4ed7..f0eef9a12c 100644 --- a/source/sundials/ida.cc +++ b/source/sundials/ida.cc @@ -32,9 +32,16 @@ #include #include +#ifdef DEAL_II_WITH_SUNDIALS_IDAS +#pragma message "compiling with idas" +#include +#else +#pragma message "compiling with ida" +#include +#endif + #include #include -#include DEAL_II_NAMESPACE_OPEN