From b839ca33861017419976a3b793ac690568bbbeaa Mon Sep 17 00:00:00 2001
From: Timo Koch <timo.koch@iws.uni-stuttgart.de>
Date: Wed, 27 Apr 2022 16:04:07 +0200
Subject: [PATCH] [cleanup] Get FluxVarCache type from Elem/GridFluxVarCache
 type and not from the property system

---
 dumux/flux/box/dispersionflux.hh         | 5 +++--
 dumux/flux/box/fickslaw.hh               | 5 +++--
 dumux/flux/ccmpfa/fickslaw.hh            | 5 +++--
 dumux/flux/ccmpfa/fourierslaw.hh         | 5 +++--
 dumux/flux/cctpfa/dispersionflux.hh      | 5 +++--
 dumux/flux/cctpfa/fickslaw.hh            | 5 +++--
 dumux/flux/cctpfa/fourierslaw.hh         | 5 +++--
 dumux/flux/cctpfa/maxwellstefanslaw.hh   | 5 +++--
 dumux/porenetwork/2p/model.hh            | 6 +++++-
 dumux/porousmediumflow/2p1c/darcyslaw.hh | 4 ++--
 10 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/dumux/flux/box/dispersionflux.hh b/dumux/flux/box/dispersionflux.hh
index 0e496e569e..b1a6c6d1ca 100644
--- a/dumux/flux/box/dispersionflux.hh
+++ b/dumux/flux/box/dispersionflux.hh
@@ -58,8 +58,9 @@ class DispersionFluxImplementation<TypeTag, DiscretizationMethods::Box, referenc
     using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace;
     using Extrusion = Extrusion_t<GridGeometry>;
     using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
-    using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView;
-    using FluxVarCache = GetPropType<TypeTag, Properties::FluxVariablesCache>;
+    using GridFluxVariablesCache = GetPropType<TypeTag, Properties::GridFluxVariablesCache>;
+    using ElementFluxVariablesCache = typename GridFluxVariablesCache::LocalView;
+    using FluxVarCache = typename GridFluxVariablesCache::FluxVariablesCache;
     using FluxVariables = GetPropType<TypeTag, Properties::FluxVariables>;
     using FluxTraits = typename Dumux::FluxTraits<FluxVariables>;
     using BalanceEqOpts = GetPropType<TypeTag, Properties::BalanceEqOpts>;
diff --git a/dumux/flux/box/fickslaw.hh b/dumux/flux/box/fickslaw.hh
index f802f6ec7f..5099a17cf7 100644
--- a/dumux/flux/box/fickslaw.hh
+++ b/dumux/flux/box/fickslaw.hh
@@ -60,8 +60,9 @@ class FicksLawImplementation<TypeTag, DiscretizationMethods::Box, referenceSyste
     using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace;
     using Extrusion = Extrusion_t<GridGeometry>;
     using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
-    using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView;
-    using FluxVarCache = GetPropType<TypeTag, Properties::FluxVariablesCache>;
+    using GridFluxVariablesCache = GetPropType<TypeTag, Properties::GridFluxVariablesCache>;
+    using ElementFluxVariablesCache = typename GridFluxVariablesCache::LocalView;
+    using FluxVarCache = typename GridFluxVariablesCache::FluxVariablesCache;
     using BalanceEqOpts = GetPropType<TypeTag, Properties::BalanceEqOpts>;
     using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView;
     using Element = typename GridView::template Codim<0>::Entity;
diff --git a/dumux/flux/ccmpfa/fickslaw.hh b/dumux/flux/ccmpfa/fickslaw.hh
index 071a9b2e23..4681a060dc 100644
--- a/dumux/flux/ccmpfa/fickslaw.hh
+++ b/dumux/flux/ccmpfa/fickslaw.hh
@@ -57,8 +57,9 @@ class FicksLawImplementation<TypeTag, DiscretizationMethods::CCMpfa, referenceSy
     using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
     using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
     using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
-    using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView;
-    using FluxVariablesCache = GetPropType<TypeTag, Properties::FluxVariablesCache>;
+    using GridFluxVariablesCache = GetPropType<TypeTag, Properties::GridFluxVariablesCache>;
+    using ElementFluxVariablesCache = typename GridFluxVariablesCache::LocalView;
+    using FluxVariablesCache = typename GridFluxVariablesCache::FluxVariablesCache;
     using BalanceEqOpts = GetPropType<TypeTag, Properties::BalanceEqOpts>;
 
     static constexpr int numComponents = GetPropType<TypeTag, Properties::ModelTraits>::numFluidComponents();
