diff --git a/gnu-system.am b/gnu-system.am index 45d9db1dde..a3c56a800c 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -413,6 +413,7 @@ dist_patch_DATA = \ gnu/packages/patches/clucene-contribs-lib.patch \ gnu/packages/patches/cursynth-wave-rand.patch \ gnu/packages/patches/dbus-localstatedir.patch \ + gnu/packages/patches/dealii-p4est-interface.patch \ gnu/packages/patches/diffutils-gets-undeclared.patch \ gnu/packages/patches/dfu-programmer-fix-libusb.patch \ gnu/packages/patches/doxygen-test.patch \ diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm index 3a74eb8e4d..7eb2f5aeae 100644 --- a/gnu/packages/maths.scm +++ b/gnu/packages/maths.scm @@ -37,6 +37,7 @@ (define-module (gnu packages maths) #:use-module (guix build-system gnu) #:use-module (gnu packages algebra) #:use-module (gnu packages bison) + #:use-module (gnu packages boost) #:use-module (gnu packages check) #:use-module (gnu packages cmake) #:use-module (gnu packages compression) @@ -72,7 +73,8 @@ (define-module (gnu packages maths) #:use-module (gnu packages texlive) #:use-module (gnu packages wxwidgets) #:use-module (gnu packages xml) - #:use-module (gnu packages zip)) + #:use-module (gnu packages zip) + #:use-module (srfi srfi-1)) (define-public units (package @@ -1847,3 +1849,83 @@ (define-public lpsolve "lp_solve is a mixed integer linear programming solver based on the revised simplex and the branch-and-bound methods.") (license license:lgpl2.1+))) + +(define-public dealii + (package + (name "dealii") + (version "8.2.1") + (source + (origin + (method url-fetch) + (uri (string-append "https://github.com/dealii/dealii/releases/" + "download/v" version "/dealii-" version ".tar.gz")) + (sha256 + (base32 + "185jych0gdnpkjwxni7pd0dda149492zwq2457xdjg76bzj78mnp")) + (patches (list (search-patch "dealii-p4est-interface.patch"))) + (modules '((guix build utils))) + (snippet + ;; Remove bundled sources: UMFPACK, TBB, muParser, and boost + '(delete-file-recursively "bundled")))) + (build-system cmake-build-system) + (inputs + `(("tbb" ,tbb) + ("zlib" ,zlib) + ("boost" ,boost) + ("p4est" ,p4est) + ("blas" ,openblas) + ("lapack" ,lapack) + ("arpack" ,arpack-ng) + ("muparser" ,muparser) + ("gfortran" ,gfortran) + ("suitesparse" ,suitesparse))) ;for UMFPACK + (arguments + `(#:build-type "DebugRelease" ;only supports Release, Debug, or DebugRelease + #:configure-flags '("-DCOMPAT_FILES=OFF") ;Follow new directory structure + #:phases (modify-phases %standard-phases + (add-after + 'install 'hint-example-prefix + ;; Set Cmake hints in examples so that they can find this + ;; deal.II when configuring. + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref %outputs "out")) + (exmpl (string-append out "/share/doc" + "/dealii/examples"))) + (substitute* (find-files exmpl "CMakeLists.txt") + (("([[:space:]]*HINTS.*)\n" _ line) + (string-append line " $ENV{HOME}/.guix-profile " + out "\n"))) + #t)))))) + (home-page "https://www.dealii.org") + (synopsis "Finite element library") + (description + "Deal.II is a C++ program library targeted at the computational solution +of partial differential equations using adaptive finite elements. The main +aim of deal.II is to enable rapid development of modern finite element codes, +using among other aspects adaptive meshes and a wide array of tools often used +in finite element programs.") + (license license:lgpl2.1+))) + +(define-public dealii-openmpi + (package (inherit dealii) + (name "dealii-openmpi") + (inputs + `(("mpi" ,openmpi) + ;;Supported only with MPI: + ("p4est" ,p4est-openmpi) + ("petsc" ,petsc-openmpi) + ("slepc" ,slepc-openmpi) + ("metis" ,metis) ;for MUMPS + ("scalapack" ,scalapack) ;for MUMPS + ("mumps" ,mumps-metis-openmpi) ;configure supports only metis orderings + ("arpack" ,arpack-ng-openmpi) + ,@(fold alist-delete (package-inputs dealii) + '("p4est" "arpack")))) + (arguments + (substitute-keyword-arguments (package-arguments dealii) + ((#:configure-flags cf) + ``("-DMPI_C_COMPILER=mpicc" + "-DMPI_CXX_COMPILER=mpicxx" + "-DMPI_Fortran_COMPILER=mpifort" + ,@,cf)))) + (synopsis "Finite element library (with MPI support)"))) diff --git a/gnu/packages/patches/dealii-p4est-interface.patch b/gnu/packages/patches/dealii-p4est-interface.patch new file mode 100644 index 0000000000..4c4125d16c --- /dev/null +++ b/gnu/packages/patches/dealii-p4est-interface.patch @@ -0,0 +1,62 @@ +From upstream commit f764598c. + +The p4est_connectivity_load function used to take an unsigned long as argument, +but this has been changed to size_t in p4est 1.0. This makes no difference on +64 bit systems, but leads to compiler errors on 32 bit systems. Fix this. + +--- a/source/distributed/tria.cc ++++ b/source/distributed/tria.cc +@@ -204,7 +204,11 @@ namespace internal + static + int (&connectivity_is_valid) (types<2>::connectivity *connectivity); + +-#if DEAL_II_P4EST_VERSION_GTE(0,3,4,3) ++#if DEAL_II_P4EST_VERSION_GTE(1,0,0,0) ++ static ++ types<2>::connectivity *(&connectivity_load) (const char *filename, ++ size_t *length); ++#elif DEAL_II_P4EST_VERSION_GTE(0,3,4,3) + static + types<2>::connectivity *(&connectivity_load) (const char *filename, + long unsigned *length); +@@ -384,7 +388,12 @@ namespace internal + *connectivity) + = p4est_connectivity_is_valid; + +-#if DEAL_II_P4EST_VERSION_GTE(0,3,4,3) ++#if DEAL_II_P4EST_VERSION_GTE(1,0,0,0) ++ types<2>::connectivity * ++ (&functions<2>::connectivity_load) (const char *filename, ++ size_t *length) ++ = p4est_connectivity_load; ++#elif DEAL_II_P4EST_VERSION_GTE(0,3,4,3) + types<2>::connectivity * + (&functions<2>::connectivity_load) (const char *filename, + long unsigned *length) +@@ -564,7 +573,11 @@ namespace internal + static + int (&connectivity_is_valid) (types<3>::connectivity *connectivity); + +-#if DEAL_II_P4EST_VERSION_GTE(0,3,4,3) ++#if DEAL_II_P4EST_VERSION_GTE(1,0,0,0) ++ static ++ types<3>::connectivity *(&connectivity_load) (const char *filename, ++ size_t *length); ++#elif DEAL_II_P4EST_VERSION_GTE(0,3,4,3) + static + types<3>::connectivity *(&connectivity_load) (const char *filename, + long unsigned *length); +@@ -747,7 +760,12 @@ namespace internal + *connectivity) + = p8est_connectivity_is_valid; + +-#if DEAL_II_P4EST_VERSION_GTE(0,3,4,3) ++#if DEAL_II_P4EST_VERSION_GTE(1,0,0,0) ++ types<3>::connectivity * ++ (&functions<3>::connectivity_load) (const char *filename, ++ size_t *length) ++ = p8est_connectivity_load; ++#elif DEAL_II_P4EST_VERSION_GTE(0,3,4,3) + types<3>::connectivity * + (&functions<3>::connectivity_load) (const char *filename, + long unsigned *length)