From 9ead19d07b967c32d28d49c960cb18894b2159bf Mon Sep 17 00:00:00 2001
From: Bernd Flemisch <bernd@iws.uni-stuttgart.de>
Date: Wed, 26 Aug 2015 11:29:06 +0000
Subject: [PATCH] [multidomain] add patch that ensures compatibilty with Dune
 2.4

The added patch multidomaingrid-2.3.patch adapts the
releases/2.3-branch of dune-multidomaingrid such that the 2.4 versions
of the Dune core modules can be used. See patches/README and
test/multidomain/README for details.

Reviewed by fetzer.



git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@15379 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 patches/README                    |   7 +-
 patches/multidomaingrid-2.3.patch | 292 ++++++++++++++++++++++++++++++
 test/multidomain/README           |  14 +-
 3 files changed, 306 insertions(+), 7 deletions(-)
 create mode 100644 patches/multidomaingrid-2.3.patch

diff --git a/patches/README b/patches/README
index bcb91ea801..2d6250de9b 100644
--- a/patches/README
+++ b/patches/README
@@ -1,7 +1,12 @@
+- If you want to run a Dumux multidomain model with Dune 2.4, the module
+  dune-multidomaingrid has to be patched: apply multidomaingrid-2.3.patch in the
+  directory containing the releases/2.3-branch of dune-multidomaingrid, e.g.:
+  patch -p1 <../dumux/patches/multidomaingrid-2.3.patch
+
 - If the AMGBackend should be used without SuperLU as coarse grid solver, it can
   be benefitial to decrease the corresponding tolerance. To do so, apply the
   patch istl-2.3.0.patch in your directory containing
-  DUNE-ISTL 2.3.0, e.g.:
+  dune-istl 2.3.0, e.g.:
   patch -p1 <../dumux/patches/istl-2.3.0.patch
 
 - If UG has been installed for parallel usage, and you want to run a Dumux