diff --git a/dumux/flux/ccmpfa/fourierslaw.hh b/dumux/flux/ccmpfa/fourierslaw.hh
index c094d4abed..af476d6be8 100644
--- a/dumux/flux/ccmpfa/fourierslaw.hh
+++ b/dumux/flux/ccmpfa/fourierslaw.hh
@@ -55,8 +55,9 @@ class FouriersLawImplementation<TypeTag, DiscretizationMethods::CCMpfa>
     using FVElementGeometry = typename GridGeometry::LocalView;
     using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
     using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
-    using ElementFluxVarsCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView;
-    using FluxVariablesCache = GetPropType<TypeTag, Properties::FluxVariablesCache>;
+    using GridFluxVariablesCache = GetPropType<TypeTag, Properties::GridFluxVariablesCache>;
+    using ElementFluxVarsCache = typename GridFluxVariablesCache::LocalView;
+    using FluxVariablesCache = typename GridFluxVariablesCache::FluxVariablesCache;
 
     //! Class that fills the cache corresponding to mpfa Darcy's Law
     class MpfaFouriersLawCacheFiller
diff --git a/dumux/flux/cctpfa/dispersionflux.hh b/dumux/flux/cctpfa/dispersionflux.hh
index 4a77270c3e..e3428afa20 100644
--- a/dumux/flux/cctpfa/dispersionflux.hh
+++ b/dumux/flux/cctpfa/dispersionflux.hh
@@ -59,8 +59,9 @@ class DispersionFluxImplementation<TypeTag, DiscretizationMethods::CCTpfa, refer
     using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace;
     using Extrusion = Extrusion_t<GridGeometry>;
     using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
-    using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView;
-    using FluxVarCache = GetPropType<TypeTag, Properties::FluxVariablesCache>;
+    using GridFluxVariablesCache = GetPropType<TypeTag, Properties::GridFluxVariablesCache>;
+    using ElementFluxVariablesCache = typename GridFluxVariablesCache::LocalView;
+    using FluxVarCache = typename GridFluxVariablesCache::FluxVariablesCache;
     using FluxVariables = GetPropType<TypeTag, Properties::FluxVariables>;
     using FluxTraits = typename Dumux::FluxTraits<FluxVariables>;
     using BalanceEqOpts = GetPropType<TypeTag, Properties::BalanceEqOpts>;
diff --git a/dumux/flux/cctpfa/fickslaw.hh b/dumux/flux/cctpfa/fickslaw.hh
index 7876e600e1..66ad159965 100644
--- a/dumux/flux/cctpfa/fickslaw.hh
+++ b/dumux/flux/cctpfa/fickslaw.hh
@@ -60,8 +60,9 @@ class FicksLawImplementation<TypeTag, DiscretizationMethods::CCTpfa, referenceSy
     using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
     using VolumeVariables = typename ElementVolumeVariables::VolumeVariables;
     using Element = typename GridView::template Codim<0>::Entity;
-    using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView;
-    using FluxVariablesCache = GetPropType<TypeTag, Properties::FluxVariablesCache>;
+    using GridFluxVariablesCache = GetPropType<TypeTag, Properties::GridFluxVariablesCache>;
+    using ElementFluxVariablesCache = typename GridFluxVariablesCache::LocalView;
+    using FluxVariablesCache = typename GridFluxVariablesCache::FluxVariablesCache;
     using BalanceEqOpts = GetPropType<TypeTag, Properties::BalanceEqOpts>;
 
     using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>;
diff --git a/dumux/flux/cctpfa/fourierslaw.hh b/dumux/flux/cctpfa/fourierslaw.hh
index ac3b95b99c..03bc4affc1 100644
--- a/dumux/flux/cctpfa/fourierslaw.hh
+++ b/dumux/flux/cctpfa/fourierslaw.hh
@@ -55,8 +55,9 @@ class FouriersLawImplementation<TypeTag, DiscretizationMethods::CCTpfa>
     using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
     using VolumeVariables = typename ElementVolumeVariables::VolumeVariables;
     using Element = typename GridView::template Codim<0>::Entity;
