From 391525f47eb1f0a56c502131c82d1d273d4af10c Mon Sep 17 00:00:00 2001
From: DennisGlaeser <dennis.glaeser@iws.uni-stuttgart.de>
Date: Tue, 16 Jan 2018 20:49:46 +0100
Subject: [PATCH] [fv] make connectivity map type tag independent

---
 .../cellcentered/connectivitymap.hh           |  8 ++---
 .../cellcentered/mpfa/connectivitymap.hh      | 12 +++----
 .../cellcentered/mpfa/fvgridgeometry.hh       | 36 +++++++++++--------
 .../cellcentered/mpfa/properties.hh           |  3 +-
 .../cellcentered/tpfa/fvgridgeometry.hh       |  6 ++--
 .../staggered/freeflow/connectivitymap.hh     | 11 +++---
 .../staggered/freeflow/properties.hh          |  5 ++-
 .../staggered/fvgridgeometry.hh               |  7 ++--
 8 files changed, 46 insertions(+), 42 deletions(-)

diff --git a/dumux/discretization/cellcentered/connectivitymap.hh b/dumux/discretization/cellcentered/connectivitymap.hh
index 07d0240e34..7cb4753e5b 100644
--- a/dumux/discretization/cellcentered/connectivitymap.hh
+++ b/dumux/discretization/cellcentered/connectivitymap.hh
@@ -31,7 +31,6 @@
 #include <algorithm>
 
 #include <dune/common/reservedvector.hh>
-#include <dumux/common/properties.hh>
 #include <dumux/discretization/fluxstencil.hh>
 
 namespace Dumux {
@@ -46,12 +45,11 @@ namespace Dumux {
  *        to compute these fluxes. The same holds for scvfs in the cells J, i.e. we need only those
  *        scvfs in the cells J in which the cell I is in the stencil.
  */
-template<class TypeTag>
+template<class FVGridGeometry>
 class CCSimpleConnectivityMap
 {
-    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
-    using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
-    using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
+    using FVElementGeometry = typename FVGridGeometry::FVElementGeometry;
+    using GridView = typename FVGridGeometry::GridView;
     using IndexType = typename GridView::IndexSet::IndexType;
     using FluxStencil = Dumux::FluxStencil<FVElementGeometry>;
 
diff --git a/dumux/discretization/cellcentered/mpfa/connectivitymap.hh b/dumux/discretization/cellcentered/mpfa/connectivitymap.hh
index ebcc7cea18..47bcc5d4c0 100644
--- a/dumux/discretization/cellcentered/mpfa/connectivitymap.hh
+++ b/dumux/discretization/cellcentered/mpfa/connectivitymap.hh
@@ -34,16 +34,12 @@
 namespace Dumux
 {
 //! Forward declaration of method specific implementation of the assembly map
-template<class TypeTag, MpfaMethods method>
-class CCMpfaConnectivityMapImplementation;
-
-//! The Assembly map for models using mpfa methods
-template<class TypeTag>
-using CCMpfaConnectivityMap = CCMpfaConnectivityMapImplementation<TypeTag, GET_PROP_VALUE(TypeTag, MpfaMethod)>;
+template<class FVGridGeometry, MpfaMethods method>
+class CCMpfaConnectivityMap;
 
 //! The o-method can use the simple (symmetric) assembly map
-template<class TypeTag>
-class CCMpfaConnectivityMapImplementation<TypeTag, MpfaMethods::oMethod> : public CCSimpleConnectivityMap<TypeTag> {};
+template<class FVGridGeometry>
+class CCMpfaConnectivityMap<FVGridGeometry, MpfaMethods::oMethod> : public CCSimpleConnectivityMap<FVGridGeometry> {};
 }
 
 #endif
diff --git a/dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh b/dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh
index d217bb2300..1406adf4dd 100644
--- a/dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh
+++ b/dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh
@@ -64,8 +64,16 @@ public:
     using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume);
     using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace);
     using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
+    using DualGridNodalIndexSet = typename GET_PROP_TYPE(TypeTag, DualGridNodalIndexSet);
+
+    //! Export the discretization method this geometry belongs to
+    static constexpr DiscretizationMethods discretizationMethod = DiscretizationMethods::CCMpfa;
+
+    //! Export the mpfa method
+    static constexpr MpfaMethods mpfaMethod = GET_PROP_VALUE(TypeTag, MpfaMethod);
 
 private:
+    using ThisType = CCMpfaFVGridGeometry<TypeTag, true>;
     using ParentType = BaseFVGridGeometry<TypeTag>;
     using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
     using MpfaHelper = typename GET_PROP_TYPE(TypeTag, MpfaHelper);
@@ -84,21 +92,17 @@ private:
     using ScvfOutsideGridIndexStorage = typename SubControlVolumeFace::Traits::OutsideGridIndexStorage;
 
     using GridIVIndexSets = CCMpfaGridInteractionVolumeIndexSets<TypeTag>;
-    using ConnectivityMap = CCMpfaConnectivityMap<TypeTag>;
+    using ConnectivityMap = CCMpfaConnectivityMap<ThisType, mpfaMethod>;
 
     using ReferenceElements = typename Dune::ReferenceElements<CoordScalar, dim>;
 
 public:
-    //! Export the discretization method this geometry belongs to
-    static constexpr DiscretizationMethods discretizationMethod = DiscretizationMethods::CCMpfa;
+    using SecondaryIvIndicatorType = std::function<bool(const Element&, const Intersection&, bool)>;
 
     //! The maximum admissible stencil size (used for static memory allocation during assembly)
     // TODO: Re-implement and obtain from nodal index set (for now we use a high value)
     static constexpr int maxElementStencilSize = (dim < dimWorld || dim == 3) ? 45 : 15;
 
-    using DualGridNodalIndexSet = typename GET_PROP_TYPE(TypeTag, DualGridNodalIndexSet);
-    using SecondaryIvIndicatorType = std::function<bool(const Element&, const Intersection&, bool)>;
-
     //! Constructor without indicator function for secondary interaction volumes
     //! Per default, we use the secondary IVs at branching points & boundaries
     CCMpfaFVGridGeometry(const GridView& gridView)
@@ -407,8 +411,16 @@ public:
     using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume);
     using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace);
     using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
