From 47221243e2402e52ae95c0a62a4d5fbd8075adc1 Mon Sep 17 00:00:00 2001
From: Timo Koch <timo.koch@iws.uni-stuttgart.de>
Date: Wed, 28 Feb 2018 19:32:54 +0100
Subject: [PATCH] [2p][2p1c] Free vtk outputfields from TypeTag

---
 dumux/porousmediumflow/2p/model.hh            |  8 ++++--
 dumux/porousmediumflow/2p/vtkoutputfields.hh  | 26 ++++++++-----------
 dumux/porousmediumflow/2p1c/model.hh          |  2 +-
 .../porousmediumflow/2p1c/vtkoutputfields.hh  | 12 ++++-----
 .../porousmediumflow/2pnc/vtkoutputfields.hh  |  2 +-
 5 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/dumux/porousmediumflow/2p/model.hh b/dumux/porousmediumflow/2p/model.hh
index b11c9247de..cdba9ba5c0 100644
--- a/dumux/porousmediumflow/2p/model.hh
+++ b/dumux/porousmediumflow/2p/model.hh
@@ -103,7 +103,9 @@ SET_BOOL_PROP(TwoP, EnableEnergyBalance, false);                              //
 SET_TYPE_PROP(TwoP, LocalResidual, ImmiscibleLocalResidual<TypeTag>);         //!< Use the immiscible local residual operator for the 2p model
 SET_TYPE_PROP(TwoP, VolumeVariables, TwoPVolumeVariables<TypeTag>);           //!< the VolumeVariables property
 SET_TYPE_PROP(TwoP, SpatialParams, FVSpatialParams<TypeTag>);                 //!< The spatial parameters. Use FVSpatialParams by default.
