#
# We support petsc from version 3.x.x onwards
#
- IF(PETSC_MAJOR LESS 3)
+ IF(PETSC_VERSION_MAJOR LESS 3)
MESSAGE(STATUS
"Could not find a sufficient modern petsc installation: "
"Version >=3.0.0 required!"
# _NOT_ enabled.
# So we check for this:
#
- FILE(STRINGS "${PETSC_PETSCCONF_H}" PETSC_RELEASE_STRING
- REGEX "#define.*PETSC_HAVE_MPIUNI 1")
- IF("${PETSC_RELEASE_STRING}" STREQUAL "")
- SET(PETSC_WITH_MPIUNI FALSE)
- ELSE()
- SET(PETSC_WITH_MPIUNI TRUE)
- ENDIF()
-
IF( (PETSC_WITH_MPIUNI AND DEAL_II_COMPILER_SUPPORTS_MPI)
OR
(NOT PETSC_WITH_MPIUNI AND NOT DEAL_II_COMPILER_SUPPORTS_MPI))
SET(${var} FALSE)
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: # TODO
+ # LIST(APPEND DEAL_II_EXTERNAL_INCLUDE_DIRS ${PETSC_INCLUDE_DIRS})
+
+ LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES
+ ${PETSC_LIBRARIES}
+ )
+
+ SET(DEAL_II_USE_PETSC TRUE)
+
+ #
+ # Work around a stupidity in PETSc that makes sure it interferes in
+ # a completely obnoxious way with boost.
+ # TODO: Obosolete?
+ #
+ ADD_DEFINITIONS(-DPETSC_SKIP_UNDERSCORE_CHKERR)
+
+ #
+ # Set some definitions for config.h:
+ #
+
+ IF(NOT PETSC_RELEASE)
+ SET(DEAL_II_USE_PETSC_DEV TRUE)
+ ENDIF()
+
+ IF(PETSC_COMPLEX)
+ SET(DEAL_II_USE_PETSC_COMPLEX TRUE)
+ ENDIF()
+
+ SET(DEAL_II_EXPAND_PETSC_VECTOR "PETScWrappers::Vector")
+ SET(DEAL_II_EXPAND_PETSC_MPI_VECTOR "PETScWrappers::MPI::Vector")
+ SET(DEAL_II_EXPAND_PETSC_BLOCKVECTOR "PETScWrappers::BlockVector")
+ SET(DEAL_II_EXPAND_PETSC_MPI_BLOCKVECTOR "PETScWrappers::MPI::BlockVector")
+
SET(${var} TRUE)
ENDMACRO()
#
# Try to find the petsc library
#
+# This module exports:
+#
+# PETSC_FOUND
+# PETSC_LIBRARIES
+# PETSC_INCLUDE_DIRS
+# PETSC_PETSCCONF_H
+# PETSC_PETSCVERSION_H
+# PETSC_VERSION
+# PETSC_VERSION_MAJOR
+# PETSC_VERSION_MINOR
+# PETSC_VERSION_SUBMINOR
+# PETSC_VERSION_PATCH
+# PETSC_RELEASE
+# PETSC_COMPLEX
+#
INCLUDE(FindPackageHandleStandardArgs)
PATH_SUFFIXES petsc
)
-FIND_LIBRARY(PETSC_LIBRARY
+FIND_LIBRARY(PETSC_LIBRARIES
NAMES petsc
HINTS
# petsc is special. Account for that
LIST(APPEND PETSC_INCLUDE_DIRS "${PETSC_DIR}/include")
ENDIF()
+
#
# Let's see whether we are able to find petscversion.h and petscconf.h:
#
NO_CMAKE_FIND_ROOT_PATH
)
+
+IF(NOT PETSC_PETSCCONF_H MATCHES "-NOTFOUND")
+
+ #
+ # Is petsc compiled with support for MPIUNI?
+ #
+ FILE(STRINGS "${PETSC_PETSCCONF_H}" PETSC_MPIUNI_STRING
+ REGEX "#define.*PETSC_HAVE_MPIUNI 1")
+ IF("${PETSC_MPIUNI_STRING}" STREQUAL "")
+ SET(PETSC_WITH_MPIUNI FALSE)
+ ELSE()
+ SET(PETSC_WITH_MPIUNI TRUE)
+ ENDIF()
+
+ IF(PETSC_WITH_MPIUNI)
+ #
+ # If yes, add libmpiuni.so/a (if available)
+ # We need to link with it on some systems where PETSc is built without
+ # a real MPI and we need to handle trivial (one process) MPI
+ # functionality.
+ #
+ FIND_LIBRARY(PETSC_LIBMPIUNI
+ NAMES mpiuni
+ HINTS
+ ${PETSC_DIR}/${PETSC_ARCH}
+ PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib
+ )
+ IF(NOT PETSC_LIBMPIUNI MATCHES "-NOTFOUND")
+ LIST(APPEND PETSC_LIBRARIES "${PETSC_LIBMPIUNI}")
+ ENDIF()
+ MARK_AS_ADVANCED(PETSC_LIBMPIUNI)
+ ENDIF()
+
+ENDIF()
+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PETSC DEFAULT_MSG
- PETSC_LIBRARY
+ PETSC_LIBRARIES
PETSC_INCLUDE_DIRS
PETSC_PETSCCONF_H
PETSC_PETSCVERSION_H
IF(PETSC_FOUND)
- FILE(STRINGS "${PETSC_PETSCVERSION_H}" PETSC_MAJOR_STRING
+ FILE(STRINGS "${PETSC_PETSCVERSION_H}" PETSC_VERSION_MAJOR_STRING
REGEX "#define.*PETSC_VERSION_MAJOR")
- STRING(REGEX REPLACE "^.*PETSC_VERSION_MAJOR.*([0-9]+).*" "\\1" PETSC_MAJOR "${PETSC_MAJOR_STRING}")
+ STRING(REGEX REPLACE "^.*PETSC_VERSION_MAJOR.*([0-9]+).*" "\\1"
+ PETSC_VERSION_MAJOR "${PETSC_VERSION_MAJOR_STRING}"
+ )
- FILE(STRINGS "${PETSC_PETSCVERSION_H}" PETSC_MINOR_STRING
+ FILE(STRINGS "${PETSC_PETSCVERSION_H}" PETSC_VERSION_MINOR_STRING
REGEX "#define.*PETSC_VERSION_MINOR")
- STRING(REGEX REPLACE "^.*PETSC_VERSION_MINOR.*([0-9]+).*" "\\1" PETSC_MINOR "${PETSC_MINOR_STRING}")
+ STRING(REGEX REPLACE "^.*PETSC_VERSION_MINOR.*([0-9]+).*" "\\1"
+ PETSC_VERSION_MINOR "${PETSC_VERSION_MINOR_STRING}"
+ )
- FILE(STRINGS "${PETSC_PETSCVERSION_H}" PETSC_SUBMINOR_STRING
+ FILE(STRINGS "${PETSC_PETSCVERSION_H}" PETSC_VERSION_SUBMINOR_STRING
REGEX "#define.*PETSC_VERSION_SUBMINOR")
- STRING(REGEX REPLACE "^.*PETSC_VERSION_SUBMINOR.*([0-9]+).*" "\\1" PETSC_SUBMINOR "${PETSC_SUBMINOR_STRING}")
+ STRING(REGEX REPLACE "^.*PETSC_VERSION_SUBMINOR.*([0-9]+).*" "\\1"
+ PETSC_VERSION_SUBMINOR "${PETSC_VERSION_SUBMINOR_STRING}"
+ )
+
+ FILE(STRINGS "${PETSC_PETSCVERSION_H}" PETSC_VERSION_PATCH_STRING
+ REGEX "#define.*PETSC_VERSION_PATCH")
+ STRING(REGEX REPLACE "^.*PETSC_VERSION_PATCH.*([0-9]+).*" "\\1"
+ PETSC_VERSION_PATCH "${PETSC_VERSION_PATCH_STRING}"
+ )
+
+ SET(PETSC_VERSION "${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}")
FILE(STRINGS "${PETSC_PETSCVERSION_H}" PETSC_RELEASE_STRING
REGEX "#define.*PETSC_VERSION_RELEASE.*1")
SET(PETSC_RELEASE TRUE)
ENDIF()
- SET(PETSC_VERSION "${PETSC_MAJOR}.${PETSC_MINOR}.${PETSC_SUBMINOR}")
+ FILE(STRINGS "${PETSC_PETSCCONF_H}" PETSC_COMPLEX_STRING
+ REGEX "#define.*PETSC_USE_COMPLEX.*1")
+ IF("${PETSC_COMPLEX_STRING}" STREQUAL "")
+ SET(PETSC_COMPLEX FALSE)
+ ELSE()
+ SET(PETSC_COMPLEX TRUE)
+ ENDIF()
MARK_AS_ADVANCED(
- PETSC_LIBRARY
- PETSC_INCLUDE_DIR
+ PETSC_LIBRARIES
+ PETSC_INCLUDE_DIRS
+ PETSC_PETSCCONF_H
+ PETSC_PETSCVERSION_H
)
ENDIF()
+++ /dev/null
-
- 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 PETSc, then the value of this variable expands to
- dnl defining the string "DEAL_II_USE_PETSC" for the preprocessor. If
- dnl we don't have no PETSc, then it does not define this string.
- DEAL_II_DEFINE_DEAL_II_USE_PETSC=DEAL_II_USE_PETSC
-
-
-
- dnl Also work around a stupidity in PETSc that makes sure it interferes in
- dnl a completely obnoxious way with boost.
- AC_DEFINE([PETSC_SKIP_UNDERSCORE_CHKERR], [1],
- [Make sure PETSc doesn't re-define the underscore through the preprocessor, since this interferes with boost. PETSc redefines the underscore to be "__gterr =", but then forgets to undef this thing. Boost simply wants to concatenate the underscore with another string to form a class name, which then of course isn't valid any more. See mails in early Feb 2006.])
- fi
-
-
-
- DEAL_II_EXPAND_PETSC_VECTOR="PETScWrappers::Vector"
- DEAL_II_EXPAND_PETSC_MPI_VECTOR="PETScWrappers::MPI::Vector"
- DEAL_II_EXPAND_PETSC_BLOCKVECTOR="PETScWrappers::BlockVector"
- DEAL_II_EXPAND_PETSC_MPI_BLOCKVECTOR="PETScWrappers::MPI::BlockVector"
-
- AC_DEFINE([DEAL_II_USE_PETSC_DEV], [1],
- [Defined if a PETSc installation was found and is not a release])
-
-
-
-dnl ------------------------------------------------------------
-dnl See if there is a library libmpiuni.a/so available. We need
-dnl to link with it on some systems where PETSc is built without
-dnl a real MPI and we need to handle trivial (one process) MPI
-dnl functionality.
-dnl
-dnl Usage: DEAL_II_CONFIGURE_PETSC_MPIUNI_LIB
-dnl
-dnl ------------------------------------------------------------
-AC_DEFUN(DEAL_II_CONFIGURE_PETSC_MPIUNI_LIB, dnl
-[
- AC_MSG_CHECKING([for PETSc libmpiuni library])
- case "${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}" in
- 3.*) dnl
- if test -f $DEAL_II_PETSC_DIR/$DEAL_II_PETSC_ARCH/lib/libmpiuni.a ; then
- DEAL_II_PETSC_MPIUNI_LIB="$DEAL_II_PETSC_DIR/$DEAL_II_PETSC_ARCH/lib/libmpiuni.a"
- fi
- ;;
- *) dnl
- AC_MSG_ERROR([Unknown PETSc version ${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}])
- ;;
- esac
-
- if test "$DEAL_II_PETSC_MPIUNI_LIB" = "" ; then
- AC_MSG_RESULT([not found])
- else
- AC_MSG_RESULT($DEAL_II_PETSC_MPIUNI_LIB)
- fi
-])
-
-
-dnl ------------------------------------------------------------
-dnl Figure out PETSc was compiled with --scalar-type=complex by
-dnl scanning PETSc configuration file.
-dnl
-dnl Warning: Up tp now, PETSc>3.0.0 is being supported and
-dnl deal.II will not safely compile if this option is "yes".
-dnl
-dnl Usage: DEAL_II_CONFIGURE_PETSC_COMPLEX
-dnl
-dnl ------------------------------------------------------------
-AC_DEFUN(DEAL_II_CONFIGURE_PETSC_COMPLEX, dnl
-[
- case "${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}" in
- 3.3*)
- AC_MSG_CHECKING([for PETSc scalar complex])
- DEAL_II_PETSC_COMPLEX=`cat $DEAL_II_PETSC_DIR/$DEAL_II_PETSC_ARCH/include/petscconf.h \
- | grep "#define PETSC_USE_COMPLEX" \
- | perl -pi -e 's/.*COMPLEX\s+//g;'`
- if test "$DEAL_II_PETSC_COMPLEX" = "1" ; then
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-
- dnl If we have previously found PETSc and here with a complex
- dnl scalar type then set the DEAL_II_USE_COMPLEX macro
- if test "$USE_CONTRIB_PETSC" = "yes" ; then
- if test "$DEAL_II_PETSC_COMPLEX" = "1" ; then
- AC_DEFINE([DEAL_II_USE_PETSC_COMPLEX], [1],
- [Defined if a PETSc installation was found with complex scalar type and is going to be used])
- fi fi
- ;;
- esac
-])
-
#cmakedefine HAVE_LIBNETCDF
-/*****************************************
+/****************************************
* Configured in configure_p4est.cmake: *
- *****************************************/
+ ****************************************/
/* Defined if we are to use the p4est library to distribute meshes on a
cluster computer. */
#cmakedefine DEAL_II_USE_P4EST
+/****************************************
+ * Configured in configure_petsc.cmake: *
+ ****************************************/
+
+/* Defined if a PETSc installation was found and is going to be used */
+#cmakedefine DEAL_II_USE_PETSC
+
+/* Define the PETSC version number: */
+#cmakedefine PETSC_VERSION_MAJOR @PETSC_VERSION_MAJOR@
+#cmakedefine PETSC_VERSION_MINOR @PETSC_VERSION_MINOR@
+#cmakedefine PETSC_VERSION_SUBMINOR @PETSC_VERSION_SUBMINOR@
+#cmakedefine PETSC_VERSION_SUBMINOR @PETSC_VERSION_SUBMINOR@
+
+/* Defined if a PETSc installation was found with complex scalar type and is
+ * going to be used
+ */
+#cmakedefine DEAL_II_USE_PETSC_COMPLEX
+
+/* Defined if a PETSc installation was found and is not a release */
+#cmakedefine DEAL_II_USE_PETSC_DEV
+
+/* Make sure PETSc doesn't re-define the underscore through the preprocessor,
+ * since this interferes with boost. PETSc redefines the underscore to be
+ * "__gterr =", but then forgets to undef this thing. Boost simply wants to
+ * concatenate the underscore with another string to form a class name, which
+ * then of course isn't valid any more. See mails in early Feb 2006.
+ */
+#cmakedefine PETSC_SKIP_UNDERSCORE_CHKERR
+
+/**
+ * These macros are defined to make testing for PETSc versions within
+ * the deal.II main code as simple as possible. In brief they are used
+ * like this: (i) DEAL_II_PETSC_VERSION_LT is used to advance the
+ * PETScWrappers to newer versions of PETSc while preserving backward
+ * compatibility; and (ii) DEAL_II_PETSC_VERSION_GTE is used to add
+ * functionality to the PETScWrappers that does not exist in previous
+ * versions of PETSc. Examples of usage can be found in
+ * lac/source/petsc_matrix_base.h. Note: SLEPcWrappers do not need
+ * their own analogical macros, since SLEPc and PETSc must have
+ * identical version numbers anyways.
+ */
+#define DEAL_II_PETSC_VERSION_LT(major,minor,subminor) \
+ ((PETSC_VERSION_MAJOR * 10000 + \
+ PETSC_VERSION_MINOR * 100 + \
+ PETSC_VERSION_SUBMINOR) \
+ < \
+ (major)*10000 + (minor)*100 + (subminor))
+
+#define DEAL_II_PETSC_VERSION_GTE(major,minor,subminor) \
+ ((PETSC_VERSION_MAJOR * 10000 + \
+ PETSC_VERSION_MINOR * 100 + \
+ PETSC_VERSION_SUBMINOR) \
+ >= \
+ (major)*10000 + (minor)*100 + (subminor))
+
+
/**************************************
* Configured in configure_tbb.cmake: *
**************************************/
/* Defined if a MUMPS installation was found and is going to be used */
#cmakedefine DEAL_II_USE_MUMPS
-/* Defined if a PETSc installation was found and is going to be used */
-#cmakedefine DEAL_II_USE_PETSC
-
-/* Defined if a PETSc installation was found with complex scalar type and is
- going to be used */
-#cmakedefine DEAL_II_USE_PETSC_COMPLEX
-
-/* Defined if a PETSc installation was found and is not a release */
-#cmakedefine DEAL_II_USE_PETSC_DEV
-
/* Defined if a SLEPc installation was found and is going to be used */
#cmakedefine DEAL_II_USE_SLEPC
/* Availability of the MA47 algorithm from HSL */
#cmakedefine HAVE_HSL_MA47
-/* Make sure PETSc doesn't re-define the underscore through the preprocessor,
- since this interferes with boost. PETSc redefines the underscore to be
- "__gterr =", but then forgets to undef this thing. Boost simply wants to
- concatenate the underscore with another string to form a class name, which
- then of course isn't valid any more. See mails in early Feb 2006. */
-#cmakedefine PETSC_SKIP_UNDERSCORE_CHKERR
-
-
/**
* A #define that indicates whether we are using the Microsoft
* Windows Visual C/C++ compiler. We currently do not run ./configure
# endif
#endif
-/**
- * These macros are defined to make testing for PETSc versions within
- * the deal.II main code as simple as possible. In brief they are used
- * like this: (i) DEAL_II_PETSC_VERSION_LT is used to advance the
- * PETScWrappers to newer versions of PETSc while preserving backward
- * compatibility; and (ii) DEAL_II_PETSC_VERSION_GTE is used to add
- * functionality to the PETScWrappers that does not exist in previous
- * versions of PETSc. Examples of usage can be found in
- * lac/source/petsc_matrix_base.h. Note: SLEPcWrappers do not need
- * their own analogical macros, since SLEPc and PETSc must have
- * identical version numbers anyways.
- */
-#define DEAL_II_PETSC_VERSION_LT(major,minor,subminor) \
- ((PETSC_VERSION_MAJOR * 10000 + \
- PETSC_VERSION_MINOR * 100 + \
- PETSC_VERSION_SUBMINOR) \
- < \
- (major)*10000 + (minor)*100 + (subminor))
-
-#define DEAL_II_PETSC_VERSION_GTE(major,minor,subminor) \
- ((PETSC_VERSION_MAJOR * 10000 + \
- PETSC_VERSION_MINOR * 100 + \
- PETSC_VERSION_SUBMINOR) \
- >= \
- (major)*10000 + (minor)*100 + (subminor))
#include <deal.II/base/numbers.h>
#include <deal.II/base/types.h>