]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add support for SLEPc, code cleanup
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 23 Oct 2012 10:14:42 +0000 (10:14 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 23 Oct 2012 10:14:42 +0000 (10:14 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_cmake@27174 0785d39b-7218-0410-832d-ea1e28bc413d

20 files changed:
deal.II/cmake/configure/configure_1_mpi.cmake
deal.II/cmake/configure/configure_1_tbb.cmake
deal.II/cmake/configure/configure_arpack.cmake
deal.II/cmake/configure/configure_boost.cmake
deal.II/cmake/configure/configure_functionparser.cmake
deal.II/cmake/configure/configure_hdf5.cmake
deal.II/cmake/configure/configure_lapack.cmake
deal.II/cmake/configure/configure_metis.cmake
deal.II/cmake/configure/configure_mumps.cmake
deal.II/cmake/configure/configure_netcdf.cmake
deal.II/cmake/configure/configure_p4est.cmake
deal.II/cmake/configure/configure_petsc.cmake
deal.II/cmake/configure/configure_slepc.cmake [new file with mode: 0644]
deal.II/cmake/configure/configure_trilinos.cmake
deal.II/cmake/configure/configure_umfpack.cmake
deal.II/cmake/features.m4
deal.II/cmake/modules/FindPETSC.cmake
deal.II/cmake/modules/FindSLEPC.cmake [new file with mode: 0644]
deal.II/include/deal.II/base/config.h.in
deal.II/include/deal.II/base/config.h.in.old

index e8bf9ad62f16890f45fbb5a051b81e5eee6239ec..669c2d7c7cc6604f843f8f1b9ea71486988d724c 100644 (file)
@@ -64,7 +64,7 @@ SET(FEATURE_MPI_CUSTOM_ERROR_MESSAGE TRUE)
 
 MACRO(FEATURE_MPI_ERROR_MESSAGE)
   MESSAGE(FATAL_ERROR "\n"
-    "Could not find any suitable mpi library!\n\n"
+    "Could not find any suitable mpi library!\n"
     "Please ensure that an mpi library is installed on your computer.\n"
     "If the library is not at a default location, either provide some hints\n"
     "for the autodetection, or set the relevant variables by hand in ccmake.\n"
@@ -73,4 +73,3 @@ ENDMACRO()
 
 
 CONFIGURE_FEATURE(MPI)
-
index e881213a6ddf6586e0cffb18730e0d9632f2c218..4d4567c34ce9e707da3eeb90317a6cda07e51e37 100644 (file)
@@ -124,7 +124,6 @@ ENDMACRO()
 
 
 MACRO(FEATURE_TBB_CONFIGURE_EXTERNAL var)
-
   INCLUDE_DIRECTORIES(${TBB_INCLUDE_DIR})
 
   IF (CMAKE_BUILD_TYPE MATCHES "Debug")
@@ -152,7 +151,6 @@ ENDMACRO()
 
 
 MACRO(FEATURE_TBB_CONFIGURE_BUNDLED var)
-
   #
   # Setup threading (before configuring our build...)
   # and if successfull return TRUE:
@@ -180,4 +178,3 @@ ENDMACRO()
 
 
 CONFIGURE_FEATURE(TBB)
-
index 9f67911072dc8d540285e36bcf77879a52026aa5..6e4ef1ef0e94eb5a93fbbd3e521f4f2da009c3ee 100644 (file)
@@ -27,7 +27,6 @@ ENDMACRO()
 
 
 MACRO(FEATURE_ARPACK_CONFIGURE_EXTERNAL var)
-
   LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${ARPACK_LIBRARIES})
   ADD_FLAGS(CMAKE_SHARED_LINKER_FLAGS "${ARPACK_LINKER_FLAGS}")
 
@@ -38,4 +37,3 @@ ENDMACRO()
 
 
 CONFIGURE_FEATURE(ARPACK)
-
index 327aca8465638cc23198ffbeefcdc224cc537951..a00bae58cad894fe37cc9ea269d44207d30c3677 100644 (file)
@@ -49,7 +49,6 @@ ENDMACRO()
 
 
 MACRO(FEATURE_BOOST_CONFIGURE_EXTERNAL var)
-
   INCLUDE_DIRECTORIES (${Boost_INCLUDE_DIR})
 
   IF (CMAKE_BUILD_TYPE MATCHES "Debug")
@@ -69,7 +68,6 @@ ENDMACRO()
 
 
 MACRO(FEATURE_BOOST_CONFIGURE_BUNDLED var)
-
   #
   # We need to set some definitions to use the headers of the bundled boost
   # library:
@@ -102,4 +100,3 @@ IF(NOT DEAL_II_WITH_BOOST)
       )
   ENDIF()
 ENDIF()
-
index 399b22b4b40c9712990bd46f9ebd3a639ff0d37c..ad92d512282590af0b7301c4900dcd1ff7a6cb1b 100644 (file)
@@ -46,4 +46,3 @@ ENDMACRO()
 
 
 CONFIGURE_FEATURE(FUNCTIONPARSER)
-
index 62f8502ae77a992f4f74cce333ab6f9f2ce6fbf0..f77a4add115ad426c15bf498bc804b495dae0636 100644 (file)
@@ -41,7 +41,7 @@ SET(FEATURE_HDF5_CUSTOM_ERROR_MESSAGE TRUE)
 
 MACRO(FEATURE_HDF5_ERROR_MESSAGE)
   MESSAGE(FATAL_ERROR "\n"
-    "Could not find the hdf5 library!\n\n"
+    "Could not find the hdf5 library!\n"
     "Please ensure that the hdf5 library is installed on your computer.\n"
     "If the library is not at a default location, either provide some hints\n"
     "for the autodetection:\n"
@@ -53,4 +53,3 @@ ENDMACRO()
 
 
 CONFIGURE_FEATURE(HDF5)
-
index 91fc3bcbe810fbc70890e29c9a9fa7f1e9c59717..f8bf62cf7d6b1a16144b17b9a5cc4772a721aac9 100644 (file)
@@ -36,9 +36,6 @@ ENDMACRO()
 # function we use. We have to ensure that this check is repeated every time
 # the lapack library or DEAL_II_WITH_LAPACK changes.
 #
-# TODO: Known bug: At the moment we don't cover the case when the lapack
-#                  library changes..
-#
 
 SET(DEAL_II_LAPACK_FUNCTIONS
   daxpy_ dgeev_ dgeevx_ dgelsd_ dgemm_ dgemv_ dgeqrf_ dgesdd_ dgesvd_ dgetrf_
@@ -70,7 +67,6 @@ ENDMACRO()
 
 
 MACRO(FEATURE_LAPACK_CONFIGURE_EXTERNAL var)
-
   ADD_FLAGS(CMAKE_SHARED_LINKER_FLAGS "${LAPACK_LINKER_FLAGS}")
 
   LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES
@@ -80,15 +76,12 @@ MACRO(FEATURE_LAPACK_CONFIGURE_EXTERNAL var)
   CHECK_FOR_LAPACK_FUNCTIONS()
 
   SET(HAVE_LIBLAPACK TRUE)
-
   SET(${var} TRUE)
-
 ENDMACRO()
 
 
 CONFIGURE_FEATURE(LAPACK)
 
-
 #
 # Call RESET_LAPACK_FUNCTIONS_CHECK if DEAL_II_WITH_LAPACK is unset to
 # clean the configuration
@@ -96,4 +89,3 @@ CONFIGURE_FEATURE(LAPACK)
 IF(NOT DEAL_II_WITH_LAPACK)
   RESET_LAPACK_FUNCTIONS_CACHE()
 ENDIF()
-
index e55ad648ace6b60e40284e718acdb2bbd25cf656..2ad1d6366fc9e7510f7e3275a24b9682cf39b186 100644 (file)
@@ -52,7 +52,7 @@ SET(FEATURE_METIS_CUSTOM_ERROR_MESSAGE TRUE)
 
 MACRO(FEATURE_METIS_ERROR_MESSAGE)
   MESSAGE(FATAL_ERROR "\n"
-    "Could not find the metis library!\n\n"
+    "Could not find the metis library!\n"
     "Please ensure that the metis library version 5.0 or newer is installed on your computer.\n"
     "If the library is not at a default location, either provide some hints\n"
     "for the autodetection:\n"
@@ -64,4 +64,3 @@ ENDMACRO()
 
 
 CONFIGURE_FEATURE(METIS)
-
index 743c8257520f8f23c75b0431a14b3e190b009d24..05f25a0434c5526ed7dcb6d6a1e9a44c6ec2f752 100644 (file)
@@ -30,7 +30,6 @@ ENDMACRO()
 
 
 MACRO(FEATURE_MUMPS_CONFIGURE_EXTERNAL var)
-
   INCLUDE_DIRECTORIES(${MUMPS_INCLUDE_DIRS})
   LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES
     ${MUMPS_LIBRARIES}
@@ -62,4 +61,3 @@ ENDMACRO()
 
 
 CONFIGURE_FEATURE(MUMPS)
-
index cc5e4546ce63953cbdab1cba7e89370c14f34151..3ae1f84682877b072bbbf074e1198d9af54eb23f 100644 (file)
@@ -36,4 +36,3 @@ ENDMACRO()
 
 
 CONFIGURE_FEATURE(NETCDF)
-
index 281caac72c424273aec11955c531b9af6467ac15..028ca79a9496ec1d646bd80bcf10d32ce7d36467 100644 (file)
@@ -21,7 +21,6 @@ SET(FEATURE_P4EST_DEPENDS DEAL_II_WITH_MPI)
 
 
 MACRO(FEATURE_P4EST_FIND_EXTERNAL var)
-
   FIND_PACKAGE(P4EST)
 
   IF(P4EST_FOUND)
@@ -42,7 +41,6 @@ ENDMACRO()
 
 
 MACRO(FEATURE_P4EST_CONFIGURE_EXTERNAL var)
-
   INCLUDE_DIRECTORIES(${P4EST_INCLUDE_DIRS})
 
   # The user has to know the location of the p4est headers as well:
@@ -61,7 +59,7 @@ SET(FEATURE_P4EST_CUSTOM_ERROR_MESSAGE TRUE)
 
 MACRO(FEATURE_P4EST_ERROR_MESSAGE)
   MESSAGE(FATAL_ERROR "\n"
-    "Could not find the p4est and sc libraries!\n\n"
+    "Could not find the p4est and sc libraries!\n"
     "Please ensure that the libraries are installed on your computer.\n"
     "If the libraries are not at a default location, either provide some hints\n"
     "for the autodetection:\n"
@@ -73,4 +71,3 @@ ENDMACRO()
 
 
 CONFIGURE_FEATURE(P4EST)
-
index 392ed2bf9c6d3df7b41baa7a9e59862f5f14337d..1b3f67c30c71fddc5971779e9a8ce798c537993a 100644 (file)
@@ -63,12 +63,10 @@ MACRO(FEATURE_PETSC_FIND_EXTERNAL var)
       UNSET(PETSC_LIBRARIES CACHE)
     ENDIF()
   ENDIF()
-
 ENDMACRO()
 
 
 MACRO(FEATURE_PETSC_CONFIGURE_EXTERNAL var)
-
   INCLUDE_DIRECTORIES(${PETSC_INCLUDE_DIRS})
 
   # The user has to know the location of the petsc headers as well:
@@ -85,7 +83,6 @@ MACRO(FEATURE_PETSC_CONFIGURE_EXTERNAL var)
   #
   ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-long-long")
 
-
   SET(DEAL_II_EXPAND_PETSC_VECTOR "PETScWrappers::Vector")
   SET(DEAL_II_EXPAND_PETSC_BLOCKVECTOR "PETScWrappers::BlockVector")
 
@@ -103,8 +100,9 @@ SET(FEATURE_PETSC_CUSTOM_ERROR_MESSAGE TRUE)
 
 MACRO(FEATURE_PETSC_ERROR_MESSAGE)
   MESSAGE(FATAL_ERROR "\n"
-    "Could not find the petsc library!\n\n"
+    "Could not find the petsc library!\n"
     "Please ensure that the petsc library version 3.0.0 or newer is installed on your computer.\n"
+    "Furthermore PETSc has to be configured with the same mpi options as deal.II.\n"
     "If the library is not at a default location, either provide some hints\n"
     "for the autodetection:\n"
     "PETSc installed with --prefix=<...> to a destination:\n"
@@ -119,4 +117,3 @@ ENDMACRO()
 
 
 CONFIGURE_FEATURE(PETSC)
-
diff --git a/deal.II/cmake/configure/configure_slepc.cmake b/deal.II/cmake/configure/configure_slepc.cmake
new file mode 100644 (file)
index 0000000..0f66434
--- /dev/null
@@ -0,0 +1,88 @@
+#####
+##
+## Copyright (C) 2012 by the deal.II authors
+##
+## This file is part of the deal.II library.
+##
+## <TODO: Full License information>
+## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later
+## version of the LGPL license.
+##
+## Author: Matthias Maier <matthias.maier@iwr.uni-heidelberg.de>
+##
+#####
+
+#
+# Configuration for the SLEPC library:
+#
+
+
+SET(FEATURE_SLEPC_DEPENDS DEAL_II_WITH_PETSC)
+
+
+MACRO(FEATURE_SLEPC_FIND_EXTERNAL var)
+  FIND_PACKAGE(SLEPC)
+
+  IF(SLEPC_FOUND)
+    #
+    # Check whether SLEPc and PETSc are compatible.
+    #
+    IF("${SLEPC_VERSION}" STREQUAL "${PETSC_VERSION}")
+      SET(${var} TRUE)
+    ELSE()
+
+      MESSAGE(WARNING "\n"
+        "Could not find a sufficient SLEPc installation: "
+        "The SLEPc library must have the same version as the PETSc library.\n\n"
+        )
+      UNSET(SLEPC_INCLUDE_DIR_ARCH CACHE)
+      UNSET(SLEPC_INCLUDE_DIR_COMMON CACHE)
+      UNSET(SLEPC_INCLUDE_DIRS CACHE)
+      UNSET(SLEPC_LIBRARIES CACHE)
+
+      SET(${var} FALSE)
+    ENDIF()
+  ENDIF()
+
+ENDMACRO()
+
+
+MACRO(FEATURE_SLEPC_CONFIGURE_EXTERNAL var)
+  INCLUDE_DIRECTORIES(${SLEPC_INCLUDE_DIRS})
+
+  # The user has to know the location of the SLEPC headers as well:
+  LIST(APPEND DEAL_II_USER_INCLUDE_DIRS ${SLEPC_INCLUDE_DIRS})
+
+  LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES
+    ${SLEPC_LIBRARIES}
+    )
+
+  SET(DEAL_II_USE_SLEPC TRUE)
+
+  SET(${var} TRUE)
+ENDMACRO()
+
+
+SET(FEATURE_SLEPC_CUSTOM_ERROR_MESSAGE TRUE)
+
+
+MACRO(FEATURE_SLEPC_ERROR_MESSAGE)
+  MESSAGE(FATAL_ERROR "\n"
+    "Could not find the SLEPc library!\n"
+    "Please ensure that the SLEPc library version 3.0.0 or newer is installed on your computer\n"
+    "and the version is the same as the one of the installed PETSc library.\n"
+    "If the library is not at a default location, either provide some hints\n"
+    "for the autodetection:\n"
+    "SLEPc installed with --prefix=<...> to a destination:\n"
+    "    $ SLEPC_DIR=\"...\" cmake <...>\n"
+    "    $ cmake -DSLEPC_DIR=\"...\" <...>\n"
+    "SLEPc compiled in source tree:\n"
+    "    $ SLEPC_DIR=\"...\"  SLEPC_ARCH=\"...\" cmake <...>\n"
+    "    $ cmake -DSLEPC_DIR=\"...\" -DSLEPC_ARCH=\"...\" <...>\n"
+    "or set the relevant variables by hand in ccmake.\n\n"
+    )
+ENDMACRO()
+
+
+CONFIGURE_FEATURE(SLEPC)
+
index ad24c26128a38d15a112f6944f974a58852aa8c2..5c974e70c8a07c40e895c8fe2f49aac24594bff8 100644 (file)
@@ -214,6 +214,8 @@ MACRO(FEATURE_TRILINOS_ERROR_MESSAGE)
   MESSAGE(FATAL_ERROR "\n"
     "Could not find a suitable set of trilinos libraries!\n"
     "Please ensure that all necessary libraries are installed on your computer.\n"
+    "Some Trilinos versions have bugs that make it incompatible with deal.II.\n"
+    "(There will be a warning above if this is the case)\n"
     "If the libraries are not at a default location, either provide some hints\n"
     "for the autodetection:\n"
     "    $ TRILINOS_DIR=\"...\" cmake <...>\n"
@@ -224,4 +226,3 @@ ENDMACRO()
 
 
 CONFIGURE_FEATURE(TRILINOS)
-
index fbe7b75560a288955d7f624aa0966270c0ef4ec3..b4509f4e05d9d9be3ad90faa3fa713652b91104b 100644 (file)
@@ -81,4 +81,3 @@ ENDMACRO()
 
 
 CONFIGURE_FEATURE(UMFPACK)
-
index 1542d699a665bd14f8a3ef17f99f61e57622c358..eaa7c11e9017d2910ca8e5307c5e9c3bbf3e942f 100644 (file)
@@ -28,130 +28,3 @@ AC_DEFUN(DEAL_II_CONFIGURE_TECPLOT, dnl
     DEAL_II_ADD_EXTERNAL_LIBS_AT_FRONT($TECPLOT_LIB)
   fi
 ])
-
-
-
-dnl ------------------------------------------------------------
-dnl Check whether SLEPc is installed, and if so store the
-dnl respective links.
-dnl
-dnl Usage: DEAL_II_CONFIGURE_SLEPC
-dnl
-dnl ------------------------------------------------------------
-AC_DEFUN(DEAL_II_CONFIGURE_SLEPC, dnl
-[
-  AC_MSG_CHECKING([for SLEPc include directory])
-  AC_ARG_WITH(slepc,
-              [AS_HELP_STRING([--with-slepc=path/to/slepc],
-              [Specify the path to the SLEPc installation, for which the include directory is a subdir; use this if you want to override the SLEPC_DIR environment variable.])],
-              [dnl Special case when someone does --with-slepc=no
-               if test "x$withval" = "xno" ; then
-                 AC_MSG_RESULT([explicitly disabled])
-                 USE_CONTRIB_SLEPC=no
-               else
-                 USE_CONTRIB_SLEPC=yes
-                 DEAL_II_SLEPC_DIR="$withval"
-                 AC_MSG_RESULT($DEAL_II_SLEPC_DIR)
-
-                 dnl Make sure that what was specified is actually correct
-               if test ! -d $DEAL_II_SLEPC_DIR \
-                    -o ! -d $DEAL_II_SLEPC_DIR/include \
-                    ; then
-                 AC_MSG_ERROR([Path to SLEPc specified with --with-slepc does not point to a complete SLEPc installation])
-               fi
-
-               if test ! -d $DEAL_II_SLEPC_DIR/$DEAL_II_PETSC_ARCH \
-                    -o ! -d $DEAL_II_SLEPC_DIR/$DEAL_II_PETSC_ARCH/lib \
-                    ; then
-            AC_MSG_ERROR([SLEPc has not been compiled for the PETSc architecture])
-               fi
-               fi
-              ],
-              [dnl Take something from the environment variables, if it is there
-               if test "x$SLEPC_DIR" != "x" ; then
-                 USE_CONTRIB_SLEPC=yes
-                 DEAL_II_SLEPC_DIR="$SLEPC_DIR"
-                 AC_MSG_RESULT($DEAL_II_SLEPC_DIR)
-
-               dnl Make sure that what this is actually correct
-               if test ! -d $DEAL_II_SLEPC_DIR \
-                    -o ! -d $DEAL_II_SLEPC_DIR/include \
-                    ; then
-                 AC_MSG_ERROR([The path to SLEPc specified in the SLEPC_DIR environment variable does not point to a complete SLEPc installation])
-               fi
-               else
-                 USE_CONTRIB_SLEPC=no
-                 DEAL_II_SLEPC_DIR=""
-                 AC_MSG_RESULT(not found)
-               fi
-              ])
-
-  if test "$USE_CONTRIB_SLEPC" = "yes" ; then
-    AC_DEFINE([DEAL_II_USE_SLEPC], [1],
-              [Defined if a SLEPc installation was found and is going to be used])
-
-    dnl Set an additional variable (not via AC_DEFINE, since we don't want
-    dnl to have it in config.h) which we can use in doc/doxygen/options.dox.in.
-    dnl If we have SLEPc, then the value of this variable expands to
-    dnl defining the string "DEAL_II_USE_SLEPC" for the preprocessor. If
-    dnl we don't have no SLEPc, then it does not define this string.
-    DEAL_II_DEFINE_DEAL_II_USE_SLEPC=DEAL_II_USE_SLEPC
-  fi
-
-  dnl If we have found SLEPc, determine additional pieces of data
-  if test "$USE_CONTRIB_SLEPC" = "yes" \
-       ; then
-    DEAL_II_CONFIGURE_SLEPC_VERSION
-
-    dnl Finally set with_slepc if this hasn't happened yet
-    if test "x$with_slepc" = "x" ; then
-      with_slepc="yes"
-  fi fi
-])
-
-dnl ------------------------------------------------------------
-dnl Figure out the version numbers of SLEPc and compare with
-dnl version numbers of PETSc. This is not strictly necessary
-dnl but highly recommended that major, minor, and subminor
-dnl version match. We blissfully ignor patch versions and hope
-dnl for the best. If you want to overide all this you can.
-dnl
-dnl Usage: DEAL_II_CONFIGURE_SLEPC_VERSION
-dnl
-dnl ------------------------------------------------------------
-AC_DEFUN(DEAL_II_CONFIGURE_SLEPC_VERSION, dnl
-[
-  AC_MSG_CHECKING([for SLEPc version])
-  DEAL_II_SLEPC_VERSION_MAJOR=`cat $DEAL_II_SLEPC_DIR/include/slepcversion.h \
-                               | grep "#define SLEPC_VERSION_MAJOR" \
-                               | perl -pi -e 's/.*MAJOR\s+//g;'`
-  DEAL_II_SLEPC_VERSION_MINOR=`cat $DEAL_II_SLEPC_DIR/include/slepcversion.h \
-                               | grep "#define SLEPC_VERSION_MINOR" \
-                               | perl -pi -e 's/.*MINOR\s+//g;'`
-  DEAL_II_SLEPC_VERSION_SUBMINOR=`cat $DEAL_II_SLEPC_DIR/include/slepcversion.h \
-                               | grep "#define SLEPC_VERSION_SUBMINOR" \
-                               | perl -pi -e 's/.*MINOR\s+//g;'`
-  SLEPC_VERSION="$DEAL_II_SLEPC_VERSION_MAJOR.$DEAL_II_SLEPC_VERSION_MINOR.$DEAL_II_SLEPC_VERSION_SUBMINOR"
-
-  dnl Here is where we check if the SLEPc version we have is a
-  dnl release but do nothing about it.
-  SLEPC_RELEASE=`cat $DEAL_II_SLEPC_DIR/include/slepcversion.h \
-               | grep "#define SLEPC_VERSION_RELEASE" \
-               | perl -pi -e 's/.*RELEASE\s+//g;'`
-  if test "$SLEPC_RELEASE" = "0" ; then
-    SLEPC_VERSION+="-dev"
-  else
-    SLEPC_VERSION+=""
-  fi
-  AC_MSG_RESULT($SLEPC_VERSION)
-
-  dnl Then check that PETSc and SLEPc versions are compatible ie. that
-  dnl they are equivalent. Patch numbers don't count for anything anymore,
-  dnl but, we do include whether PETSc and SLEPc are both release
-  dnl versions in the check. If they are not, we vomit.
-  if test "${PETSC_VERSION}" != "${SLEPC_VERSION}" \
-       -o "${PETSC_RELEASE}" != "${SLEPC_RELEASE}" \
-       ; then
-          AC_MSG_ERROR([If SLEPc is used, you must use the same version number as your PETSc Installation])
-  fi
-])
index a22d4d34bebf0bcefb36f70789da240276763301..ff8e4aa6d134fe42e72559bf4c3512ebc7eef3bc 100644 (file)
@@ -77,9 +77,9 @@ FIND_PATH(PETSC_INCLUDE_DIR_ARCH petscconf.h
   HINTS
     # petsc is special. Account for that
     ${PETSC_DIR}
-    ${PETSC_DIR}/${PETSC_ARCH}/include
+    ${PETSC_DIR}/${PETSC_ARCH}
     ${PETSC_INCLUDE_DIRS}
-  PATH_SUFFIXES include petsc
+  PATH_SUFFIXES petsc include include/petsc
 )
 
 #
@@ -98,9 +98,9 @@ FIND_PATH(PETSC_INCLUDE_DIR_ARCH petscconf.h
 FIND_PATH(PETSC_INCLUDE_DIR_COMMON petscversion.h
   HINTS
     ${PETSC_DIR}
-    ${PETSC_DIR}/${PETSC_ARCH}/include
+    ${PETSC_DIR}/${PETSC_ARCH}
     ${PETSC_INCLUDE_DIRS}
-  PATH_SUFFIXES petsc
+  PATH_SUFFIXES petsc include include/petsc
 )
 
 #
@@ -129,6 +129,8 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(PETSC DEFAULT_MSG
   )
 
 IF(PETSC_FOUND)
+  SET(PETSC_PETSCCONF_H "${PETSC_INCLUDE_DIR_ARCH}/petscconf.h")
+  SET(PETSC_PETSCVERSION_H "${PETSC_INCLUDE_DIR_COMMON}/petscversion.h")
 
   #
   # Is petsc compiled with support for MPIUNI?
@@ -165,7 +167,6 @@ IF(PETSC_FOUND)
     MARK_AS_ADVANCED(PETSC_LIBMPIUNI)
   ENDIF()
 
-
   FILE(STRINGS "${PETSC_PETSCVERSION_H}" PETSC_VERSION_MAJOR_STRING
     REGEX "#define.*PETSC_VERSION_MAJOR")
   STRING(REGEX REPLACE "^.*PETSC_VERSION_MAJOR.*([0-9]+).*" "\\1"
diff --git a/deal.II/cmake/modules/FindSLEPC.cmake b/deal.II/cmake/modules/FindSLEPC.cmake
new file mode 100644 (file)
index 0000000..b9c35f8
--- /dev/null
@@ -0,0 +1,162 @@
+#####
+##
+## Copyright (C) 2012 by the deal.II authors
+##
+## This file is part of the deal.II library.
+##
+## <TODO: Full License information>
+## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later
+## version of the LGPL license.
+##
+## Author: Matthias Maier <matthias.maier@iwr.uni-heidelberg.de>
+##
+#####
+
+#
+# Try to find the SLEPC library
+#
+# This module exports:
+#
+#     SLEPC_FOUND
+#     SLEPC_LIBRARIES
+#     SLEPC_INCLUDE_DIRS
+#     SLEPC_VERSION
+#     SLEPC_VERSION_MAJOR
+#     SLEPC_VERSION_MINOR
+#     SLEPC_VERSION_SUBMINOR
+#     SLEPC_VERSION_PATCH
+#
+
+INCLUDE(FindPackageHandleStandardArgs)
+
+SET_IF_EMPTY(SLEPC_DIR "$ENV{SLEPC_DIR}")
+SET_IF_EMPTY(SLEPC_ARCH "$ENV{SLEPC_ARCH}")
+SET_IF_EMPTY(PETSC_DIR "$ENV{PETSC_DIR}")
+
+#
+# Luckily, SLEPc wants the same insanity as PETSc, so we can just copy the
+# mechanism.
+#
+
+FIND_LIBRARY(SLEPC_LIBRARIES
+  NAMES slepc
+  HINTS
+    # SLEPC is special. Account for that
+    ${SLEPC_DIR}
+    ${SLEPC_DIR}/${SLEPC_ARCH}
+    ${PETSC_DIR}
+  PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib
+)
+
+
+#
+# So, up to this point it was easy. Now, the tricky part:
+#
+
+
+#
+# Search for the first part of the includes:
+#
+FIND_PATH(SLEPC_INCLUDE_DIR_ARCH slepcconf.h
+  HINTS
+    # SLEPC is special. Account for that
+    ${SLEPC_DIR}
+    ${SLEPC_DIR}/${SLEPC_ARCH}
+    ${SLEPC_INCLUDE_DIRS}
+    ${PETSC_DIR}
+  PATH_SUFFIXES slepc include include/slepc
+)
+
+#
+# Sometimes, this is not enough...
+# If SLEPc is not installed but in source tree layout, there will be
+#   ${SLEPC_DIR}/${SLEPC_ARCH}/include - which we should have found by now.
+#   ${SLEPC_DIR}/include               - which we still have to find.
+#
+# Or it is installed in a non standard layout in the system (e.g. in
+# Gentoo), where there will be
+#   ${SLEPC_DIR}/${SLEPC_ARCH}/include
+#   /usr/include/slepc ...
+#
+# Either way, slepcversion.h should lie around:
+#
+FIND_PATH(SLEPC_INCLUDE_DIR_COMMON slepcversion.h
+  HINTS
+    ${SLEPC_DIR}
+    ${SLEPC_DIR}/${SLEPC_ARCH}
+    ${SLEPC_INCLUDE_DIRS}
+    ${PETSC_DIR}
+  PATH_SUFFIXES slepc include include/slepc
+)
+
+#
+# And finally set SLEPC_INCLUDE_DIRS depending on the outcome of our crude
+# guess:
+#
+IF( SLEPC_INCLUDE_DIR_ARCH MATCHES "-NOTFOUND" OR
+    SLEPC_INCLUDE_DIR_COMMON MATCHES "-NOTFOUND" )
+  SET(SLEPC_INCLUDE_DIRS "SLEPC_INCLUDE_DIRS-NOTFOUND"
+    CACHE STRING "Include paths for SLEPC"
+    FORCE
+    )
+  UNSET(SLEPC_INCLUDE_DIR_ARCH CACHE)
+  UNSET(SLEPC_INCLUDE_DIR_COMMON CACHE)
+ELSE()
+  UNSET(SLEPC_INCLUDE_DIRS CACHE)
+  SET(SLEPC_INCLUDE_DIRS
+    ${SLEPC_INCLUDE_DIR_ARCH}
+    ${SLEPC_INCLUDE_DIR_COMMON}
+    )
+ENDIF()
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SLEPC DEFAULT_MSG
+  SLEPC_LIBRARIES
+  SLEPC_INCLUDE_DIRS
+  )
+
+IF(SLEPC_FOUND)
+  SET(SLEPC_SLEPCVERSION_H "${SLEPC_INCLUDE_DIR_COMMON}/slepcversion.h")
+
+  FILE(STRINGS "${SLEPC_SLEPCVERSION_H}" SLEPC_VERSION_MAJOR_STRING
+    REGEX "#define.*SLEPC_VERSION_MAJOR")
+  STRING(REGEX REPLACE "^.*SLEPC_VERSION_MAJOR.*([0-9]+).*" "\\1"
+    SLEPC_VERSION_MAJOR "${SLEPC_VERSION_MAJOR_STRING}"
+    )
+
+  FILE(STRINGS "${SLEPC_SLEPCVERSION_H}" SLEPC_VERSION_MINOR_STRING
+    REGEX "#define.*SLEPC_VERSION_MINOR")
+  STRING(REGEX REPLACE "^.*SLEPC_VERSION_MINOR.*([0-9]+).*" "\\1"
+    SLEPC_VERSION_MINOR "${SLEPC_VERSION_MINOR_STRING}"
+    )
+
+  FILE(STRINGS "${SLEPC_SLEPCVERSION_H}" SLEPC_VERSION_SUBMINOR_STRING
+    REGEX "#define.*SLEPC_VERSION_SUBMINOR")
+  STRING(REGEX REPLACE "^.*SLEPC_VERSION_SUBMINOR.*([0-9]+).*" "\\1"
+    SLEPC_VERSION_SUBMINOR "${SLEPC_VERSION_SUBMINOR_STRING}"
+    )
+
+  FILE(STRINGS "${SLEPC_SLEPCVERSION_H}" SLEPC_VERSION_PATCH_STRING
+    REGEX "#define.*SLEPC_VERSION_PATCH")
+  STRING(REGEX REPLACE "^.*SLEPC_VERSION_PATCH.*([0-9]+).*" "\\1"
+    SLEPC_VERSION_PATCH "${SLEPC_VERSION_PATCH_STRING}"
+    )
+
+  SET(SLEPC_VERSION "${SLEPC_VERSION_MAJOR}.${SLEPC_VERSION_MINOR}.${SLEPC_VERSION_SUBMINOR}")
+
+  MARK_AS_ADVANCED(
+    SLEPC_ARCH
+    SLEPC_DIR
+    SLEPC_INCLUDE_DIR_ARCH
+    SLEPC_INCLUDE_DIR_COMMON
+    SLEPC_INCLUDE_DIRS
+    SLEPC_LIBRARIES
+  )
+ELSE()
+  SET(SLEPC_DIR "" CACHE STRING
+    "An optional hint to a SLEPC directory"
+    )
+  SET(SLEPC_ARCH "" CACHE STRING
+    "An optional hint to a SLEPC arch"
+    )
+ENDIF()
+
index 22f67a0e157504e9ea5a2e4c8836515a260889e6..717627e80348298538dde56b598a543379bd188b 100644 (file)
     (major)*10000 + (minor)*100 + (subminor))
 
 
+/****************************************
+ * Configured in configure_slepc.cmake: *
+ ****************************************/
+
+/* Defined if a SLEPc installation was found and is going to be used */
+#cmakedefine DEAL_II_USE_SLEPC
+
+
 /**************************************
  * Configured in configure_tbb.cmake: *
  **************************************/
index 7aea871350acc2841d8a0a9e19fff08c7eb843dc..bb3cefc6065ca2ac5fdfdf5855c26c5bd9b9f741 100644 (file)
@@ -109,9 +109,6 @@ BUGS:
    this bug. */
 #cmakedefine DEAL_II_TEMPL_SPEC_FRIEND_BUG
 
-/* Defined if a SLEPc installation was found and is going to be used */
-#cmakedefine DEAL_II_USE_SLEPC
-
 /* This error appears in the Apple edition of the gcc 3.3, which ships with
    Darwin7.9.0 and probably previous version. It leads to problems during
    linking. For the details, look at aclocal.m4 in the top-level directory. */

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.