-SET_TYPE_PROP(TwoP, VtkOutputFields, TwoPVtkOutputFields<TypeTag>);           //!< Set the vtk output fields specific to the twop model
+
+//! Set the vtk output fields specific to the twop model
+SET_TYPE_PROP(TwoP, VtkOutputFields, TwoPVtkOutputFields<typename GET_PROP_TYPE(TypeTag, Indices)>);
 
 SET_TYPE_PROP(TwoP,
               Indices,
@@ -125,7 +127,9 @@ public:
 SET_INT_PROP(TwoPNI, IsothermalNumEq, 2);                                         //!< set isothermal NumEq
 SET_TYPE_PROP(TwoPNI, IsothermalVolumeVariables, TwoPVolumeVariables<TypeTag>);   //!< set isothermal VolumeVariables
 SET_TYPE_PROP(TwoPNI, IsothermalLocalResidual, ImmiscibleLocalResidual<TypeTag>); //!< set isothermal LocalResidual
-SET_TYPE_PROP(TwoPNI, IsothermalVtkOutputFields, TwoPVtkOutputFields<TypeTag>);   //!< set isothermal output fields
+
+//! Set the vtk output fields specific to the isothermal twop model
+SET_TYPE_PROP(TwoPNI, IsothermalVtkOutputFields, TwoPVtkOutputFields<typename GET_PROP_TYPE(TypeTag, Indices)>);
 
 //! Set isothermal Indices
 SET_PROP(TwoPNI, IsothermalIndices)
diff --git a/dumux/porousmediumflow/2p/vtkoutputfields.hh b/dumux/porousmediumflow/2p/vtkoutputfields.hh
index 45f7534415..402c92cc6c 100644
--- a/dumux/porousmediumflow/2p/vtkoutputfields.hh
+++ b/dumux/porousmediumflow/2p/vtkoutputfields.hh
@@ -24,33 +24,29 @@
 #ifndef DUMUX_TWOP_VTK_OUTPUT_FIELDS_HH
 #define DUMUX_TWOP_VTK_OUTPUT_FIELDS_HH
 
-#include <dumux/common/properties.hh>
-
 namespace Dumux {
 
 /*!
  * \ingroup TwoPModel
  * \brief Adds vtk output fields specific to the two-phase model
  */
-template<class TypeTag>
+template<class Indices>
 class TwoPVtkOutputFields
 {
-    using Indices = typename GET_PROP_TYPE(TypeTag, Indices);
-    using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables);
 public:
     template <class VtkOutputModule>
     static void init(VtkOutputModule& vtk)
     {
-        vtk.addVolumeVariable([](const VolumeVariables& v){ return v.saturation(Indices::wPhaseIdx); }, "Sw");
-        vtk.addVolumeVariable([](const VolumeVariables& v){ return v.saturation(Indices::nPhaseIdx); }, "Sn");
-        vtk.addVolumeVariable([](const VolumeVariables& v){ return v.pressure(Indices::wPhaseIdx); }, "pw");
-        vtk.addVolumeVariable([](const VolumeVariables& v){ return v.pressure(Indices::nPhaseIdx); }, "pn");
-        vtk.addVolumeVariable([](const VolumeVariables& v){ return v.capillaryPressure(); }, "pc");
-        vtk.addVolumeVariable([](const VolumeVariables& v){ return v.density(Indices::wPhaseIdx); }, "rhoW");
-        vtk.addVolumeVariable([](const VolumeVariables& v){ return v.density(Indices::nPhaseIdx); }, "rhoN");
-        vtk.addVolumeVariable([](const VolumeVariables& v){ return v.mobility(Indices::wPhaseIdx); }, "mobW");
-        vtk.addVolumeVariable([](const VolumeVariables& v){ return v.mobility(Indices::nPhaseIdx); }, "mobN");
-        vtk.addVolumeVariable([](const VolumeVariables& v){ return v.porosity(); }, "porosity");
+        vtk.addVolumeVariable([](const auto& v){ return v.saturation(Indices::wPhaseIdx); }, "Sw");
+        vtk.addVolumeVariable([](const auto& v){ return v.saturation(Indices::nPhaseIdx); }, "Sn");
+        vtk.addVolumeVariable([](const auto& v){ return v.pressure(Indices::wPhaseIdx); }, "pw");
+        vtk.addVolumeVariable([](const auto& v){ return v.pressure(Indices::nPhaseIdx); }, "pn");
+        vtk.addVolumeVariable([](const auto& v){ return v.capillaryPressure(); }, "pc");
+        vtk.addVolumeVariable([](const auto& v){ return v.density(Indices::wPhaseIdx); }, "rhoW");
+        vtk.addVolumeVariable([](const auto& v){ return v.density(Indices::nPhaseIdx); }, "rhoN");
+        vtk.addVolumeVariable([](const auto& v){ return v.mobility(Indices::wPhaseIdx); }, "mobW");
+        vtk.addVolumeVariable([](const auto& v){ return v.mobility(Indices::nPhaseIdx); }, "mobN");
+        vtk.addVolumeVariable([](const auto& v){ return v.porosity(); }, "porosity");
     }
 };
 
diff --git a/dumux/porousmediumflow/2p1c/model.hh b/dumux/porousmediumflow/2p1c/model.hh
index 90aa3d692c..e50a935239 100644
--- a/dumux/porousmediumflow/2p1c/model.hh
+++ b/dumux/porousmediumflow/2p1c/model.hh
@@ -183,7 +183,7 @@ SET_TYPE_PROP(TwoPOneCNI, IsothermalLocalResidual, ImmiscibleLocalResidual<TypeT
 SET_TYPE_PROP(TwoPOneCNI, IsothermalIndices, TwoPOneCIndices<TypeTag, 0>);
 
 //! The isothermal vtk output fields.
-SET_TYPE_PROP(TwoPOneCNI, IsothermalVtkOutputFields, TwoPOneCVtkOutputFields<TypeTag>);
+SET_TYPE_PROP(TwoPOneCNI, IsothermalVtkOutputFields, TwoPOneCVtkOutputFields<typename GET_PROP_TYPE(TypeTag, Indices)>);
 
 //! Set isothermal NumEq.
 SET_INT_PROP(TwoPOneCNI, IsothermalNumEq, 1);
diff --git a/dumux/porousmediumflow/2p1c/vtkoutputfields.hh b/dumux/porousmediumflow/2p1c/vtkoutputfields.hh
index 69d1bdf4d2..054f68bf4a 100644
--- a/dumux/porousmediumflow/2p1c/vtkoutputfields.hh
+++ b/dumux/porousmediumflow/2p1c/vtkoutputfields.hh
@@ -26,26 +26,24 @@
 
 #include <dumux/porousmediumflow/2p/vtkoutputfields.hh>
 
-namespace Dumux
-{
+namespace Dumux {
 
 /*!
  * \ingroup TwoPOneCModel
  * \brief Adds vtk output fields specific to two-phase one-component model.
  */
-template<class TypeTag>
+template<class Indices>
 class TwoPOneCVtkOutputFields
 {
-    using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables);
 public:
     template <class VtkOutputModule>
     static void init(VtkOutputModule& vtk)
     {
         // use default fields from the 2p model
-        TwoPVtkOutputFields<TypeTag>::init(vtk);
+        TwoPVtkOutputFields<Indices>::init(vtk);
 
-        //output additional to TwoP output:
-        vtk.addVolumeVariable([](const VolumeVariables& v){ return v.priVars().state(); }, "phasePresence");
+        // output additional to TwoP output:
+        vtk.addVolumeVariable([](const auto& v){ return v.priVars().state(); }, "phasePresence");
     }
 };
 
diff --git a/dumux/porousmediumflow/2pnc/vtkoutputfields.hh b/dumux/porousmediumflow/2pnc/vtkoutputfields.hh
index 15da2ad3fc..25cc9571b6 100644
--- a/dumux/porousmediumflow/2pnc/vtkoutputfields.hh
+++ b/dumux/porousmediumflow/2pnc/vtkoutputfields.hh
@@ -49,7 +49,7 @@ public:
     static void init(VtkOutputModule& vtk)
     {
         // use default fields from the 2p model
-        TwoPVtkOutputFields<TypeTag>::init(vtk);
+        TwoPVtkOutputFields<Indices>::init(vtk);
 
         //output additional to TwoP output:
         for (int i = 0; i < numPhases; ++i)
-- 
GitLab