]> https://gitweb.dealii.org/ - dealii.git/commitdiff
add check if sundials has idas
authorJulian Andrej <juan@tf.uni-kiel.de>
Mon, 11 Dec 2017 12:12:47 +0000 (13:12 +0100)
committerJulian Andrej <juan@tf.uni-kiel.de>
Mon, 11 Dec 2017 12:12:47 +0000 (13:12 +0100)
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.

cmake/modules/FindSUNDIALS.cmake
include/deal.II/sundials/ida.h
source/sundials/ida.cc

index bddb8c8d51b3636d53ad3df725d956a4408f5e20..30fe2f8eca92b9a99639abab83415f71c1aa07dc 100644 (file)
@@ -18,7 +18,7 @@
 #
 # This module exports
 #
-#   SUNDIALS_LIB_IDA
+#   SUNDIALS_LIB_IDA(S)
 #   SUNDIALS_LIB_ARKODE
 #   SUNDIALS_LIB_KINSOL
 #   SUNDIALS_LIB_PAR
 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
   )
 
index 5441c4675f773d178e519cccab1324973a8fedb2..1ebbe34bb083fc22d4f5dcfe5fc658630ca5ad1d 100644 (file)
 #include <deal.II/lac/vector.h>
 #include <deal.II/lac/vector_memory.h>
 
-
+#ifdef DEAL_II_WITH_SUNDIALS_IDAS
+#include <idas/idas.h>
+#else
 #include <ida/ida.h>
-#include <ida/ida_spils.h>
+#endif
+
 #include <sundials/sundials_config.h>
 #if DEAL_II_SUNDIALS_VERSION_LT(3,0,0)
 #  include <ida/ida_spgmr.h>
index cd887d4ed75775d5d1e197e2b98aca6599541f0d..f0eef9a12c433690d0310e7ed89878297fb6edb9 100644 (file)
 #include <deal.II/base/utilities.h>
 #include <deal.II/sundials/copy.h>
 
+#ifdef DEAL_II_WITH_SUNDIALS_IDAS
+#pragma message "compiling with idas"
+#include <idas/idas_impl.h>
+#else
+#pragma message "compiling with ida"
+#include <ida/ida_impl.h>
+#endif
+
 #include <iostream>
 #include <iomanip>
-#include <ida/ida_impl.h>
 
 DEAL_II_NAMESPACE_OPEN
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.