+    using DualGridNodalIndexSet = typename GET_PROP_TYPE(TypeTag, DualGridNodalIndexSet);
+
+    //! Export the discretization method this geometry belongs to
+    static constexpr DiscretizationMethods discretizationMethod = DiscretizationMethods::CCMpfa;
+
+    //! Export the mpfa method
+    static constexpr MpfaMethods mpfaMethod = GET_PROP_VALUE(TypeTag, MpfaMethod);
 
 private:
+    using ThisType = CCMpfaFVGridGeometry<TypeTag, false>;
     using ParentType = BaseFVGridGeometry<TypeTag>;
     using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
     using MpfaHelper = typename GET_PROP_TYPE(TypeTag, MpfaHelper);
@@ -427,21 +439,17 @@ private:
     using ScvfOutsideGridIndexStorage = typename SubControlVolumeFace::Traits::OutsideGridIndexStorage;
 
     using GridIVIndexSets = CCMpfaGridInteractionVolumeIndexSets<TypeTag>;
-    using ConnectivityMap = CCMpfaConnectivityMap<TypeTag>;
+    using ConnectivityMap = CCMpfaConnectivityMap<ThisType, mpfaMethod>;
 
     using ReferenceElements = typename Dune::ReferenceElements<CoordScalar, dim>;
 
 public:
-    //! Export the discretization method this geometry belongs to
-    static constexpr DiscretizationMethods discretizationMethod = DiscretizationMethods::CCMpfa;
+    using SecondaryIvIndicatorType = std::function<bool(const Element&, const Intersection&, bool)>;
 
     //! The maximum admissible stencil size (used for static memory allocation during assembly)
     // TODO: Re-implement and obtain from nodal index set (for now we use a high value)
     static constexpr int maxElementStencilSize = (dim < dimWorld || dim == 3) ? 45 : 15;
 