diff --git a/patches/multidomaingrid-2.3.patch b/patches/multidomaingrid-2.3.patch
new file mode 100644
index 0000000000..4fedee6f9d
--- /dev/null
+++ b/patches/multidomaingrid-2.3.patch
@@ -0,0 +1,292 @@
+diff --git a/dune/grid/multidomaingrid/entity.hh b/dune/grid/multidomaingrid/entity.hh
+index 2de5650..25e049a 100644
+--- a/dune/grid/multidomaingrid/entity.hh
++++ b/dune/grid/multidomaingrid/entity.hh
+@@ -3,6 +3,7 @@
+ 
+ #include <dune/grid/common/entity.hh>
+ #include <dune/grid/common/gridenums.hh>
++#include <dune/common/version.hh>
+ 
+ namespace Dune {
+ 
+@@ -178,6 +179,12 @@ public:
+     return _hostEntityPointer->template count<cc>();
+   }
+ 
++#if DUNE_VERSION_NEWER(DUNE_GRID, 2, 4)
++  int subEntities(int cc) const {
++    return _hostEntityPointer->subEntities(cc);
++  }
++#endif
++
+   Geometry geometry() const {
+     return Geometry(_hostEntityPointer->geometry());
+   }
+@@ -271,6 +278,12 @@ public:
+     return _hostEntityPointer->template count<cc>();
+   }
+ 
++#if DUNE_VERSION_NEWER(DUNE_GRID, 2, 4)
++  int subEntities(int cc) const {
++    return _hostEntityPointer->subEntities(cc);
++  }
++#endif
++
+   template<int cc>
+   typename GridImp::template Codim<cc>::EntityPointer subEntity(int i) const {
+     return EntityPointerWrapper<cc,GridImp>(_hostEntityPointer->template subEntity<cc>(i));
+diff --git a/dune/grid/multidomaingrid/geometry.hh b/dune/grid/multidomaingrid/geometry.hh
+index 517abe2..0a47501 100644
+--- a/dune/grid/multidomaingrid/geometry.hh
++++ b/dune/grid/multidomaingrid/geometry.hh
+@@ -2,6 +2,7 @@
+ #define DUNE_MULTIDOMAINGRID_GEOMETRY_HH
+ 
+ #include <dune/grid/common/geometry.hh>
++#include <dune/common/version.hh>
+ 
+ namespace Dune {
+ 
+@@ -102,6 +103,7 @@ private:
+ } // namespace mdgrid
+ 
+ 
++#if !DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
+ namespace FacadeOptions {
+ 
+ template< int mydim, int coorddim, class GridImp >
+@@ -111,6 +113,7 @@ struct StoreGeometryReference< mydim, coorddim, GridImp, mdgrid::GeometryWrapper
+ };
+ 
+ } // namespace FacadeOptions
++#endif
+ 
+ } // namespace Dune
+ 
+diff --git a/dune/grid/multidomaingrid/indexsets.hh b/dune/grid/multidomaingrid/indexsets.hh
+index 96ca13b..01b982c 100644
+--- a/dune/grid/multidomaingrid/indexsets.hh
++++ b/dune/grid/multidomaingrid/indexsets.hh
+@@ -21,6 +21,7 @@
+ #include <boost/swap.hpp>
+ 
+ #include <dune/common/shared_ptr.hh>
++#include <dune/common/version.hh>
+ #include <dune/grid/common/exceptions.hh>
+ #include <dune/grid/common/indexidset.hh>
+ 
+@@ -237,7 +238,11 @@ T& rw(const T& t) {
+ template<typename GridImp, typename HostGridViewType>
+ class IndexSetWrapper :
+     public Dune::IndexSet<GridImp,IndexSetWrapper<GridImp,HostGridViewType>,
+-                          typename HostGridViewType::IndexSet::IndexType>
++                          typename HostGridViewType::IndexSet::IndexType
++#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
++                          , typename HostGridViewType::IndexSet::Types
++#endif
++                         >
+ {
+ 
+   template<typename, typename>
+@@ -275,6 +280,9 @@ public:
+ 
+ 
+   typedef typename HostIndexSet::IndexType IndexType;
++#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
++  typedef typename HostIndexSet::Types Types;
++#endif
+   static const int dimension = remove_const<GridImp>::type::dimension;
+   static const std::size_t maxSubDomains = SubDomainSet::maxSize;
+ 
+@@ -384,6 +392,12 @@ public:
+     return r;
+   }
+ 
++#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
++  Types types (int codim) const {
++    return _hostGridView.indexSet().types(codim);
++  }
++#endif
++
+   //! Returns a list of all geometry types with codimension codim contained in the grid.
+   const std::vector<GeometryType>& geomTypes(int codim) const {
+     return _hostGridView.indexSet().geomTypes(codim);
+diff --git a/dune/grid/multidomaingrid/localgeometry.hh b/dune/grid/multidomaingrid/localgeometry.hh
+index 7e9a748..2f8049d 100644
+--- a/dune/grid/multidomaingrid/localgeometry.hh
++++ b/dune/grid/multidomaingrid/localgeometry.hh
+@@ -2,6 +2,7 @@
+ #define DUNE_MULTIDOMAINGRID_LOCALGEOMETRY_HH
+ 
+ #include <dune/grid/common/geometry.hh>
++#include <dune/common/version.hh>
+ 
+ namespace Dune {
+ 
+@@ -104,6 +105,7 @@ private:
+ } // namespace mdgrid
+ 
+ 
++#if !DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
+ namespace FacadeOptions {
+ 
+ template< int mydim, int coorddim, class GridImp >
+@@ -113,6 +115,7 @@ struct StoreGeometryReference< mydim, coorddim, GridImp, mdgrid::LocalGeometryWr
+ };
+ 
+ } // namespace FacadeOptions
++#endif
+ 
+ } // namespace Dune
+ 
+diff --git a/dune/grid/multidomaingrid/subdomaingrid/entity.hh b/dune/grid/multidomaingrid/subdomaingrid/entity.hh
+index 2d5a43d..f65c6a8 100644
+--- a/dune/grid/multidomaingrid/subdomaingrid/entity.hh
++++ b/dune/grid/multidomaingrid/subdomaingrid/entity.hh
+@@ -3,6 +3,7 @@
+ 
+ #include <dune/grid/common/entity.hh>
+ #include <dune/grid/common/gridenums.hh>
++#include <dune/common/version.hh>
+ 
+ namespace Dune {
+ 
+@@ -190,6 +191,12 @@ public:
+     return _multiDomainEntityPointer->template count<cc>();
+   }
+ 
++#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
++  int subEntities(int cc) const {
++    return _multiDomainEntityPointer->subEntities(cc);
++  }
++#endif
++
+   Geometry geometry() const {
+     return Geometry(hostEntity().geometry());
+   }
+@@ -302,6 +309,12 @@ public:
+     return hostEntity().template count<cc>();
+   }
+ 
++#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
++  int subEntities(int cc) const {
++    return hostEntity().subEntities(cc);
++  }
++#endif
++
+   template<int cc>
+   typename GridImp::template Codim<cc>::EntityPointer subEntity(int i) const {
+     return EntityPointerWrapper<cc,GridImp>(_grid,_multiDomainEntityPointer->template subEntity<cc>(i));
+diff --git a/dune/grid/multidomaingrid/subdomaingrid/geometry.hh b/dune/grid/multidomaingrid/subdomaingrid/geometry.hh
+index 235bf2f..6aa23fc 100644
+--- a/dune/grid/multidomaingrid/subdomaingrid/geometry.hh
++++ b/dune/grid/multidomaingrid/subdomaingrid/geometry.hh
+@@ -2,6 +2,7 @@
+ #define DUNE_MULTIDOMAINGRID_SUBDOMAINGRID_GEOMETRY_HH
+ 
+ #include <dune/grid/common/geometry.hh>
++#include <dune/common/version.hh>
+ 
+ namespace Dune {
+ 
+@@ -78,12 +79,20 @@ public:
+     return _hostGeometry.center();
+   }
+ 
++#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
++  const JacobianTransposed
++#else
+   const JacobianTransposed&
++#endif
+   jacobianTransposed(const LocalCoords& local) const {
+     return _hostGeometry.jacobianTransposed(local);
+   }
+ 
++#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
++  const JacobianInverseTransposed
++#else
+   const JacobianInverseTransposed&
++#endif
+   jacobianInverseTransposed(const LocalCoords& local) const {
+     return _hostGeometry.jacobianInverseTransposed(local);
+   }
+@@ -103,6 +112,7 @@ private:
+ } // namespace mdgrid
+ 
+ 
++#if !DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
+ namespace FacadeOptions {
+ 
+ template< int mydim, int coorddim, class GridImp >
+@@ -112,6 +122,7 @@ struct StoreGeometryReference< mydim, coorddim, GridImp, mdgrid::subdomain::Geom
+ };
+ 
+ } // namespace FacadeOptions
++#endif
+ 
+ } // namespace Dune
+ 
+diff --git a/dune/grid/multidomaingrid/subdomaingrid/indexsets.hh b/dune/grid/multidomaingrid/subdomaingrid/indexsets.hh
+index b510dcd..e45b7c1 100644
+--- a/dune/grid/multidomaingrid/subdomaingrid/indexsets.hh
++++ b/dune/grid/multidomaingrid/subdomaingrid/indexsets.hh
+@@ -9,6 +9,7 @@
+ #include <tuple>
+ #include <boost/scoped_ptr.hpp>
+ #include <boost/bind.hpp>
++#include <dune/common/version.hh>
+ #include <dune/grid/common/indexidset.hh>
+ #include <dune/grid/multidomaingrid/utility.hh>
+ 
+@@ -57,6 +58,9 @@ public:
+   typedef SubDomainIndex SubDomainIndexType DUNE_DEPRECATED_MSG("Use SubDomainIndex instead.");
+   typedef SubDomainIndex SubDomainType DUNE_DEPRECATED_MSG("Use SubDomainIndex instead.");
+   typedef typename MDIndexSet::IndexType IndexType;
++#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
++  typedef typename MDIndexSet::Types Types;
++#endif
+   static const int dimension = remove_const<GridImp>::type::dimension;
+   //typedef typename SubDomainSet::DomainType DomainType;
+   //static const std::size_t maxSubDomains = MDGrid::MDGridTraits::template Codim
+@@ -86,6 +90,12 @@ public:
+     return _mdIndexSet.subIndex(_grid.domain(),_grid.multiDomainEntity(e),i,codim);
+   }
+ 
++#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
++  Types types (int codim) const {
++    return _mdIndexSet.types(codim);
++  }
++#endif
++
+   const std::vector<GeometryType>& geomTypes(int codim) const {
+     return _mdIndexSet.geomTypesForSubDomain(_grid.domain(),codim);
+   }
+diff --git a/dune/grid/multidomaingrid/subdomaingrid/localgeometry.hh b/dune/grid/multidomaingrid/subdomaingrid/localgeometry.hh
+index bd1cc68..b8096cb 100644
+--- a/dune/grid/multidomaingrid/subdomaingrid/localgeometry.hh
++++ b/dune/grid/multidomaingrid/subdomaingrid/localgeometry.hh
+@@ -2,6 +2,7 @@
+ #define DUNE_MULTIDOMAINGRID_SUBDOMAINGRID_LOCALGEOMETRY_HH
+ 
+ #include <dune/grid/common/geometry.hh>
++#include <dune/common/version.hh>
+ 
+ namespace Dune {
+ 
+@@ -103,6 +104,7 @@ private:
+ } // namespace mdgrid
+ 
+ 
++#if !DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
+ namespace FacadeOptions {
+ 
+ template< int mydim, int coorddim, class GridImp >
+@@ -112,6 +114,7 @@ struct StoreGeometryReference< mydim, coorddim, GridImp, mdgrid::subdomain::Loca
+ };
+ 
+ } // namespace FacadeOptions
++#endif
+ 
+ } // namespace Dune
+ 
diff --git a/test/multidomain/README b/test/multidomain/README
index 8ea1fa2c77..cd513ff45d 100755
--- a/test/multidomain/README
+++ b/test/multidomain/README
@@ -1,15 +1,17 @@
 == Running the test cases in test/multidomain ==
 
-You need the following releases of the DUNE core modules and
-dune-multidomain(grid):
-Dune core modules: release 2.3
-Dune-PDELab: release 2.0
-dune-multidomaingrid: release branch 2.3
-dune-multidomain: release branch 2.0
+You need the following versions of the required Dune modules:
+Dune core modules, dune-typetree, dune-multidomaingrid: release (branch) 2.3
+Dune-PDELab, dune-multidomain: release (branch) 2.0
+
 For your convenience we provide the Shell script installRequiredModules.sh
 in the same folder as this README. Alternatively, you can use the script
 checkout-dumux from dumux.org/download/.
 
+Alternatively, you can use version 2.4 of the Dune core modules
+(_not_ dune-typetree which stays at 2.3). In this case, you have to patch
+dune-multidomaingrid. See the patches directory for more information.
+
 Install the external grid manager UG and a direct linear solver like SuperLU
 or PARDISO. You need Boost fusion for dune-multidomaingrid.
 
-- 
GitLab