Subject: [PATCH] gnu: maths: dune-*: Update to version 2.7

From: Felix Gruber <[email-masked]>
Date: Sun, 5 Apr 2020 14:51:41 +0200

* gnu/packages/maths.scm (dune-*): Update to version 2.7.
(dune-uggrid)[source] Download from Git, as no release tarball for
version 2.7 exists.
(dune-alugrid,dune-subgrid,dune-pdelab)[source] Use commit hashes as no
tags for version 2.7 exist (yet?).
(dune-istl)[source](patches) Add patch required to build version 2.7
without openmpi.
* gnu/packages/patches/dune-istl-2.7-fix-non-mpi-tests.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
---
 gnu/local.mk                                  |  2 +
 gnu/packages/maths.scm                        | 65 ++++++++-------
 .../dune-istl-2.7-fix-non-mpi-tests.patch     | 82 +++++++++++++++++++
 3 files changed, 119 insertions(+), 30 deletions(-)
 create mode 100644 gnu/packages/patches/dune-istl-2.7-fix-non-mpi-tests.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 42dbf61af1..baa9bfff69 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -29,6 +29,7 @@
 # Copyright © 2020 Brendan Tildesley <[email-masked]>
 # Copyright © 2020 Vincent Legoll <[email-masked]>
 # Copyright © 2020 R Veera Kumar <[email-masked]>
+# Copyright © 2020 Felix Gruber <[email-masked]>
 #
 # This file is part of GNU Guix.
 #
@@ -838,6 +839,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/doxygen-test.patch			\
   %D%/packages/patches/dstat-fix-crash-when-specifying-delay.patch	\
   %D%/packages/patches/dstat-skip-devices-without-io.patch	\