-    using DualGridNodalIndexSet = typename GET_PROP_TYPE(TypeTag, DualGridNodalIndexSet);
-    using SecondaryIvIndicator = std::function<bool(const Element&, const Intersection&, bool)>;
-
     //! Constructor without indicator function for secondary interaction volumes
     //! Per default, we use the secondary IVs at branching points & boundaries
     CCMpfaFVGridGeometry(const GridView& gridView)
@@ -451,7 +459,7 @@ public:
     {}
 
     //! Constructor with user-defined indicator function for secondary interaction volumes
-    CCMpfaFVGridGeometry(const GridView& gridView, const SecondaryIvIndicator& indicator)
+    CCMpfaFVGridGeometry(const GridView& gridView, const SecondaryIvIndicatorType& indicator)
     : ParentType(gridView)
     , secondaryIvIndicator_(indicator)
     {}
@@ -669,7 +677,7 @@ private:
     GridIVIndexSets ivIndexSets_;
 
     // Indicator function on where to use the secondary IVs
-    SecondaryIvIndicator secondaryIvIndicator_;
+    SecondaryIvIndicatorType secondaryIvIndicator_;
 };
 
 } // end namespace Dumux
diff --git a/dumux/discretization/cellcentered/mpfa/properties.hh b/dumux/discretization/cellcentered/mpfa/properties.hh
index aeb2b83479..5a461ae58c 100644
--- a/dumux/discretization/cellcentered/mpfa/properties.hh
+++ b/dumux/discretization/cellcentered/mpfa/properties.hh
@@ -188,7 +188,8 @@ SET_TYPE_PROP(CCMpfaModel, ElementBoundaryTypes, CCElementBoundaryTypes<TypeTag>
 SET_TYPE_PROP(CCMpfaModel, BaseLocalResidual, CCLocalResidual<TypeTag>);
 
 //! Set the AssemblyMap property
-SET_TYPE_PROP(CCMpfaModel, AssemblyMap, Dumux::CCMpfaConnectivityMap<TypeTag>);
+SET_TYPE_PROP(CCMpfaModel, AssemblyMap, Dumux::CCMpfaConnectivityMap<typename GET_PROP_TYPE(TypeTag, FVGridGeometry),
+                                                                     GET_PROP_VALUE(TypeTag, MpfaMethod)>);
 
 } // namespace Properties
 } // namespace Dumux
diff --git a/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh b/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh
index b08a9b41c6..0f9a7c00b9 100644
--- a/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh
+++ b/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh
@@ -64,8 +64,9 @@ public:
     using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
 
 private:
+    using ThisType = CCTpfaFVGridGeometry<TypeTag, true>;
     using ParentType = BaseFVGridGeometry<TypeTag>;
-    using ConnectivityMap = CCSimpleConnectivityMap<TypeTag>;
+    using ConnectivityMap = CCSimpleConnectivityMap<ThisType>;
     using ElementMapper = typename GET_PROP_TYPE(TypeTag, ElementMapper);
     using ScvfGridIndexStorage = typename SubControlVolumeFace::Traits::GridIndexStorage;
     using IndexType = typename GridView::IndexSet::IndexType;
@@ -333,8 +334,9 @@ public:
     using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
 
 private:
+    using ThisType = CCTpfaFVGridGeometry<TypeTag, false>;
     using ParentType = BaseFVGridGeometry<TypeTag>;
-    using ConnectivityMap = CCSimpleConnectivityMap<TypeTag>;
+    using ConnectivityMap = CCSimpleConnectivityMap<ThisType>;
     using ElementMapper = typename GET_PROP_TYPE(TypeTag, ElementMapper);
     using ScvfGridIndexStorage = typename SubControlVolumeFace::Traits::GridIndexStorage;
     using IndexType = typename GridView::IndexSet::IndexType;
