]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add support for p4est
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 17 Sep 2012 21:00:58 +0000 (21:00 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 17 Sep 2012 21:00:58 +0000 (21:00 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_cmake@26451 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/CMakeLists.txt
deal.II/contrib/cmake/configure/configure_p4est.cmake [new file with mode: 0644]
deal.II/contrib/cmake/configure/configure_tbb.cmake
deal.II/contrib/cmake/modules/FindP4EST.cmake [new file with mode: 0644]
deal.II/contrib/cmake/modules/FindSC.cmake [new file with mode: 0644]
deal.II/features.m4
deal.II/include/deal.II/base/config.h.in
deal.II/include/deal.II/base/config.h.in.old
deal.II/source/dofs/dof_tools.cc

index 19f9ee25be454d05dd2a20f4036e491a75a7bfa2..fbc43305c43e267cdb3bb174c13b84acd8815103 100644 (file)
@@ -123,6 +123,10 @@ OPTION(DEAL_II_WITH_NETCDF
   "Build deal.II with support for netcdf."
   OFF)
 
+OPTION(DEAL_II_WITH_P4EST
+  "Build deal.II with support for P4EST."
+  OFF)
+
 OPTION(DEAL_II_WITH_TBB
   "Build deal.II with support for tbb. This will enable thread support in deal.II."
   OFF)
@@ -132,7 +136,7 @@ OPTION(DEAL_II_FORCE_CONTRIB_TBB
 
 OPTION(DEAL_II_WITH_TRILINOS
   "Build deal.II with support for trilinos."
-  ON)
+  OFF)
 
 OPTION(DEAL_II_WITH_UMFPACK
   "Build deal.II with support for UMFPACK."
@@ -269,6 +273,8 @@ INCLUDE(configure_mpi)
 
 INCLUDE(configure_netcdf)
 
+INCLUDE(configure_p4est)
+
 INCLUDE(configure_tbb)
 
 INCLUDE(configure_trilinos)
diff --git a/deal.II/contrib/cmake/configure/configure_p4est.cmake b/deal.II/contrib/cmake/configure/configure_p4est.cmake
new file mode 100644 (file)
index 0000000..d0f452a
--- /dev/null
@@ -0,0 +1,71 @@
+#
+# Configuration for the umfpack and amd libraries:
+#
+
+
+SET(FEATURE_P4EST_DEPENDS
+  DEAL_II_WITH_MPI
+  )
+
+
+MACRO(FEATURE_P4EST_FIND_EXTERNAL var)
+
+  FIND_PACKAGE(P4EST)
+  FIND_PACKAGE(SC)
+
+  IF(P4EST_FOUND AND SC_FOUND)
+    SET(${var} TRUE)
+  ENDIF()
+
+ENDMACRO()
+
+
+MACRO(FEATURE_P4EST_CONFIGURE_EXTERNAL var)
+
+  INCLUDE_DIRECTORIES(${P4EST_INCLUDE_DIR} ${SC_INCLUDE_DIR})
+
+  IF (CMAKE_BUILD_TYPE MATCHES "Debug")
+    IF(P4EST_DEBUG_FOUND AND SC_DEBUG_FOUND)
+      LIST(APPEND deal_ii_external_libraries
+        ${P4EST_DEBUG_LIBRARY} ${SC_DEBUG_LIBRARY}
+        )
+    ELSE()
+      MESSAGE(WARNING "
+deal.II was configured with CMAKE_BUILD_TYPE=Debug but no debug p4est and
+sc libraries were found. The regular p4est and sc libraries will be used
+instead.
+
+")
+      LIST(APPEND deal_ii_external_libraries
+        ${P4EST_LIBRARY} ${SC_LIBRARY}
+        )
+    ENDIF()
+  ELSE()
+    LIST(APPEND deal_ii_external_libraries
+      ${P4EST_LIBRARY} ${SC_LIBRARY}
+      )
+  ENDIF()
+
+  SET(DEAL_II_USE_P4EST TRUE)
+
+  SET(${var} TRUE)
+
+ENDMACRO()
+
+
+SET(FEATURE_P4EST_CUSTOM_ERROR_MESSAGE TRUE)
+
+
+MACRO(FEATURE_P4EST_ERROR_MESSAGE)
+  MESSAGE(SEND_ERROR "
+Could not find the p4est and sc libraries!
+
+Please ensure that the libraries are installed on your computer.
+If the libraries are not at a default location, either provide some hints
+for the autodetection, or set the relevant variables by hand in ccmake.
+
+")
+ENDMACRO()
+
+
+CONFIGURE_FEATURE(P4EST)
index e8883da6e70400163cd7642e68eeb1c8981d699d..ea8e1672ff6100935952007696222ac3513a97cf 100644 (file)
@@ -88,11 +88,6 @@ MACRO(FEATURE_TBB_FIND_EXTERNAL var)
 
   FIND_PACKAGE(TBB)
 
-  # In case we don't have a debug library:
-  IF(NOT TBB_DEBUG_FOUND)
-    SET(TBB_DEBUG_LIBRARY ${TBB_LIBRARY})
-  ENDIF()
-
   IF(TBB_FOUND)
     SET(${var} TRUE)
   ENDIF()
@@ -105,7 +100,17 @@ MACRO(FEATURE_TBB_CONFIGURE_EXTERNAL var)
   INCLUDE_DIRECTORIES(${TBB_INCLUDE_DIR})
 
   IF (CMAKE_BUILD_TYPE MATCHES "Debug")
-    LIST(APPEND deal_ii_external_libraries ${TBB_DEBUG_LIBRARY})
+    IF(TBB_DEBUG_FOUND)
+      LIST(APPEND deal_ii_external_libraries ${TBB_DEBUG_LIBRARY})
+    ELSE()
+      MESSAGE(WARNING "
+deal.II was configured with CMAKE_BUILD_TYPE=Debug but no debug tbb
+library was found. The regular tbb library will be used instead.
+
+")
+      LIST(APPEND deal_ii_external_libraries ${TBB_LIBRARY})
+    ENDIF()
+
   ELSE()
     LIST(APPEND deal_ii_external_libraries ${TBB_LIBRARY})
   ENDIF()
diff --git a/deal.II/contrib/cmake/modules/FindP4EST.cmake b/deal.II/contrib/cmake/modules/FindP4EST.cmake
new file mode 100644 (file)
index 0000000..e8336b6
--- /dev/null
@@ -0,0 +1,26 @@
+# Try to find P4EST
+
+INCLUDE(FindPackageHandleStandardArgs)
+
+FIND_PATH(P4EST_INCLUDE_DIR p4est.h)
+
+FIND_LIBRARY(P4EST_LIBRARY
+  NAMES p4est
+  PATH_SUFFIXES lib64 lib
+)
+
+FIND_LIBRARY(P4EST_DEBUG_LIBRARY
+  NAMES p4est_debug p4est.g
+  PATH_SUFFIXES lib64 lib
+)
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(P4EST DEFAULT_MSG P4EST_LIBRARY P4EST_INCLUDE_DIR)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(P4EST_DEBUG DEFAULT_MSG P4EST_DEBUG_LIBRARY P4EST_INCLUDE_DIR)
+
+IF(P4EST_FOUND)
+  MARK_AS_ADVANCED(
+    P4EST_LIBRARY
+    P4EST_DEBUG_LIBRARY
+    P4EST_INCLUDE_DIR
+  )
+ENDIF()
diff --git a/deal.II/contrib/cmake/modules/FindSC.cmake b/deal.II/contrib/cmake/modules/FindSC.cmake
new file mode 100644 (file)
index 0000000..702f55f
--- /dev/null
@@ -0,0 +1,27 @@
+# Try to find SC
+
+INCLUDE(FindPackageHandleStandardArgs)
+
+FIND_PATH(SC_INCLUDE_DIR sc.h)
+
+
+FIND_LIBRARY(SC_LIBRARY
+  NAMES sc
+  PATH_SUFFIXES lib64 lib
+)
+
+FIND_LIBRARY(SC_DEBUG_LIBRARY
+  NAMES sc_debug sc.g
+  PATH_SUFFIXES lib64 lib
+)
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SC DEFAULT_MSG SC_LIBRARY SC_INCLUDE_DIR)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SC_DEBUG DEFAULT_MSG SC_DEBUG_LIBRARY SC_INCLUDE_DIR)
+
+IF(SC_FOUND)
+  MARK_AS_ADVANCED(
+    SC_LIBRARY
+    SC_DEBUG_LIBRARY
+    SC_INCLUDE_DIR
+  )
+ENDIF()
index 6e62f0955702db87f5dd3469d9962bbe00963482..57bad77cb02dd89689d174e1720f4139307cdfc1 100644 (file)
@@ -749,63 +749,10 @@ dnl
 dnl Usage: DEAL_II_CONFIGURE_P4EST
 dnl
 dnl ------------------------------------------------------------
-AC_DEFUN(DEAL_II_CONFIGURE_P4EST, dnl
-[
-  AC_MSG_CHECKING(whether p4est will be used)
-
-  AC_ARG_WITH(p4est,
-             [AS_HELP_STRING([--with-p4est=/path/to/p4est],
-             [Specify the path to the p4est installation; use this to distribute meshes on a cluster computer.])],
-              use_p4est=$withval,
-              use_p4est=no)
-
-  if test "x$use_p4est" != "xno" ; then
-    AC_MSG_RESULT(yes)
-
     dnl Verify that the p4est files are actually there
-    if test ! -d "${use_p4est}/DEBUG" -o ! -d "${use_p4est}/FAST" ; then
-      AC_MSG_ERROR([p4est directories $use_p4est/DEBUG or $use_p4est/FAST not found])
-    fi
 
     dnl Make sure that we have also enabled MPI
+
     if test "x${DEAL_II_COMPILER_SUPPORTS_MPI}" != "x1" ; then
       AC_MSG_ERROR([When using p4est you also need to enable MPI.])
     fi
-
-    dnl Right now, we always build p4est as shared lib, so make sure we
-    dnl have built deal.II as a shared lib as well
-    if test "x$enableshared" != "xyes" ; then
-      AC_MSG_ERROR([When using p4est with shared libraries, you need to build
-                    deal.II with shared libraries as well.])
-    fi
-
-    AC_DEFINE(DEAL_II_USE_P4EST, 1,
-              [Defined if we are to use the p4est library to distribute
-               meshes on a cluster computer.])
-    USE_CONTRIB_P4EST=yes
-    AC_SUBST(USE_CONTRIB_P4EST)
-
-    DEAL_II_P4EST_DIR=${use_p4est}
-    AC_SUBST(DEAL_II_P4EST_DIR)
-
-    CXXFLAGSG="$CXXFLAGSG -I$use_p4est/DEBUG/include"
-    CXXFLAGSO="$CXXFLAGSO -I$use_p4est/FAST/include"
-
-    AC_MSG_CHECKING(for p4est library directory)
-    if test -d "$use_p4est/DEBUG/lib64" -a -d "$use_p4est/FAST/lib64" ; then
-      AC_MSG_RESULT(lib64)
-      DEAL_II_P4EST_LIBDIR_NAME=lib64
-    else
-      if test -d "$use_p4est/DEBUG/lib" -a -d "$use_p4est/FAST/lib" ; then
-        AC_MSG_RESULT(lib)
-        DEAL_II_P4EST_LIBDIR_NAME=lib
-      else
-        AC_MSG_ERROR(could not determine whether p4est stores its library in lib/ or lib64/ directories)
-      fi
-    fi
-    AC_SUBST(DEAL_II_P4EST_LIBDIR_NAME)
-
-  else
-    AC_MSG_RESULT(no)
-  fi
-])
index da99e9328d66e3c670c6ea04b2c5dda72ed0cddc..292363135dbbbd3b6b176eda505bc40a5e42a08c 100644 (file)
 #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_tbb.cmake: *
  **************************************/
index fbb87918cd7fd884ff51acd18c892ff32b669c03..b381758f2257aed84b981d383048e81369252415 100644 (file)
 /* Defined if a MUMPS installation was found and is going to be used */
 #cmakedefine DEAL_II_USE_MUMPS
 
-/* Defined if we are to use the p4est library to distribute meshes on a
-   cluster computer. */
-#cmakedefine DEAL_II_USE_P4EST
-
 /* Defined if a PETSc installation was found and is going to be used */
 #cmakedefine DEAL_II_USE_PETSC
 
index 6b7d7276663c6390ef8b6851b96615c7ea7cee34..b5a834e0d3a70da2d863cc8e10a28ef657a30b48 100644 (file)
@@ -4954,7 +4954,7 @@ namespace DoFTools
                           block);
 
 #ifdef DEAL_II_USE_P4EST
-#if DEAL_II_COMPILER_SUPPORTS_MPI
+#ifdef DEAL_II_COMPILER_SUPPORTS_MPI
                                          // if we are working on a parallel
                                          // mesh, we now need to collect
                                          // this information from all

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.