+  %D%/packages/patches/dune-istl-2.7-fix-non-mpi-tests.patch	\
   %D%/packages/patches/dvd+rw-tools-add-include.patch 		\
   %D%/packages/patches/eigen-stabilise-sparseqr-test.patch	\
   %D%/packages/patches/einstein-build.patch			\
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 391b2a26de..d2c8253eb5 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -4585,7 +4585,7 @@ linear algebra primitives specifically targeting graph analytics.")
 (define-public dune-common
   (package
     (name "dune-common")
-    (version "2.6.0")
+    (version "2.7.0")
     (source
      (origin
        (method url-fetch)
@@ -4593,7 +4593,7 @@ linear algebra primitives specifically targeting graph analytics.")
                            version "/dune-common-" version ".tar.gz"))
        (sha256
         (base32
-         "019wcr1qf7jwyxx1y5y290wdlglylskvbb2m01ljkzcza2xnlmhw"))))
+         "140q1zh44cr5yrjwg4b5ga803rkqv55vk30l2cqm29aklj1wb0rw"))))
     (build-system cmake-build-system)
     (arguments
      `(#:phases
@@ -4623,7 +4623,7 @@ Differences} (FD).")
 (define-public dune-geometry
   (package
     (name "dune-geometry")
-    (version "2.6.0")
+    (version "2.7.0")
     (source
      (origin
        (method url-fetch)
@@ -4631,7 +4631,7 @@ Differences} (FD).")
                            version "/dune-geometry-" version ".tar.gz"))
        (sha256
         (base32
-         "0hlaaxjyv9j05blasvb67sy02hd0w4g9znf68gdh3l731dd1aqbn"))))
+         "1cicvlwbyyw76npicnblxckyvhbfn3ip8isydiv3hlrlz8zcg5nr"))))
     (build-system cmake-build-system)
     (arguments
      `(#:phases
@@ -4663,15 +4663,17 @@ This package contains the basic DUNE geometry classes.")
 (define-public dune-uggrid
   (package
     (name "dune-uggrid")
-    (version "2.6.0")
+    (version "2.7.0")
     (source
      (origin
-       (method url-fetch)
-       (uri (string-append "https://dune-project.org/download/"
-                           version "/dune-uggrid-" version ".tar.gz"))
+       (method git-fetch)
+       (uri (git-reference
+         (url "https://gitlab.dune-project.org/staging/dune-uggrid.git")
+         (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
        (sha256
         (base32
-         "05l7a1gb78mny49anyxk6rjvn66rhgm30y72v5cjg0m5kfgr1a1f"))))
+         "192miqgmfj6jwk969gydzpbv9ki7jg5nky3ydnrwa2nq29b5xkh0"))))
     (build-system cmake-build-system)
     (arguments
      `(#:phases
@@ -4698,7 +4700,7 @@ This package contains the DUNE UG grid classes.")
 (define-public dune-grid
   (package
     (name "dune-grid")
-    (version "2.6.0")
+    (version "2.7.0")
     (source
      (origin
        (method url-fetch)
@@ -4706,7 +4708,7 @@ This package contains the DUNE UG grid classes.")
                            version "/dune-grid-" version ".tar.gz"))
        (sha256
         (base32
-         "1jp4vscm9yb9xg0lh7apzccfkhvgbnk652yahigmh3cvzpl4acd0"))))
+         "17fjz30qazjgl11sryyxnw9klai4yz1ji4bs68013xcxc5hdv27s"))))
     (build-system cmake-build-system)
     (arguments
      `(#:phases
@@ -4741,7 +4743,7 @@ This package contains the basic DUNE grid classes.")
 (define-public dune-istl
   (package
     (name "dune-istl")
-    (version "2.6.0")
+    (version "2.7.0")
     (source
      (origin
        (method url-fetch)
@@ -4749,7 +4751,8 @@ This package contains the basic DUNE grid classes.")
                            version "/dune-istl-" version ".tar.gz"))
        (sha256
         (base32
-         "0l2gyrvys5w6wsmk0ckbb7295s80b7yk7qrl7x66akv2jv1nzq2w"))))
+         "0gl3wgz5rs6sb4m83440ny45sbx7z7lnbi3gx6r9nm3rvy5j33f9"))
+       (patches (search-patches "dune-istl-2.7-fix-non-mpi-tests.patch"))))
     (build-system cmake-build-system)
     (arguments
      `(#:phases
@@ -4787,7 +4790,7 @@ aggregation-based algebraic multigrid.")
 (define-public dune-localfunctions
   (package
     (name "dune-localfunctions")
-    (version "2.6.0")
+    (version "2.7.0")
     (source
      (origin
        (method url-fetch)
@@ -4795,7 +4798,7 @@ aggregation-based algebraic multigrid.")
                            version "/dune-localfunctions-" version ".tar.gz"))
        (sha256
         (base32
-         "19c6zjinwwpy8jh4v4prhphyd438rapd4x80fj93apmwgw04nrhl"))))
+         "1yih59h6vngii696bx1c2vil02lriij4kz0nc583mjn9kiaqxfqd"))))
     (build-system cmake-build-system)
     (arguments
      `(#:phases
@@ -4830,15 +4833,17 @@ assemble global function spaces on finite-element grids.")
 (define-public dune-alugrid
   (package
     (name "dune-alugrid")
-    (version "2.6.0")
+    (version "2.7.0-git-81d35682")
     (source
      (origin
-       (method url-fetch)
-       (uri (string-append "https://dune-project.org/download/"
-                           version "/dune-alugrid-" version ".tar.gz"))
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://gitlab.dune-project.org/extensions/dune-alugrid.git")
+             (commit "81d356827c84454b971937db02c02b90bbcd7fe5")))
+       (file-name (git-file-name name version))
        (sha256
         (base32
-         "1l9adgyjpra8mvwm445s0lpjshnb63jag85fb2hisbjn6bm320yj"))))
+         "0z54lwfp53prcrs94k8gwh047l9z642jll3l56xlyfr69z0b2zz1"))))
     (build-system cmake-build-system)
     (arguments
      `(#:phases
@@ -4878,17 +4883,17 @@ cubes.")
 (define-public dune-subgrid
   (package
     (name "dune-subgrid")
-    (version "2.6.0")
+    (version "2.7.0-git-2103a363")
     (source
      (origin
        (method git-fetch)
        (uri (git-reference
          (url "https://git.imp.fu-berlin.de/agnumpde/dune-subgrid")
-         (commit "releases/2.6-1")))
+         (commit "2103a363f32e8d7b60e66eee7ddecf969f6cf762")))
        (file-name (git-file-name name version))
        (sha256
         (base32
-          "1gcv35rx3knqd54r4pp9rzd639db4j8w2r2ibq43w1mgwdcqhs64"))))
+          "1wsjlypd3835c3arqjkw836cxx5q67zy447wa65q634lf6f6v9ia"))))
     (build-system cmake-build-system)
     (arguments
      `(#:phases
@@ -4918,7 +4923,7 @@ provides the full grid interface including adaptive mesh refinement.")
 (define-public dune-typetree
   (package
     (name "dune-typetree")
-    (version "2.6.0")
+    (version "2.7.0")
     (source
      (origin
        (method git-fetch)
@@ -4928,7 +4933,7 @@ provides the full grid interface including adaptive mesh refinement.")
        (file-name (git-file-name name version))
        (sha256
         (base32
-         "0mnv6w2f22lz3j4bdpdjq55vjm8xxfx9v4vvhg9bd36xpsbjpjp9"))))
+         "1rhv25yg0q1hw50c8wlfqhgwrjl4mh62zq9v14ilwgzbfgxmpiy7"))))
     (build-system cmake-build-system)
     (arguments
      `(#:phases
@@ -4957,7 +4962,7 @@ operating on statically typed trees of objects.")
 (define-public dune-functions
   (package
     (name "dune-functions")
-    (version "2.6.0")
+    (version "2.7.0")
     (source
      (origin
        (method git-fetch)
@@ -4967,7 +4972,7 @@ operating on statically typed trees of objects.")
        (file-name (git-file-name name version))
        (sha256
         (base32
-         "1an8gb477n8j0kzpbrv7nr1snh8pxip0gsxq6w63jc83gg3dj200"))))
+         "1na4gcih0kin37ksj2xj07ds04v7zx53pjdhm1hzy55jjfqdjk8h"))))
     (build-system cmake-build-system)
     (arguments
      `(#:phases
@@ -5007,17 +5012,17 @@ implemented as callable objects, and bases of finite element spaces.")
 (define-public dune-pdelab
   (package
     (name "dune-pdelab")
-    (version "2.6.0-rc1")
+    (version "2.7.0-git-476fe437")
     (source
      (origin
        (method git-fetch)
        (uri (git-reference
              (url "https://gitlab.dune-project.org/pdelab/dune-pdelab")
-             (commit (string-append "v" version))))
+             (commit "476fe43763fa6f459c5e4658e2a2b4b5582db834")))
        (file-name (git-file-name name version))
        (sha256
         (base32
-         "07g0s9448z65vjrq88g5rv3340iifil85k170n8kbqchsvi4ny5v"))))
+         "0cs36piqzn6rq0j2ih3ab3q3q9yg199wk72k5qi86pkzh7i7fdn1"))))
     (build-system cmake-build-system)
     (arguments '(#:tests? #f)) ; XXX: the tests cannot be compiled
     (inputs
diff --git a/gnu/packages/patches/dune-istl-2.7-fix-non-mpi-tests.patch b/gnu/packages/patches/dune-istl-2.7-fix-non-mpi-tests.patch
new file mode 100644
index 0000000000..ee2bb8f676
--- /dev/null
+++ b/gnu/packages/patches/dune-istl-2.7-fix-non-mpi-tests.patch
@@ -0,0 +1,82 @@
+Fix build of dune-istl's tests
+
+Patch copied from upstream source repository:
+
+https://gitlab.dune-project.org/core/dune-istl/-/commit/9eee3462df5a64881c08574f9291e76db398de0a
+
+From 9eee3462df5a64881c08574f9291e76db398de0a Mon Sep 17 00:00:00 2001
+From: Felix Gruber <[email-masked]>
+Date: Sat, 4 Apr 2020 15:27:09 +0200
+Subject: [PATCH] make tests succeed when MPI is disabled
+
+When MPI is not available or explicitly disabled with the CMake build
+option -DCMAKE_IDSABLE_FIND_PACKAGE_MPI=TRUE, some tests were unable to
+build.
+
+The tests created from solverfactorytest.cc.in and part of
+scalarproductstest.cc use Dune::OwnerOverlapCopyCommunication which is
+defined behind `#if HAVE_MPI` and is thus not available in a non-MPI
+build. I've thus disabled those tests when MPI is unavailable.
+
+The matrixmarkettest did not work without MPI, as it contained some code
+using the wrong template parameters when HAVE_MPI was not set. Those
+template paramters have been fixed now.
+
+I've confirmed, that after my changes `make build_tests` succeeds to
+build all tests and that those tests run without failure.
+---
+ dune/istl/test/CMakeLists.txt        | 3 ++-
+ dune/istl/test/matrixmarkettest.cc   | 2 +-
+ dune/istl/test/scalarproductstest.cc | 2 ++
+ 3 files changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/dune/istl/test/CMakeLists.txt b/dune/istl/test/CMakeLists.txt
+index ffd87969..2c7b2387 100644
+--- a/dune/istl/test/CMakeLists.txt
++++ b/dune/istl/test/CMakeLists.txt
+@@ -77,7 +77,8 @@ set(DUNE_TEST_FACTORY_BLOCK_SIZES
+ function(add_factory_test BLOCK)
+   STRING(REGEX REPLACE "[^a-zA-Z0-9]" "" BLOCK_CLEAN ${BLOCK})
+   configure_file(solverfactorytest.cc.in solverfactorytest_${BLOCK_CLEAN}.cc)
+-  dune_add_test(SOURCES ${CMAKE_CURRENT_BINARY_DIR}/solverfactorytest_${BLOCK_CLEAN}.cc)
++  dune_add_test(SOURCES ${CMAKE_CURRENT_BINARY_DIR}/solverfactorytest_${BLOCK_CLEAN}.cc
++                CMAKE_GUARD HAVE_MPI)
+ endfunction(add_factory_test)
+
+ foreach(FIELD_TYPE ${DUNE_TEST_FACTORY_FIELD_TYPES})
+diff --git a/dune/istl/test/matrixmarkettest.cc b/dune/istl/test/matrixmarkettest.cc
+index b335afe6..ce30e8ae 100644
+--- a/dune/istl/test/matrixmarkettest.cc
++++ b/dune/istl/test/matrixmarkettest.cc
+@@ -52,7 +52,7 @@ int testMatrixMarket(int N)
+   storeMatrixMarket(mat, std::string("testmat"), comm);
+   storeMatrixMarket(bv, std::string("testvec"), comm, false);
+ #else
+-  typedef Dune::MatrixAdapter<BCRSMat,BVector,BVector> Operator;
++  typedef Dune::MatrixAdapter<Matrix,Vector,Vector> Operator;
+   Operator op(mat);
+   op.apply(bv, cv);
+
+diff --git a/dune/istl/test/scalarproductstest.cc b/dune/istl/test/scalarproductstest.cc
+index 452b1d89..f46ce2a9 100644
+--- a/dune/istl/test/scalarproductstest.cc
++++ b/dune/istl/test/scalarproductstest.cc
+@@ -115,6 +115,7 @@ int main(int argc, char** argv)
+     scalarProductTest<ScalarProduct, Vector>(scalarProduct,numBlocks);
+   }
+
++#if HAVE_MPI
+   // Test the ParallelScalarProduct class
+   {
+     using Vector = BlockVector<FieldVector<double,BlockSize> >;
+@@ -139,6 +140,7 @@ int main(int argc, char** argv)
+     ScalarProduct scalarProduct(communicator,SolverCategory::nonoverlapping);
+     scalarProductTest<ScalarProduct, Vector>(scalarProduct,numBlocks);
+   }
++#endif
+
+   return t.exit();
+ }
+--
+2.25.1
+
-- 
2.25.1