-    using ElementFluxVarsCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView;
-    using FluxVariablesCache = GetPropType<TypeTag, Properties::FluxVariablesCache>;
+    using GridFluxVariablesCache = GetPropType<TypeTag, Properties::GridFluxVariablesCache>;
+    using ElementFluxVarsCache = typename GridFluxVariablesCache::LocalView;
+    using FluxVariablesCache = typename GridFluxVariablesCache::FluxVariablesCache;
 
     static const int dim = GridView::dimension;
     static const int dimWorld = GridView::dimensionworld;
diff --git a/dumux/flux/cctpfa/maxwellstefanslaw.hh b/dumux/flux/cctpfa/maxwellstefanslaw.hh
index 89f3a1a48a..b567b05722 100644
--- a/dumux/flux/cctpfa/maxwellstefanslaw.hh
+++ b/dumux/flux/cctpfa/maxwellstefanslaw.hh
@@ -61,8 +61,9 @@ class MaxwellStefansLawImplementation<TypeTag, DiscretizationMethods::CCTpfa, re
     using VolumeVariables = GetPropType<TypeTag, Properties::VolumeVariables>;
     using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
     using Element = typename GridView::template Codim<0>::Entity;
-    using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView;
-    using FluxVariablesCache = GetPropType<TypeTag, Properties::FluxVariablesCache>;
+    using GridFluxVariablesCache = GetPropType<TypeTag, Properties::GridFluxVariablesCache>;
+    using ElementFluxVariablesCache = typename GridFluxVariablesCache::LocalView;
+    using FluxVariablesCache = typename GridFluxVariablesCache::FluxVariablesCache;
     using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
 
     static const int dim = GridView::dimension;
diff --git a/dumux/porenetwork/2p/model.hh b/dumux/porenetwork/2p/model.hh
index 61c3df98f6..2782d1d44e 100644
--- a/dumux/porenetwork/2p/model.hh
+++ b/dumux/porenetwork/2p/model.hh
@@ -57,6 +57,7 @@
 #include <dumux/common/properties.hh>
 
 #include <dumux/flux/porenetwork/advection.hh>
+#include <dumux/flux/fluxvariablescaching.hh>
 
 #include <dumux/porenetwork/properties.hh>
 
@@ -130,7 +131,10 @@ struct GridFluxVariablesCache<TypeTag, TTag::PNMTwoP>
 private:
     static constexpr bool enableCache = getPropValue<TypeTag, Properties::EnableGridFluxVariablesCache>();
     using Problem = GetPropType<TypeTag, Properties::Problem>;
-    using FluxVariablesCache = GetPropType<TypeTag, Properties::FluxVariablesCache>;
+    using Scalar = GetPropType<TypeTag, Properties::Scalar>;
+    using FluxVariablesCache = GetPropTypeOr<TypeTag,
+        Properties::FluxVariablesCache, FluxVariablesCaching::EmptyCache<Scalar>
+    >;
     using Traits = PoreNetwork::PNMTwoPDefaultGridFVCTraits<Problem, FluxVariablesCache>;
 public:
     using type = PoreNetwork::PNMTwoPGridFluxVariablesCache<Problem, FluxVariablesCache, enableCache, Traits>;
diff --git a/dumux/porousmediumflow/2p1c/darcyslaw.hh b/dumux/porousmediumflow/2p1c/darcyslaw.hh
index f687bfd1c4..61e5aeee6c 100644
--- a/dumux/porousmediumflow/2p1c/darcyslaw.hh
+++ b/dumux/porousmediumflow/2p1c/darcyslaw.hh
@@ -52,8 +52,8 @@ class TwoPOneCDarcysLaw : public DarcysLaw<TypeTag>
     using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
     using SubControlVolume = typename FVElementGeometry::SubControlVolume;
     using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
-    using ElemFluxVarCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView;
-    using FluxVarCache = GetPropType<TypeTag, Properties::FluxVariablesCache>;
+    using GridFluxVariablesCache = GetPropType<TypeTag, Properties::GridFluxVariablesCache>;
+    using ElemFluxVarCache = typename GridFluxVariablesCache::LocalView;
     using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
     using VolumeVariables = GetPropType<TypeTag, Properties::VolumeVariables>;
     using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView;
-- 
GitLab