diff --git a/dumux/discretization/staggered/freeflow/connectivitymap.hh b/dumux/discretization/staggered/freeflow/connectivitymap.hh
index 49f3554bd3..d38d1a8731 100644
--- a/dumux/discretization/staggered/freeflow/connectivitymap.hh
+++ b/dumux/discretization/staggered/freeflow/connectivitymap.hh
@@ -25,7 +25,6 @@
 #define DUMUX_STAGGERED_FREEFLOW_CONNECTIVITY_MAP_HH
 
 #include <vector>
-#include <dumux/common/properties.hh>
 
 namespace Dumux
 {
@@ -35,18 +34,16 @@ namespace Dumux
  * \brief Stores the dof indices corresponding to the neighboring cell centers and faces
  *        that contribute to the derivative calculation. Specialization for the staggered free flow model.
  */
-template<class TypeTag>
+template<class FVGridGeometry, class DofTypeIndices>
 class StaggeredFreeFlowConnectivityMap
 {
-    using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
-    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
-    using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
-    using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace);
+    using GridView = typename FVGridGeometry::GridView;
+    using FVElementGeometry = typename FVGridGeometry::FVElementGeometry;
+    using SubControlVolumeFace = typename FVGridGeometry::SubControlVolumeFace;
 
     using Element = typename GridView::template Codim<0>::Entity;
     using IndexType = typename GridView::IndexSet::IndexType;
 
-    using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices);
     typename DofTypeIndices::CellCenterIdx cellCenterIdx;
     typename DofTypeIndices::FaceIdx faceIdx;
 
diff --git a/dumux/discretization/staggered/freeflow/properties.hh b/dumux/discretization/staggered/freeflow/properties.hh
index dc0367e61f..9808a0b77d 100644
--- a/dumux/discretization/staggered/freeflow/properties.hh
+++ b/dumux/discretization/staggered/freeflow/properties.hh
@@ -114,9 +114,8 @@ public:
 //! The velocity output
 SET_TYPE_PROP(StaggeredFreeFlowModel, VelocityOutput, StaggeredFreeFlowVelocityOutput<TypeTag>);
 
-SET_TYPE_PROP(StaggeredFreeFlowModel, AssemblyMap, StaggeredFreeFlowConnectivityMap<TypeTag>);
-
-
+SET_TYPE_PROP(StaggeredFreeFlowModel, AssemblyMap, StaggeredFreeFlowConnectivityMap<typename GET_PROP_TYPE(TypeTag, FVGridGeometry),
+                                                                                    typename GET_PROP(TypeTag, DofTypeIndices)>);
 } // namespace Properties
 } // namespace Dumux
 
diff --git a/dumux/discretization/staggered/fvgridgeometry.hh b/dumux/discretization/staggered/fvgridgeometry.hh
index caf05d8ab2..597ca659ad 100644
--- a/dumux/discretization/staggered/fvgridgeometry.hh
+++ b/dumux/discretization/staggered/fvgridgeometry.hh
@@ -49,12 +49,15 @@ class StaggeredFVGridGeometry
 template<class TypeTag>
 class StaggeredFVGridGeometry<TypeTag, true> : public BaseFVGridGeometry<TypeTag>
 {
-    using ParentType = BaseFVGridGeometry<TypeTag>;
+public:
     using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
-    using IndexType = typename GridView::IndexSet::IndexType;
     using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume);
     using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace);
     using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
+
+private:
+    using ParentType = BaseFVGridGeometry<TypeTag>;
+    using IndexType = typename GridView::IndexSet::IndexType;
     using Element = typename GridView::template Codim<0>::Entity;
     using IntersectionMapper = typename GET_PROP_TYPE(TypeTag, IntersectionMapper);
     //! The local class needs access to the scv, scvfs and the fv element geometry
-- 
GitLab